aboutsummaryrefslogtreecommitdiff
path: root/plugin/KarlMarks.vim
blob: f0699e1fbc35d55bc99266951171c7f56caf67a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
let g:markerbar_additional =   '"'   " position in buffer when left
let g:markerbar_additional .=  '<>'  " start/end last selection
let g:markerbar_additional .=  '{}'  " start/end paragraph
let g:markerbar_additional .=  '()'  " start/end sentence
let g:markerbar_additional .=  '[]'  " start/end sentence
let g:markerbar_additional .=  '.'   " last change
let g:markerbar_additional .=  "^"   " insert mode stopped
let g:markerbar_additional .=  "'`"

function! KarlMarks()
    for c in map(split(g:markerbar_additional, '\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
..