mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 19:43:47 -05:00
Extract method for clarity.
This commit is contained in:
38
README.mkd
38
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`.
|
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
|
### FAQ
|
||||||
|
|
||||||
> The colours in the sign column are weird.
|
> 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)?
|
> What happens if I also use another plugin which uses signs (e.g. Syntastic)?
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ function! s:init()
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
" Utility {{{
|
" Utility {{{
|
||||||
@@ -86,6 +85,10 @@ function! s:is_tracked_by_git()
|
|||||||
return !v:shell_error
|
return !v:shell_error
|
||||||
endfunction
|
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
|
" {{{ Colours and signs
|
||||||
@@ -140,7 +143,6 @@ function! s:update_line_highlights(highlight_lines)
|
|||||||
redraw!
|
redraw!
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
" Diff processing {{{
|
" Diff processing {{{
|
||||||
@@ -305,8 +307,7 @@ endfunction
|
|||||||
function! s:show_signs(file_name, modified_lines)
|
function! s:show_signs(file_name, modified_lines)
|
||||||
for line in a:modified_lines
|
for line in a:modified_lines
|
||||||
let line_number = line[0]
|
let line_number = line[0]
|
||||||
" snake case to camel case
|
let type = s:snake_case_to_camel_case(line[1])
|
||||||
let type = substitute(line[1], '\v(.)(\a+)(_(.)(.+))?', '\u\1\l\2\u\4\l\5', '')
|
|
||||||
call s:add_sign(line_number, 'GitGutterLine' . type, a:file_name)
|
call s:add_sign(line_number, 'GitGutterLine' . type, a:file_name)
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
Reference in New Issue
Block a user