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

augment the number of lines on indent
Insert mode mapping in Vim
Matching multi-line parenthesis in R syntax with vim
Change vim-airline colorscheme via vim-sunset plugin
Integrate Vim-R-plugin with remote ssh-byobu session?
unset a filetype option when switching to any other filetype?
error when vim macro recording play
Moved .vimrc in a new dir, trying to get it to work
to see which case I'm in in vim?
Vim language: send current word to CtrlP
Slow performance in Vim w/ Ag (the Silver Searcher)
Perl Syntaxcheck: Add path
Mapping `ALT + m` to `Esc` in Vim
Go directly to end of specific line in Vim
vim syntastic/phpcs turn off 'style' errors
Getting all the installed color schemes in Vim

Categories

HOME
yii2
variables
hive
openmp
webpack
pycharm
iterator
cvs
rdf
fsm
umd
retrofit
blueprintjs
bs4
upload
adfs
applepay
maude-system
row
numeral.js
timeout
static-libraries
hex-editors
iron-router
crystal-reports-2008
textfield
immutable.js
ml
abi
jquery-ajaxq
accessor
microsoft-r
angular2-aot
facet
selectedindexchanged
url-scheme
wpfdatagrid
strncpy
xacml
tasklet
procdump
key-value-observing
hybridauth
rotational-matrices
mapbox-gl
normal-distribution
wpf-controls
hockeyapp
espeak
libraries
event-driven
hue
leading-zero
lumberjack
wso2carbon
prolog-setof
clean-architecture
nativeapplication
np-complete
boost-preprocessor
python-cryptography
dynamics-sl
minimization
topbeat
specrun
android-fonts
angular-cache
probability-density
xml-attribute
ubuntu-10.04
apachebench
wapiti
prerequisites
wordml
tarjans-algorithm
ionic
pretty-print
lustre
android-imagebutton
client-side-templating
uitouch
contenttype
hippomocks
typo3-neos
stxxl
imdbpy
mcts
uv-mapping
tws
yui-compressor
specification-pattern
qtkit
adk
nsdatecomponents
fireworks
pydot
heartbeat
f#-powerpack
django-tagging
javax.script
database-management
avatar
sustainable-pace
private-members

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile