de297820bc
References #141.
389 lines
14 KiB
Plaintext
389 lines
14 KiB
Plaintext
*signify.txt* Indicate changed lines within a file using a VCS.
|
|
*signify*
|
|
___
|
|
__ __ /'___\
|
|
____/\_\ __ ___ /\_\/\ \__/ __ __
|
|
/',__\/\ \ /'_ `\ /' _ `\/\ \ \ ,__\/\ \/\ \
|
|
/\__, `\ \ \/\ \L\ \/\ \/\ \ \ \ \ \_/\ \ \_\ \
|
|
\/\____/\ \_\ \____ \ \_\ \_\ \_\ \_\ \/`____ \
|
|
\/___/ \/_/\/___L\ \/_/\/_/\/_/\/_/ `/___/> \
|
|
/\____/ /\___/
|
|
\_/__/ \/__/
|
|
|
|
by Marco Hinz~
|
|
|
|
Twitter: https://twitter.com/_mhinz_
|
|
Github: http://github.com/mhinz
|
|
IRC: mhi^ (Freenode)
|
|
>
|
|
If you use any of my plugins, please star them on github. It's a great way
|
|
of getting feedback and gives me the kick to put more time into their
|
|
development.
|
|
|
|
If you encounter any bugs or have feature requests, just open an issue
|
|
report on Github.
|
|
|
|
Thank you for flying mhi^ airlines. Get the Vim on!
|
|
<
|
|
==============================================================================
|
|
TOC *signify-contents*
|
|
|
|
INTRO .......................... |signify-intro|
|
|
USAGE .......................... |signify-usage|
|
|
OPTIONS ........................ |signify-options|
|
|
COMMANDS ....................... |signify-commands|
|
|
MAPPINGS ....................... |signify-mappings|
|
|
FUNCTIONS ...................... |signify-functions|
|
|
OBJECTS ........................ |signify-objects|
|
|
COLORS ......................... |signify-colors|
|
|
|
|
==============================================================================
|
|
INTRO *signify-intro*
|
|
|
|
Signify (or just Sy) is a quite unobtrusive plugin. It uses signs to indicate
|
|
added, modified and removed lines based on data of an underlying version
|
|
control system.
|
|
|
|
==============================================================================
|
|
USAGE *signify-usage*
|
|
|
|
The usage is pretty straight-forward. By default you should only notice a
|
|
difference, if you're working in a directory that is managed by a supported
|
|
version control system and the current file was changed since the last commit.
|
|
|
|
Supported VCS:~
|
|
>
|
|
git
|
|
mercurial
|
|
darcs
|
|
bzr
|
|
subversion
|
|
cvs
|
|
rcs
|
|
fossil
|
|
accurev
|
|
perforce
|
|
<
|
|
Sign explanation:~
|
|
|
|
`+` This line was added.
|
|
|
|
`!` This line was modified.
|
|
|
|
`_1` The number of deleted lines below this sign. If the number is larger
|
|
`99` than 9, the `_` will be omitted. For numbers larger than 99, `_>`
|
|
`_>` will be shown instead.
|
|
|
|
`!1` This line was modified and a number of lines below were deleted.
|
|
`!>` It is a combination of `!` and `_`. If the number is larger than 9,
|
|
`!>` will be shown instead.
|
|
|
|
`‾` The first line was removed. It's a special case of the `_` sign.
|
|
|
|
==============================================================================
|
|
OPTIONS *signify-options*
|
|
|
|
Put these variables into your vimrc. The provided examples also indicate the
|
|
default values, as long as no "Default:" section is given.
|
|
|
|
All available options:~
|
|
|
|
|g:signify_vcs_list|
|
|
|g:signify_disable_by_default|
|
|
|g:signify_mapping_next_hunk|
|
|
|g:signify_mapping_prev_hunk|
|
|
|g:signify_mapping_toggle_highlight|
|
|
|g:signify_mapping_toggle|
|
|
|g:signify_skip_filetype|
|
|
|g:signify_skip_filename|
|
|
|g:signify_update_on_bufenter|
|
|
|g:signify_update_on_focusgained|
|
|
|g:signify_line_highlight|
|
|
|g:signify_sign_add|
|
|
|g:signify_sign_delete|
|
|
|g:signify_sign_delete_first_line|
|
|
|g:signify_sign_change|
|
|
|g:signify_sign_changedelete|
|
|
|g:signify_sign_show_count|
|
|
|g:signify_cursorhold_normal|
|
|
|g:signify_cursorhold_insert|
|
|
|g:signify_difftool|
|
|
|g:signify_diffoptions|
|
|
|
|
------------------------------------------------------------------------------
|
|
*g:signify_vcs_list*
|
|
>
|
|
let g:signify_vcs_list = [ 'git', 'hg' ]
|
|
<
|
|
Default: empty
|
|
Possible values: 'accurev'
|
|
'bzr'
|
|
'cvs'
|
|
'darcs'
|
|
'fossil'
|
|
'git'
|
|
'hg'
|
|
'perforce'
|
|
'rcs'
|
|
'svn'
|
|
|
|
NOTE: This is the most important option, so read closely.
|
|
|
|
It determines the VCS to check for and in what order. If you only use git and
|
|
mercurial, you can shorten the list to the shown example. If you use mostly
|
|
mercurial and only sometimes git, put 'hg' in the front of the list. It's
|
|
basically a priority list.
|
|
|
|
This can improve buffer loading time since by default all supported and
|
|
installed VCS will be checked for, so you are advised to change this option to
|
|
your needs. (This only happens once at the first time the signs get updated.
|
|
Afterwards, the VCS will be remembered anyway.)
|
|
|
|
NOTE: Some VCS rely on a an external diff tool to work properly (svn, darcs,
|
|
bzr, fossil), thus you have to make sure that Vim can find a valid diff tool.
|
|
So either the one you set through |g:signify_difftool| or "diff" by default.
|
|
|
|
NOTE: If you don't set this option and Sy is activated, updating signs for a
|
|
non-VCS file can lead to significant delay since all supported and installed
|
|
VCS will be tested for.
|
|
|
|
------------------------------------------------------------------------------
|
|
*g:signify_disable_by_default*
|
|
>
|
|
let g:signify_disable_by_default = 0
|
|
<
|
|
Don't run Sy by default. You can toggle it anytime via :SignifyToggle.
|
|
|
|
------------------------------------------------------------------------------
|
|
*g:signify_mapping_next_hunk*
|
|
*g:signify_mapping_prev_hunk*
|
|
>
|
|
let g:signify_mapping_next_hunk = '<leader>gj'
|
|
let g:signify_mapping_prev_hunk = '<leader>gk'
|
|
<
|
|
Mapping for jumping to the start of the next or previous hunk.
|
|
|
|
Alternatively, you can also map it yourself:
|
|
>
|
|
nmap <leader>gj <plug>(signify-next-hunk)
|
|
nmap <leader>gk <plug>(signify-prev-hunk)
|
|
<
|
|
There is no difference between both variants.
|
|
|
|
NOTE: Analog to Vim's diff mode, you can also use |]c| and |[c| for jumping
|
|
between hunks.
|
|
|
|
------------------------------------------------------------------------------
|
|
*g:signify_mapping_toggle_highlight*
|
|
>
|
|
let g:signify_mapping_toggle_highlight = '<leader>gh'
|
|
<
|
|
Mapping for toggling line highlighting for lines containing changes.
|
|
|
|
------------------------------------------------------------------------------
|
|
*g:signify_mapping_toggle*
|
|
>
|
|
let g:signify_mapping_toggle = '<leader>gt'
|
|
<
|
|
Mapping for toggling the plugin for the current buffer only.
|
|
|
|
------------------------------------------------------------------------------
|
|
*g:signify_skip_filetype*
|
|
*g:signify_skip_filename*
|
|
>
|
|
let g:signify_skip_filetype = { 'vim': 1, 'c': 1 }
|
|
let g:signify_skip_filename = { '/home/user/.vimrc': 1 }
|
|
<
|
|
Don't activate the plugin for these filetypes and/or filenames.
|
|
|
|
NOTE: Filenames have to be absolute paths.
|
|
|
|
Default: Both are empty.
|
|
|
|
------------------------------------------------------------------------------
|
|
*g:signify_update_on_bufenter*
|
|
>
|
|
let g:signify_update_on_bufenter = 0
|
|
<
|
|
Update signs when entering a buffer that was modified.
|
|
|
|
NOTE: This also saves the buffer to disk!
|
|
|
|
------------------------------------------------------------------------------
|
|
*g:signify_update_on_focusgained*
|
|
>
|
|
let g:signify_update_on_focusgained = 0
|
|
<
|
|
Update signs when Vim gains focus.
|
|
|
|
------------------------------------------------------------------------------
|
|
*g:signify_line_highlight*
|
|
>
|
|
let g:signify_line_highlight = 0
|
|
<
|
|
Enable line highlighting in addition to using signs by default.
|
|
|
|
------------------------------------------------------------------------------
|
|
*g:signify_sign_add*
|
|
*g:signify_sign_delete*
|
|
*g:signify_sign_delete_first_line*
|
|
*g:signify_sign_change*
|
|
*g:signify_sign_changedelete*
|
|
>
|
|
let g:signify_sign_add = '+'
|
|
let g:signify_sign_delete = '_'
|
|
let g:signify_sign_delete_first_line = '‾'
|
|
let g:signify_sign_change = '!'
|
|
let g:signify_sign_changedelete = g:signify_sign_change
|
|
<
|
|
The sign to use if a line was added, deleted or changed or a combination of
|
|
these.
|
|
|
|
NOTE: You can use unicode characters.
|
|
|
|
NOTE: You can use up to 2 characters for the signs with two exceptions that
|
|
happen in combination with |g:signify_sign_show_count| set:
|
|
|
|
1) |g:signify_sign_delete| uses only 1 character and truncates while the count
|
|
increases.
|
|
|
|
2) |g:signify_sign_changedelete| uses only 1 character and truncates if
|
|
necessary.
|
|
|
|
------------------------------------------------------------------------------
|
|
*g:signify_sign_show_count*
|
|
>
|
|
let g:signify_sign_show_count = 1
|
|
<
|
|
Add the number of deleted lines to |g:signify_sign_delete| (up to 99) and
|
|
|g:signify_sign_changedelete| (up to 9). Otherwise only the normal signs will
|
|
be shown.
|
|
|
|
------------------------------------------------------------------------------
|
|
*g:signify_cursorhold_normal*
|
|
*g:signify_cursorhold_insert*
|
|
>
|
|
let g:signify_cursorhold_normal = 0
|
|
let g:signify_cursorhold_insert = 0
|
|
<
|
|
Additionally trigger sign updates in normal or insert mode after 'updatetime'
|
|
miliseconds without any keypresses. This fires only once between keypresses,
|
|
thus not every 'updatetime' miliseconds.
|
|
|
|
NOTE: This also saves the buffer to disk!
|
|
|
|
------------------------------------------------------------------------------
|
|
*g:signify_difftool*
|
|
>
|
|
let g:signify_difftool = 'gnudiff'
|
|
<
|
|
This will avoid the attempt to find the proper diff tool for version control
|
|
systems that rely on an external diff tool that supports the -U0 flag. These
|
|
are: svn, bzr, darcs, fossil.
|
|
|
|
Default: "diff"
|
|
|
|
------------------------------------------------------------------------------
|
|
*g:signify_diffoptions*
|
|
>
|
|
let g:signify_diffoptions = { 'git': '-w', 'hg': '-w' }
|
|
<
|
|
This will pass the given additional options to the selected VCS diff command.
|
|
|
|
Default: Does not exist.
|
|
|
|
==============================================================================
|
|
COMMAND *signify-commands*
|
|
MAPPINGS *signify-mappings*
|
|
>
|
|
:SignifyToggle
|
|
<
|
|
Toggle the plugin for the current buffer only.
|
|
Default mapping: <leader>gt
|
|
|
|
------------------------------------------------------------------------------
|
|
>
|
|
:SignifyToggleHighlight
|
|
<
|
|
Toggle line highlighting for lines containing changes.
|
|
Default mapping: <leader>gh
|
|
|
|
==============================================================================
|
|
FUNCTIONS *signify-functions*
|
|
|
|
Signify exposes some functions which you can use to customize its behavior.
|
|
|
|
------------------------------------------------------------------------------
|
|
*signify-#refresh_windows()*
|
|
|
|
This function updates signs for all windows. For example, to update signs when
|
|
Vim loses focus, you use:
|
|
>
|
|
autocmd FocusLost * call sy#util#refresh_windows()
|
|
<
|
|
==============================================================================
|
|
OBJECTS *signify-objects*
|
|
|
|
Sy also provides text objects that operate on the current hunk:
|
|
>
|
|
ic
|
|
>
|
|
Operate on all the lines of the current hunk.
|
|
>
|
|
ac
|
|
<
|
|
Does the same as ic and also removes all trailing empty lines.
|
|
|
|
NOTE: Don't be surprised that this also works with "deleted lines".
|
|
|
|
Map hunk text objects like this:
|
|
>
|
|
omap ic <plug>(signify-motion-inner-pending)
|
|
xmap ic <plug>(signify-motion-inner-visual)
|
|
omap ac <plug>(signify-motion-outer-pending)
|
|
xmap ac <plug>(signify-motion-outer-visual)
|
|
<
|
|
==============================================================================
|
|
COLORS *signify-colors*
|
|
|
|
This plugin defines highlighting groups for two different places: for lines
|
|
and signs. Per default these don't really exist but are linked to the standard
|
|
highlighting groups: DiffAdd, DiffChange, DiffDelete:
|
|
>
|
|
highlight link SignifyLineAdd DiffAdd
|
|
highlight link SignifyLineChange DiffChange
|
|
highlight link SignifyLineDelete DiffDelete
|
|
highlight link SignifyLineChangeDelete SignifyLineChange
|
|
highlight link SignifyLineDeleteFirstLine SignifyLineDelete
|
|
|
|
highlight link SignifySignAdd DiffAdd
|
|
highlight link SignifySignChange DiffChange
|
|
highlight link SignifySignDelete DiffDelete
|
|
highlight link SignifySignChangeDelete SignifySignChange
|
|
highlight link SignifySignDeleteFirstLine SignifySignDelete
|
|
<
|
|
Thus if you do not want to change the standard highlighting groups, but want
|
|
different colors for either your signs or lines, you can define one of these 6
|
|
Signify groups yourself in your vimrc.
|
|
|
|
Personally I use (256 colors terminal):
|
|
>
|
|
" highlight lines in Sy and vimdiff etc.)
|
|
|
|
highlight DiffAdd cterm=bold ctermbg=none ctermfg=119
|
|
highlight DiffDelete cterm=bold ctermbg=none ctermfg=167
|
|
highlight DiffChange cterm=bold ctermbg=none ctermfg=227
|
|
|
|
" highlight signs in Sy
|
|
|
|
highlight SignifySignAdd cterm=bold ctermbg=237 ctermfg=119
|
|
highlight SignifySignDelete cterm=bold ctermbg=237 ctermfg=167
|
|
highlight SignifySignChange cterm=bold ctermbg=237 ctermfg=227
|
|
<
|
|
For Unix people there is a small script, showcolors.bash, in the repo that
|
|
shows all 256 colors available to the terminal. That makes picking the right
|
|
numbers much easier.
|
|
|
|
==============================================================================
|
|
vim: tw=78
|