Skip to content

Instantly share code, notes, and snippets.

@lmullen
Created April 3, 2013 13:47

Revisions

  1. lmullen created this gist Apr 3, 2013.
    29 changes: 29 additions & 0 deletions ToggleFootnoteJumping.vim
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    " 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