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

Indent statement after case only without braces in vim cindent
Barebones vim with `nocp`
How to hide parent folder in netrw of vim
VIM Convert Text to URL with Search/Replace
Is there a variant of f in vim to only match the first character in a word?
how to change the regex responsible for vim's “current word” search
Why I cannot save my `_vimrc` after defining a register item?
Indentation with “#.” start of paragraph
Automate a process of steps that insert/add/replace somewhere in the middle
vim syntax highlighting weirdness
Set colors for custom syntax keywords in Vim?
Vim Solarized Light theme with wrong colors
Disable autoindent in vim
can I install msysgit after having github installed so I can use native cmd console?
How to properly set up Vim/MacVim for Web Development like Sublime Text
Manage vim-plugin using git submodule and pathogen

Categories

HOME
ms-access
xamarin
yii2
log4j
azure-data-factory
onedrive
adb
yahoo-oauth
google-project-tango
datastax-java-driver
uber-api
autotools
cross-validation
facebook-php-sdk
floating-action-button
libtiff
progressive-web-apps
tostring
contextmenu
visjs
ml
cx-freeze
riot.js
tokenize
status
chromebook
info.plist
web-api-testing
publish
libssl
primitive
procdump
karaf
copying
column-family
webtest
stringtemplate
commit
mapdb
main
bitbucket-pipelines
elasticsearch-plugin
optix
pdf-reactor
gulp-sourcemaps
botbuilder
fakeiteasy
unixodbc
wptoolkit
nstextview
darcs
python-cryptography
mako
chord-diagram
gnome-shell-extensions
objective-c-swift-bridge
spring-android
libpng
adxstudio-portals
google-web-starter-kit
multiple-regression
prettytensor
hill-climbing
bgp
independentsoft
intel-fortran
coveralls
processmodel
clipperlib
xc16
qpainter
markers
has-many-through
navigationservice
elliptic-curve
expected-exception
viadeo
tidy
soundtouch
ruby-datamapper
sharp-repository
simba
chuck
trusted
google-email-migration
first-responder
cascalog
qtkit
netdna-api
coredump
rfc1123
mysql-error-1005
xfbml
cxxtest
yslow
data-driven
windows-live-messenger

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