Created
April 3, 2013 13:47
-
-
Save lmullen/5301333 to your computer and use it in GitHub Desktop.
Jump between footnote markers with Vim's * key
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Find related Pandoc footnote numbers | |
" ------------------------------------------------------------------- | |
" Vim's * key searches for the next instance of the word under the | |
" cursor; Vim decides what counts as the boundary of a word with the | |
" iskeyword option. This function toggles the special characters of a | |
" Pandoc footnote in the form [^1] to allow you to jump between | |
" footnotes with the * key. | |
nnoremap _fn :call ToggleFootnoteJumping()<CR> | |
function! ToggleFootnoteJumping() | |
if exists("g:FootnoteJumping") | |
if g:FootnoteJumping == 1 | |
set iskeyword-=[ | |
set iskeyword-=] | |
set iskeyword-=^ | |
let g:FootnoteJumping = 0 | |
else | |
set iskeyword+=[ | |
set iskeyword+=] | |
set iskeyword+=^ | |
let g:FootnoteJumping = 1 | |
endif | |
else | |
set iskeyword+=[ | |
set iskeyword+=] | |
set iskeyword+=^ | |
let g:FootnoteJumping = 1 | |
endif | |
endfunction | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment