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 add commas inbetween items using vi?
How to get vim-rails' :Rake to run bin/rspec?
Find test name in Vim Script
How to add automatic text at start of line for new lines?
In Vim, how would I make a change then go back where I was?
showbreak causing cursor to show in wrong place
Auto search NERDTree upon typing
Vim: can indentation use spaces after non-whitespace?
Vim: Restart Syntax Highlighting from Arbitrary Line
Follow link in vim with markdown syntax
Disable window resize when changing focus
Vim: What's the best way to have markdown automatically enabled for comments?
VIM/Python: visualmode/mode detection
vim text replacement : :%s/é/&&eacute/g foreign language
Vim commands containing `r` cause me to replace
readonly option is set add to ! override - Windows 8.1

Categories

HOME
ms-access
twitter
log4j
azure-data-factory
google-api-php-client
session
relayjs
webstorm
disassembler
ckeditor
medical
gitpitch
spring-kafka
jplayer
alignment
dtrace
decomposition
telephony
cloudhub
google-search-api
blazemeter
sparse-matrix
apache-commons-io
brunch
atlassian-crucible
delicious-api
react-chartjs
pim
perlin-noise
protovis
avcapturesession
serve
libraries
mixture-model
sqlite2
apple-news
fault
hibernate-tools
hendrix
dandelion
datastax-startup
cudafy.net
flow-control
wdf
multiple-regression
fputcsv
design-by-contract
natvis
javax.sound.midi
xna-4.0
google-places
mutation-observers
event-bubbling
graph-api-explorer
pretty-print
gadt
file-copying
rebol3
viadeo
ccss
ril
batterylevel
dataadapter
drools-planner
e4x
isnullorempty
gil
broken-links
removeclass
asyncfileupload
data-loss
coredump
netbeans-7.1
celltable
datareader
paster
sef
nerddinner





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