2013-09-30 04:19:31 -04:00
|
|
|
" vim: et sw=2 sts=2
|
|
|
|
|
2013-08-19 11:36:16 -04:00
|
|
|
scriptencoding utf-8
|
|
|
|
|
2013-07-17 06:30:58 -04:00
|
|
|
" Init: values {{{1
|
|
|
|
let s:sign_add = get(g:, 'signify_sign_add', '+')
|
|
|
|
let s:sign_delete_first_line = get(g:, 'signify_sign_delete_first_line', '‾')
|
|
|
|
let s:sign_change = get(g:, 'signify_sign_change', '!')
|
2014-10-04 13:35:51 -04:00
|
|
|
let s:sign_changedelete = get(g:, 'signify_sign_changedelete', s:sign_change)
|
2014-10-07 06:49:41 -04:00
|
|
|
let s:sign_show_count = get(g:, 'signify_sign_show_count', 1)
|
2013-07-17 06:30:58 -04:00
|
|
|
|
|
|
|
" Function: #setup {{{1
|
|
|
|
function! sy#highlight#setup() abort
|
2014-10-04 13:35:51 -04:00
|
|
|
highlight default link SignifyLineAdd DiffAdd
|
|
|
|
highlight default link SignifyLineDelete DiffDelete
|
|
|
|
highlight default link SignifyLineDeleteFirstLine SignifyLineDelete
|
|
|
|
highlight default link SignifyLineChange DiffChange
|
|
|
|
highlight default link SignifyLineChangeDelete SignifyLineChange
|
2013-07-17 06:30:58 -04:00
|
|
|
|
2014-10-04 13:35:51 -04:00
|
|
|
highlight default link SignifySignAdd DiffAdd
|
|
|
|
highlight default link SignifySignDelete DiffDelete
|
|
|
|
highlight default link SignifySignDeleteFirstLine SignifySignDelete
|
|
|
|
highlight default link SignifySignChange DiffChange
|
|
|
|
highlight default link SignifySignChangeDelete SignifySignChange
|
2013-07-17 06:30:58 -04:00
|
|
|
endfunction
|
|
|
|
|
|
|
|
" Function: #line_enable {{{1
|
|
|
|
function! sy#highlight#line_enable() abort
|
2014-10-07 06:49:41 -04:00
|
|
|
execute 'sign define SignifyAdd text='. s:sign_add 'texthl=SignifySignAdd linehl=SignifyLineAdd'
|
|
|
|
execute 'sign define SignifyChange text='. s:sign_change 'texthl=SignifySignChange linehl=SignifyLineChange'
|
2014-10-08 01:50:21 -04:00
|
|
|
execute 'sign define SignifyRemoveFirstLine text='. s:sign_delete_first_line 'texthl=SignifySignDeleteFirstLine linehl=SignifyLineDeleteFirstLine'
|
2014-10-07 06:49:41 -04:00
|
|
|
|
|
|
|
if s:sign_show_count
|
|
|
|
let s:sign_changedelete = substitute(s:sign_changedelete, '^.\zs.*', '', '')
|
|
|
|
for n in range(1, 9)
|
|
|
|
execute 'sign define SignifyChangeDelete'. n 'text='. s:sign_changedelete . n 'texthl=SignifySignChangeDelete linehl=SignifyLineChangeDelete'
|
|
|
|
endfor
|
|
|
|
execute 'sign define SignifyChangeDeleteMore text='. s:sign_changedelete .'> texthl=SignifySignChangeDelete linehl=SignifyLineChangeDelete'
|
|
|
|
else
|
|
|
|
for n in range(1, 9)
|
|
|
|
execute 'sign define SignifyChangeDelete'. n 'text='. s:sign_changedelete 'texthl=SignifySignChangeDelete linehl=SignifyLineChangeDelete'
|
|
|
|
endfor
|
|
|
|
execute 'sign define SignifyChangeDeleteMore text='. s:sign_changedelete 'texthl=SignifySignChangeDelete linehl=SignifyLineChangeDelete'
|
|
|
|
endif
|
2013-07-17 06:30:58 -04:00
|
|
|
|
|
|
|
let g:signify_line_highlight = 1
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
" Function: #line_disable {{{1
|
|
|
|
function! sy#highlight#line_disable() abort
|
2014-10-07 06:49:41 -04:00
|
|
|
execute 'sign define SignifyAdd text='. s:sign_add 'texthl=SignifySignAdd linehl='
|
|
|
|
execute 'sign define SignifyChange text='. s:sign_change 'texthl=SignifySignChange linehl='
|
2014-10-08 01:50:21 -04:00
|
|
|
execute 'sign define SignifyRemoveFirstLine text='. s:sign_delete_first_line 'texthl=SignifySignDeleteFirstLine linehl='
|
2014-10-07 06:49:41 -04:00
|
|
|
|
|
|
|
if s:sign_show_count
|
|
|
|
let s:sign_changedelete = substitute(s:sign_changedelete, '^.\zs.*', '', '')
|
|
|
|
for n in range(1, 9)
|
|
|
|
execute 'sign define SignifyChangeDelete'. n 'text='. s:sign_changedelete . n 'texthl=SignifySignChangeDelete linehl='
|
|
|
|
endfor
|
|
|
|
execute 'sign define SignifyChangeDeleteMore text='. s:sign_changedelete .'> texthl=SignifySignChangeDelete linehl='
|
|
|
|
else
|
|
|
|
for n in range(1, 9)
|
|
|
|
execute 'sign define SignifyChangeDelete'. n 'text='. s:sign_changedelete 'texthl=SignifySignChangeDelete linehl='
|
|
|
|
endfor
|
|
|
|
execute 'sign define SignifyChangeDeleteMore text='. s:sign_changedelete 'texthl=SignifySignChangeDelete linehl='
|
|
|
|
endif
|
2013-07-17 06:30:58 -04:00
|
|
|
|
|
|
|
let g:signify_line_highlight = 0
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
" Function: #line_toggle {{{1
|
|
|
|
function! sy#highlight#line_toggle() abort
|
2013-08-21 13:13:03 -04:00
|
|
|
if get(g:, 'signify_line_highlight')
|
2013-07-17 06:30:58 -04:00
|
|
|
call sy#highlight#line_disable()
|
|
|
|
else
|
|
|
|
call sy#highlight#line_enable()
|
|
|
|
endif
|
|
|
|
|
2015-12-06 08:00:35 -05:00
|
|
|
redraw!
|
2014-10-04 13:48:10 -04:00
|
|
|
call sy#start()
|
2013-07-17 06:30:58 -04:00
|
|
|
endfunction
|
2014-10-24 05:39:05 -04:00
|
|
|
" }}}
|
|
|
|
|
|
|
|
call sy#highlight#setup()
|