summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugues Hiegel <hugues@hiegel.fr>2011-10-14 14:50:13 +0200
committerHugues Hiegel <hugues@hiegel.fr>2011-10-14 14:50:13 +0200
commite45c7159ed5a93ac4d2b6d20bbcacf25a88ab8cd (patch)
tree0ab0304f2cc2cfbb05ea0795b4e6ad0c6e0b407e
parent5744d8415a52dbb454870f8c22f4394cacd0f29a (diff)
[Vim] footnotes. TODO: use marks to navigate
-rw-r--r--vimrc24
1 files changed, 24 insertions, 0 deletions
diff --git a/vimrc b/vimrc
index 5ab50a8..700b231 100644
--- a/vimrc
+++ b/vimrc
@@ -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
+