Customisable signs' symbols.

This commit is contained in:
Andy Stewart
2013-03-20 09:29:00 +01:00
parent 2a5ae179fc
commit e04d719159
3 changed files with 44 additions and 11 deletions

View File

@@ -74,7 +74,7 @@ You can customise:
* The sign column's colours * The sign column's colours
* Whether or not the sign column is shown when there aren't any signs (defaults to no) * 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 * Line highlights
* Whether or not vim-gitgutter is on initially (defaults to on) * Whether or not vim-gitgutter is on initially (defaults to on)
* Whether or not line highlighting is on initially (defaults to off) * 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`. 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 ```viml
GitGutterAdd " an added line 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`. 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 #### Line highlights
Similarly to the signs' colours, set up the following highlight groups in your colorscheme or `~/.vimrc`: Similarly to the signs' colours, set up the following highlight groups in your colorscheme or `~/.vimrc`:

View File

@@ -92,7 +92,7 @@ Commands for jumping between marked hunks:
You can customise: You can customise:
- The sign column's colours - The sign column's colours
- The signs' colours - The signs' colours and symbols
- Line highlights - Line highlights
- Whether or not vim-gitgutter is on initially (defaults to on) - Whether or not vim-gitgutter is on initially (defaults to on)
- Whether or not line highlighting is on initially (defaults to off) - 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 (terminal Vim) highlight SignColumn ctermbg={whatever}
User-defined (graphical Vim) highlight SignColumn guibg={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 To customise the colours, set up the following highlight groups in your
or |vimrc|: colorscheme or |vimrc|:
> >
GitGutterAdd " an added line GitGutterAdd " an added line
@@ -146,6 +146,14 @@ them to existing highlight groups with, say:
highlight link GitGutterAdd DiffAdd 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 LINE HIGHLIGHTS
Similarly to the signs' colours, set up the following highlight groups in your Similarly to the signs' colours, set up the following highlight groups in your

View File

@@ -26,6 +26,22 @@ if !exists('g:gitgutter_all_on_focusgained')
let g:gitgutter_all_on_focusgained = 1 let g:gitgutter_all_on_focusgained = 1
endif 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 = '' let s:file = ''
function! s:init() function! s:init()
@@ -160,10 +176,10 @@ function! s:define_signs()
endfunction endfunction
function! s:define_sign_symbols() function! s:define_sign_symbols()
sign define GitGutterLineAdded text=+ exe "sign define GitGutterLineAdded text=" . g:gitgutter_sign_added
sign define GitGutterLineModified text=~ exe "sign define GitGutterLineModified text=" . g:gitgutter_sign_modified
sign define GitGutterLineRemoved text=_ exe "sign define GitGutterLineRemoved text=" . g:gitgutter_sign_removed
sign define GitGutterLineModifiedRemoved text=~_ exe "sign define GitGutterLineModifiedRemoved text=" . g:gitgutter_sign_modified_removed
endfunction endfunction
function! s:define_sign_text_highlights() function! s:define_sign_text_highlights()