Created
July 30, 2012 13:22
-
-
Save ynkdir/3206872 to your computer and use it in GitHub Desktop.
footmark.vim
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
augroup Footmark | |
au! | |
autocmd CursorMoved,CursorMovedI * call s:Footmark() | |
augroup END | |
let s:max = 5 | |
function! s:Footmark() | |
if !exists('w:footmark_marks') | |
let w:footmark_marks = [] | |
let w:footmark_pos = [] | |
endif | |
if !empty(w:footmark_pos) | |
let pat = printf('\%%%dl\%%%dc.', w:footmark_pos[1], w:footmark_pos[2]) | |
let m = matchadd('Cursor', pat) | |
call add(w:footmark_marks, m) | |
endif | |
if len(w:footmark_marks) > s:max | |
call matchdelete(w:footmark_marks[0]) | |
call remove(w:footmark_marks, 0) | |
endif | |
let w:footmark_pos = getpos('.') | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment