Skip to content

Instantly share code, notes, and snippets.

@lmullen
Created April 3, 2013 13:47
Show Gist options
  • Save lmullen/5301333 to your computer and use it in GitHub Desktop.
Save lmullen/5301333 to your computer and use it in GitHub Desktop.
Jump between footnote markers with Vim's * key
" 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