Skip to content
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 when exiting Neovim #230

Closed
lostl1ght opened this issue Nov 17, 2022 · 1 comment · Fixed by #639
Closed

Error when exiting Neovim #230

lostl1ght opened this issue Nov 17, 2022 · 1 comment · Fixed by #639
Labels
bug Something isn't working

Comments

@lostl1ght
Copy link

lostl1ght commented Nov 17, 2022

Describe the bug
After 973659e there's an error and a lag in a terminal whenever one exits Neovim and has Heirline installed.

Which version of Neovim are you using?

  • Terminal: alacritty with tmux
  • Version: latest nightly:
NVIM v0.9.0-dev-329+ged27f0e93
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3

To Reproduce
Steps to reproduce the behavior:

  1. Open Neovim
  2. Exit Neovim
  3. Observer an error

Error

Error executing vim.schedule lua callback: ...te/pack/packer/start/noice.nvim/lua/noice/util/hacks.lua:267: Vim:E5108: Error executing lua ...k/packer/start/heirline.nvim/lua/heirline/statusline.lua:348: bad argument #1 to 'provider' (string expected, got nil)
stack traceback:
        [C]: in function 'provider'
        ...k/packer/start/heirline.nvim/lua/heirline/statusline.lua:348: in function '_eval'
        ...k/packer/start/heirline.nvim/lua/heirline/statusline.lua:365: in function '_eval'
        ...k/packer/start/heirline.nvim/lua/heirline/statusline.lua:440: in function 'eval'
        ...te/pack/packer/start/heirline.nvim/lua/heirline/init.lua:71: in function <...te/pack/packer/start/heirline.nvim/lua/heirline/init.lua:66>
        [C]: in function 'redrawstatus'
        ...te/pack/packer/start/noice.nvim/lua/noice/util/hacks.lua:267: in function <...te/pack/packer/start/noice.nvim/lua/noice/util/hacks.lua:263>
stack traceback:
        [C]: in function 'redrawstatus'
        ...te/pack/packer/start/noice.nvim/lua/noice/util/hacks.lua:267: in function <...te/pack/packer/start/noice.nvim/lua/noice/util/hacks.lua:263>⏎

Expected Behavior
An error should not be printed and a terminal should not lag.

Screenshots
Not applicable.

Noice Log
Nothing is printed in log.

Minial Configuration

The error appears only with this ScrollBar component.

Config
vim.o.runtimepath = '$VIMRUNTIME'
vim.o.packpath = '/tmp/nvim/site'
local package_root = '/tmp/nvim/site/pack'
local install_path = package_root .. '/packer/start/packer.nvim'
local function load_plugins()
  require('packer').startup({
    {
      { 'wbthomason/packer.nvim' },
      { 'rebelot/kanagawa.nvim' },
      -- plugins
      {
        'folke/noice.nvim',
        requires = 'MunifTanjim/nui.nvim',
        -- commit = '1b2caaa116c13f062b520b28eaa609cc82dabb94', -- <-- previous commit works
      },
      { 'rebelot/heirline.nvim' },
    },
    config = {
      package_root = package_root,
      compile_path = install_path .. '/plugin/packer_compiled.lua',
    },
  })
end
local function load_config()
  vim.opt.termguicolors = true
  vim.cmd.colorscheme('kanagawa')
  -- config
  require('noice').setup({})

  local ScrollBar = {
    static = {
      sbar = { '', '', '', '', '', '', '', '' },
    },
    provider = function(self)
      local curr_line = vim.api.nvim_win_get_cursor(0)[1]
      local lines = vim.api.nvim_buf_line_count(0)
      local i = math.floor((curr_line - 1) / lines * #self.sbar) + 1
      return string.rep(self.sbar[i], 2)
    end,
  }

  local statusline = {
    ScrollBar,
  }

  require('heirline').setup(statusline)
end
if vim.fn.isdirectory(install_path) == 0 then
  print('Installing dependencies.')
  vim.fn.system({
    'git',
    'clone',
    '--depth=1',
    'https://github.com/wbthomason/packer.nvim',
    install_path,
  })
end
load_plugins()
require('packer').sync()
vim.api.nvim_create_autocmd('User', {
  pattern = 'PackerComplete',
  once = true,
  callback = function()
    load_config()
    print('Ready')
  end,
})

Additional Note

Maybe there's something wrong with this component or it is an Heirline issue if so, please, let me know.

@lostl1ght lostl1ght added the bug Something isn't working label Nov 17, 2022
@crivotz
Copy link

crivotz commented Nov 17, 2022

Same in my config here with Feline

Error executing vim.schedule lua callback: ...te/pack/packer/start/noice.nvim/lua/noice/util/hacks.lua:267: Vim:Feline: error while processing statusline component number 8on section 3 of type 'active' for window 1000: ...e/pack/packer/start/feline.nvim/lua/feline/generator.lua:288: bad argument #1 to '?' (string expected, got nil)
stack traceback:
        [C]: in function 'redrawstatus'
        ...te/pack/packer/start/noice.nvim/lua/noice/util/hacks.lua:267: in function <...te/pack/packer/start/noice.nvim/lua/noice/util/hacks.lua:263>%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants