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 tab header not visible? I am not able to see tab header in vim when opened multiple files using vim -p *.
Vim File Explorer with include directory
Copy lines longer than terminal window
Is there a vim errorformat that will catch a function name instead of a line number?
vim “Unknown function: omni#cpp#maycomplete#Dot”
Jump to next occurence of different characters
Open xlsx with vim
How to remove the start message of Gvim? And why my mark function does not work?
How to display the function name quickly?
explanation of the following text-manipulation command in vim
delete ocurrences that ocurr less than X time
How can I determine a variable's type in a vim function?
vimscript call vs. execute
Vim colors too bright (terminal)
vim remove non existing mapping [closed]
Advanced Usage of Ranges with Vim Keymappings

Categories

HOME
vbscript
openstack
fft
office365api
android-4.4-kitkat
youtube-api-v3
sql-server-2016
mvvmcross
azure-media-services
qore
cloudkit
adobe-analytics
node-pdfkit
imacros
collectd
clojurescript
seaborn
saxon
reactcsstransitiongroup
extjs5
apache-commons-io
spring-mybatis
c++-amp
primitive
fabric8
bcd
xmlreader
normal-distribution
scaffold
gesture
elasticsearch-plugin
sas-visual-analytics
mesos-chronos
email-templates
pdf-reactor
reportingservices-2005
spring-security-kerberos
isbn
jquery-validate
font-size
pearson
zendesk-app
spring-mongodb
lync-client-sdk
query-performance
xcb
instant
phishing
skobbler-maps
transmitfile
django-debug-toolbar
php-parse-error
photobucket
netmq
0xdbe
sysinternals
method-parameters
sniffer
python-green
openexr
ceil
rtmfp
didselectrowatindexpath
concurrent-collections
monomac
access-rights
web2py-modules
dotnetnuke-5
gridcontrol
yui-compressor
seed
random-seed
plasma
hamiltonian-cycle
bluepill
manchester-syntax
twrequest
osql
netbeans-6.9
spring-portlet-mvc
cufon
blackberry-playbook
coercion
xmemcached
xdomainrequest
xtype
visitor-statistic
filtered-index
database-management
multi-tier
microsoft-virtualization
virtual-functions
ntvdm.exe

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