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

How to escape a shell command in the rhs of a mapping?
How to preserve the file encoding when recovering a Vim swap file?
filter quickfix buffer vim
vundle/YouCompleteme: requires Vim 7.3.584+
How can I hightlight markdown in doxygen under vim?
vim-powerline plugin in ConEmu
Is there any way to tell vim to highlight any asterisks preceded by a type?
How to change terminal prompt in zsh using YADR
Search and Append to a pattern without affecting anything else in Vim
MacVim how to disable arrow navigation?
dos2unix doesn't convert ^M
Highlighting ascii tables
Adding multiple marks in one line in Vim?
What something fishy is going on in Vim with relative number?
How can I map Ctrl + semicolon to add a semicolon to the end of the line?
emacs evil equivalent of vim remapping, e.g. :nnoremap dd g0dg$

Categories

HOME
openlayers
openmp
oracle11g
mediawiki
smarty
json.net
appx
iot
mean-stack
q
cvs
sharepoint-designer
v8
icloud
ebean
yum
google-translate
numeral.js
quicklook
nstableview
gz
django-admin
evopdf
ab-testing
oracle-coherence
oxyplot
plunker
tokenize
wkwebview
language-agnostic
spark-jobserver
opentype
subdomains
google-cloud-nl
key-value-observing
phonegap
siesta-swift
jspresso
http-get
perlin-noise
framemaker
phpfreechat
windows-dev-center
xmlreader
form-data
http-referer
amazon-kinesis-kpl
host
disassembling
scaffold
xenforo
graphenedb
turbogears
tactic
specrun
google-cdn
heidisql
mathematica-frontend
flash-cs5
essence
python-stackless
phpcas
ruby-2.2
angular-leaflet-directive
varargs
php-ci
fluid-dynamics
census
composite
typekit
has-many-through
article
typeof
mysqltuner
ccss
ora-00911
qt-faststart
padarn
django-nonrel
html-editor
enterprisedb
anonymous-methods
netbeans-6.9
postgresql-performance
fireworks
hamachi
rfc1123
yui-datatable
inotifycollectionchanged
jmock
floating
w3wp.exe
h.323
getresponsestream
database-management
swing-app-framework
temporal-database

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