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 detect what kind of buffer the current buffer is
vim - forcing >> to use spaces, not tabs
Exuberant ctags exclude directories
Setting line number color works in command mode but not in .vimrc
Make clang-complete in vim to autocomplete after any input
background issue with my vim
Vim airline/status bar buffers of the same name
Control-Backslash doesn't work
How to replace '&=' with '=&' in Vim?
add the next occurrence of the current word to the selection in VIM
NERDTree: Autocmd error vim
Disable syntax hightlighting in vim only for specific buffer
Quickest way to switch order of comma-sparated list in Vim
Is there any Ctrl - R kind of command search in vim?
How to surround visual block with quotes (or similar) in vim
How to find the first uppercase letter of a word in vim?

Categories

HOME
log4j
keras
path-finding
hashmap
dot
cplex
filtering
youtube-api-v3
ip
in-app-purchase
amazon-cloudformation
medical
facebook-php-sdk
communication
fancybox-3
numeral.js
collectd
apache-cayenne
circular-dependency
circuit
iron-router
decimal
serverless-framework
vaadin7
clickonce
scriptcs
graphicsmagick
javacv
poltergeist
publish
subdomains
objectanimator
c++-amp
gsoap
google-cloud-endpoints-v2
asset-pipeline
hexo
web-mining
hockeyapp
serverside-rendering
twitch
reportbuilder
bootstrapper
user-controls
optix
gzipstream
nand2tetris
taffy
filepicker
typescript1.8
veracode
lowpass-filter
elgg
tactic
sqlclient
smart-table
android-fonts
fody
asp.net-4.5
nsfilemanager
bgp
goose
two-factor-authentication
srand
wso2cloud
atk4
generic-programming
npapi
kineticjs
codeigniter-url
qcodo
client-side-templating
code-access-security
java.nio.file
viadeo
page-layout
quantlib-swig
aqtime
jquery-mobile-dialog
html-editor
android-hardware
factory-method
angularjs-controller
broken-links
runas
hosts-file
objective-c-2.0
ocx
bubble-chart
custom-backend
javax.script
sproutcore-2
compiler-specific
sef
data-driven
port-number
document-conversion

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