-
-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error after update – gitsigns: Ignoring invalid configuration field 'on_attach_pre' #965
Comments
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 To be honest, I don't know what |
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 |
This comment was marked as abuse.
This comment was marked as abuse.
It's Back (6ef8c54)I have debugged all my config after followed your instructions regarding 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. |
link to relevant issue: lewis6991/gitsigns.nvim#965 (comment)
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:
![Screenshot from 2024-04-02 09-08-31](https://private-user-images.githubusercontent.com/125358469/318680284-acd51bef-1e84-46da-a1c4-5662e93bb66a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1MjUzMjQsIm5iZiI6MTczOTUyNTAyNCwicGF0aCI6Ii8xMjUzNTg0NjkvMzE4NjgwMjg0LWFjZDUxYmVmLTFlODQtNDZkYS1hMWM0LTU2NjJlOTNiYjY2YS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNFQwOTIzNDRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT01YzJmZGQ0YmFmMjNkODBmNTRjYzhlN2Y2MmI3MDE5MzZiZDFiM2VlNmY2MjFmODY3ZmM2MmExYjBmNTM1NjlkJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.tkuf3Cf05qb7PZPe147ZEbYywstuy014anuKA__jme0)
Error message with
![Screenshot from 2024-04-02 09-27-56](https://private-user-images.githubusercontent.com/125358469/318683199-cfd8de6f-48c2-4f88-8042-c8b06a46329d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1MjUzMjQsIm5iZiI6MTczOTUyNTAyNCwicGF0aCI6Ii8xMjUzNTg0NjkvMzE4NjgzMTk5LWNmZDhkZTZmLTQ4YzItNGY4OC04MDQyLWM4YjA2YTQ2MzI5ZC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNFQwOTIzNDRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yYzA4ZWUwM2I1NWUzNDZjYWI0NTQxMDdkNmJiZDU1NGQzNjNkMWViMGQ4MTUyOGY1NjBhMDFlOTgwYzc3OWY2JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.vgTdK5q1mU5EdoPebV_M49fsn8qcaRKfQIoDNm6AZgs)
minimal.lua
:Minimal config
Steps to reproduce
nvim --clean -u minimal.lua
Gitsigns debug messages
:Gitsigns debug_messages
Gitsigns dump_cache
The text was updated successfully, but these errors were encountered: