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

gist-vim: change token location
In Vim why is the behavior of “w” word selector inconsistent when preceded by “d” vs “v”
Vim “yank” does not seem to work
howto change location of .vimrc and .vim
My terminal's indentation is not working properly
Is there any efficient ways to locate, open files in Vim? [duplicate]
Compiling vim with MinGW results in mingw-get install --reinstall binutils=2.22-1
Set buffer content with variable
VHDL tags not efficient in vim with ctags+taglist
Map :w to Escape in insert mode and normal mode
Vim pasting — scroll through previously yanked text
Internal vim command output to external application
call function when last vim instance is closing
Can't map Home button in vimrc
Vim opens with with value pre-entered in command line
How can i add four blanks in the head of everyline in vim?

Categories

HOME
winforms
hive
plot
raspberry-pi
lodash
framework7
getelementsbytagname
at-command
spring-cloud-stream
react-redux
serverspec
paradox
communication
modelica
quickbooks
size
quickfix
percona
vaadin7
saxon
pc
footer
propel
solaris-10
autocad-plugin
orleans
pass-by-reference
kudan
zurb-foundation-6
jndi
autosys
trading
sparse-matrix
semantic-analysis
fopen
elasticsearch-ruby
titanium-mobile
catch-all
accelerate-framework
android-nestedscrollview
http-referer
google-api-nodejs-client
nssegmentedcontrol
bytecode-manipulation
disassembling
serve
libvpx
android-browser
service-discovery
hp-ux
avro4s
pdf-reactor
quadratic-programming
ibpy
auto-update
pango
alphabet
brightcove
pg-dump
dtexec
sybase-asa
spring-cache
color-profile
word-vba-mac
abcpdf9
jquery-filter
fuzzy-search
lua-5.1
hill-climbing
teamcity-8.0
tmuxinator
sonarqube5.1.2
c++03
kineticjs
qpainter
qcodo
preferences
google-reader
doskey
mechanize-ruby
picturefill
transcoding
meteor-velocity
monomac
coverflow
dataservice
gwt-rpc
mhtml
dsn
asyncfileupload
punbb
qt-jambi
pydot
django-tagging
inotifycollectionchanged
mozilla-prism
gin
getresponsestream
swing-app-framework
spec#
private-members
data-acquisition

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