aboutsummaryrefslogtreecommitdiff
path: root/plugin/vim-karlmarks.vim
blob: cd54fa56fd440eb8ed006d84b177c3f25c5baa1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
if !exists("g:karlmarks")
    let g:karlmarks = "<>"
endif

function! KarlMarks()
    for c in map(split(g:karlmarks, '\zs'), "char2nr(v:val)") +
                \ range(char2nr('a'), char2nr('z')) +
                \ range(char2nr('A'), char2nr('Z')) +
                \ range(char2nr('0'), char2nr('9'))

        let p = getpos("'".nr2char(c))

        if (p[0] == 0 || p[0] == winbufnr(0)) && p[1] > 0
            exec "sign unplace ".c
            exec "sign define mark_".c." text=".nr2char(c)." texthl=SignColumn"
            exec "sign place ".c." name=mark_".c." line=".p[1]." buffer=".winbufnr(0)
        endif
    endfor
endfunction
autocmd CursorHold * call KarlMarks()

" important for distraction free reading while changing windows
" setlocal signcolumn=yes
..