lewis6991 / gitsigns.nvim

Git integration for buffers
MIT License
5.22k stars 191 forks source link

Gitsigns Error in neovim 0.8.0-dev 959 #613

Closed NEX-S closed 2 years ago

NEX-S commented 2 years ago

Description

Error detected while processing VimEnter Autocommands for "*":
E5108: Error executing lua Vim:E5248: Invalid character in group name
stack traceback:
        [C]: in function 'sign_define'
        ...e/pack/packer/start/gitsigns.nvim/lua/gitsigns/signs.lua:56: in function 'define'
        ...pack/packer/start/gitsigns.nvim/lua/gitsigns/manager.lua:353: in function 'setup_signs_and_highlights'
        [string ":lua"]:1: in main chunk

Neovim version

NVIM v0.8.0-dev-959-g6547f4397f Build type: RelWithDebInfo LuaJIT 2.1.0-beta3 Compilation: /usr/bin/cc -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/nex/.cache/yay/neovim-git/src/build/cmake.config -I/home/nex/.cache/yay/neovim-git/src/neovim-git/src -I/usr/include -I/home/nex/.cache/yay/neovim-git/src/build/src/nvim/auto -I/home/nex/.cache/yay/neovim-git/src/build/include Compiled by nex@UNEXPECTED Features: +acl +iconv +tui See ":help feature-compile" system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/usr/share/nvim"

Operating system and version

Manjaro Linux Gnome

Expected behavior

No response

Actual behavior

Error detected while processing VimEnter Autocommands for "*": E5108: Error executing lua Vim:E5248: Invalid character in group name stack traceback: [C]: in function 'sign_define' ...e/pack/packer/start/gitsigns.nvim/lua/gitsigns/signs.lua:56: in function 'define' ...pack/packer/start/gitsigns.nvim/lua/gitsigns/manager.lua:353: in function 'setup_signs_and_highlights' [string ":lua"]:1: in main chunk

Minimal config

vim.o.packpath = '/tmp/nvim/site'

local plugins = {
  gitsigns = 'https://github.com/lewis6991/gitsigns.nvim',
  -- ADD OTHER PLUGINS _NECESSARY_ TO REPRODUCE THE ISSUE
}

for name, url in pairs(plugins) do
  local install_path = '/tmp/nvim/site/pack/test/start/'..name
  if vim.fn.isdirectory(install_path) == 0 then
    vim.fn.system { 'git', 'clone', '--depth=1', url, install_path }
  end
end

require('gitsigns').setup{
  debug_mode = true, -- You must add this to enable debug messages
  -- ADD GITSIGNS CONFIG THAT IS _NECESSARY_ FOR REPRODUCING THE ISSUE
}

-- ADD INIT.LUA SETTINGS THAT IS _NECESSARY_ FOR REPRODUCING THE ISSUE

Steps to reproduce

open nvim with this gitsigns config

require"gitsigns".setup {
    signs = {
        -- add          = { hl = 'GitSignsAdd'   , text = '+', numhl='GitSignsAddNr'   , linehl='GitSignsAddLn'},
        -- change       = { hl = 'GitSignsChange', text = '~', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'},
        -- delete       = { hl = 'GitSignsDelete', text = '-', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn' },

        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 = 'GitSignsTopDelete'   , text = '▎', numhl='GitSignsTopDeleteNr'   , linehl='GitSignsTopDeleteLn' },
        changedelete = { hl = 'GitSignsChangeDelete', text = '▎', numhl='GitSignsChangeDeleteNr', linehl='GitSignsChangeDeleteLn' },
    },
    signcolumn = true,  -- Toggle with `:Gitsigns toggle_signs`
    numhl      = false, -- Toggle with `:Gitsigns toggle_numhl`
    linehl     = false, -- Toggle with `:Gitsigns toggle_linehl`
    word_diff  = false, -- Toggle with `:Gitsigns toggle_word_diff`
    watch_gitdir = {
        interval = 1000,
        follow_files = true
    },
    attach_to_untracked = true,
    current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
    current_line_blame_opts = {
        virt_text = true,
        virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
        delay = 1000,
        ignore_whitespace = false,
    },
    -- current_line_blame_formatter = '<author>, <author_time:%Y-%m-%d> - <summary>',
    sign_priority = 6,
    update_debounce = 100,
    status_formatter = nil, -- Use default
    max_file_length = 40000,
    preview_config = {
        -- Options passed to nvim_open_win
        border = 'single',
        style = 'minimal',
        relative = 'cursor',
        row = 0,
        col = 1
    },
    yadm = {
        enable = false
    },
    on_attach = function(bufnr)
        local gs = package.loaded.gitsigns

        local function map(mode, l, r, opts)
            opts = opts or {}
            opts.buffer = bufnr
            vim.keymap.set(mode, l, r, opts)
        end

        -- Navigation
        map('n', ']c', function()
            if vim.wo.diff then return ']c' end
            vim.schedule(function() gs.next_hunk() end)
            return '<Ignore>'
        end, {expr=true})

        map('n', '[c', function()
            if vim.wo.diff then return '[c' end
            vim.schedule(function() gs.prev_hunk() end)
            return '<Ignore>'
        end, {expr=true})

        -- Actions
        map('n', ';gb', function()
            package.loaded.gitsigns.blame_line { full = true }
        end)
        map('n', ';gd', package.loaded.gitsigns.diffthis)
        map({'n', 'v'}, ';hs', ':Gitsigns stage_hunk<CR>')
        map({'n', 'v'}, ';hr', ':Gitsigns reset_hunk<CR>')
        map('n', ';hS', package.loaded.gitsigns.stage_buffer)
        map('n', ';hu', package.loaded.gitsigns.undo_stage_hunk)
        map('n', ';hR', package.loaded.gitsigns.reset_buffer)
        map('n', ';hp', package.loaded.gitsigns.preview_hunk)
        -- map('n', ';tb', package.loaded.gitsigns.toggle_current_line_blame)
        map('n', ';hD', function()
            package.loaded.gitsigns.diffthis('~')
        end)
        -- map('n', ';td', gs.toggle_deleted)

        -- Text object
        map({'o', 'x'}, 'ih', ':<C-U>Gitsigns select_hunk<CR>')
    end
        }

vim.api.nvim_set_hl(0, "GitSignsAdd", { bg = "NONE", fg = "#9EB73D", italic = true })
vim.api.nvim_set_hl(0, "GitSignsChange", { bg = "NONE", fg = "#008fbf", italic = true })
vim.api.nvim_set_hl(0, "GitSignsDelete", { bg = "NONE", fg = "#C53B82", italic = true })
vim.api.nvim_set_hl(0, "GitSignsChangeDelete", { bg = "NONE", fg = "#DEA600", italic = true })
vim.api.nvim_set_hl(0, "GitSignsTopDelete", { bg = "NONE", fg = "#C53B82", italic = true })
vim.api.nvim_set_hl(0, "gitcommitSummary", { bg = "NONE", fg = "#D0EE7A", bold = true, italic = true })

then get this error

Error detected while processing VimEnter Autocommands for "*":
E5108: Error executing lua Vim:E5248: Invalid character in group name
stack traceback:
        [C]: in function 'sign_define'
        ...e/pack/packer/start/gitsigns.nvim/lua/gitsigns/signs.lua:56: in function 'define'
        ...pack/packer/start/gitsigns.nvim/lua/gitsigns/manager.lua:353: in function 'setup_signs_and_highlights'
        [string ":lua"]:1: in main chunk
Error executing vim.schedule lua callback: ...pack/packer/opt/plenary.nvim/lua/plenary/async/async.lua:14: The coroutine failed with this message: Vim:E155: Unk
nown sign: GitSignsDelete
stack traceback:
        [C]: in function 'error'
        ...pack/packer/opt/plenary.nvim/lua/plenary/async/async.lua:14: in function 'callback_or_next'
        ...pack/packer/opt/plenary.nvim/lua/plenary/async/async.lua:40: in function 'cb'
        ...pack/packer/start/gitsigns.nvim/lua/gitsigns/manager.lua:46: in function <...pack/packer/start/gitsigns.nvim/lua/gitsigns/manager.lua:44>

Gitsigns debug messages

No response

lewis6991 commented 2 years ago

You need to be using the latest version of Gitsigns if you are running Neovim dev builds

Deluxo commented 2 years ago

So now this is happening, but now it's not dev build anymore.

lewis6991 commented 2 years ago

Are you using the latest version of Gitsigns?

sahibalejandro commented 2 years ago

I can confirm this is happening even when using tag = "release" in my packer config, using neovim 8.

lewis6991 commented 2 years ago

I think the release tag still points to 0.4, I forgot to update when I released 0.5. In the meantime you can just use the main branch.

sahibalejandro commented 2 years ago

Removing tag = release and running PackerSync worked. I'll wait for release tag get correctly tagged.

Thanks 👍🏼

kamalkech commented 2 years ago

@sahibalejandro but today still i get the same issue

sahibalejandro commented 2 years ago

@sahibalejandro but today still i get the same issue

@kamalkech try to first remove the package and add it again.

kamalkech commented 2 years ago

@sahibalejandro i downground neovim to 0.7.2 because i found a looooot of issues with different plugins, and mostly not response asap to fix all that, so i save my time to downground