Closed PhilippFeO closed 8 months ago
Removing
yadm = {
enable = false
}
solves the issue. I found it by trial and error. An error message indicating a solution or a more verbose commit message would have improved removing the error message. The help on yadm
pointing to gitsigns-config-on_attach_pre
but this term doesn't show up in the help at all.
To be honest, I don't know what yadm
is about. I use(d) kickstart.nvim
and should not have touched gitsigns
. Maybe it is completely obvious for people who know yadm
.
If you don't use yadm, then why on earth did you configure it in gitsigns?
I strongly suggest you remove any configuration that repeats the defaults since you'll see this issue again. The more config you have, the more likely you are to have issues when config changes.
I use(d) it, because it was part of kickstart.nvim. For me, the point of kickstart.nvim is that I don't have to iterate over every plugin before using it – very handy when starting with Neovim.
kickstart.nvim should not be setting fields which are already default.
EDIT: not on master https://github.com/nvim-lua/kickstart.nvim/blob/19afab164183a5e80d8f7e7ae9df6b57e26a4a48/init.lua#L243-L259
Can't comment on that. It was nearly a year ago that I started using Neovim.
Anyway, does this all even matter? Before we continue another pointless discussion on the internet, I propose I close the issue and we are both happy that everything works. I, because I fixed it myself and you, because you had no work fixing anything. When you agree on that, you can also close the issue.
I have debugged all my config after followed your instructions regarding yadm
, yet the warning keeps popping up:
This only appeared after updating. At first I thought it was an error concerning a fault in my code (there was, but it was unrelated). After debugging and fixing it, the same warning has kept popping up thus far.
I'll provide a sample of my configuration, but bear in mind I'm using customized modules for handling some stuff. Still, I've documented all the bits I've deemed relevant. If anything else is needed from my config please tell me.
--- ...
local Gsig = require('gitsigns')
---@type UserBufModeKeys
local keys = {
n = {
-- Navigati7on
{ lhs = '<leader>G]c', rhs = "&diff ? ']c' : '<CMD>Gitsigns next_hunk<CR>'", opts = { expr = true } },
{ lhs = '<leader>G[c', rhs = "&diff ? '[c' : '<CMD>Gitsigns prev_hunk<CR>'", opts = { expr = true } },
-- Actions
{ lhs = '<leader>Ghs', rhs = ':Gitsigns stage_hunk<CR>' },
{ lhs = '<leader>Ghr', rhs = ':Gitsigns reset_hunk<CR>' },
{ lhs = '<leader>GhS', rhs = '<CMD>Gitsigns stage_buffer<CR>' },
{ lhs = '<leader>Ghu', rhs = '<CMD>Gitsigns undo_stage_hunk<CR>' },
{ lhs = '<leader>GhR', rhs = '<CMD>Gitsigns reset_buffer<CR>' },
{ lhs = '<leader>Ghp', rhs = '<CMD>Gitsigns preview_hunk<CR>' },
{ lhs = '<leader>Ghb', rhs = '<CMD>lua require"gitsigns".blame_line{full=true}<CR>' },
{ lhs = '<leader>Gtb', rhs = '<CMD>Gitsigns toggle_current_line_blame<CR>' },
{ lhs = '<leader>Ghd', rhs = '<CMD>Gitsigns diffthis<CR>' },
{ lhs = '<leader>GhD', rhs = '<CMD>lua require"gitsigns".diffthis("~")<CR>' },
{ lhs = '<leader>Gtd', rhs = '<CMD>Gitsigns toggle_deleted<CR>' },
},
v = {
{ lhs = '<leader>Ghs', rhs = ':Gitsigns stage_hunk<CR>' },
{ lhs = '<leader>Ghr', rhs = ':Gitsigns reset_hunk<CR>' },
},
}
---@alias GitSignOpts { ['text']: string }
---@class GitSigns
---@field add GitSignOpts
---@field change GitSignOpts
---@field delete GitSignOpts
---@field topdelete GitSignOpts
---@field changedelete GitSignOpts
---@field untracked GitSignOpts
---@alias GitSignsArr GitSigns[]
---@type GitSigns
local signs = {
add = { text = '÷' },
change = { text = '~' },
delete = { text = '-' },
topdelete = { text = 'X' },
changedelete = { text = '≈' },
untracked = { text = '┆' },
}
Gsig.setup({
---@param bufnr integer
on_attach = function(bufnr)
for mode, v in next, keys do
---@type BufMapFunction
local func = bufmap[mode]
for _, t in next, v do
func(bufnr, t.lhs, t.rhs, t.opts or {})
end
end
end,
signs = signs,
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
numhl = true, -- Toggle with `:Gitsigns toggle_numhl`
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
watch_gitdir = { follow_files = true },
auto_attach = true,
attach_to_untracked = true,
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
current_line_blame_opts = {
virt_text = false,
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
delay = 5000,
ignore_whitespace = false,
virt_text_priority = 100,
},
current_line_blame_formatter = '<author>, <author_time:%Y-%m-%d> - <summary>',
sign_priority = 4,
update_debounce = 100,
-- status_formatter = nil, -- Use default
max_file_length = 40000, -- Disable if file is longer than this (in lines)
preview_config = {
border = 'double',
style = 'minimal',
relative = 'cursor',
row = 0,
col = 1,
},
-- WARN: This causes a VERY annoying warning
-- each time Neovim starts.
-- See: [https://github.com/lewis6991/gitsigns.nvim/issues/965](this issue).
-- yadm = { enable = false },
})
--- ...
You know the commit you referenced is 4 months old?
Welp, a bit of an awkward oversight from my part. Either way, thanks for your time, and apologies for taking it up.
Description
After Executing
:Lazy sync
, I receive the following error message when starting Neovim:gitsigns: Ignoring invalid configuration field 'on_attach_pre'
(s. attached screenshot), although I am not using this field anywhere.I've seen in the changes of the last commit that some things concerning
yadm
changed but I was not able to fix it myself. I also checked the help onyadm
. It refers to usingon_attach_pre
instead but since the error message states the field is invalid, I am cueless.Neovim version
NVIM v0.9.5 Build type: Release LuaJIT 2.1.1692716794
Operating system and version
Ubunut 22.04 LTS
Expected behavior
Neovim starts without printing an error message.
Actual behavior
Neovim starts and prints an error message although the mentioned field is not used anywhere.
Error message using my config:
Error message with
minimal.lua
:Minimal config
Steps to reproduce
nvim --clean -u minimal.lua
Gitsigns debug messages
:Gitsigns debug_messages
Gitsigns dump_cache