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

Vim loses colorscheme when launched from tmux
spacemacs vi bindings not working
VIM snipmate tab not working
How can I apply vimrc conf file in .py
Why is the default vim's background option is differrent when run in gnome-terminal and gnu-screen?
Copy & Paste Vim effects
VIM and X11: do not touch primary buffer
mouse clicking doesn't work well in vim while encoding != termencoding
VIM: How to list all key mappings in the current buffer for a specified plugin
How let function that wrote by vimscript concurrently run?
Homebrew fails when upgrading VIM
Can Vim matchadd work if matched lines are off screen?
Which directory to put snippets.json file for customization?
Same visible character but different bytes
Spacemacs - how to map a Vim command in normal mode?
How to execute the same vi command in sublime text 3?

Categories

HOME
log4j
winforms
listview
amazon-ec2
reflection
stock
iot
relay
grep
sd-card
q
tizen-web-app
ip
ravendb
serverspec
echarts
gitpitch
vault
user-input
kentor-authservices
wheelnav.js
mapserver
alignment
vb.net-2010
task
worldwind
foselasticabundle
highlight.js
propel
beyondcompare
openedx
google-pagespeed
paging
devops
jndi
firebase-crash-reporting
sqlcipher
facet
url-scheme
bootstrap-material-design
primitive
procdump
gsmcomm
delicious-api
srcset
key-value-observing
functor
copying
winrt-xaml-toolkit
normal-distribution
sequential
suricata
dartium
swisscomdev
theano.scan
grid.mvc
node-gyp
isbn
jquery-nestable
powercli
colorama
tactic
knockout-components
spring-android
intrusion-detection
py2app
nsviewcontroller
lua-5.1
skype4py
livequery
asp.net5
ford-fulkerson
hsv
vhd
citrus-pay
android-listview
unity3d-gui
truevault
c++03
gadt
gui-test-framework
android-imagebutton
client-side-templating
java-metro-framework
markers
onactivityresult
ceil
hippomocks
braille
c18
oam
geos
.aspxauth
aqtime
html4
dataadapter
rabl
hungarian-algorithm
jquery-mobile-dialog
random-seed
sqlperformance
html-editor
anonymous-methods
objective-c-2.0
semantic-diff
boost-filesystem
libc++
nsobject
psi
xmlspy
rfc1123
yui-datatable
propagation
coda-slider
dentrix
ncqrs
firefox-5
iweb
mtj
privilege
ubuntu-9.04
commodore

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