diff --git a/README.mkd b/README.mkd index 696ec23..c694601 100644 --- a/README.mkd +++ b/README.mkd @@ -74,7 +74,7 @@ You can customise: * The sign column's colours * Whether or not the sign column is shown when there aren't any signs (defaults to no) -* The signs' colours +* The signs' colours and symbols * Line highlights * Whether or not vim-gitgutter is on initially (defaults to on) * Whether or not line highlighting is on initially (defaults to off) @@ -101,9 +101,9 @@ To change your sign column's appearance, update your colorscheme or `~/.vimrc` l By default the sign column will appear when there are signs to show and disappear when there aren't. If you would always like the sign column to be there, add `let g:gitgutter_sign_column_always = 1` to your `~/.vimrc`. -#### Signs' colours +#### Signs' colours and symbols -To customise these, set up the following highlight groups in your colorscheme or `~/.vimrc`: +To customise the colours, set up the following highlight groups in your colorscheme or `~/.vimrc`: ```viml GitGutterAdd " an added line @@ -114,6 +114,15 @@ GitGutterChangeDelete " a changed line followed by at least one removed line You can either set these with `highlight GitGutterAdd {key}={arg}...` or link them to existing highlight groups with, say, `highlight link GitGutterAdd DiffAdd`. +To customise the symbols, add the following to your `~/.vimrc`: + +```viml +let g:gitgutter_sign_added = 'xx' +let g:gitgutter_sign_modified = 'yy' +let g:gitgutter_sign_removed = 'zz' +let g:gitgutter_sign_modified_removed = 'ww' +``` + #### Line highlights Similarly to the signs' colours, set up the following highlight groups in your colorscheme or `~/.vimrc`: diff --git a/doc/gitgutter.txt b/doc/gitgutter.txt index 0339cc7..0de252c 100644 --- a/doc/gitgutter.txt +++ b/doc/gitgutter.txt @@ -92,7 +92,7 @@ Commands for jumping between marked hunks: You can customise: - The sign column's colours -- The signs' colours +- The signs' colours and symbols - Line highlights - Whether or not vim-gitgutter is on initially (defaults to on) - Whether or not line highlighting is on initially (defaults to off) @@ -128,10 +128,10 @@ like this: User-defined (terminal Vim) highlight SignColumn ctermbg={whatever} User-defined (graphical Vim) highlight SignColumn guibg={whatever} -SIGNS' COLOURS +SIGNS' COLOURS AND SYMBOLS -To customise these, set up the following highlight groups in your colorscheme -or |vimrc|: +To customise the colours, set up the following highlight groups in your +colorscheme or |vimrc|: > GitGutterAdd " an added line @@ -146,6 +146,14 @@ them to existing highlight groups with, say: highlight link GitGutterAdd DiffAdd < +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_modified_removed = 'ww' +< + LINE HIGHLIGHTS Similarly to the signs' colours, set up the following highlight groups in your diff --git a/plugin/gitgutter.vim b/plugin/gitgutter.vim index 57464cd..2bcfd65 100644 --- a/plugin/gitgutter.vim +++ b/plugin/gitgutter.vim @@ -26,6 +26,22 @@ if !exists('g:gitgutter_all_on_focusgained') let g:gitgutter_all_on_focusgained = 1 endif +if !exists('g:gitgutter_sign_added') + let g:gitgutter_sign_added = '+' +endif + +if !exists('g:gitgutter_sign_modified') + let g:gitgutter_sign_modified = '~' +endif + +if !exists('g:gitgutter_sign_removed') + let g:gitgutter_sign_removed = '_' +endif + +if !exists('g:gitgutter_sign_modified_removed') + let g:gitgutter_sign_modified_removed = '~_' +endif + let s:file = '' function! s:init() @@ -160,10 +176,10 @@ function! s:define_signs() endfunction function! s:define_sign_symbols() - sign define GitGutterLineAdded text=+ - sign define GitGutterLineModified text=~ - sign define GitGutterLineRemoved text=_ - sign define GitGutterLineModifiedRemoved text=~_ + exe "sign define GitGutterLineAdded text=" . g:gitgutter_sign_added + exe "sign define GitGutterLineModified text=" . g:gitgutter_sign_modified + exe "sign define GitGutterLineRemoved text=" . g:gitgutter_sign_removed + exe "sign define GitGutterLineModifiedRemoved text=" . g:gitgutter_sign_modified_removed endfunction function! s:define_sign_text_highlights()