lewis6991 / gitsigns.nvim Goto Github PK
View Code? Open in Web Editor NEWGit integration for buffers
License: MIT License
Git integration for buffers
License: MIT License
One thing I like about https://github.com/mhinz/vim-signify is that the sign for deletion also indicates the number of lines, as in
Would this be possible for gitsigns as well (optionally, at least)?
I tried to disable the default keymaps by setting keymaps = {}
but this doesn't seem to work, unfortunately.
I checked the place, where the configuration is being applied and it seems like there is actually no way to disable the bindings:
if cfg.keymaps and not vim.tbl_isempty(cfg.keymaps) then
default_config.keymaps = {}
end
Would be awesome, if you could provide a way (setting to {}
, nil
or false
) to disable the bindings.
Everything else seem to work great, thank you for your hard work! ๐
Today while browsing node_modules folder I noticed an error when opening files within the folder. I gave it a bit more test and figured out that Plenary's Job is failing when you open a file that is part of wildignore
. Not sure if I should open up the issue there, but gitsigns causes the initial error so that's why I opened it here.
This init.vim should reproduce it:
lua require('gitsigns').setup()
"Add some nested folder to wildignore. In my case, I tried with snippets that are part of my dotfiles
set wildignore+=*nvim/snippets*
:edit nvim/snippets/javascript.json
or whatever the file name isError executing vim.schedule lua callback: ...vim/pack/packager/start/plenary.nvim/lua/plenary/job.lua:358: Failed to spawn process: {
... some lua table here
}
stack traceback:
...vim/pack/packager/start/plenary.nvim/lua/plenary/job.lua:358: in function '_execute'
...vim/pack/packager/start/plenary.nvim/lua/plenary/job.lua:401: in function 'start'
.../nvim/pack/packager/start/gitsigns.nvim/lua/gitsigns.lua:84: in function 'run_job'
.../nvim/pack/packager/start/gitsigns.nvim/lua/gitsigns.lua:197: in function 'ret'
...pack/packager/start/gitsigns.nvim/lua/gitsigns/async.lua:28: in function 'step'
...pack/packager/start/gitsigns.nvim/lua/gitsigns/async.lua:31: in function 'cb'
vim.lua:236: in function <vim.lua:236>
I'm fine with just ignoring the gitsigns for these files, there's no need to do any status for them since they are part of the ignore anyway.
Edit:
This works for me, not sure if it will slow down everything:
diff --git a/lua/gitsigns.lua b/lua/gitsigns.lua
index 087b17e..b8ef5b8 100644
--- a/lua/gitsigns.lua
+++ b/lua/gitsigns.lua
@@ -81,6 +81,10 @@ local function run_job(job_spec)
local cmd = job_spec.command..' '..table.concat(job_spec.args, ' ')
dprint('Running: '..cmd)
end
+ if job_spec.cwd then
+ local cwd = vim.fn.expand(job_spec.cwd)
+ if not cwd or cwd == '' then return end
+ end
Job:new(job_spec):start()
job_cnt = job_cnt + 1
end
When switching git branches using vim-fugitive
or lazygit.nvim
I get a series of errors. When just switching branch I get the aforementioned /lua/gitsigns.lua:663: attempt to index local 'bcache' (a nil value)
. However when opening the lazygit
terminal floating window I get
I can't tell if it's trying to perform git operations on this invalid buffer somehow, it just generally really seems to react very badly to opening that plugin window, but ignores others like FZF so could be git
related or could be some buffer attribute of lazygit isn't set up properly
I recently opened a file that had 99000 lines inside, and this made it really slow and stopped me from exiting the file and providing input before it was finished loading and showing the signs. I didn't know if I should mark this as a feature request or a bug since, I know it's a really big file, and that of course will slow it down. But I was hoping that there was something that could be done to handle this.
I was thinking either have an option like gitgutter so that the signs will not load if the file has more than a certain amount of lines. Or make the signs load in the background so I am able to do things while they are loading. Either of these fixes would be really appreciated!
Error executing vim.schedule lua callback: ...ack/packer/start/gitsigns.nvim/lua/gitsigns/debounce.lua:12: bad argument #1 to 'start' (number expected, got nil)
The most recent commit gives this error on loading any file.
neovim version: NVIM v0.5.0-789-gca7449db4
Commit f519122
also seems to introduce an extra new line git diff marker on buffers which do not have any change.
Hey,
installed with (version 3581f2d):
use {
'lewis6991/gitsigns.nvim',
branch = 'main',
config = [[require('gitsigns').setup()]
}
and getting
E5108: Error executing lua ...im/site/pack/packer/start/gitsigns.nvim/lua/gitsigns.lua:717: attempt to index local 'cfg' (a nil value)
on startup.
Same happens without config
key and initialised with :lua require('gitsigns').setup()
.
BTW, 5d3f324 might be irrelevant due to wbthomason/packer.nvim@a68b21b.
using nvim v0.5.0-dev+1007-g9223d1450 / git-signs master on archlinux
I use packer.nvim and i call git-signs.setup with no config option, in the config
parameter of packer use function.
When i open a file in a repository containing changes, i've noticed the git signs will replace the line numbers. It happens if i have either signcolumn=yes set or not in my init.lua file.
If you set signcolumn=yes
, the signs will properly be displayed in the signcolumn and the relative numbers will reappear.
Thanks to work on this, i'm not familiar with the codebase but if you point me in the right direction i will fix it :)
Describe the bug
Not sure if this is user error (which it could be), but recently updated and now I'm no longer getting signs printed in my signcolum
To Reproduce
init.vim:
let $PLUGIN_DIRECTORY = '~/.config/nvim/bundle'
lua << EOF
use {"nvim-lua/plenary.nvim"}
use {
"lewis6991/gitsigns.nvim",
config = function()
require "gitsigns".setup {
signs = {
add = {hl = 'DiffAdd' , text = 'โ', numhl='GitSignsAddNr'},
change = {hl = 'DiffChange', text = 'โ', numhl='GitSignsChangeNr'},
delete = {hl = 'DiffDelete', text = '_', numhl='GitSignsDeleteNr'},
topdelete = {hl = 'DiffDelete', text = 'โพ', numhl='GitSignsDeleteNr'},
changedelete = {hl = 'DiffChange', text = '~', numhl='GitSignsChangeNr'},
}
}
end
}
EOF
Steps to reproduce the behavior:
Observed output
No error messages are printed, it just fails silently
Additional context
System: Mac, Linux, Windows: macOS 11.2
Neovim version:
NVIM v0.5.0-dev+1065-g94cf7bba0
Build type: Debug
LuaJIT 2.1.0-beta3
Describe the bug
On Windows after a98df15 the plugin doesn't work.
To Reproduce
Just install plugin and run Neovim, you will see the following error:
...im\pack\plugins\opt\gitsigns.nvim\lua\gitsigns\async.lua:53: ...vim\pack\plugins\opt\gitsigns.nvim\lua\gitsigns\diff.lua:130: cannot resolve symbol 'xdl_diff'.
Observed output
Error messages, logs, etc
Screenshots
If applicable, add screenshots to help explain your problem or to capture error messages.
Additional context
System: Windows
Neovim version: gf5daf55c1 (latest master at the time of writing).
Hello,
When I try to open the changed file directly (nvim path/to/file
), it doesn't show any git signs. When I open Neovim without any arguments and then open file (:e path/to/file
), everything works fine.
Here are some basic details about my setup:
" init.vim
autocmd VimEnter * lua require'init'
--init.lua
require'gitsigns'.setup({
signs = {
add = {hl = 'diffAdded', text = 'โ'},
change = {hl = 'diffRemoved', text = 'โ'},
delete = {hl = 'diffRemoved', text = '_'},
topdelete = {hl = 'diffRemoved', text = 'โพ'},
changedelete = {hl = 'diffRemoved', text = '~'},
},
})
It's probably just an initialization issue.
Describe the bug
Opening a file in a git project that has never been committed will result in an error
If ./git/index
does not exist, an error will occur.
To Reproduce
init.vim:
let $PLUGIN_DIRECTORY = '~/.config/nvim/.plugged'
set runtimepath^=$PLUGIN_DIRECTORY/plenary.nvim
set runtimepath^=$PLUGIN_DIRECTORY/gitsigns.nvim
lua << EOF
require('gitsigns').setup {
-- config
}
EOF
Steps to reproduce the behavior:
$ mkdir sample_proj && cd $_ && git init
$ touch file.vim
$ nvim -u ~/tmp/init.vim -i NONE file.vim
Observed output
Error messages, logs, etc
Error executing luv callback:
...onfig/nvim/.plugged/gitsigns.nvim/lua/gitsigns/async.lua:21: ...324/.config/nvim/.plugged/gitsigns.nvim/lua/gitsigns.lua:328: Cannot find index file: /home/tamago324/tmp/sample_proj/.git/index
Screenshots
If applicable, add screenshots to help explain your problem or to capture error messages.
Additional context
System: Linux
Neovim version: v0.5.0-dev+1012-gfe1ebea33
Is there any reason the default branch is called main
and not master
? I'm not sure about other package managers but packer.nvim seems to look for the master
branch which is not available in this repository if you run PackerUpdate
.
I fixed it for now by specifying the default branch via:
use {
"lewis6991/gitsigns.nvim",
branch = "main",
requires = {
"nvim-lua/plenary.nvim"
}
}
Maybe this is a packer.nvim issue though and other package mangers are handling it "better".
Describe the bug
The signs column is not displayed.
To Reproduce
vim.cmd 'packadd paq-nvim' -- Load Paq
local paq = require('paq-nvim').paq -- Import Paq
-- paq { 'junegunn/vim-easy-align' } -- Provide mappings to align stuff
paq { 'lewis6991/gitsigns.nvim' } --
paq { 'nvim-lua/plenary.nvim' }
-- paq { 'lifepillar/vim-gruvbox8' } -- Add a beautiful theme
paq { 'savq/paq-nvim', opt=true } -- Let Paq manage itself
require('gitsigns').setup {
signs = {
add = {hl = 'DiffAdd' , text = 'โ', numhl='GitSignsAddNr'},
change = {hl = 'DiffChange', text = 'โ', numhl='GitSignsChangeNr'},
delete = {hl = 'DiffDelete', text = '_', numhl='GitSignsDeleteNr'},
topdelete = {hl = 'DiffDelete', text = 'โพ', numhl='GitSignsDeleteNr'},
changedelete = {hl = 'DiffChange', text = '~', numhl='GitSignsChangeNr'},
},
numhl = false,
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>',
['n <leader>hu'] = '<cmd>lua require"gitsigns".undo_stage_hunk()<CR>',
['n <leader>hr'] = '<cmd>lua require"gitsigns".reset_hunk()<CR>',
['n <leader>hp'] = '<cmd>lua require"gitsigns".preview_hunk()<CR>',
['n <leader>hb'] = '<cmd>lua require"gitsigns".blame_line()<CR>',
-- Text objects
['o ih'] = ':<C-U>lua require"gitsigns".text_object()<CR>',
['x ih'] = ':<C-U>lua require"gitsigns".text_object()<CR>'
},
watch_index = {
interval = 1000
},
sign_priority = 6,
status_formatter = nil, -- Use default
}
Steps to reproduce the behavior:
No.
Observed output
No.
Screenshots
Additional context
Nom du systรจme dโexploitation: Microsoft Windows 10 Entreprise LTSC
Version du systรจme: 10.0.17763 N/A build 17763
Describe the bug
Pull request #73 (58544f1) is causing this error for me:
Error executing vim.schedule lua callback: ...e/pack/packer/start/gitsigns.nvim/lua/gitsigns/async.lua:53: ...im/site/pack/packer/start/gitsigns.nvim/lua/gitsigns.lua:126: In
valid buffer id: 2
To Reproduce
To Stop the Bug
use {
'lewis6991/gitsigns.nvim', -- Git signs in the signcolumn
commit = '63ba88fa4bcc96c2d5844050cfc460acc3496069',
config = function() require('gitsigns').setup() end,
requires = {'nvim-lua/plenary.nvim'},
}
init.lua:
utils = require('utils')
---------------------------------- Paths ----------------------------------- {{{
cmd 'set runtimepath+=~/.config/nvim'
cmd 'set runtimepath+=~/.config/nvim/lua'
cmd 'set runtimepath+=~/.config/nvim/after'
cmd 'set runtimepath+=~/.local/share/nvim/site'
cmd 'set runtimepath+=~/.local/share/nvim/site/after'
cmd 'set packpath+=~/.config/nvim'
cmd 'set packpath+=~/.config/nvim/after'
cmd 'set packpath+=~/.local/share/nvim/site'
cmd 'set packpath+=~/.local/share/nvim/site/after'
---------------------------------------------------------------------------- }}}
-- Require Lua files
require('plugins')
require('settings')
require('functions')
-- Set the appearance
colorschemes = {
light = 'onehalflight',
dark = 'onedark'
}
SetTheme('dark')
plugins/init.lua:
---------------------------------- INSTALL --------------------------------- {{{
local install_path = fn.stdpath('data') .. '/site/pack/packer/opt/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
cmd ('!git clone https://github.com/wbthomason/packer.nvim '..install_path)
end
cmd 'packadd packer.nvim'
cmd 'autocmd BufWritePost plugins.lua PackerCompile'
local packer = require("packer")
local util = require("packer.util")
local compile_path = util.join_paths(
fn.stdpath("config"), "plugin", "packer_compiled.vim"
)
---------------------------------------------------------------------------- }}}
---------------------------------- PLUGINS --------------------------------- {{{
function packer_spec()
use {'wbthomason/packer.nvim', opt = true}
-- Appearance plugins
use {'joshdick/onedark.vim' } -- Theme
use {'sonph/onehalf', rtp = 'vim' } -- Theme
use {
'romgrk/barbar.nvim', -- Tabline
event = {'VimEnter *'},
config = require('plugins.bufferline').config(),
requires = {'kyazdani42/nvim-web-devicons', opt = true}
}
use {
'dstein64/nvim-scrollview', -- Scrollbars in Neovim
event = {'VimEnter *'}
}
use {
'lewis6991/gitsigns.nvim', -- Git signs in the signcolumn
config = function() require('gitsigns').setup() end,
requires = {'nvim-lua/plenary.nvim'},
}
use {
'glepnir/galaxyline.nvim', -- Status line written in Lua
branch = 'main',
-- event = {'VimEnter *'},
requires = {'kyazdani42/nvim-web-devicons', opt = true},
config = function() require('plugins.statusline') end,
}
use {
'lukas-reineke/indent-blankline.nvim', -- Show indentation lines
branch = 'lua',
event = {'BufReadPre *', 'BufNewFile *'},
config = require('plugins.indentline').config()
}
-- Coding plugins
use {
'neovim/nvim-lspconfig', -- Use native LSP
setup = require('plugins.lsp').setup(),
config = require('plugins.lsp').config()
}
use {
'hrsh7th/nvim-compe', -- Code completion
event = {'InsertEnter *'},
config = require('plugins.compe').config(),
requires = {'norcalli/snippets.nvim'} -- Snippets
}
use {'glepnir/lspsaga.nvim'} -- Async finder, code action, hover docs
use {'onsails/lspkind-nvim'} -- VSCode like icons in menu
use {
'kosayoda/nvim-lightbulb', -- Use VSCode lightbulb hint
config = require('plugins.lightbulb').config()
}
use {
'nvim-treesitter/nvim-treesitter',
requires = {
{
'nvim-treesitter/nvim-treesitter-refactor',
after = 'nvim-treesitter'
},
{
'nvim-treesitter/nvim-treesitter-textobjects',
after = 'nvim-treesitter'
}
},
run = ':TSUpdate',
config = require('plugins.treesitter').config()
}
use {'nvim-treesitter/playground'} -- See the structure for the given file
use {
'vim-test/vim-test', -- Run tests on any type of code base
requires = {
{
'rcarriga/vim-ultest', -- Seemless running of tests within neovim
after = 'vim-test'
},
{
'voldikss/vim-floaterm', -- Use the terminal in a floating window
after = 'vim-test'
}
},
config = require('plugins.testing').config()
}
-- Misc plugins
use {'sheerun/vim-polyglot'} -- Language packs
use {'tpope/vim-surround'} -- Use Vim commands within parenthesis and brackets
use {'alvan/vim-closetag'} -- Auto close HTML tags
use {'kassio/neoterm'} -- Wrapper for neovim terminal commands and can reuse terminal
use {'tweekmonster/django-plus.vim'} -- Django support
use {'b3nj5m1n/kommentary', config = require('plugins.kommentary').config()} -- Comment out code
use {
'kyazdani42/nvim-tree.lua', -- File explorer
setup = require('plugins.nvim_tree').setup(),
requires = {'kyazdani42/nvim-web-devicons', opt = true}
}
use {
'nvim-telescope/telescope.nvim', -- Awesome fuzzy finder for everything
setup = require('plugins.telescope').setup(),
config = require('plugins.telescope').config(),
requires = {{'nvim-lua/popup.nvim'}, {'nvim-lua/plenary.nvim'}}
}
use {
'christoomey/vim-tmux-navigator', -- Navigate Tmux panes inside of neovim
cond = function() return os.getenv('TMUX') end,
setup = function() cmd 'packadd vim-tmux-navigator' end
}
use {
'dhruvasagar/vim-prosession', -- Easy session switching and also auto-starts sessions
config = require('plugins.misc').prosession(),
requires = {'tpope/vim-obsession'} -- Continuously update session files
}
use {'mhinz/vim-startify'} -- Startup screen for Vim
use {'dbakker/vim-projectroot'} -- Detect the project root of a folder
end
---------------------------------------------------------------------------- }}}
packer.startup {
packer_spec,
}
Supplementary files:
Additional context
System: Mac
Neovim version: Nightly
Describe the bug
This happened to me several times. I don't know how to reproduce it unfortunately. If I figure it out in the meantime i'll update the issue.
To Reproduce
Don't know unfortunately. It happened few times, randomly.
Observed output
I'm getting this error:
Error executing vim.schedule lua callback: ...pack/packager/start/gitsigns.nvim/lua/gitsigns/async.lua:21: .../nvim/pack/packager/start/gitsigns.nvim/lua/gitsigns.lua:272: Cache for buffer 6 was nil
System
Linux, latest neovim master.
Thanks for making this plugin โค๏ธ . It is awesome and fast like really fast.
Is your feature request related to a problem? Please describe.
Currently, by default, signcolumn background is highlighted. Which attracts too much attention. I was able to disable that but now the text is white and I am not able to find any option to highlight the text.
My config
require('gitsigns').setup({
signs = {
add = {hl = 'NONE', text = '+'},
change = {hl = 'NONE', text = '~'},
delete = {hl = 'NONE', text = '_'},
topdelete = {hl = 'NONE', text = 'โพ'},
changedelete = {hl = 'NONE', text = '!'},
}
})
I am migrating from gitgutter and I like its signs better.
Describe the solution you'd like
numhl
Describe the bug
When I open edit-buffer in Deol, I get an error.
Since I don't know of any other way to reproduce this problem, I am limiting myself to Deol.
To Reproduce
$ nvim -u minvimrc -i NONE
:Deol -edit
" minvimrc
set encoding=utf-8
scriptencoding utf-8
filetype plugin indent on
if has('vim_starting')
let s:pluin_manager_dir='~/.config/nvim/.plugged/vim-plug'
execute 'set runtimepath+=' . s:pluin_manager_dir
endif
call plug#begin('~/.config/nvim/.plugged')
Plug 'sainnhe/gruvbox-material'
Plug 'lewis6991/gitsigns.nvim'
Plug 'nvim-lua/plenary.nvim'
Plug 'Shougo/deol.nvim'
call plug#end()
lua << EOF
require'gitsigns'.setup{
debug_mode = true
}
EOF
set nobackup
set nowritebackup
set noswapfile
set updatecount=0
set backspace=indent,eol,start
language messages en_US.utf8
set termguicolors
let g:gruvbox_material_enable_italic = 0
let g:gruvbox_material_disable_italic_comment = 1
let g:gruvbox_material_background = 'medium'
set bg=dark
colorscheme gruvbox-material
Observed output
I'm getting this error:
Error executing vim.schedule lua callback: ...4/.config/nvim/.plugged/plenary.nvim/lua/plenary/job.lua:370: Failed to spawn process: {
_additional_on_exit_callbacks = {},
_shutdown_check = <userdata 1>,
_stderr_results = {},
_stdout_results = {},
_user_on_exit = <function 1>,
_user_on_stdout = <function 2>,
args = { "rev-parse", "--show-toplevel", "--absolute-git-dir", "--abbrev-ref", "HEAD" },
command = "git",
cwd = "deol-edit@term://~/.ghq/github.com/lewis6991/gitsigns.nvim//24604:/usr/bin/",
enable_handlers = true,
enable_recording = true,
interactive = true,
pid = "ENOENT: no such file or directory",
stderr = <userdata 2>,
stdin = <userdata 3>,
stdout = <userdata 4>,
user_data = {},
<metatable> = <1>{
__index = <table 1>,
_create_uv_options = <function 3>,
_execute = <function 4>,
_pipes_are_closed = <function 5>,
_prepare_pipes = <function 6>,
_reset = <function 7>,
_shutdown = <function 8>,
_stop = <function 9>,
add_on_exit_callback = <function 10>,
and_then = <function 11>,
chain = <function 12>,
chain_status = <function 13>,
co_wait = <function 14>,
is_job = <function 15>,
join = <function 16>,
new = <function 17>,
pid = <function 18>,
result = <function 19>,
send = <function 20>,
shutdown = <function 21>,
start = <function 22>,
stderr_result = <function 23>,
sync = <function 24>,
wait = <function 25>
}
}
stack traceback:
...4/.config/nvim/.plugged/plenary.nvim/lua/plenary/job.lua:370: in function '_execute'
...4/.config/nvim/.plugged/plenary.nvim/lua/plenary/job.lua:413: in function 'start'
....ghq/github.com/lewis6991/gitsigns.nvim/lua/gitsigns.lua:79: in function 'run_job'
....ghq/github.com/lewis6991/gitsigns.nvim/lua/gitsigns.lua:205: in function 'ret'
...ithub.com/lewis6991/gitsigns.nvim/lua/gitsigns/async.lua:28: in function 'step'
...ithub.com/lewis6991/gitsigns.nvim/lua/gitsigns/async.lua:31: in function 'cb'
vim.lua:236: in function <vim.lua:236>
System
Linux, latest neovim master.
Suggestions and solutions
No error occurred when I checked first.
diff --git a/lua/gitsigns.lua b/lua/gitsigns.lua
index 69d738a..54383e4 100644
--- a/lua/gitsigns.lua
+++ b/lua/gitsigns.lua
@@ -595,6 +595,10 @@ local attach = throttle_leading(100, async('attach', function()
dprint('Attaching', cbuf, 'attach')
local file = get_buf_path(cbuf)
+ if not path_exists(file) or uv.fs_stat(file).type == 'directory' then
+ dprint('Not a file', cbuf, 'attach')
+ return
+ end
for _, p in ipairs(vim.split(file, '/')) do
if p == '.git' then
@@ -612,11 +616,6 @@ local attach = throttle_leading(100, async('attach', function()
Status:update_head_var(cbuf, abbrev_head)
- if not path_exists(file) or uv.fs_stat(file).type == 'directory' then
- dprint('Not a file', cbuf, 'attach')
- return
- end
-
await_main()
local relpath, object_name, mode_bits = await(git_relative, file, toplevel)
In addition to the short change summary in b:gitsigns_status
, another useful information is the current branch. Would it be easy to expose this, too, as b:gitsigns_branch
as a side effect? (Currently I'm relying on https://github.com/tpope/vim-fugitive for this, but it'd be nice to drop it at least for this purpose.)
Is your feature request related to a problem? Please describe.
Hi, thanks for this great plugin ๐๐ฟ .
I've noticed whilst using it that if a new file is added to a repo the branch indicator doesn't appear for that buffer till it is added to the repo. I imagine there's a check somewhere to see if the file part of the tree and that returns false or something.
Describe the solution you'd like
I think if a file is within a repository the branch indicator should show regardless. Understandably the changes wouldn't. As a stretch it'd be nice to have an indicator to say the file hasn't been added so you know you still need to do that.
Are the highlights supposed to be applied to the whole signcolumn or just the text? It looks like in the gif of the readme just the text
are colored. My situation has the whole sign column highlighted.
To Reproduce
init.vim:
let $PLUGIN_DIRECTORY = '~/.config/nvim/bundle'
set runtimepath^=$PLUGIN_DIRECTORY/plenary.nvim
set runtimepath^=$PLUGIN_DIRECTORY/gitsigns.nvim
lua << EOF
require('gitsigns').setup {
signs = {
add = {hl = 'DiffAdd' , text = 'โ', numhl='GitSignsAddNr'},
change = {hl = 'DiffChange', text = 'โ', numhl='GitSignsChangeNr'},
delette = {hl = 'DiffDelete', text = '_', numhl='GitSignsDeleteNr'},
topdelete = {hl = 'DiffDelete', text = 'โพ', numhl='GitSignsDeleteNr'},
changedelete = {hl = 'DiffChange', text = '~', numhl='GitSignsChangeNr'},
}
}
EOF
The above config is just copied from the default in the readme. I have tried defining it and and letting the defaults kick in. Same result.
Additional context
System: Linux
Neovim version: 0.5.0-dev+1059
Neovim now prints the message dwqdqwwqdqw: myers
on startup :)
It's due to the stray
gitsigns.nvim/lua/gitsigns/config.lua
Line 93 in 01155f7
Hey,
got a file which has no changes made to it yet gitsigns reports a lot of them (~1 -1293) (file is 1425 lines long). git diff <file>
returns nothing.
How could I debug it?
Thanks for great plugin!
Describe the bug
After I remove + unload the buffer completely, gitsigns throw the following error
Error executing vim.schedule lua callback: .../pack/packer/start/gitsigns.nvim/lua/gitsigns/status.lua:21: Key not found: gitsigns_head
Screenshots
If applicable, add screenshots to help explain your problem or to capture error messages.
Additional context
System: Linux
Neovim version: 0.5
Another one from the "nice things Signify does": Open a new buffer with the diff between current state and last commit (:SignifyDiff
) or a copy of the current buffer with folding showing only changed locations (:SignifyFold
) -- might be useful to add if it's not hard?
(Unlike supporting other VCS like hg
;))
Originally posted by @clason in #63 (comment)
Implement config.attach_to_untracked
Describe the bug
I have noticed that signs do not refresh automatically after I have git add and commit the current file. I have to manually :e %
to make the diff signs disappear.
To Reproduce
init.vim:
set runtimepath+=/home/haojiedong/.local/share/nvim/plugged/gitsigns.nvim
set runtimepath+=/home/haojiedong/.local/share/nvim/plugged/plenary.nvim
lua << EOF
require('gitsigns').setup {
signs = {
add = {text = '+'},
change = {text = '~'},
delete = {text = '_', show_count=true},
topdelete = {text = 'โพ', show_count=true},
changedelete = {text = '~', show_count=true},
},
}
EOF
Steps to reproduce the behavior:
nvim -u init.vim some_file
git add some_file
and git commit
it.some_file
.only after :e %
, the git signs disappear.
Additional context
System: Linux
Neovim version: v0.5.0-dev+1133-g0869cbd55
After the most recent update, I'm getting an error when I try to update the plugin
Error executing vim.schedule lua callback: .../share/nvim/site/pack/paqs/opt/paq-nvim/lua/paq-nvim.lua:61: Vim(helptags):E154: Duplicate tag "gitsigns.toggle_numhl(
)" in file /Users/evantravers/.local/share/nvim/site/pack/paqs/start/gitsigns.nvim/doc/gitsigns.txt
It looks like there's accidentally the same key in the doc file hereโฆย I'd PR but I honestly don't know what the right code should be here. Found it, created a PR.
https://github.com/lewis6991/gitsigns.nvim/blob/main/doc/gitsigns.txt#L151-L154
My config is: https://github.com/evantravers/dotfiles/blob/master/nvim/.config/nvim/init.lua
Is your feature request related to a problem? Please describe.
I was planning to move to gitsigns
, but coming from mhinz/vim-signify
, I noticed that it misses yadm
support.
Describe the solution you'd like
I know that gitsigns
is more tied to git
than signify, but yadm
is only a git wrapper, so it's enough to:
git
with the GIT_DIR
set as the output of yadm enter 'echo $GIT_DIR'
in that case.Describe the bug
Nvim crash on startup with git config --global core.autocrlf input
on W10. See #64 (comment). Finally, I got an error message after several attempts to start nvim without crashing.
Observed output
Additional context
It's caused by
gitsigns.nvim/teal/gitsigns/git.tl
Line 221 in cfc8728
I think the reason is the same as
gitsigns.nvim/teal/gitsigns.tl
Lines 469 to 470 in 926eb06
So, as the crash is initially caused by staged
which uses \r\n
instead of \n
, I searched to fix that and I found this. I tested with(open(file, 'wb'), function(writer: FILE)
in
gitsigns.nvim/teal/gitsigns.tl
Line 68 in cfc8728
And it works, staged
uses \n
now. So, wb
fix the root of the previously broken diff and --ignore-space-at-eol
seems no longer useful.
But there is still the problem of print in on_stderr
which causes nvim to crash. With wb
, git config --global core.autocrlf input
no longer returns an error, so nvim don't crash, but I don't think it's enough, an error may be caused by some other problem and if there is an error, there is a crash.
diff --git a/teal/gitsigns.tl b/teal/gitsigns.tl
index 17b258b..36ec4b4 100644
--- a/teal/gitsigns.tl
+++ b/teal/gitsigns.tl
@@ -65,7 +65,8 @@ local function dirname(file: string): string
end
local function write_to_file(file: string, content: {string})
- with(open(file, 'w'), function(writer: FILE)
+ -- On windows 'w' mode use \r\n instead of \n, see: https://stackoverflow.com/a/43967013
+ with(open(file, 'wb'), function(writer: FILE)
for _, l in ipairs(content) do
writer:write(l..'\n')
end
diff --git a/teal/gitsigns/git.tl b/teal/gitsigns/git.tl
index e3d3514..82eb1c4 100644
--- a/teal/gitsigns/git.tl
+++ b/teal/gitsigns/git.tl
@@ -203,7 +203,6 @@ function M.run_diff(staged: string, text: {string}, diff_algo: string): cb_funct
'--diff-algorithm='..diff_algo,
'--patch-with-raw',
'--unified=0',
- '--ignore-space-at-eol', -- On windows 'staged' has \r\n instead of \n
staged,
'-'
},
However, I don't know how to fix the print issue.
Thank you.
Currently, the plugin remains active even in diff mode. So, it hijacks the signs column and the keymappings too. I'm not able to use [c & ]c, to move between the changes.
My request is to disable the signs and unmap the keymappings when in diff mode. You can use the &diff variable to check if diff mode is active or not.
Describe the bug
When using with neovim official lsp client, and the client seems caused neovim CPU high.
The plugin report:
Error executing vim.schedule lua callback: ...al/share/nvim/plugged/gitsigns.nvim/lua/gitsigns/git.lua:222: attempt to concatenate upvalue 'line' (a nil value)
Press ENTER or type command to continue
To Reproduce
init.vim:
" Specify a directory for plugins
" - For Neovim: ~/.local/share/nvim/plugged
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.local/share/nvim/plugged')
Plug 'neovim/nvim-lspconfig'
autocmd Filetype go setlocal omnifunc=v:lua.vim.lsp.omnifunc
" https://github.com/nvim-lua/completion-nvim/wiki/chain-complete-support
Plug 'nvim-lua/completion-nvim'
" Configure the completion chains
let g:completion_chain_complete_list = {
\ 'default': [
\ {'complete_items': ['lsp']},
\ {'mode': '<c-p>'},
\ {'mode': '<c-n>'}
\]
\}
let g:completion_enable_auto_popup = 1
let g:completion_enable_auto_hover = 1
let g:completion_enable_auto_signature = 1
let g:completion_matching_smart_case = 1
let g:completion_trigger_keyword_length = 1 " default = 1
let g:completion_timer_cycle = 80 "default value is 80
" auto change sources whenever this completion source has no complete item
let g:completion_auto_change_source = 1
let g:completion_enable_auto_paren = 1
" Set completeopt to have a better completion experience
set completeopt=menuone,noinsert,noselect
" Avoid showing message extra message when using completion
set shortmess+=c
n
" The delay is governed by vim's updatetime option,
" default updatetime 4000ms is not good for async update
set updatetime=100
" set signcolumn to 2 to avoid git gutter sign conflict with linter sign
set signcolumn=yes:2
" signify show git diff sigs
" Plug 'mhinz/vim-signify'
" https://github.com/lewis6991/gitsigns.nvim
Plug 'nvim-lua/plenary.nvim'
Plug 'lewis6991/gitsigns.nvim'
lua << EOF
require('gitsigns').setup {
signs = {
add = {hl = 'DiffAdd' , text = 'โ', numhl='GitSignsAddNr'},
change = {hl = 'DiffChange', text = 'โ', numhl='GitSignsChangeNr'},
delete = {hl = 'DiffDelete', text = '_', numhl='GitSignsDeleteNr'},
topdelete = {hl = 'DiffDelete', text = 'โพ', numhl='GitSignsDeleteNr'},
changedelete = {hl = 'DiffChange', text = '~', numhl='GitSignsChangeNr'},
},
numhl = false,
sign_priority = 6,
status_formatter = nil, -- Use default
}
local lsp = require'lspconfig'
local cmp = require'completion'
--@param client: (required, vim.lsp.client)
local mix_attach = function(client)
-- lsp_status.on_attach(client)
cmp.on_attach(client)
end
-- lsp.gopls.setup{}
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/gopls.lua
-- https://github.com/golang/tools/blob/master/gopls/doc/vim.md#neovim
-- https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#gopls
lsp.gopls.setup({
on_attach = mix_attach,
settings = {
gopls = {
usePlaceholders = true,
completeUnimported = true,
},
},
capabilities = lsp_status.capabilities,
})
EOF
Steps to reproduce the behavior:
Error executing vim.schedule lua callback: ...al/share/nvim/plugged/gitsigns.nvim/lua/gitsigns/git.lua:222: attempt to concatenate upvalue 'line' (a nil value)
Press ENTER or type command to continue
Observed output
Error messages, logs, etc
Screenshots
Additional context
System: Linux Ubuntu 20.10 x86_64
Neovim version:
NVIM v0.5.0-dev+1115-gc1fbc2ddf
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/ttys3/.config/nvim/neovim/build/config -I/home/ttys3/.config/nvim/neovim/src -I/home/ttys3/.config/nvim/neovim/.deps/usr/include -I/usr/include -I/home/ttys3/.config/nvim/neovim/build/src/nvim/auto -I/home/ttys3/.config/nvim/neovim/build/include
Compiled by ttys3@ttys3-ht
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/local/share/nvim"
Run :checkhealth for more info
also reported to nvim lsp neovim/neovim#14037
Here's a maybe stupid idea: I prefer the status formatted slightly differently (added changed modified
, with empty changes still shown so that the status line doesn't jump around too much). Of course I can do that myself from b:gitsigns_status_dict
, but it might be more efficient to do this in Lua.
So I was thinking whether it'd be possible to allow providing (instead or in addition) a function in the setup that builds the status string from the three components (with default as now)?
Suddenly, this awesome plugin stopped showing signs and its variables return nothing. No errors though. All functions are available, but they do nothing. "Preview" function is a NOP function now, no errors but no effect.
Plugin version: 2218e1ab512c21699a9b42aa73cc56efd9f9ba33
Neovim version: 71d4f5851f068eeb432af34850dddda8cc1c71e3
from master
gitsigns.nvim/lua/gitsigns.lua
Lines 1 to 4 in 6433129
It seems that plenary is overkill for gitsigns.nvim.
Easier way to discover actions as opposed to using mappings.
Is your feature request related to a problem? Please describe.
Thanks for making gitsigns.nvim! I used to use vim-gitgutter but gitsigns.nvim is almost a complete drop-in replacement and is much faster/more efficient.
One feature I've noticed that's missing though; sometimes I used to disable signs on a per-buffer basis using :GitGutterDisable
. It would be really nice to have an equivalent of this in gitsigns.
Describe the solution you'd like
Either a command (like :GitSignsDisableBuffer
, probably with a corresponding :GitSignsEnableBuffer
) or a buffer-local variable (e.g. b:git_signs_disable=1
) which can turn off the signs in a buffer.
Describe alternatives you've considered
One alternative is to go back to gitgutter, obviously don't want to do that. Not aware of any other alternatives.
Thanks for all your hard work on this plugin!
Describe the bug
With use_internal_diff = false
on Windows on every diff I see a warning message about CRLF.
To Reproduce
Just run with the default settings on Windows and you will get the following message on every change:
error: warning: LF will be replaced by CRLF in AppData\Local\Temp\s1x8.0. NA run_diff
Additional context
System: Windows
Neovim version: gf5daf55c1 (latest master at the time of writing).
Describe the bug
The commit 4ce590f broke the show_count
functionality, unfortunately (bisect confirmed).
To Reproduce
Set up
require 'gitsigns'.setup{
signs = {
delete = { show_count = true},
},
}
then in any git repo, delete a line (not the first).
Observed output
Error executing vim.schedule lua callback: ...e/pack/packer/start/gitsigns.nvim/lua/gitsigns/async.lua:21: Vim
:E715: Dictionary required
Describe the bug
Changing colorscheme makes the sign column markers plain and gray.
To Reproduce
init.vim:
let $PLUGIN_DIRECTORY = '~/.local/share/nvim/pack/packager/start'
set runtimepath^=$PLUGIN_DIRECTORY/plenary.nvim
set runtimepath^=$PLUGIN_DIRECTORY/gitsigns.nvim
"https://github.com/gruvbox-community/gruvbox sets GitGutter*
set runtimepath^=$PLUGIN_DIRECTORY/gruvbox
"https://github.com/NLKNguyen/papercolor-theme sets SignifySign*
set runtimepath^=$PLUGIN_DIRECTORY/PaperColor
" re-setup gitsigns after every colorscheme change
autocmd ColorScheme * lua require('gitsigns').setup{debug_mode = true}
Steps to reproduce the behavior:
nvim -u init.vim --noplugin <somefile>
:colorscheme gruvbox
, then :w
to show the signs in beautiful color.:colorscheme PaperColor
, see the signs are now gray.Observed output
:colorscheme gruvbox
:lua require('gitsigns').debug_messages()
dprint(nil): Deriving GitSignsAdd from GitGutterAdd
dprint(nil): Deriving GitSignsChange from GitGutterChange
dprint(nil): Deriving GitSignsDelete from GitGutterDelete
:highlight GitSignsAdd
GitSignsAdd xxx links to GitGutterAdd
:highlight GitGutterAdd
GitGutterAdd xxx links to GruvboxGreenSign
:colorscheme PaperColor
:lua require('gitsigns').debug_messages()
dprint(nil): Deriving GitSignsAdd from GitGutterAdd
dprint(nil): Deriving GitSignsChange from GitGutterChange
dprint(nil): Deriving GitSignsDelete from GitGutterDelete
dprint(nil): Deriving GitSignsAdd from DiffAdd
dprint(nil): Deriving GitSignsChange from DiffChange
dprint(nil): Deriving GitSignsDelete from DiffDelete
dprint(nil): Deriving GitSignsChange from DiffChange
dprint(nil): Deriving GitSignsDelete from DiffDelete
:highlight GitSignsAdd
GitSignsAdd xxx links to GitGutterAdd
:highlight GitGutterAdd
GitGutterAdd xxx links to GruvboxGreenSign
Additional context
System: Linux (NixOS)
Neovim version: NVIM v0.5.0-dev (nightly)
First of all thank you for your work on this. Been using it since 2 days.
I notice an error when trying to use gina.
Not sure why this occurs. Do you think this could be because of gitsigns running on a buffer which should not be handled by gitsigns?
Am on neovim nightly and gitsigns is at latest commit.
I'm working on dracula/vim#234 and I needed a way to check it gitsigns
was loaded/available.
Now I'm not very familiar with lua, so I'm not sure if there's already a different convention/way to do this, but in traditional vimscript plugins, they set a g:loaded_<plugin>
variable to 1
.
nvim-treesitter
does it here
In my PR, I need to do some checking:
" GitGutter / gitsigns: {{{
if exists('g:loaded_gitgitter') || (has('nvim') && check_gitsigns)
hi! link GitGutterAdd DiffAdd
hi! link GitGutterChange DiffChange
hi! link GitGutterDelete DiffDelete
endif
But I'm not sure how what to do for check_gitsigns
.
I'm wondering if there's already a way to check this, and if not, could it be implemented?
I'm not sure if that's the correct name, but I've recently been keeping my sign column off because gitgutter is able to add highlights to the number column through GitGutterAddLineNr, GitGutterChangeLineNr, GitGutterDeleteLineNr, and GitGutterChangeDeleteLineNr.
While using gitsigns, opening a fugitive buffer results in the following error -
Error executing vim.schedule lua callback: ...dh/.config/nvim/plugged/ple
nary.nvim/lua/plenary/job.lua:358: Failed to spawn process: {
_additional_on_exit_callbacks = {},
_shutdown_check = <userdata 1>,
_stderr_results = {},
_stdout_results = {},
_user_on_exit = <function 1>,
_user_on_stdout = <function 2>,
args = { "rev-parse", "--show-toplevel", "--absolute-git-dir", "--abbre
v-ref", "HEAD" },
command = "git",
cwd = "",
enable_handlers = true,
enable_recording = true,
interactive = true,
pid = "ENOENT: no such file or directory",
stderr = <userdata 2>,
stdin = <userdata 3>,
stdout = <userdata 4>,
user_data = {},
<metatable> = <1>{
__index = <table 1>,
_create_uv_options = <function 3>,
_execute = <function 4>,
_pipes_are_closed = <function 5>,
_prepare_pipes = <function 6>,
_reset = <function 7>,
_shutdown = <function 8>,
_stop = <function 9>,
add_on_exit_callback = <function 10>,
and_then = <function 11>,
chain = <function 12>,
chain_status = <function 13>,
co_wait = <function 14>,
is_job = <function 15>,
join = <function 16>,
new = <function 17>,
pid = <function 18>,
result = <function 19>,
send = <function 20>,
shutdown = <function 21>,
start = <function 22>,
stderr_result = <function 23>,
sync = <function 24>,
wait = <function 25>
}
}
stack traceback:
...dh/.config/nvim/plugged/plenary.nvim/lua/plenary/job.lua:358:
in function '_execute'
...dh/.config/nvim/plugged/plenary.nvim/lua/plenary/job.lua:401:
in function 'start'
...rudh/.config/nvim/plugged/gitsigns.nvim/lua/gitsigns.lua:83: i
n function 'run_job'
...rudh/.config/nvim/plugged/gitsigns.nvim/lua/gitsigns.lua:194:
in function 'ret'
...config/nvim/plugged/gitsigns.nvim/lua/gitsigns/async.lua:28: i
n function 'step'
...config/nvim/plugged/gitsigns.nvim/lua/gitsigns/async.lua:31: i
n function 'cb'
vim.lua:234: in function <vim.lua:234>
Am I right in understanding this is caused due to gitsigns? Let me know what additional information I can provide.
Is your feature request related to a problem? Please describe.
When detaching, the scheduled callback still tries to act on buffers even if they don't exist, spitting out something like:
Error executing vim.schedule lua callback: .../pack/packer/start/gitsigns.nvim/lua/gitsigns/status.lua:21: Invalid buffer id: 17
notably when using something like :h bwipeout
to remove the buffers.
Describe the solution you'd like
Huck this in a local success, result = pcall(...)
, and check whether or not it was a success before continuing. This will silence the output, and the functionality remains unchanged. Something like:
function Status:clear(bufnr)
vim.schedule(function()
local buf_vars = {
'gitsigns_head',
'gitsigns_status_dict',
'gitsigns_status',
}
for _, buf_var in ipairs(buf_vars) do
pcall(api.nvim_buf_del_var, bufnr, buf_var)
end
end)
end
Describe alternatives you've considered
ยฏ\_(ใ)_/ยฏ
Additional context
See above, but I would imagine this has something to do with the forceful nature of :h bwipeout
, regardless, it doesn't hurt to add.
gh
Lost the original issue body. So Li wont type it all out again. Heres the error message
Error executing vim.schedule lua callback: .../home-manager/start/gitsigns-nvim/lua/gitsigns/async.lua:21: ...r/pack/home-manager/start/gitsigns-nvim/lua/gitsigns.lua:594: attempt to index local 'bcache' (a nil value)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.