diff --git a/README.mkd b/README.mkd index 506ff6a..234dcf0 100644 --- a/README.mkd +++ b/README.mkd @@ -61,15 +61,45 @@ You may want to add mappings for these if you use them often. If you want to define your own highlights, you can turn off vim-gitgutter's with `let g:gitgutter_highlights = 0` in your `~/.vimrc`. +### Customisation + +* The sign column's colours +* The signs' colours +* The signs' 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) + +Please note that vim-gitgutter won't override any colours or highlights you've set in your colorscheme. + + +#### Sign column + +The background colour of the sign column is controlled by the `SignColumn` highlight group. This will be either set in your colour scheme or Vim's default. + +To find out where it's set, and to what it's set, use `:verbose highlight SignColumn`. + +If your `SignColumn` is not set (`:highlight SignColumn` gives you `SignColumn xxx cleared`), vim-gitgutter will set it to the same as your line number column (i.e. the `LineNr` highlight group). + +To change your sign column's appearance, update your colour scheme or `~/.vimrc` like this: + +* For the same appearance as your line number column: `highlight clear SignColumn` +* For a specific appearance on terminal Vim: `highlight SignColumn ctermbg=whatever` +* For a specific appearance on gVim/MacVim: `highlight SignColumn guibg=whatever` + + +#### Signs' colours + +To customise these, put this in your colorscheme or `~/.vimrc`: + + + ### FAQ > The colours in the sign column are weird. -The syntax highlighting for your sign column is probably set strangely. Either modify your colorscheme or add this to your `~/.vimrc`: +Please see the section above on customising the sign column. -``` -highlight clear SignColumn -``` > What happens if I also use another plugin which uses signs (e.g. Syntastic)? diff --git a/plugin/gitgutter.vim b/plugin/gitgutter.vim index b221a7d..36cf315 100644 --- a/plugin/gitgutter.vim +++ b/plugin/gitgutter.vim @@ -38,7 +38,6 @@ function! s:init() endif endfunction - " }}} " Utility {{{ @@ -86,6 +85,10 @@ function! s:is_tracked_by_git() return !v:shell_error endfunction +function! s:snake_case_to_camel_case(text) + return substitute(a:text, '\v(.)(\a+)(_(.)(.+))?', '\u\1\l\2\u\4\l\5', '') +endfunction + " }}} " {{{ Colours and signs @@ -140,7 +143,6 @@ function! s:update_line_highlights(highlight_lines) redraw! endfunction - " }}} " Diff processing {{{ @@ -305,8 +307,7 @@ endfunction function! s:show_signs(file_name, modified_lines) for line in a:modified_lines let line_number = line[0] - " snake case to camel case - let type = substitute(line[1], '\v(.)(\a+)(_(.)(.+))?', '\u\1\l\2\u\4\l\5', '') + let type = s:snake_case_to_camel_case(line[1]) call s:add_sign(line_number, 'GitGutterLine' . type, a:file_name) endfor endfunction