Skip to content

Commit

Permalink
Customisable signs' symbols.
Browse files Browse the repository at this point in the history
  • Loading branch information
airblade committed Mar 20, 2013
1 parent 2a5ae17 commit e04d719
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 11 deletions.
15 changes: 12 additions & 3 deletions README.mkd
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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`:
Expand Down
16 changes: 12 additions & 4 deletions doc/gitgutter.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
24 changes: 20 additions & 4 deletions plugin/gitgutter.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit e04d719

Please sign in to comment.