Skip to content

Instantly share code, notes, and snippets.

@ynkdir
Created July 30, 2012 13:22
Show Gist options
  • Save ynkdir/3206872 to your computer and use it in GitHub Desktop.
Save ynkdir/3206872 to your computer and use it in GitHub Desktop.
footmark.vim
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