diff options
author | Hugues Hiegel <hugues@hiegel.fr> | 2011-10-14 14:50:13 +0200 |
---|---|---|
committer | Hugues Hiegel <hugues@hiegel.fr> | 2011-10-14 14:50:13 +0200 |
commit | e45c7159ed5a93ac4d2b6d20bbcacf25a88ab8cd (patch) | |
tree | 0ab0304f2cc2cfbb05ea0795b4e6ad0c6e0b407e | |
parent | 5744d8415a52dbb454870f8c22f4394cacd0f29a (diff) |
[Vim] footnotes. TODO: use marks to navigate
-rw-r--r-- | vimrc | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -219,3 +219,27 @@ autocmd BufEnter * set cursorline autocmd WinEnter * set cursorline autocmd BufLeave * set nocursorline autocmd WinLeave * set nocursorline + + +" footnotes +inoremap ,f <Esc>:call VimFootnotes()<CR> +inoremap ,r <Esc>:exe b:pos<CR> + +function! VimFootnotes() + if exists("b:vimfootnotenumber") + let b:vimfootnotenumber = b:vimfootnotenumber + 1 + let cr = "" + else + let b:vimfootnotenumber = 0 + let cr = "\<CR>" + endif + let b:pos = line('.').' | normal! '.virtcol('.').'|'.'4l' + exe "normal a[".b:vimfootnotenumber."]\<Esc>G" + if search("-- $", "b") + exe "normal O".cr."[".b:vimfootnotenumber."] " + else + exe "normal o".cr."[".b:vimfootnotenumber."] " + endif + startinsert! +endfunction + |