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 display actual syntax highlight in vim?
Vim wizardry to do this
Running arbitrary vim commands from bash command line to script vim
What in Vim determines encoding of text sent external apps through a filter?
Neovim asynchronous buffer waiting
Search and replace same visual region
Set autocmd for every time I change file
run external command from vim, passing list of files from buffer
Vim Ag Plugin Context Option and Show Results in Tab
Disable swap file on flie type
How to make VIM create a new window below the current as default?
vim syntax: match all lines with a given pattern that follow a line with a different pattern
Vim: ENTER takes cursor to the beginning of line
How do I open a directory under the cursor in vim? A gf-like for directories
vim : Yanking doesn't work between file
Neovim - gitgutter diff column appears in Nerd Tree

Categories

HOME
multithreading
variables
hook
tinymce
json.net
react-virtualized
tesseract
spagobi
xmpp
analysis
maven-3
infragistics
networkx
amazon-cloudformation
windows-10-universal
adobe-analytics
jplayer
ups
worldwind
solaris-10
http-status-code-504
contextmenu
predix
ml
clickonce
kudan
replaceall
gsmcomm
sql-server-2012-express
binary-data
galsim
ioio
titanium-mobile
copying
repo
appfabric
swift3.0.2
abstract-class
webdriver-manager
mapzen
pdf-reactor
node-gyp
eclipse-gef
executenonquery
babel-core
dotcover
jlink
yii2-extension
statsd
snmptrapd
mako
linode
imanage
background-service
root-framework
ctest
photobucket
javax.sound.midi
msys
intel-fortran
lib.web.mvc
t4mvc
marching-cubes
rgeo
bridge.net
python-green
clicktag
google-style-guide
xcode-6.2
android-radiobutton
tld
uitouch
valueconverter
hippomocks
meteor-velocity
srs
java.nio.file
jsctypes
soundtouch
coverflow
enterprisedb
android-hardware
quickdialog
runas
errai
appconkit
semantic-diff
code-cleanup
php-parser
libc++
window-management
infobox
coredump
joyent
xtype
asp.net-profiles
privilege
project-hosting
private-members
ubuntu-9.04

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