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

Compiling with gVim not working
VIM digraph not working
save previous mapping in vim [closed]
vsvim when input shift+each letter in insert mode, it add a '\n' automatically
gVim makes alt+(letter) key produce an accented character instead of exiting insert mode and executing the command
What's the fastest way to copy the current file to another folder in VIM
Set Vim window size and selection from command line
Call a function with list or splat arguments
Tmux/Vim plugin that shows a list of open files
Vim put cursor in the middle of screen after buffer switch
How to execute a :cabbr in a function?
Weird font artifacts
Vim: Searching for class/func-view Plugin
VIM: Replace [aeiou]' with the respective accented letter
Capturing echo to stdout from Vim
how to add c++11 support to syntastic vim plugin?

Categories

HOME
pandas
listview
mockito
relative-path
relayjs
tesseract
at-command
ip
fingerprint
pivotal-cloud-foundry
fancybox
adfs
virtualization
elasticsearch-hadoop
visual-studio-cordova
quickfix
dynamics-crm-online
serverless-framework
django-simple-history
graphlab
http-status-code-504
plunker
paging
cx-freeze
scriptcs
css-animations
wkwebview
mustache.php
tibco-mdm
angular2-aot
user-interaction
strncpy
kendo-datasource
r-raster
subset-sum
mapbox-gl
suricata
xcode-extension
retina-display
automake
opshub
bootstrapper
greenrobot-eventbus
ncalc
g-code
node-gyp
turbogears
atomicity
typescript1.8
hls.js
aurelia-validation
colorama
tactic
pg-dump
snmptrapd
knpmenubundle
jspdf-autotable
account-kit
cubes
mikroc
qgraphicsview
ios4
kendonumerictextbox
pervasive-sql
spidermonkey
ideamart
myo
operation
ami
rake-task
typeof
hippomocks
.aspxauth
gridfs
spring-io
eventual-consistency
pvrtc
libstdc++
nsnetservice
bluepill
jspinclude
pydot
f#-powerpack
file-comparison
remember-me
google-friend-connect
ncqrs
ti-dsp
mtj
thread-local-storage
procedural-music
zune
genealogy
geneva-server
lzh

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App