mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-10 20:43:47 -05:00
Add ability to toggle signs on and off.
This commit is contained in:
24
README.mkd
24
README.mkd
@@ -55,18 +55,30 @@ You don't have to do anything: it just works.
|
|||||||
|
|
||||||
With one exception the plugin diffs your saved buffers, i.e. the files on disk. It produces the same result as running `git diff` on the command line. The exception is realtime updating: in this case the plugin diffs the (unsaved) buffer contents against the version in git.
|
With one exception the plugin diffs your saved buffers, i.e. the files on disk. It produces the same result as running `git diff` on the command line. The exception is realtime updating: in this case the plugin diffs the (unsaved) buffer contents against the version in git.
|
||||||
|
|
||||||
|
|
||||||
|
#### Activation
|
||||||
|
|
||||||
You can explicitly turn vim-gitgutter off and on (defaults to on):
|
You can explicitly turn vim-gitgutter off and on (defaults to on):
|
||||||
|
|
||||||
* turn off with `:GitGutterDisable`
|
* turn off with `:GitGutterDisable`
|
||||||
* turn on with `:GitGutterEnable`
|
* turn on with `:GitGutterEnable`
|
||||||
* toggle with `:GitGutterToggle`.
|
* toggle with `:GitGutterToggle`.
|
||||||
|
|
||||||
|
You can turn the signs on and off (defaults to on):
|
||||||
|
|
||||||
|
* turn on with `:GitGutterSignsEnable`
|
||||||
|
* turn off with `:GitGutterSignsDisable`
|
||||||
|
* toggle with `:GitGutterSignsToggle`.
|
||||||
|
|
||||||
And you can turn line highlighting on and off (defaults to off):
|
And you can turn line highlighting on and off (defaults to off):
|
||||||
|
|
||||||
* turn on with `:GitGutterLineHighlightsEnable`
|
* turn on with `:GitGutterLineHighlightsEnable`
|
||||||
* turn off with `:GitGutterLineHighlightsDisable`
|
* turn off with `:GitGutterLineHighlightsDisable`
|
||||||
* toggle with `:GitGutterLineHighlightsToggle`.
|
* toggle with `:GitGutterLineHighlightsToggle`.
|
||||||
|
|
||||||
|
|
||||||
|
#### Hunks
|
||||||
|
|
||||||
Furthermore you can jump between hunks:
|
Furthermore you can jump between hunks:
|
||||||
|
|
||||||
* jump to next hunk (change): `]c`
|
* jump to next hunk (change): `]c`
|
||||||
@@ -177,13 +189,6 @@ let g:gitgutter_sign_removed = 'zz'
|
|||||||
let g:gitgutter_sign_modified_removed = 'ww'
|
let g:gitgutter_sign_modified_removed = 'ww'
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Whether or not signs are shown
|
|
||||||
|
|
||||||
If you never want signs to be shown (presumably you only want the line highlights), add this to your `~/.vimrc`:
|
|
||||||
|
|
||||||
```viml
|
|
||||||
let g:gitgutter_signs = 0
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Line highlights
|
#### Line highlights
|
||||||
|
|
||||||
@@ -228,6 +233,11 @@ let g:gitgutter_escape_grep = 1
|
|||||||
Add `let g:gitgutter_enabled = 0` to your `~/.vimrc`.
|
Add `let g:gitgutter_enabled = 0` to your `~/.vimrc`.
|
||||||
|
|
||||||
|
|
||||||
|
#### To turn off signs by default
|
||||||
|
|
||||||
|
Add `let g:gitgutter_signs = 0` to your `~/.vimrc`.
|
||||||
|
|
||||||
|
|
||||||
#### To turn on line highlighting by default
|
#### To turn on line highlighting by default
|
||||||
|
|
||||||
Add `let g:gitgutter_highlight_lines = 1` to your `~/.vimrc`.
|
Add `let g:gitgutter_highlight_lines = 1` to your `~/.vimrc`.
|
||||||
|
|||||||
@@ -28,10 +28,8 @@ function! highlight#define_signs()
|
|||||||
sign define GitGutterLineModifiedRemoved
|
sign define GitGutterLineModifiedRemoved
|
||||||
sign define GitGutterDummy
|
sign define GitGutterDummy
|
||||||
|
|
||||||
if g:gitgutter_signs
|
|
||||||
call highlight#define_sign_symbols()
|
call highlight#define_sign_symbols()
|
||||||
call highlight#define_sign_text_highlights()
|
call highlight#define_sign_text_highlights()
|
||||||
endif
|
|
||||||
call highlight#define_sign_line_highlights()
|
call highlight#define_sign_line_highlights()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,17 @@ Commands for turning Git Gutter on and off:
|
|||||||
:GitGutterAll *:GitGutterAll*
|
:GitGutterAll *:GitGutterAll*
|
||||||
Update signs across all buffers.
|
Update signs across all buffers.
|
||||||
|
|
||||||
|
Commands for turning signs on and off (defaults to on):
|
||||||
|
|
||||||
|
:GitGutterSignsEnable *:GitGutterSignsEnable*
|
||||||
|
Explicitly turn line signs on.
|
||||||
|
|
||||||
|
:GitGutterSignsDisable *:GitGutterSignsDisable*
|
||||||
|
Explicitly turn line signs off.
|
||||||
|
|
||||||
|
:GitGutterSignsToggle *:GitGutterSignsToggle*
|
||||||
|
Explicitly turn line signs on if it was off and vice versa.
|
||||||
|
|
||||||
Commands for turning line highlighting on and off (defaults to off):
|
Commands for turning line highlighting on and off (defaults to off):
|
||||||
|
|
||||||
:GitGutterLineHighlightsEnable *:GitGutterLineHighlightsEnable*
|
:GitGutterLineHighlightsEnable *:GitGutterLineHighlightsEnable*
|
||||||
@@ -165,13 +176,6 @@ To customise the symbols, add the following to your |vimrc|:
|
|||||||
let g:gitgutter_sign_modified_removed = 'ww'
|
let g:gitgutter_sign_modified_removed = 'ww'
|
||||||
<
|
<
|
||||||
|
|
||||||
SIGNS
|
|
||||||
|
|
||||||
To never show signs, use this:
|
|
||||||
>
|
|
||||||
let g:gitgutter_signs = 0
|
|
||||||
<
|
|
||||||
|
|
||||||
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
|
||||||
@@ -223,6 +227,13 @@ Add to your |vimrc|
|
|||||||
let g:gitgutter_enabled = 0
|
let g:gitgutter_enabled = 0
|
||||||
<
|
<
|
||||||
|
|
||||||
|
TO TURN OFF SIGNS BY DEFAULT
|
||||||
|
|
||||||
|
Add to your |vimrc|
|
||||||
|
>
|
||||||
|
let g:gitgutter_signs = 0
|
||||||
|
<
|
||||||
|
|
||||||
TO TURN ON LINE HIGHLIGHTING BY DEFAULT
|
TO TURN ON LINE HIGHLIGHTING BY DEFAULT
|
||||||
|
|
||||||
Add to your |vimrc|
|
Add to your |vimrc|
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ function! GitGutter(file, realtime)
|
|||||||
let s:hunks = diff#parse_diff(diff)
|
let s:hunks = diff#parse_diff(diff)
|
||||||
let modified_lines = diff#process_hunks(s:hunks)
|
let modified_lines = diff#process_hunks(s:hunks)
|
||||||
|
|
||||||
|
if g:gitgutter_signs
|
||||||
if g:gitgutter_sign_column_always
|
if g:gitgutter_sign_column_always
|
||||||
call sign#add_dummy_sign()
|
call sign#add_dummy_sign()
|
||||||
else
|
else
|
||||||
@@ -70,6 +71,7 @@ function! GitGutter(file, realtime)
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
call sign#update_signs(a:file, modified_lines)
|
call sign#update_signs(a:file, modified_lines)
|
||||||
|
endif
|
||||||
|
|
||||||
call utility#save_last_seen_change(a:file)
|
call utility#save_last_seen_change(a:file)
|
||||||
endif
|
endif
|
||||||
@@ -133,6 +135,38 @@ function! GitGutterNextHunk(count)
|
|||||||
if hunk_count == a:count
|
if hunk_count == a:count
|
||||||
execute 'normal!' hunk[2] . 'G'
|
execute 'normal!' hunk[2] . 'G'
|
||||||
break
|
break
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
|
||||||
|
" Signs: enable / disable / toggle {{{
|
||||||
|
|
||||||
|
function! GitGutterSignsEnable()
|
||||||
|
let g:gitgutter_signs = 1
|
||||||
|
call GitGutterAll()
|
||||||
|
endfunction
|
||||||
|
command GitGutterSignsEnable call GitGutterSignsEnable()
|
||||||
|
|
||||||
|
function! GitGutterSignsDisable()
|
||||||
|
let g:gitgutter_signs = 0
|
||||||
|
call sign#clear_signs(utility#file())
|
||||||
|
call sign#remove_dummy_sign()
|
||||||
|
endfunction
|
||||||
|
command GitGutterSignsDisable call GitGutterSignsDisable()
|
||||||
|
|
||||||
|
function! GitGutterSignsToggle()
|
||||||
|
if g:gitgutter_signs
|
||||||
|
call GitGutterSignsDisable()
|
||||||
|
else
|
||||||
|
call GitGutterSignsEnable()
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
command GitGutterSignsToggle call GitGutterSignsToggle()
|
||||||
|
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
|
||||||
|
" Hunks: jump to next/previous {{{
|
||||||
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|||||||
Reference in New Issue
Block a user