Revert "Show sign on first line when line(s) deleted at start of file."

Signs aren't shown for deleted lines which aren't at the start of the
file.

This reverts commit 0fd18d66f6.
This commit is contained in:
Andy Stewart
2014-05-31 16:57:15 +02:00
parent 0fd18d66f6
commit d1e66b71f9
7 changed files with 12 additions and 22 deletions

View File

@@ -204,7 +204,6 @@ To customise the symbols, add the following to your `~/.vimrc`:
let g:gitgutter_sign_added = 'xx'
let g:gitgutter_sign_modified = 'yy'
let g:gitgutter_sign_removed = 'zz'
let g:gitgutter_sign_removed_first_line = '^^'
let g:gitgutter_sign_modified_removed = 'ww'
```
@@ -277,6 +276,10 @@ let g:gitgutter_realtime = 0
let g:gitgutter_eager = 0
```
> Why is no sign shown if I delete the first line(s) in a file?
vim-gitgutter shows removed lines with a sign on the line above. In this case there isn't a line above so vim-gitgutter can't show the sign. In due course I'll fix this with an overline character on the first line.
> What happens if I also use another plugin which uses signs (e.g. Syntastic)?
Vim only allows one sign per line. Before adding a sign to a line, vim-gitgutter checks whether a sign has already been added by somebody else. If so it doesn't do anything. In other words vim-gitgutter won't overwrite another plugin's signs. It also won't remove another plugin's signs.

View File

@@ -142,11 +142,7 @@ function! diff#process_added(modifications, from_count, to_count, to_line)
endfunction
function! diff#process_removed(modifications, from_count, to_count, to_line)
if a:to_line == 0
call add(a:modifications, [1, 'removed_first_line'])
else
call add(a:modifications, [0, 'removed'])
endif
call add(a:modifications, [a:to_line, 'removed'])
endfunction
function! diff#process_modified(modifications, from_count, to_count, to_line)

View File

@@ -34,7 +34,6 @@ function! highlight#define_signs()
sign define GitGutterLineAdded
sign define GitGutterLineModified
sign define GitGutterLineRemoved
sign define GitGutterLineRemovedFirstLine
sign define GitGutterLineModifiedRemoved
sign define GitGutterDummy
@@ -47,7 +46,6 @@ function! highlight#define_sign_text()
execute "sign define GitGutterLineAdded text=" . g:gitgutter_sign_added
execute "sign define GitGutterLineModified text=" . g:gitgutter_sign_modified
execute "sign define GitGutterLineRemoved text=" . g:gitgutter_sign_removed
execute "sign define GitGutterLineRemovedFirstLine text=" . g:gitgutter_sign_removed_first_line
execute "sign define GitGutterLineModifiedRemoved text=" . g:gitgutter_sign_modified_removed
endfunction
@@ -70,7 +68,6 @@ function! highlight#define_sign_text_highlights()
sign define GitGutterLineAdded texthl=GitGutterAdd
sign define GitGutterLineModified texthl=GitGutterChange
sign define GitGutterLineRemoved texthl=GitGutterDelete
sign define GitGutterLineRemovedFirstLine texthl=GitGutterDelete
sign define GitGutterLineModifiedRemoved texthl=GitGutterChangeDelete
endfunction
@@ -79,13 +76,11 @@ function! highlight#define_sign_line_highlights()
sign define GitGutterLineAdded linehl=GitGutterAddLine
sign define GitGutterLineModified linehl=GitGutterChangeLine
sign define GitGutterLineRemoved linehl=GitGutterDeleteLine
sign define GitGutterLineRemovedFirstLine linehl=GitGutterDeleteLine
sign define GitGutterLineModifiedRemoved linehl=GitGutterChangeDeleteLine
else
sign define GitGutterLineAdded linehl=
sign define GitGutterLineModified linehl=
sign define GitGutterLineRemoved linehl=
sign define GitGutterLineRemovedFirstLine linehl=
sign define GitGutterLineModifiedRemoved linehl=
endif
endfunction

View File

@@ -54,8 +54,7 @@ function! hunk#prev_hunk(count)
if hunk[2] < current_line
let hunk_count += 1
if hunk_count == a:count
let target = hunk[2] == 0 ? 1 : hunk[2]
execute 'normal!' target . 'G'
execute 'normal!' hunk[2] . 'G'
break
endif
endif
@@ -70,11 +69,6 @@ function! hunk#current_hunk()
let current_line = line('.')
for hunk in s:hunks
if current_line == 1 && hunk[2] == 0
let current_hunk = hunk
break
endif
if current_line >= hunk[2] && current_line < hunk[2] + (hunk[3] == 0 ? 1 : hunk[3])
let current_hunk = hunk
break

View File

@@ -88,8 +88,6 @@ function! utility#highlight_name_for_change(text)
return 'GitGutterLineAdded'
elseif a:text ==# 'removed'
return 'GitGutterLineRemoved'
elseif a:text ==# 'removed_first_line'
return 'GitGutterLineRemovedFirstLine'
elseif a:text ==# 'modified'
return 'GitGutterLineModified'
elseif a:text ==# 'modified_removed'

View File

@@ -270,7 +270,12 @@ a. Why are the colours in the sign column weird?
Your colorscheme is configuring the |hl-SignColumn| highlight group weirdly.
Please see |GitGutterCustomisation| on customising the sign column.
b. What happens if I also use another plugin which uses signs (e.g. Syntastic)?
b. Why is no sign shown if I delete the first line(s) in a file?
vim-gitgutter shows removed lines with a sign on the line above. In this
case there isn't a line above so vim-gitgutter can't show the sign.
c. What happens if I also use another plugin which uses signs (e.g. Syntastic)?
Vim only allows one sign per line. Before adding a sign to a line,
vim-gitgutter checks whether a sign has already been added by somebody else.

View File

@@ -34,7 +34,6 @@ call s:set('g:gitgutter_eager', 1)
call s:set('g:gitgutter_sign_added', '+')
call s:set('g:gitgutter_sign_modified', '~')
call s:set('g:gitgutter_sign_removed', '_')
call s:set('g:gitgutter_sign_removed_first_line', '‾')
call s:set('g:gitgutter_sign_modified_removed', '~_')
call s:set('g:gitgutter_diff_args', '')
call s:set('g:gitgutter_escape_grep', 0)