new option: g:signify_line_highlight

You can enable line highlighting per default now.
This commit is contained in:
Marco Hinz 2013-04-04 11:14:07 +02:00
parent 45dae2e900
commit d41bb86243
3 changed files with 48 additions and 23 deletions

View File

@ -195,6 +195,8 @@ let g:signify_sign_overwrite = 1
let g:signify_update_on_bufenter = 1 let g:signify_update_on_bufenter = 1
let g:signify_line_highlight = 1
let g:signify_sign_add = '+' let g:signify_sign_add = '+'
let g:signify_sign_delete = '-' let g:signify_sign_delete = '-'
let g:signify_sign_change = '*' let g:signify_sign_change = '*'

View File

@ -135,6 +135,11 @@ NOTE: Disable this if you're working in huge repositories and experience
delays. delays.
let g:signify_line_highlight = 1
Enable line highlighting in addation to using signs.
let g:signify_sign_add = '+' let g:signify_sign_add = '+'
let g:signify_sign_change = '*' let g:signify_sign_change = '*'
let g:signify_sign_change_delete = '!_' let g:signify_sign_change_delete = '!_'

View File

@ -10,7 +10,6 @@ let g:loaded_signify = 1
" Init: values {{{1 " Init: values {{{1
let s:sy = {} " the main data structure let s:sy = {} " the main data structure
let s:line_highlight = 0 " disable line highlighting
let s:other_signs_line_numbers = {} let s:other_signs_line_numbers = {}
" overwrite non-signify signs by default " overwrite non-signify signs by default
@ -100,7 +99,7 @@ augroup END
" Init: commands {{{1 " Init: commands {{{1
com! -nargs=0 -bar SignifyToggle call s:toggle_signify() com! -nargs=0 -bar SignifyToggle call s:toggle_signify()
com! -nargs=0 -bar SignifyToggleHighlight call s:toggle_line_highlighting() com! -nargs=0 -bar SignifyToggleHighlight call s:line_highlighting_toggle()
com! -nargs=0 -bar -count SignifyJumpToNextHunk call s:jump_to_next_hunk(<count>) com! -nargs=0 -bar -count SignifyJumpToNextHunk call s:jump_to_next_hunk(<count>)
com! -nargs=0 -bar -count SignifyJumpToPrevHunk call s:jump_to_prev_hunk(<count>) com! -nargs=0 -bar -count SignifyJumpToPrevHunk call s:jump_to_prev_hunk(<count>)
@ -172,6 +171,14 @@ function! s:start(path) abort
let s:sy[a:path].last_jump_was_next = -1 let s:sy[a:path].last_jump_was_next = -1
endif endif
if !exists('s:line_highlight')
if get(g:, 'signify_line_highlight')
call s:line_highlighting_enable()
else
call s:line_highlighting_disable()
endif
endif
if !s:sign_overwrite if !s:sign_overwrite
call s:sign_get_others(a:path) call s:sign_get_others(a:path)
endif endif
@ -467,22 +474,8 @@ function! s:toggle_signify() abort
endif endif
endfunction endfunction
" Function: s:toggle_line_highlighting {{{1 " Function: s:line_highlighting_enable {{{1
function! s:toggle_line_highlighting() abort function! s:line_highlighting_enable() abort
if !has_key(s:sy, s:path)
echo 'signify: I cannot detect any changes!'
return
endif
if s:line_highlight
sign define SignifyAdd text=+ texthl=SignifyAdd linehl=none
sign define SignifyChange text=! texthl=SignifyChange linehl=none
sign define SignifyChangeDelete text=!_ texthl=SignifyChange linehl=none
sign define SignifyDelete text=_ texthl=SignifyDelete linehl=none
sign define SignifyDeleteFirstLine text=texthl=SignifyDelete linehl=none
let s:line_highlight = 0
else
let add = get(g:, 'signify_line_color_add', 'DiffAdd') let add = get(g:, 'signify_line_color_add', 'DiffAdd')
let delete = get(g:, 'signify_line_color_delete', 'DiffDelete') let delete = get(g:, 'signify_line_color_delete', 'DiffDelete')
let change = get(g:, 'signify_line_color_change', 'DiffChange') let change = get(g:, 'signify_line_color_change', 'DiffChange')
@ -494,7 +487,32 @@ function! s:toggle_line_highlighting() abort
execute 'sign define SignifyDeleteFirstLine text=‾ texthl=SignifyDelete linehl='. delete execute 'sign define SignifyDeleteFirstLine text=‾ texthl=SignifyDelete linehl='. delete
let s:line_highlight = 1 let s:line_highlight = 1
endfunction
" Function: s:line_highlighting_disable {{{1
function! s:line_highlighting_disable() abort
sign define SignifyAdd text=+ texthl=SignifyAdd linehl=none
sign define SignifyChange text=! texthl=SignifyChange linehl=none
sign define SignifyChangeDelete text=!_ texthl=SignifyChange linehl=none
sign define SignifyDelete text=_ texthl=SignifyDelete linehl=none
sign define SignifyDeleteFirstLine text=texthl=SignifyDelete linehl=none
let s:line_highlight = 0
endfunction
" Function: s:line_highlighting_toggle {{{1
function! s:line_highlighting_toggle() abort
if !has_key(s:sy, s:path)
echo 'signify: I cannot detect any changes!'
return
endif endif
if s:line_highlight
call s:line_highlighting_disable()
else
call s:line_highlighting_enable()
endif
call s:start(s:path) call s:start(s:path)
endfunction endfunction
@ -560,7 +578,7 @@ function s:escape(path) abort
return path return path
endfunction endfunction
" Function: SignifyDebugListActiveBuffers() {{{1 " Function: SignifyDebugListActiveBuffers {{{1
function! SignifyDebugListActiveBuffers() abort function! SignifyDebugListActiveBuffers() abort
if empty(s:sy) if empty(s:sy)
echo 'No active buffers!' echo 'No active buffers!'