diff --git a/README.md b/README.md index 199b415..99d2748 100644 --- a/README.md +++ b/README.md @@ -68,23 +68,26 @@ Sign explanation A new line was added. The sign is shown on the same line as the new line. -`_` +`_1` -A line was deleted. The sign is shown on the line above the deleted line. Special case: The first line was deleted. In this case the sign is shown on the same line. +A line was deleted. The sign is shown on the line above the deleted line. The +second character indicates the number of deleted lines: 1-9, and # for +everything above. `!` -A line was changed. Something was changed, but the amount of lines stayed the same. The sign is shown on the same line. +A line was changed. Something was changed, but the amount of lines stayed the +same. The sign is shown on the same line. `!_` -A line was changed and one or more of the lines below were deleted. A combination of **!** and **_**. The sign is shown on the same line. +A line was changed and one or more of the lines below were deleted. A +combination of **!** and **_**. The sign is shown on the same line. `‾` -The first line was deleted. This special case is indicated by **‾** rather than -**_**. +This is used instead of _ in the special case of the first line being removed. Longer introduction ------------------- diff --git a/doc/signify.txt b/doc/signify.txt index 6489d78..e7d3972 100644 --- a/doc/signify.txt +++ b/doc/signify.txt @@ -66,11 +66,11 @@ Sign explanation: A new line was added. The sign is shown on the same line as the new line. - _ + _1 -A line was deleted. The sign is shown on the line above the deleted line. -Special case: The first line was deleted. In this case the sign is shown on -the same line. +A line was deleted. The sign is shown on the line above the deleted line. The +second character indicates the number of deleted lines: 1-9, and # for +everything above. ! diff --git a/plugin/signify.vim b/plugin/signify.vim index 4f27fe5..d69d104 100644 --- a/plugin/signify.vim +++ b/plugin/signify.vim @@ -342,14 +342,14 @@ function! s:repo_process_diff(path, diff) abort call s:sign_set(new_line + offset, 'SignifyAdd', a:path) let offset += 1 endwhile - " An old line was removed. + " An old line was removed. elseif (old_count >= 1) && (new_count == 0) if new_line == 0 call s:sign_set(1, 'SignifyDeleteFirstLine', a:path) else - call s:sign_set(new_line, 'SignifyDelete', a:path) + call s:sign_set(new_line, (old_count > 9) ? 'SignifyDeleteMore' : 'SignifyDelete'. old_count, a:path) endif - " A line was changed. + " A line was changed. elseif (old_count == new_count) let offset = 0 while offset < new_count @@ -365,7 +365,7 @@ function! s:repo_process_diff(path, diff) abort let offset += 1 endwhile call s:sign_set(new_line + offset - 1, 'SignifyChangeDelete', a:path) - " (old_count < new_count): Lines were changed && added. + " (old_count < new_count): Lines were changed && added. else let offset = 0 while offset < old_count @@ -474,8 +474,17 @@ endfunction function! s:line_highlighting_enable() abort execute 'sign define SignifyAdd text='. s:sign_add .' texthl=SignifyAdd linehl='. s:line_color_add execute 'sign define SignifyChange text='. s:sign_change .' texthl=SignifyChange linehl='. s:line_color_change - execute 'sign define SignifyChangeDelete text='. s:sign_change_delete .' texthl=SignifyChange linehl='. s:line_color_change_delete - execute 'sign define SignifyDelete text='. s:sign_delete .' texthl=SignifyDelete linehl='. s:line_color_delete + execute 'sign define SignifyChangeDelete text='. s:sign_change_delete .' texthl=SignifyChange linehl='. s:line_color_change + execute 'sign define SignifyDelete1 text='. s:sign_delete .'1 texthl=SignifyDelete linehl='. s:line_color_delete + execute 'sign define SignifyDelete2 text='. s:sign_delete .'2 texthl=SignifyDelete linehl='. s:line_color_delete + execute 'sign define SignifyDelete3 text='. s:sign_delete .'3 texthl=SignifyDelete linehl='. s:line_color_delete + execute 'sign define SignifyDelete4 text='. s:sign_delete .'4 texthl=SignifyDelete linehl='. s:line_color_delete + execute 'sign define SignifyDelete5 text='. s:sign_delete .'5 texthl=SignifyDelete linehl='. s:line_color_delete + execute 'sign define SignifyDelete6 text='. s:sign_delete .'6 texthl=SignifyDelete linehl='. s:line_color_delete + execute 'sign define SignifyDelete7 text='. s:sign_delete .'7 texthl=SignifyDelete linehl='. s:line_color_delete + execute 'sign define SignifyDelete8 text='. s:sign_delete .'8 texthl=SignifyDelete linehl='. s:line_color_delete + execute 'sign define SignifyDelete9 text='. s:sign_delete .'9 texthl=SignifyDelete linehl='. s:line_color_delete + execute 'sign define SignifyDeleteMore text='. s:sign_delete .'# texthl=SignifyDelete linehl='. s:line_color_delete execute 'sign define SignifyDeleteFirstLine text='. s:sign_delete_first_line .' texthl=SignifyDelete linehl='. s:line_color_delete let s:line_highlight = 1 @@ -483,11 +492,20 @@ endfunction " Function: s:line_highlighting_disable {{{1 function! s:line_highlighting_disable() abort - execute 'sign define SignifyAdd text='. s:sign_add .' texthl=SignifyAdd linehl=NONE' - execute 'sign define SignifyChange text='. s:sign_change .' texthl=SignifyChange linehl=NONE' - execute 'sign define SignifyChangeDelete text='. s:sign_change_delete .' texthl=SignifyChange linehl=NONE' - execute 'sign define SignifyDelete text='. s:sign_delete .' texthl=SignifyDelete linehl=NONE' - execute 'sign define SignifyDeleteFirstLine text='. s:sign_delete_first_line .' texthl=SignifyDelete linehl=NONE' + execute 'sign define SignifyAdd text='. s:sign_add .' texthl=SignifyAdd linehl=none' + execute 'sign define SignifyChange text='. s:sign_change .' texthl=SignifyChange linehl=none' + execute 'sign define SignifyChangeDelete text='. s:sign_change_delete .' texthl=SignifyChange linehl=none' + execute 'sign define SignifyDelete1 text='. s:sign_delete .'1 texthl=SignifyDelete linehl=none' + execute 'sign define SignifyDelete2 text='. s:sign_delete .'2 texthl=SignifyDelete linehl=none' + execute 'sign define SignifyDelete3 text='. s:sign_delete .'3 texthl=SignifyDelete linehl=none' + execute 'sign define SignifyDelete4 text='. s:sign_delete .'4 texthl=SignifyDelete linehl=none' + execute 'sign define SignifyDelete5 text='. s:sign_delete .'5 texthl=SignifyDelete linehl=none' + execute 'sign define SignifyDelete6 text='. s:sign_delete .'6 texthl=SignifyDelete linehl=none' + execute 'sign define SignifyDelete7 text='. s:sign_delete .'7 texthl=SignifyDelete linehl=none' + execute 'sign define SignifyDelete8 text='. s:sign_delete .'8 texthl=SignifyDelete linehl=none' + execute 'sign define SignifyDelete9 text='. s:sign_delete .'9 texthl=SignifyDelete linehl=none' + execute 'sign define SignifyDeleteMore text='. s:sign_delete .'# texthl=SignifyDelete linehl=none' + execute 'sign define SignifyDeleteFirstLine text='. s:sign_delete_first_line .' texthl=SignifyDelete linehl=none' let s:line_highlight = 0 endfunction