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

why \r\n displayed as ^M in vi? [duplicate]
Multiline search/replace in Vim without escaping
w / b in vim is including . in the word
How do I use tcomment (vim's plugin) and how do can I say it is installed?
Vim - close autocomplete menu and go to normal mode when pressing ESC
node-jslint with Syntastic in vim on Cygwin only display partial errors
How can I set a global syntax rule that takes precedent over a file specific one?
Reset Vim Window switching shortcut in Python Mode
Command for putting backticks around the current word
Vim, setting .el folding has killed syntax highlighting
Creating a generic command to edit and quickly execute (python) scripts
Vim: How do I see whether a command is switched on?
How do I prevent changing buffer when using the :bufdo command?
Why does vim not recognize comments after non-whitespace characters? How can this be resolved?
Vim: executing a visual command on startup
Vim - how to exclude part of clipboard register when pasting

Categories

HOME
testng
netsuite
amazon-ec2
zeromq
mediawiki
mfc
google-api-php-client
tesseract
amortized-analysis
jxls
mvvmcross
offline
postgres-xl
fortumo
netflix
serverless-framework
django-admin
openrefine
fatal-error
lldb
predix
scriptcs
kvc
vlsi
facet
poltergeist
facebook-access-token
brunch
publish
ping
jspm
windows-server-2000
kendo-datasource
c++-amp
procdump
ghost4j
occlusion
sqlite2
webdriver-manager
sql-server-agent
dynamic-reports
estimote
acoustics
wso2carbon
filepicker
errordocument
rails-routing
worksheet
blogengine.net
dropbox-php
nativeapplication
tactic
feeds
python-cryptography
pdfclown
titanium-android
vtigercrm
background-service
nested-sets
visual-c++-2008
impresspages
qpid
gstreamer-0.10
clang-static-analyzer
disque
react-native-listview
python-stackless
pickadate
oauth2client
energy
xna-4.0
atk4
wireshark-dissector
arcanist
clipperlib
streambase
device-orientation
xc16
nsbutton
socketexception
openexr
navigationservice
jquery-layout
picturefill
message-driven-bean
mcts
industrial
ms-project-server-2010
jquery-mobile-dialog
sharp-repository
pygit2
quickdialog
subscript
zpt
appender
recent-documents
locate
user-friendly
adrotator
ctp4
thread-local-storage
private-members
mdac
3gp

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile