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

configure vim-airline to show hostname
Why colors are not displaying in VIM - OH-MY-ZSH
Can't save files created with vim anymore
Ideavim plugin for Intellij keymaps
Binding EasyMotion in Vim Visual Mode
vim autocmd windowing: placement
VIM - Converting a binary file back
How to map <space> while still pressed plus other key to something in vim
Move current line to end of previous line
Open file in vertical split in Vim / netrw
vim + solarized colorscheme + lxterminal
vim: how to change a few last letters of the word?
How to save and overwrite in Vim when hitting E13?
Using the vim to align a series of python assignment statements, some of which include logic statements
Vim: Set register with let that contains backslashes
UTF-8 Characters are Truncated in Vim

Categories

HOME
google-chrome-extension
clips
cookies
include
onedrive
objectgears
filtering
echarts
django-imagekit
metatrader4
floating-action-button
handsontable
google-cloud-ml
remote-access
ibm-odm
zebra-printers
dosgi
ef-migrations
facebook-page
aurigma
nhibernate-envers
openedx
viewport
introduction
dbext
realex-payments-api
angular2-aot
one-to-many
chromebook
neo4j-spatial
unboundid
bluestacks
socialengine
directx-10
ecto
titanium-mobile
calibre
typed.js
normal-distribution
serverside-rendering
abstract-class
sharefile
greenrobot-eventbus
ensembles
sfdc
ibpy
arena-simulation
galleria
parentheses
python-webbrowser
powercli
rdfs
yii2-extension
dwscript
smart-table
nxt
removechild
elements
pagedlist
make-install
captivenetwork
ios4
itextpdf
natvis
tcpserver
eclipse-clp
angular-leaflet-directive
deis
responsive-images
appfabric-cache
createprocessasuser
cisco-ios
skos
google-style-guide
relocation
rdl
transcoding
concurrent-collections
intentservice
uv-mapping
cdc
jmapviewer
gridcontrol
comaddin
spring-validator
sabredav
jelly
path-separator
hosts-file
windows-phone-7.1.1
transactionscope
pydot
servicehost
celltable
mozilla-prism
fixed-width
audio-capture
uimenucontroller
post-build
data-acquisition
document-conversion
ntvdm.exe

Resources

Encrypt Message