2020-11-14 19:24:18 +00:00
|
|
|
*gitsigns.txt* Gitsigns
|
|
|
|
*gitsigns.nvim*
|
|
|
|
|
|
|
|
Author: Lewis Russell <lewis6991@gmail.com>
|
2021-05-27 13:17:45 +00:00
|
|
|
Version: 0.1-dev
|
2020-11-14 19:24:18 +00:00
|
|
|
Homepage: <https://github.com/lewis6991/gitsigns.nvim>
|
|
|
|
License: MIT license
|
|
|
|
|
|
|
|
==============================================================================
|
|
|
|
INTRODUCTION *gitsigns*
|
|
|
|
|
|
|
|
Gitsigns is a plugin for Neovim that provides integration with Git via a
|
|
|
|
feature set which includes (but not limited to):
|
|
|
|
• Provides signs in the |signcolumn| to show changed/added/removed lines.
|
|
|
|
• Mappings to operate on hunks to stage, undo or reset against Git's index.
|
|
|
|
|
|
|
|
Gitsigns is implemented entirely in Lua which is built into Neovim and because
|
|
|
|
of this requires no external dependencies. This is unlike other plugins that
|
|
|
|
require python, node, etc, which need to communicate with Neovim using |RPC|.
|
2021-05-01 10:02:07 +00:00
|
|
|
By default, Gitsigns also uses Neovim's built-in diff library and runs
|
|
|
|
in-process via LuaJIT's FFI module. This is unlike other similar plugins that
|
|
|
|
need to run `git-diff` as an external process which is less efficient, has
|
|
|
|
tighter bottlenecks and requires file IO.
|
2020-11-14 19:24:18 +00:00
|
|
|
|
|
|
|
==============================================================================
|
|
|
|
USAGE *gitsigns-usage*
|
|
|
|
|
|
|
|
For basic setup with all batteries included:
|
|
|
|
>
|
|
|
|
require('gitsigns').setup()
|
|
|
|
<
|
|
|
|
|
2021-05-01 10:02:07 +00:00
|
|
|
Configuration can be passed to the setup function. Here is an example with most
|
|
|
|
of the default settings:
|
2020-11-14 19:24:18 +00:00
|
|
|
>
|
|
|
|
require('gitsigns').setup {
|
|
|
|
signs = {
|
2021-05-01 10:02:07 +00:00
|
|
|
add = {hl = 'GitSignsAdd' , text = '│', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'},
|
|
|
|
change = {hl = 'GitSignsChange', text = '│', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'},
|
|
|
|
delete = {hl = 'GitSignsDelete', text = '_', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'},
|
|
|
|
topdelete = {hl = 'GitSignsDelete', text = '‾', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'},
|
|
|
|
changedelete = {hl = 'GitSignsChange', text = '~', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'},
|
2020-11-14 19:24:18 +00:00
|
|
|
},
|
2020-11-22 16:06:06 +00:00
|
|
|
numhl = false,
|
2021-05-01 10:02:07 +00:00
|
|
|
linehl = false,
|
2020-11-14 19:24:18 +00:00
|
|
|
keymaps = {
|
|
|
|
-- Default keymap options
|
|
|
|
noremap = true,
|
|
|
|
buffer = true,
|
|
|
|
|
|
|
|
['n ]c'] = { expr = true, "&diff ? ']c' : '<cmd>lua require\"gitsigns\".next_hunk()<CR>'"},
|
|
|
|
['n [c'] = { expr = true, "&diff ? '[c' : '<cmd>lua require\"gitsigns\".prev_hunk()<CR>'"},
|
|
|
|
|
|
|
|
['n <leader>hs'] = '<cmd>lua require"gitsigns".stage_hunk()<CR>',
|
2021-05-05 23:52:54 +00:00
|
|
|
['v <leader>hs'] = '<cmd>lua require"gitsigns".stage_hunk({vim.fn.line("."), vim.fn.line("v")})<CR>',
|
2020-11-14 19:24:18 +00:00
|
|
|
['n <leader>hu'] = '<cmd>lua require"gitsigns".undo_stage_hunk()<CR>',
|
|
|
|
['n <leader>hr'] = '<cmd>lua require"gitsigns".reset_hunk()<CR>',
|
2021-05-05 23:52:54 +00:00
|
|
|
['v <leader>hr'] = '<cmd>lua require"gitsigns".reset_hunk({vim.fn.line("."), vim.fn.line("v")})<CR>',
|
2021-05-01 10:02:07 +00:00
|
|
|
['n <leader>hR'] = '<cmd>lua require"gitsigns".reset_buffer()<CR>',
|
2020-11-14 19:24:18 +00:00
|
|
|
['n <leader>hp'] = '<cmd>lua require"gitsigns".preview_hunk()<CR>',
|
2021-05-05 18:18:18 +00:00
|
|
|
['n <leader>hb'] = '<cmd>lua require"gitsigns".blame_line(true)<CR>',
|
2021-05-01 10:02:07 +00:00
|
|
|
|
|
|
|
-- Text objects
|
|
|
|
['o ih'] = ':<C-U>lua require"gitsigns".select_hunk()<CR>',
|
|
|
|
['x ih'] = ':<C-U>lua require"gitsigns".select_hunk()<CR>'
|
2020-11-14 19:24:18 +00:00
|
|
|
},
|
|
|
|
watch_index = {
|
|
|
|
interval = 1000
|
|
|
|
},
|
2021-05-01 10:02:07 +00:00
|
|
|
current_line_blame = false,
|
2020-11-16 23:10:47 +00:00
|
|
|
sign_priority = 6,
|
2021-05-01 10:02:07 +00:00
|
|
|
update_debounce = 100,
|
|
|
|
status_formatter = nil, -- Use default
|
|
|
|
use_decoration_api = true,
|
|
|
|
use_internal_diff = true, -- If luajit is present
|
2020-11-14 19:24:18 +00:00
|
|
|
}
|
|
|
|
<
|
|
|
|
|
|
|
|
==============================================================================
|
|
|
|
MAPPINGS *gitsigns-mappings*
|
|
|
|
|
|
|
|
All mappings are configurable via |gitsigns-setup()|.
|
|
|
|
|
|
|
|
Most actions can be repeated with `.` if you have |vim-repeat| installed.
|
|
|
|
|
|
|
|
Buffer ~
|
|
|
|
]c Jump to the next hunk.
|
|
|
|
[c Jump to the previous hunk.
|
|
|
|
<leader>hs Stage the hunk at the cursor position.
|
|
|
|
<leader>hu Undo the last stage hunk.
|
|
|
|
<leader>hr Reset the lines of the hunk to what is in Git's index.
|
|
|
|
<leader>hp Preview the hunk in a floating window.
|
|
|
|
|
|
|
|
Custom mappings are defined using the `keymaps` table in the config table
|
2020-12-14 22:30:13 +00:00
|
|
|
passed to |gitsigns-setup()|. See |gitsigns-config-keymaps|.
|
2020-11-14 19:24:18 +00:00
|
|
|
|
|
|
|
==============================================================================
|
|
|
|
FUNCTIONS *gitsigns-functions*
|
|
|
|
|
|
|
|
setup({config}) *gitsigns.setup()*
|
|
|
|
Setup and start Gitsigns.
|
|
|
|
|
|
|
|
Parameters: ~
|
|
|
|
{config} Table object containing configuration for
|
|
|
|
Gitsigns. See |gitsigns-usage| for more details.
|
|
|
|
|
2020-12-22 13:35:56 +00:00
|
|
|
next_hunk({opts}) *gitsigns.next_hunk()*
|
2020-11-14 19:24:18 +00:00
|
|
|
Jump to the next hunk in the current buffer. Respects
|
|
|
|
|wrapscan|.
|
|
|
|
|
2020-12-22 13:35:56 +00:00
|
|
|
Parameters: ~
|
|
|
|
{opts} table|nil Configuration table. Keys:
|
|
|
|
• {wrap}: (boolean)
|
|
|
|
Whether to loop around file or not. Defaults
|
|
|
|
to the value 'wrapscan'
|
|
|
|
|
|
|
|
prev_hunk({opts}) *gitsigns.prev_hunk()*
|
2020-11-14 19:24:18 +00:00
|
|
|
Jump to the previous hunk in the current buffer. Respects
|
|
|
|
|wrapscan|.
|
|
|
|
|
2020-12-22 13:35:56 +00:00
|
|
|
Parameters: ~
|
|
|
|
{opts} table|nil Configuration table. Keys:
|
|
|
|
• {wrap}: (boolean)
|
|
|
|
Whether to loop around file or not. Defaults
|
|
|
|
to the value 'wrapscan'
|
|
|
|
|
2021-05-05 23:52:54 +00:00
|
|
|
stage_hunk({range}) *gitsigns.stage_hunk()*
|
|
|
|
Stage the hunk at the cursor position, or all hunks in the
|
|
|
|
given range. If {range} is provided, all hunks that intersect
|
|
|
|
with the given range are staged.
|
|
|
|
|
|
|
|
Parameters:~
|
|
|
|
{range} table|nil List-like table of two integers making
|
|
|
|
up the line range from which you want to stage the hunks.
|
2020-11-14 19:24:18 +00:00
|
|
|
|
|
|
|
undo_stage_hunk() *gitsigns.undo_stage_hunk()*
|
|
|
|
Undo the last call of stage_hunk(). Note: only the calls to
|
|
|
|
stage_hunk() performed in the current session can be undone.
|
|
|
|
|
2021-05-02 09:08:02 +00:00
|
|
|
stage_buffer() *gitsigns.stage_buffer()*
|
2021-04-05 11:02:49 +00:00
|
|
|
Stage all hunks in current buffer.
|
|
|
|
|
2021-05-02 09:08:02 +00:00
|
|
|
reset_buffer_index() *gitsigns.reset_buffer_index()*
|
|
|
|
Unstage all hunks for current buffer in the index. Note:
|
|
|
|
Unlike |gitsigns.undo_stage_hunk()| this doesn't simply undo
|
|
|
|
stages, this runs an `git reset` on current buffers file.
|
2021-04-05 11:02:49 +00:00
|
|
|
|
2021-05-05 23:52:54 +00:00
|
|
|
reset_hunk({range}) *gitsigns.reset_hunk()*
|
|
|
|
Reset the lines of the hunk at the cursor position, or all
|
|
|
|
hunks in the given range, to what it is in Git's index. If
|
|
|
|
{range} is provided, all hunks that intersect with the given
|
|
|
|
range are reset.
|
|
|
|
|
|
|
|
Parameters:~
|
|
|
|
{range} table|nil List-like table of two integers making
|
|
|
|
up the line range from which you want to reset the hunks.
|
2020-11-14 19:24:18 +00:00
|
|
|
|
2021-03-11 00:01:52 +00:00
|
|
|
reset_buffer() *gitsigns.reset_buffer()*
|
|
|
|
Reset the lines of all hunks in the buffer.
|
|
|
|
|
2020-11-14 19:24:18 +00:00
|
|
|
preview_hunk() *gitsigns.preview_hunk()*
|
|
|
|
Preview the hunk at the cursor position in a floating
|
|
|
|
window.
|
|
|
|
|
2021-05-05 18:18:18 +00:00
|
|
|
blame_line({full}) *gitsigns.blame_line()*
|
2020-12-06 21:28:58 +00:00
|
|
|
Run git blame on the current line and show the results in a
|
2021-05-05 18:18:18 +00:00
|
|
|
floating window. If {full} is true then the full commit
|
|
|
|
message is displayed instead of just the one-line summary.
|
2020-12-06 21:28:58 +00:00
|
|
|
|
2021-05-06 10:16:26 +00:00
|
|
|
change_base({base}) *gitsigns.change_base()*
|
|
|
|
Change the base revision to diff against. If {base} is not
|
|
|
|
given, then the original base is used.
|
|
|
|
|
|
|
|
Examples: >
|
|
|
|
" Change base to 1 commit behind head
|
|
|
|
:lua require('gitsigns').change_base('HEAD~1')
|
|
|
|
|
|
|
|
" Also works using the Gitsigns command
|
|
|
|
:Gitsigns change_base HEAD~1
|
|
|
|
|
|
|
|
" Other variations
|
|
|
|
:Gitsigns change_base ~1
|
|
|
|
:Gitsigns change_base ~
|
|
|
|
:Gitsigns change_base ^
|
|
|
|
|
|
|
|
" Commits work too
|
|
|
|
:Gitsigns change_base 92eb3dd
|
|
|
|
|
|
|
|
" Revert to original base
|
|
|
|
:Gitsigns change_base
|
|
|
|
<
|
2021-06-23 13:25:20 +00:00
|
|
|
|
|
|
|
For a more complete list of ways to specify bases, see
|
|
|
|
|gitsigns-revision|.
|
|
|
|
|
2021-05-27 13:17:45 +00:00
|
|
|
diffthis({base}) *gitsigns.diffthis()*
|
|
|
|
Perform a |vimdiff| on the given file with {base} if it is
|
|
|
|
given, or with the currently set base (index by default).
|
|
|
|
|
|
|
|
Examples: >
|
|
|
|
" Diff against the index
|
|
|
|
:Gitsigns diffthis
|
|
|
|
|
|
|
|
" Diff against the last commit
|
|
|
|
:Gitsigns diffthis ~1
|
2021-06-23 13:25:20 +00:00
|
|
|
<
|
|
|
|
|
|
|
|
For a more complete list of ways to specify bases, see
|
|
|
|
|gitsigns-revision|.
|
2021-05-29 10:44:49 +00:00
|
|
|
>
|
|
|
|
get_actions() *gitsigns.get_actions()*
|
|
|
|
Get all the available line specific actions for the current
|
|
|
|
buffer at the cursor position. Returns a map of action name to
|
|
|
|
function.
|
2021-05-06 10:16:26 +00:00
|
|
|
|
2020-11-14 19:24:18 +00:00
|
|
|
attach() *gitsigns.attach()*
|
|
|
|
Attach Gitsigns to the current buffer.
|
|
|
|
|
2021-02-13 20:43:47 +00:00
|
|
|
detach({bufnr}) *gitsigns.detach()*
|
|
|
|
Detach Gitsigns from the buffer {bufnr}. If {bufnr} is not
|
|
|
|
provided then the current buffer is used.
|
|
|
|
|
|
|
|
Parameters: ~
|
|
|
|
{bufnr} (number): Buffer number
|
|
|
|
|
2020-11-14 19:24:18 +00:00
|
|
|
detach_all() *gitsigns.detach_all()*
|
|
|
|
Detach Gitsigns from all buffers it is attached to.
|
|
|
|
|
2021-03-23 10:42:46 +00:00
|
|
|
refresh() *gitsigns.refresh()*
|
|
|
|
Refresh all buffers.
|
|
|
|
|
2021-03-25 14:47:33 +00:00
|
|
|
select_hunk() *gitsigns.select_hunk()*
|
2021-01-31 10:41:36 +00:00
|
|
|
Select the hunk under the cursor.
|
|
|
|
|
2021-03-17 21:46:25 +00:00
|
|
|
toggle_signs() *gitsigns.toggle_signs()*
|
2021-03-17 11:01:57 +00:00
|
|
|
Toggle |gitsigns-config-signcolumn|
|
|
|
|
|
|
|
|
toggle_numhl() *gitsigns.toggle_numhl()*
|
|
|
|
Toggle |gitsigns-config-numhl|
|
|
|
|
|
|
|
|
toggle_linehl() *gitsigns.toggle_linehl()*
|
|
|
|
Toggle |gitsigns-config-linehl|
|
|
|
|
|
2021-03-31 11:46:28 +00:00
|
|
|
toggle_current_line_blame() *gitsigns.toggle_current_line_blame()*
|
|
|
|
Toggle |gitsigns-config-current_line_blame|
|
|
|
|
|
2020-11-22 16:06:06 +00:00
|
|
|
==============================================================================
|
|
|
|
CONFIGURATION *gitsigns-config*
|
|
|
|
|
2021-05-30 14:46:40 +00:00
|
|
|
This section describes the configuration fields which can be passed to
|
|
|
|
|gitsigns.setup()|. Note fields of type `table` may be marked with extended
|
|
|
|
meaning the field is merged with the default, with the user value given higher
|
|
|
|
precedence. This allows only specific sub-fields to be configured without
|
|
|
|
having to redefine the whole field.
|
|
|
|
|
2020-12-14 22:30:13 +00:00
|
|
|
signs *gitsigns-config-signs*
|
2021-05-30 14:46:40 +00:00
|
|
|
Type: `table[extended]`
|
2021-05-02 09:08:02 +00:00
|
|
|
Default: >
|
2020-12-20 23:45:36 +00:00
|
|
|
{
|
2021-03-13 11:47:35 +00:00
|
|
|
add = {hl = 'GitSignsAdd' , text = '│', numhl='GitSignsAddNr' , linehl='GitSignsAddLn' },
|
|
|
|
change = {hl = 'GitSignsChange', text = '│', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn' },
|
|
|
|
delete = {hl = 'GitSignsDelete', text = '_', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn' },
|
|
|
|
topdelete = {hl = 'GitSignsDelete', text = '‾', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn' },
|
|
|
|
changedelete = {hl = 'GitSignsChange', text = '~', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn' },
|
2020-12-20 23:45:36 +00:00
|
|
|
}
|
2020-12-14 22:30:13 +00:00
|
|
|
<
|
2021-05-02 09:08:02 +00:00
|
|
|
Configuration for signs:
|
|
|
|
• `hl` specifies the highlight group to use for the sign.
|
|
|
|
• `text` specifies the character to use for the sign.
|
|
|
|
• `numhl` specifies the highlight group to use for the number column
|
|
|
|
(see |gitsigns-config.numhl|).
|
|
|
|
• `linehl` specifies the highlight group to use for the line
|
|
|
|
(see |gitsigns-config.linehl|).
|
|
|
|
• `show_count` to enable showing count of hunk, e.g. number of deleted
|
|
|
|
lines.
|
|
|
|
|
|
|
|
Note if `hl`, `numhl` or `linehl` use a `GitSigns*` highlight and it is
|
|
|
|
not defined, it will be automatically derived by searching for other
|
|
|
|
defined highlights in the following order:
|
|
|
|
• `GitGutter*`
|
|
|
|
• `Signify*`
|
|
|
|
• `Diff*`
|
|
|
|
|
|
|
|
For example if `signs.add.hl = GitSignsAdd` and `GitSignsAdd` is not
|
|
|
|
defined but `GitGutterAdd` is defined, then `GitSignsAdd` will be linked
|
|
|
|
to `GitGutterAdd`.
|
2021-03-13 11:47:35 +00:00
|
|
|
|
2020-12-14 22:30:13 +00:00
|
|
|
keymaps *gitsigns-config-keymaps*
|
2021-05-02 09:08:02 +00:00
|
|
|
Type: `table`
|
|
|
|
Default: >
|
2020-12-14 22:30:13 +00:00
|
|
|
{
|
|
|
|
-- Default keymap options
|
|
|
|
noremap = true,
|
|
|
|
|
|
|
|
['n ]c'] = { expr = true, "&diff ? ']c' : '<cmd>lua require\"gitsigns\".next_hunk()<CR>'"},
|
|
|
|
['n [c'] = { expr = true, "&diff ? '[c' : '<cmd>lua require\"gitsigns\".prev_hunk()<CR>'"},
|
|
|
|
|
|
|
|
['n <leader>hs'] = '<cmd>lua require"gitsigns".stage_hunk()<CR>',
|
2021-05-05 23:52:54 +00:00
|
|
|
['v <leader>hs'] = '<cmd>lua require"gitsigns".stage_hunk({vim.fn.line("."), vim.fn.line("v")})<CR>',
|
2020-12-14 22:30:13 +00:00
|
|
|
['n <leader>hu'] = '<cmd>lua require"gitsigns".undo_stage_hunk()<CR>',
|
|
|
|
['n <leader>hr'] = '<cmd>lua require"gitsigns".reset_hunk()<CR>',
|
2021-05-05 23:52:54 +00:00
|
|
|
['v <leader>hr'] = '<cmd>lua require"gitsigns".reset_hunk({vim.fn.line("."), vim.fn.line("v")})<CR>',
|
2021-03-11 00:01:52 +00:00
|
|
|
['n <leader>hR'] = '<cmd>lua require"gitsigns".reset_buffer()<CR>',
|
2020-12-14 22:30:13 +00:00
|
|
|
['n <leader>hp'] = '<cmd>lua require"gitsigns".preview_hunk()<CR>',
|
2021-05-05 18:18:18 +00:00
|
|
|
['n <leader>hb'] = '<cmd>lua require"gitsigns".blame_line(true)<CR>',
|
2021-04-05 11:02:49 +00:00
|
|
|
['n <leader>hS'] = '<cmd>lua require"gitsigns".stage_buffer()<CR>',
|
|
|
|
['n <leader>hU'] = '<cmd>lua require"gitsigns".reset_buffer_index()<CR>',
|
2021-01-16 15:32:55 +00:00
|
|
|
|
2021-03-25 14:47:33 +00:00
|
|
|
['o ih'] = ':<C-U>lua require"gitsigns".select_hunk()<CR>',
|
|
|
|
['x ih'] = ':<C-U>lua require"gitsigns".select_hunk()<CR>'
|
2020-12-14 22:30:13 +00:00
|
|
|
}
|
|
|
|
<
|
2021-05-02 09:08:02 +00:00
|
|
|
Keymaps to set up when attaching to a buffer.
|
2020-12-14 22:30:13 +00:00
|
|
|
|
2021-05-02 09:08:02 +00:00
|
|
|
Each key in the table defines the mode and key (whitespace delimited)
|
|
|
|
for the mapping and the value defines what the key maps to. The value
|
|
|
|
can be a table which can contain keys matching the options defined in
|
|
|
|
|map-arguments| which are: `expr`, `noremap`, `nowait`, `script`,
|
|
|
|
`silent`, `unique` and `buffer`. These options can also be used in
|
|
|
|
the top level of the table to define default options for all mappings.
|
2020-12-14 22:30:13 +00:00
|
|
|
|
2021-05-30 14:46:40 +00:00
|
|
|
Since this field is not extended (unlike |gitsigns-config-signs|),
|
|
|
|
mappings defined in this field can be disabled by setting the whole field
|
|
|
|
to `{}`, and |gitsigns-config-on_attach| can instead be used to define
|
|
|
|
mappings.
|
|
|
|
|
|
|
|
on_attach *gitsigns-config-on_attach*
|
|
|
|
Type: `function`, Default: `nil`
|
|
|
|
|
|
|
|
Callback called when attaching to a buffer. Mainly used to setup keymaps
|
|
|
|
when `config.keymaps` is empty. The buffer number is passed as the first
|
|
|
|
argument.
|
|
|
|
|
|
|
|
This callback can return `false` to prevent attaching to the buffer.
|
|
|
|
|
|
|
|
Example: >
|
|
|
|
on_attach = function(bufnr)
|
|
|
|
if vim.api.nvim_buf_get_name(bufnr):match(<PATTERN>) then
|
|
|
|
-- Don't attach to specific buffers whose name matches a pattern
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Setup keymaps
|
|
|
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'hs', '<cmd>lua require"gitsigns".stage_hunk()<CR>', {})
|
|
|
|
... -- More keymaps
|
|
|
|
end
|
|
|
|
<
|
|
|
|
|
2020-12-14 22:30:13 +00:00
|
|
|
watch_index *gitsigns-config-watch_index*
|
2021-06-25 15:47:17 +00:00
|
|
|
Type: `table`
|
|
|
|
Default: >
|
|
|
|
{
|
|
|
|
interval = 1000,
|
|
|
|
follow_files = true
|
|
|
|
}
|
|
|
|
<
|
2021-05-02 09:08:02 +00:00
|
|
|
When opening a file, a libuv watcher is placed on the respective
|
|
|
|
`.git/index` file to detect when changes happen to use as a trigger to
|
|
|
|
update signs.
|
2020-12-14 22:30:13 +00:00
|
|
|
|
2021-06-25 15:47:17 +00:00
|
|
|
Fields:
|
|
|
|
• `interval`:
|
|
|
|
Interval the watcher waits between polls of `.git/index` is milliseconds.
|
|
|
|
|
|
|
|
• `follow_files`:
|
|
|
|
If a file is moved with `git mv`, switch the buffer to the new location.
|
|
|
|
|
2020-12-14 22:30:13 +00:00
|
|
|
sign_priority *gitsigns-config-sign_priority*
|
2021-05-02 09:08:02 +00:00
|
|
|
Type: `number`, Default: `6`
|
2020-12-14 22:30:13 +00:00
|
|
|
|
2021-05-02 09:08:02 +00:00
|
|
|
Priority to use for signs.
|
2020-12-14 22:30:13 +00:00
|
|
|
|
2021-03-17 11:01:57 +00:00
|
|
|
signcolumn *gitsigns-config-signcolumn*
|
2021-05-02 09:08:02 +00:00
|
|
|
Type: `boolean`, Default: `true`
|
2021-03-17 11:01:57 +00:00
|
|
|
|
2021-05-02 09:08:02 +00:00
|
|
|
Enable/disable symbols in the sign column.
|
2021-03-17 11:01:57 +00:00
|
|
|
|
2021-05-02 09:08:02 +00:00
|
|
|
When enabled the highlights defined in `signs.*.hl` and symbols defined
|
|
|
|
in `signs.*.text` are used.
|
2021-03-17 11:01:57 +00:00
|
|
|
|
2020-11-22 16:06:06 +00:00
|
|
|
numhl *gitsigns-config-numhl*
|
2021-05-02 09:08:02 +00:00
|
|
|
Type: `boolean`, Default: `false`
|
2020-12-14 22:30:13 +00:00
|
|
|
|
2021-05-02 09:08:02 +00:00
|
|
|
Enable/disable line number highlights.
|
2020-11-22 16:06:06 +00:00
|
|
|
|
2021-05-02 09:08:02 +00:00
|
|
|
When enabled the highlights defined in `signs.*.numhl` are used. If
|
|
|
|
the highlight group does not exist, then it is automatically defined
|
|
|
|
and linked to the corresponding highlight group in `signs.*.hl`.
|
2020-12-14 22:30:13 +00:00
|
|
|
|
2021-03-04 22:56:53 +00:00
|
|
|
linehl *gitsigns-config-linehl*
|
2021-05-02 09:08:02 +00:00
|
|
|
Type: `boolean`, Default: `false`
|
2021-03-04 22:56:53 +00:00
|
|
|
|
2021-05-02 09:08:02 +00:00
|
|
|
Enable/disable line highlights.
|
2021-03-04 22:56:53 +00:00
|
|
|
|
2021-05-02 09:08:02 +00:00
|
|
|
When enabled the highlights defined in `signs.*.linehl` are used. If
|
|
|
|
the highlight group does not exist, then it is automatically defined
|
|
|
|
and linked to the corresponding highlight group in `signs.*.hl`.
|
2021-03-04 22:56:53 +00:00
|
|
|
|
2020-12-14 22:30:13 +00:00
|
|
|
diff_algorithm *gitsigns-config-diff_algorithm*
|
2021-05-02 09:08:02 +00:00
|
|
|
Type: `string`, Default: taken from 'diffopt'
|
2020-12-14 22:30:13 +00:00
|
|
|
|
2021-05-02 09:08:02 +00:00
|
|
|
Diff algorithm to pass to `git diff` .
|
2020-12-14 22:30:13 +00:00
|
|
|
|
|
|
|
count_chars *gitsigns-config-count_chars*
|
2021-05-02 09:08:02 +00:00
|
|
|
Type: `table`
|
|
|
|
Default: >
|
|
|
|
{
|
|
|
|
[1] = '1', -- '₁',
|
|
|
|
[2] = '2', -- '₂',
|
|
|
|
[3] = '3', -- '₃',
|
|
|
|
[4] = '4', -- '₄',
|
|
|
|
[5] = '5', -- '₅',
|
|
|
|
[6] = '6', -- '₆',
|
|
|
|
[7] = '7', -- '₇',
|
|
|
|
[8] = '8', -- '₈',
|
|
|
|
[9] = '9', -- '₉',
|
|
|
|
['+'] = '>', -- '₊',
|
2020-12-20 23:45:36 +00:00
|
|
|
}
|
2020-12-14 22:30:13 +00:00
|
|
|
<
|
2021-05-02 09:08:02 +00:00
|
|
|
The count characters used when `signs.*.show_count` is enabled. The
|
|
|
|
`+` entry is used as a fallback. With the default, any count outside
|
|
|
|
of 1-9 uses the `>` character in the sign.
|
2020-12-14 22:30:13 +00:00
|
|
|
|
2021-05-02 09:08:02 +00:00
|
|
|
Possible use cases for this field:
|
|
|
|
• to specify unicode characters for the counts instead of 1-9.
|
|
|
|
• to define characters to be used for counts greater than 9.
|
2020-12-14 22:30:13 +00:00
|
|
|
|
|
|
|
status_formatter *gitsigns-config-status_formatter*
|
2021-05-02 09:08:02 +00:00
|
|
|
Type: `function`
|
|
|
|
Default: >
|
2020-12-20 23:45:36 +00:00
|
|
|
function(status)
|
|
|
|
local added, changed, removed = status.added, status.changed, status.removed
|
|
|
|
local status_txt = {}
|
2021-01-16 15:32:55 +00:00
|
|
|
if added and added > 0 then table.insert(status_txt, '+'..added ) end
|
|
|
|
if changed and changed > 0 then table.insert(status_txt, '~'..changed) end
|
|
|
|
if removed and removed > 0 then table.insert(status_txt, '-'..removed) end
|
2020-12-20 23:45:36 +00:00
|
|
|
return table.concat(status_txt, ' ')
|
|
|
|
end
|
2020-12-14 22:30:13 +00:00
|
|
|
<
|
2021-05-02 09:08:02 +00:00
|
|
|
Function used to format `b:gitsigns_status`.
|
2020-11-22 16:06:06 +00:00
|
|
|
|
2021-02-27 11:12:39 +00:00
|
|
|
max_file_length *gitsigns-config-max_file_length*
|
2021-05-02 09:08:02 +00:00
|
|
|
Type: `number`, Default: `40000`
|
2021-02-27 11:12:39 +00:00
|
|
|
|
|
|
|
Max file length to attach to.
|
|
|
|
|
2021-04-24 15:48:01 +00:00
|
|
|
preview_config *gitsigns-config-preview_config*
|
2021-05-30 14:46:40 +00:00
|
|
|
Type: `table[extended]`
|
2021-05-03 10:09:35 +00:00
|
|
|
Default: >
|
|
|
|
{
|
|
|
|
border = 'single',
|
|
|
|
style = 'minimal',
|
|
|
|
relative = 'cursor',
|
|
|
|
row = 0,
|
|
|
|
col = 1
|
|
|
|
}
|
|
|
|
<
|
2021-04-24 15:48:01 +00:00
|
|
|
Option overrides for the Gitsigns preview window. Table is passed directly
|
|
|
|
to `nvim_open_win`.
|
|
|
|
|
2021-04-24 15:59:51 +00:00
|
|
|
attach_to_untracked *gitsigns-config-attach_to_untracked*
|
2021-05-02 09:08:02 +00:00
|
|
|
Type: `boolean`, Default: `true`
|
2021-04-24 15:59:51 +00:00
|
|
|
|
|
|
|
Attach to untracked files.
|
|
|
|
|
2021-03-04 20:32:53 +00:00
|
|
|
update_debounce *gitsigns-config-update_debounce*
|
2021-05-02 09:08:02 +00:00
|
|
|
Type: `number`, Default: `100`
|
2021-03-04 20:32:53 +00:00
|
|
|
|
|
|
|
Debounce time for updates (in milliseconds).
|
|
|
|
|
2021-03-14 19:29:20 +00:00
|
|
|
use_internal_diff *gitsigns-config-use_internal_diff*
|
2021-05-02 09:08:02 +00:00
|
|
|
Type: `boolean`, Default: `true` if luajit is present (windows unsupported)
|
2021-03-14 19:29:20 +00:00
|
|
|
|
2021-05-02 09:08:02 +00:00
|
|
|
Use Neovim's built in xdiff library for running diffs.
|
2021-02-27 19:55:22 +00:00
|
|
|
|
2021-05-02 09:08:02 +00:00
|
|
|
This uses LuaJIT's FFI interface.
|
2021-03-14 19:29:20 +00:00
|
|
|
|
|
|
|
use_decoration_api *gitsigns-config-use_decoration_api*
|
2021-05-02 09:08:02 +00:00
|
|
|
Type: `boolean`, Default: `true`
|
2021-02-27 19:55:22 +00:00
|
|
|
|
2021-05-02 09:08:02 +00:00
|
|
|
Use Neovim's decoration API to apply signs. This should improve
|
|
|
|
performance on large files since signs will only be applied to drawn
|
|
|
|
lines as opposed to all lines in the buffer.
|
2021-02-27 19:55:22 +00:00
|
|
|
|
2021-03-31 11:46:28 +00:00
|
|
|
current_line_blame *gitsigns-config-current_line_blame*
|
2021-05-02 09:08:02 +00:00
|
|
|
Type: `boolean`, Default: `false`
|
2021-03-31 11:46:28 +00:00
|
|
|
|
2021-05-02 09:08:02 +00:00
|
|
|
Adds an unobtrusive and customisable blame annotation at the end of
|
|
|
|
the current line.
|
2021-03-31 11:46:28 +00:00
|
|
|
|
2021-05-02 09:08:02 +00:00
|
|
|
The highlight group used for the text is `GitSignsCurrentLineBlame`.
|
2021-03-31 11:46:28 +00:00
|
|
|
|
2021-06-06 00:47:08 +00:00
|
|
|
current_line_blame_position *gitsigns-config-current_line_blame_position*
|
|
|
|
Type: `string`, Default: `"eol"`
|
|
|
|
|
|
|
|
Blame annotation position. Available options:
|
|
|
|
- eol: right after eol character (default).
|
|
|
|
- overlay: display over the specified column, without shifting the underlying text.
|
|
|
|
- right_align: display right aligned in the window.
|
|
|
|
|
2021-03-31 11:46:28 +00:00
|
|
|
current_line_blame_formatter *gitsigns-config-current_line_blame_formatter*
|
2021-05-02 09:08:02 +00:00
|
|
|
Type: `function`
|
|
|
|
Default: >
|
2021-03-31 11:46:28 +00:00
|
|
|
function(name, blame_info)
|
|
|
|
if blame_info.author == name then
|
|
|
|
blame_info.author = 'You'
|
|
|
|
end
|
|
|
|
|
|
|
|
local text
|
|
|
|
if blame_info.author == 'Not Committed Yet' then
|
|
|
|
text = blame_info.author
|
|
|
|
else
|
|
|
|
text = string.format(
|
|
|
|
'%s, %s - %s',
|
|
|
|
blame_info.author,
|
|
|
|
os.date('%Y-%m-%d', tonumber(blame_info['author_time'])),
|
|
|
|
blame_info.summary
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
return {{' '..text, 'GitSignsCurrentLineBlame'}}
|
|
|
|
end
|
|
|
|
<
|
2021-05-02 09:08:02 +00:00
|
|
|
Function used to format the virtual text of
|
|
|
|
|gitsigns-config-current_line_blame|. The first argument {name} is the
|
|
|
|
git user name returned from: >
|
|
|
|
git config user.name
|
2021-03-31 11:46:28 +00:00
|
|
|
<
|
2021-05-02 09:08:02 +00:00
|
|
|
The second argument {blame_info} is a table with the following keys:
|
|
|
|
- abbrev_sha: string
|
|
|
|
- orig_lnum: integer
|
|
|
|
- final_lnum: integer
|
|
|
|
- author: string
|
|
|
|
- author_mail: string
|
|
|
|
- author_time: integer
|
|
|
|
- author_tz: string
|
|
|
|
- committer: string
|
|
|
|
- committer_mail: string
|
|
|
|
- committer_time: integer
|
|
|
|
- committer_tz: string
|
|
|
|
- summary: string
|
|
|
|
- previous: string
|
|
|
|
- filename: string
|
|
|
|
|
|
|
|
Note that the keys map onto the output of: >
|
|
|
|
git blame --line-porcelain
|
2021-03-31 11:46:28 +00:00
|
|
|
<
|
|
|
|
|
2021-06-10 00:45:52 +00:00
|
|
|
current_line_blame_delay *gitsigns-config-current_line_blame_delay*
|
|
|
|
Type: `number`, Default: `1000`
|
|
|
|
|
|
|
|
Sets the delay before blame virtual text is displayed in milliseconds.
|
|
|
|
|
2021-04-10 14:42:54 +00:00
|
|
|
yadm *gitsigns-config-yadm*
|
2021-05-30 14:46:40 +00:00
|
|
|
Type: `table`, Default: `{ enable = false }`
|
2021-05-02 09:08:02 +00:00
|
|
|
|
|
|
|
yadm configuration.
|
2021-04-10 14:42:54 +00:00
|
|
|
|
2021-06-25 16:08:01 +00:00
|
|
|
word_diff *gitsigns-config-word_diff*
|
|
|
|
Type: `boolean`, Default: `false`
|
|
|
|
|
|
|
|
Highlight intra-line word differences in the buffer.
|
|
|
|
|
|
|
|
Uses the highlights:
|
|
|
|
• GitSignsAddLn
|
|
|
|
• GitSignsChangeLn
|
|
|
|
• GitSignsDeleteLn
|
|
|
|
|
2020-12-14 22:30:13 +00:00
|
|
|
debug_mode *gitsigns-config-debug_mode*
|
2021-05-02 09:08:02 +00:00
|
|
|
Type: `boolean`, Default: `false`
|
2020-11-22 16:06:06 +00:00
|
|
|
|
2021-05-02 09:08:02 +00:00
|
|
|
Print diagnostic messages.
|
2020-11-22 16:06:06 +00:00
|
|
|
|
2021-06-23 13:25:20 +00:00
|
|
|
==============================================================================
|
|
|
|
COMMAND *gitsigns-command*
|
|
|
|
|
|
|
|
*:Gitsigns*
|
|
|
|
:Gitsigns {subcmd} {args} Run a Gitsigns commands. {subcmd} can be any
|
|
|
|
function documented in |gitsigns-functions|.
|
|
|
|
{args} are processed as |<f-args>|.
|
|
|
|
|
|
|
|
Note this command is equivalent to:
|
|
|
|
`:lua require('gitsigns').{subcmd}({args})`
|
|
|
|
|
|
|
|
Examples: >
|
|
|
|
:Gitsigns diffthis HEAD~1
|
|
|
|
:Gitsigns blame_line
|
|
|
|
:Gitsigns toggle_signs
|
|
|
|
:Gitsigns toggle_current_line_blame
|
|
|
|
:Gitsigns change_base ~
|
|
|
|
:Gitsigns reset_buffer
|
|
|
|
|
|
|
|
==============================================================================
|
|
|
|
SPECIFYING OBJECTS *gitsigns-object* *gitsigns-revision*
|
|
|
|
|
|
|
|
Gitsigns objects are Git revisions as defined in the
|
|
|
|
"SPECIFYING REVISIONS" section in the gitrevisions(7) man page. For commands that accept an
|
|
|
|
optional base, the default is the file in the index. Examples:
|
|
|
|
|
|
|
|
Object Meaning ~
|
|
|
|
@ Version of file in the commit referenced by @ aka HEAD
|
|
|
|
main Version of file in the commit referenced by main
|
|
|
|
main^ Version of file in the parent of the commit referenced by main
|
|
|
|
main~ "
|
|
|
|
main~1 "
|
|
|
|
main...other Version of file in the merge base of main and other
|
|
|
|
@^ Version of file in the parent of HEAD
|
|
|
|
@~2 Version of file in the grandparent of HEAD
|
|
|
|
92eb3dd Version of file in the commit 92eb3dd
|
|
|
|
:1 The file's common ancestor during a conflict
|
|
|
|
:2 The alternate file in the target branch during a conflict
|
|
|
|
|
|
|
|
==============================================================================
|
|
|
|
STATUSLINE *gitsigns-statusline*
|
|
|
|
|
|
|
|
*b:gitsigns_status* *b:gitsigns_status_dict*
|
|
|
|
The buffer variables `b:gitsigns_status` and `b:gitsigns_status_dict` are
|
|
|
|
provided. `b:gitsigns_status` is formatted using `config.status_formatter`
|
|
|
|
. `b:gitsigns_status_dict` is a dictionary with the keys `added`, `removed`,
|
|
|
|
`changed` and `head`.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
>
|
|
|
|
set statusline+=%{get(b:,'gitsigns_status','')}
|
|
|
|
<
|
|
|
|
*b:gitsigns_head*
|
|
|
|
Use `b:gitsigns_head` to return the name of the current branch. If the current
|
|
|
|
HEAD is detached then this will be an empty string.
|
|
|
|
|
|
|
|
==============================================================================
|
|
|
|
TEXT OBJECTS *gitsigns-textobject*
|
|
|
|
|
|
|
|
Since text objects are defined via keymaps, these are exposed and configurable
|
|
|
|
via the config, see |gitsigns-config-keymaps|. The lua implementation is
|
|
|
|
exposed through |gitsigns.select_hunk()|.
|
|
|
|
|
|
|
|
------------------------------------------------------------------------------
|
|
|
|
vim:tw=78:ts=8:ft=help:norl:
|