plugins.gitsigns.settings
Options provided to the require('gitsigns').setup function.
Type: open submodule of attribute set of lua value
Default:
{ }
Example:
{
current_line_blame = false;
current_line_blame_opts = {
virt_text = true;
virt_text_pos = "eol";
};
signcolumn = true;
signs = {
add = {
text = "│";
};
change = {
text = "│";
};
changedelete = {
text = "~";
};
delete = {
text = "_";
};
topdelete = {
text = "‾";
};
untracked = {
text = "┆";
};
};
watch_gitdir = {
follow_files = true;
};
}
Declared by:
plugins.gitsigns.settings.on_attach
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:
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
Type: null or lua code string
Default:
null
Declared by:
plugins.gitsigns.settings.status_formatter
Function used to format b:gitsigns_status.
Type: null or lua function string
Default:
null
Plugin default:
''
function(status)
local added, changed, removed = status.added, status.changed, status.removed
local status_txt = {}
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
return table.concat(status_txt, ' ')
end
''
Declared by: