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

Why does slime-vim indent improperly while paredit is on?
how do I call esnext in vim?
How to make Vim ignore file extensions when opening files through the command line/shell?
Vim key mapping for emmet-vim
Turn off gitgutter within vimrc
eclim .classpath commands :NewSrcEntry not recognized?
Difference between * and ** in Vim file search patterns
run external command from within vim
vividchalk scheme only displays properly if different colorscheme applied first
Find and replace only part of a single line in Vim
mac string search in files
vim update complete popup as I type
vim comment syntax coloring that resets based on columns value without linebreaks
vim syntax doesn't work at all
what does the function! mean in vimscript?
Make NERD Commenter prepend before spaces [duplicate]

Categories

HOME
ibm-bluemix
pdf
netsuite
kde
reserved
angular-material
fme
cplex
yarn
jgroups
c#-2.0
webpack-2
ojdbc
windows-azure-storage
commonmark
event-handling
reactive-cocoa
interop
beyondcompare
introduction
predix
custom-wordpress-pages
intentfilter
hammerspoon
shopware
entitlements
elasticsearch-ruby
atlassian-crucible
windowbuilder
objectanimator
google-rich-snippets
grails-3.1
overriding
particles.js
sfdc
sql-server-agent
quadratic-programming
acoustics
qcombobox
strptime
pango
veracode
lowpass-filter
elgg
crypt
pillow
bind9
messenger
probability-density
database-optimization
intrusion-detection
login-control
mathematica-frontend
gridview-sorting
make-install
hsv
unity-networking
wso2cloud
spidermonkey
rgeo
ionic
splash
fluid-dynamics
angular-local-storage
truevault
website-monitoring
relocation
file-copying
javafx-webengine
googlemock
comexception
stxxl
gnu-smalltalk
floating-point-precision
ivyde
easy-install
flash-builder4.5
ril
gwt-rpc
interface-orientation
jelly
tinn-r
jquery-knob
twrequest
stage
joyent
blitz++
sortable-tables
multi-tier
audio-capture
xetex
sustainable-pace
putchar
genealogy
mdac

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App