Skip to content

Very slow on exit neovim #2438

Closed
Closed
@overcache

Description

@overcache

Description

I've noticed that when I exit Neovim, it's extremely slow, often hanging on the :qa command for 5 seconds or even longer before the Neovim instance finally quits. After individually removing plugins, I eventually identified that nvim-tree was the cause of this issue.

Neovim version

NVIM v0.9.2
Build type: Release
LuaJIT 2.1.0-beta3

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/Cellar/neovim/0.9.2/share/nvim"

Run :checkhealth for more info

Operating system and version

macOS12.1, Darwin macbox.local 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 20:28:54 PST 2021; root:xnu-8019.61.5~1/RELEASE_X86_64 x86_64

nvim-tree version

934469b

Clean room replication

vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1

vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvt-min/site]]
local package_root = "/tmp/nvt-min/site/pack"
local install_path = package_root .. "/packer/start/packer.nvim"
local function load_plugins()
  require("packer").startup {
    {
      "wbthomason/packer.nvim",
      "nvim-tree/nvim-tree.lua",
      "nvim-tree/nvim-web-devicons",
      -- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
    },
    config = {
      package_root = package_root,
      compile_path = install_path .. "/plugin/packer_compiled.lua",
      display = { non_interactive = true },
    },
  }
end
if vim.fn.isdirectory(install_path) == 0 then
  print "Installing nvim-tree and dependencies."
  vim.fn.system { "git", "clone", "--depth=1", "https://github.com/wbthomason/packer.nvim", install_path }
end
load_plugins()
require("packer").sync()
vim.cmd [[autocmd User PackerComplete ++once echo "Ready!" | lua setup()]]
vim.opt.termguicolors = true
vim.opt.cursorline = true

-- MODIFY NVIM-TREE SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
_G.setup = function()
  require("nvim-tree").setup {
        -- copy form 'ahmedkhalf/project.nvim'
      sync_root_with_cwd = true,
      respect_buf_cwd = true,
      update_focused_file = {
        enable = true,
        -- update_root = true
      },
      --

      disable_netrw = true,
      view = { number = false, },
      git = { ignore = false },
      renderer = {
        add_trailing = true,
      },
      }
end

Steps to reproduce

  1. cd to some Project: cd webpack
  2. nvim -nu /tmp/nvt-min.lua
  3. open some file: :e package.json
  4. :NvimTreeFindFile
  5. open some file in deep dir: :e node_modules/semver/bin/semver.js
  6. quit: :qa, neovim will hang 3~5 seconds

Expected behavior

:qa execute then neovim quit quickly.

Actual behavior

quit: :qa, neovim will hang 3~5 seconds

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS macOSspecific to macOSbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions