vim


Vim - Issue calling repeat#set from function on nomodifiable file


I'm using Tim Pope's repeat.vim plugin and am having some trouble invoking repeat#set correctly. I want to create two mappings for quickly navigating between sections of a help doc, which are delineated by rows of equals signs. My function for going to the next section below works and is repeatable.
function! s:NextHelpSection()
execute "normal /^===\<CR>"
nohlsearch
normal zt
endfunction
nnoremap <buffer> <silent> <LocalLeader>n
\ :<C-u>call <SID>NextHelpSection()<CR>
\:<C-u>call repeat#set("\<LocalLeader>n")<CR>
My function for going to the previous section works on its own but fails when I try to repeat it with E21: Cannot make changes, 'modifiable' is off.
function! s:PrevHelpSection()
execute "normal ?^===\<CR>"
nohlsearch
normal zt
call repeat#set("\<LocalLeader>p")
endfunction
nnoremap <buffer> <silent> <LocalLeader>p :<C-u>call <SID>PrevHelpSection()<CR>
The difference between the two is just where I call repeat#set, whether it's inside the function or afterwards. Why should this matter? Why would this second version fail? It's cleaner, so I'd prefer to write it this way if possible.

Related Links

relative number on netbeans/JavaVI
Vim Multi-Line If-Statements into Single-Line If-Statements
emmet (vim plugin) won't work after restart
Can't read when Vim/Neovim highlight same color as text
marvim.vim doesn't load via pathogen
Vim “fast” search gets disabled after adding `.vimrc`
Chaining vimgrep and copen with Vim
How to get sufficient info about selection range in vim's 'VISUAL BLOCK' mode? getpos() is insufficient
How to change vim tab pages in tmux
How to satisfy this pattern comparison in vim script?
Why tab can't replace with white spaces in emmet plugin?
How to copy only yanked text to system clipboard in vim
Can you view the default vim settings?
How to straighten a grouped gvim Buffers menu?
How to remove Vim from fedora?
Vim replace command after yanking a word

Categories

HOME
vbscript
netsuite
activiti
isabelle
mediawiki
mockito
comparison
plot
getelementsbytagname
elm
dxl
disassembler
ezpublish
in-app-purchase
qore
virtualization
medical
ssl-client-authentication
angular-ui
nhibernate-envers
alpine
plunker
pass-by-reference
mmap
autosys
javacv
react-css-modules
windows-error-reporting
maxmind
neo4j-spatial
xacml
compatibility
facebook-apps
gsmcomm
bpel
gsoap
react-chartjs
google-rich-snippets
javascriptcore
code-contracts
textmate
android-kernel
mmenu
occlusion
ssjs
particles.js
hp-ux
galen
ibpy
unixodbc
netcdf4
sas-jmp
taffy
hibernate-tools
clean-architecture
darcs
composite-key
typed-lambda-calculus
imanage
pintos
word-vba-mac
sts-springsourcetoolsuite
phishing
fputcsv
ubuntu-10.04
python-stackless
rvest
ipconfig
two-factor-authentication
icu4j
collapse
interrupted-exception
mmc
system32
remobjects
p2
skos
kineticjs
python-green
clicktag
qpainter
network-interface
asp.net-web-api-odata
doskey
comexception
oracle-warehouse-builder
gnu-smalltalk
flash-builder4.5
xamlparseexception
kyotocabinet
pvrtc
browser-detection
gil
labwindows
ocx
getmessage
mod-auth
xmemcached
imac
ext3
libs
virtual-functions

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile