renaming some identifiers
This commit is contained in:
parent
ff80b442b4
commit
17667befff
@ -91,7 +91,7 @@ endif
|
|||||||
" Initial stuff {{{1
|
" Initial stuff {{{1
|
||||||
aug signify
|
aug signify
|
||||||
au!
|
au!
|
||||||
au ColorScheme * call s:set_colors()
|
au ColorScheme * call s:colors_set()
|
||||||
au BufWritePost,FocusGained * call s:start(expand('<afile>:p'))
|
au BufWritePost,FocusGained * call s:start(expand('<afile>:p'))
|
||||||
au BufEnter * let s:colors_set = 0 | call s:start(expand('<afile>:p'))
|
au BufEnter * let s:colors_set = 0 | call s:start(expand('<afile>:p'))
|
||||||
aug END
|
aug END
|
||||||
@ -125,10 +125,10 @@ function! s:start(path) abort
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" Is a diff available?
|
" Is a diff available?
|
||||||
let diff = s:get_diff(a:path)
|
let diff = s:diff_get(a:path)
|
||||||
if empty(diff)
|
if empty(diff)
|
||||||
if has_key(s:sy, a:path)
|
if has_key(s:sy, a:path)
|
||||||
call s:remove_signs(a:path)
|
call s:sign_remove_all(a:path)
|
||||||
endif
|
endif
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
@ -141,19 +141,19 @@ function! s:start(path) abort
|
|||||||
return
|
return
|
||||||
" Update active buffer.. reset default values
|
" Update active buffer.. reset default values
|
||||||
else
|
else
|
||||||
call s:remove_signs(a:path)
|
call s:sign_remove_all(a:path)
|
||||||
let s:sy[a:path].id_top = s:id_top
|
let s:sy[a:path].id_top = s:id_top
|
||||||
let s:sy[a:path].id_jump = s:id_top
|
let s:sy[a:path].id_jump = s:id_top
|
||||||
let s:sy[a:path].last_jump_was_next = -1
|
let s:sy[a:path].last_jump_was_next = -1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if s:sign_overwrite == 0
|
if s:sign_overwrite == 0
|
||||||
call s:get_other_signs(a:path)
|
call s:sign_get_others(a:path)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Set colors only for the first time or when a new colorscheme is set.
|
" Set colors only for the first time or when a new colorscheme is set.
|
||||||
if !s:colors_set
|
if !s:colors_set
|
||||||
call s:set_colors()
|
call s:colors_set()
|
||||||
let s:colors_set = 1
|
let s:colors_set = 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ function! s:stop(path) abort
|
|||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call s:remove_signs(a:path)
|
call s:sign_remove_all(a:path)
|
||||||
|
|
||||||
if (s:sy[a:path].active == 0)
|
if (s:sy[a:path].active == 0)
|
||||||
return
|
return
|
||||||
@ -182,28 +182,8 @@ function! s:stop(path) abort
|
|||||||
aug END
|
aug END
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Functions -> s:toggle_signify() {{{2
|
" Functions -> s:sign_get_others() {{{2
|
||||||
function! s:toggle_signify() abort
|
function! s:sign_get_others(path) abort
|
||||||
let path = expand('%:p')
|
|
||||||
|
|
||||||
if empty(path)
|
|
||||||
echoerr "signify: I don't sy empty buffers!"
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
if has_key(s:sy, path)
|
|
||||||
if (s:sy[path].active == 1)
|
|
||||||
let s:sy[path].active = 0
|
|
||||||
call s:stop(path)
|
|
||||||
else
|
|
||||||
let s:sy[path].active = 1
|
|
||||||
call s:start(path)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Functions -> s:get_other_signs() {{{2
|
|
||||||
function! s:get_other_signs(path) abort
|
|
||||||
redir => signlist
|
redir => signlist
|
||||||
sil! exe 'sign place file='. a:path
|
sil! exe 'sign place file='. a:path
|
||||||
redir END
|
redir END
|
||||||
@ -216,8 +196,8 @@ function! s:get_other_signs(path) abort
|
|||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Functions -> s:set_sign() {{{2
|
" Functions -> s:sign_set() {{{2
|
||||||
function! s:set_sign(lnum, type, path)
|
function! s:sign_set(lnum, type, path)
|
||||||
" Preserve non-signify signs
|
" Preserve non-signify signs
|
||||||
if get(s:other_signs_line_numbers, a:lnum) == 1
|
if get(s:other_signs_line_numbers, a:lnum) == 1
|
||||||
return
|
return
|
||||||
@ -229,8 +209,8 @@ function! s:set_sign(lnum, type, path)
|
|||||||
let s:id_top += 1
|
let s:id_top += 1
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Functions -> s:remove_signs() {{{2
|
" Functions -> s:sign_remove_all() {{{2
|
||||||
function! s:remove_signs(path) abort
|
function! s:sign_remove_all(path) abort
|
||||||
for id in s:sy[a:path].ids
|
for id in s:sy[a:path].ids
|
||||||
exe 'sign unplace '. id
|
exe 'sign unplace '. id
|
||||||
endfor
|
endfor
|
||||||
@ -239,8 +219,8 @@ function! s:remove_signs(path) abort
|
|||||||
let s:sy[a:path].ids = []
|
let s:sy[a:path].ids = []
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Functions -> s:get_diff() {{{2
|
" Functions -> s:diff_get() {{{2
|
||||||
function! s:get_diff(path) abort
|
function! s:diff_get(path) abort
|
||||||
if !executable('grep')
|
if !executable('grep')
|
||||||
echoerr 'signify: I cannot work without grep!'
|
echoerr 'signify: I cannot work without grep!'
|
||||||
return
|
return
|
||||||
@ -304,17 +284,17 @@ function! s:process_diff(diff) abort
|
|||||||
if (old_count == 0) && (new_count >= 1)
|
if (old_count == 0) && (new_count >= 1)
|
||||||
let offset = 0
|
let offset = 0
|
||||||
while offset < new_count
|
while offset < new_count
|
||||||
call s:set_sign(new_line + offset, 'SignifyAdd', l:path)
|
call s:sign_set(new_line + offset, 'SignifyAdd', l:path)
|
||||||
let offset += 1
|
let offset += 1
|
||||||
endwhile
|
endwhile
|
||||||
" An old line was removed.
|
" An old line was removed.
|
||||||
elseif (old_count >= 1) && (new_count == 0)
|
elseif (old_count >= 1) && (new_count == 0)
|
||||||
call s:set_sign(new_line, 'SignifyDelete', l:path)
|
call s:sign_set(new_line, 'SignifyDelete', l:path)
|
||||||
" A line was changed.
|
" A line was changed.
|
||||||
elseif (old_count == new_count)
|
elseif (old_count == new_count)
|
||||||
let offset = 0
|
let offset = 0
|
||||||
while offset < new_count
|
while offset < new_count
|
||||||
call s:set_sign(new_line + offset, 'SignifyChange', l:path)
|
call s:sign_set(new_line + offset, 'SignifyChange', l:path)
|
||||||
let offset += 1
|
let offset += 1
|
||||||
endwhile
|
endwhile
|
||||||
else
|
else
|
||||||
@ -322,19 +302,19 @@ function! s:process_diff(diff) abort
|
|||||||
if (old_count > new_count)
|
if (old_count > new_count)
|
||||||
let offset = 0
|
let offset = 0
|
||||||
while offset < new_count
|
while offset < new_count
|
||||||
call s:set_sign(new_line + offset, 'SignifyChange', l:path)
|
call s:sign_set(new_line + offset, 'SignifyChange', l:path)
|
||||||
let offset += 1
|
let offset += 1
|
||||||
endwhile
|
endwhile
|
||||||
call s:set_sign(new_line + offset - 1, 'SignifyDelete', l:path)
|
call s:sign_set(new_line + offset - 1, 'SignifyDelete', l:path)
|
||||||
" (old_count < new_count): Lines were added && changed.
|
" (old_count < new_count): Lines were added && changed.
|
||||||
else
|
else
|
||||||
let offset = 0
|
let offset = 0
|
||||||
while offset < old_count
|
while offset < old_count
|
||||||
call s:set_sign(new_line + offset, 'SignifyChange', l:path)
|
call s:sign_set(new_line + offset, 'SignifyChange', l:path)
|
||||||
let offset += 1
|
let offset += 1
|
||||||
endwhile
|
endwhile
|
||||||
while offset < new_count
|
while offset < new_count
|
||||||
call s:set_sign(new_line + offset, 'SignifyAdd', l:path)
|
call s:sign_set(new_line + offset, 'SignifyAdd', l:path)
|
||||||
let offset += 1
|
let offset += 1
|
||||||
endwhile
|
endwhile
|
||||||
endif
|
endif
|
||||||
@ -342,8 +322,8 @@ function! s:process_diff(diff) abort
|
|||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Functions -> s:set_colors() {{{2
|
" Functions -> s:colors_set() {{{2
|
||||||
func! s:set_colors() abort
|
func! s:colors_set() abort
|
||||||
if has('gui_running')
|
if has('gui_running')
|
||||||
let guifg_add = exists('g:signify_color_sign_guifg_add') ? g:signify_color_sign_guifg_add : '#11ee11'
|
let guifg_add = exists('g:signify_color_sign_guifg_add') ? g:signify_color_sign_guifg_add : '#11ee11'
|
||||||
let guifg_delete = exists('g:signify_color_sign_guifg_delete') ? g:signify_color_sign_guifg_delete : '#ee1111'
|
let guifg_delete = exists('g:signify_color_sign_guifg_delete') ? g:signify_color_sign_guifg_delete : '#ee1111'
|
||||||
@ -391,6 +371,26 @@ func! s:set_colors() abort
|
|||||||
endif
|
endif
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" Functions -> s:toggle_signify() {{{2
|
||||||
|
function! s:toggle_signify() abort
|
||||||
|
let path = expand('%:p')
|
||||||
|
|
||||||
|
if empty(path)
|
||||||
|
echoerr "signify: I don't sy empty buffers!"
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
if has_key(s:sy, path)
|
||||||
|
if (s:sy[path].active == 1)
|
||||||
|
let s:sy[path].active = 0
|
||||||
|
call s:stop(path)
|
||||||
|
else
|
||||||
|
let s:sy[path].active = 1
|
||||||
|
call s:start(path)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Functions -> s:toggle_line_highlighting() {{{2
|
" Functions -> s:toggle_line_highlighting() {{{2
|
||||||
function! s:toggle_line_highlighting() abort
|
function! s:toggle_line_highlighting() abort
|
||||||
if s:line_highlight
|
if s:line_highlight
|
||||||
|
Loading…
x
Reference in New Issue
Block a user