Skip to content

Nvim freezes when i disable git files #2938

@AlejandroSanchez90

Description

@AlejandroSanchez90

Description

im working on a monorepo app, if i set use this config

			git = {
				enable = false,
			},

then each time i open nvim tree and open a file or folder using nvim tree, then after i quit it will hang for around 20 to 30 secs, opening the file with a picker like fzflua or telescope does work fine, so in the meantime i enabled git to be able to quit, but i do need to see my env files and some other ignored files whiile working

Neovim version

NVIM v0.10.1
Build type: Release
LuaJIT 2.1.1724232689

Operating system and version

MacOs Sonoma 14.6.1

Windows variant

No response

nvim-tree version

latest

Clean room replication

return {
	"nvim-tree/nvim-tree.lua",
	dependencies = "nvim-tree/nvim-web-devicons",
	config = function()
		local nvimtree = require("nvim-tree")

		-- recommended settings from nvim-tree documentation
		vim.g.loaded_netrw = 1
		vim.g.loaded_netrwPlugin = 1

		nvimtree.setup({
			view = {},
			-- change folder arrow icons
			renderer = {
				indent_markers = {
					enable = true,
				},
				icons = {
					glyphs = {
						folder = {
							-- arrow_closed = "", -- arrow when folder is closed
							-- arrow_open = "", -- arrow when folder is open
						},
					},
				},
			},
			-- disable window_picker for
			-- explorer to work well with
			-- window splits
			actions = {
				open_file = {
					window_picker = {
						enable = false,
					},
				},
			},
			filters = {
				custom = { ".DS_Store" },
			},
			git = {
				enable = false,
			},
		})

		-- set keymaps
		local keymap = vim.keymap -- for conciseness

		keymap.set("n", "<leader>ee", "<cmd>NvimTreeToggle<CR>", { desc = "Toggle file explorer" }) -- toggle file explorer
		keymap.set("n", "<leader>ef", "<cmd>NvimTreeFindFile<CR>", { desc = "Toggle file explorer on current file" }) -- toggle file explorer on current file
		keymap.set("n", "<leader>ec", "<cmd>NvimTreeCollapse<CR>", { desc = "Collapse file explorer" }) -- collapse file explorer
		keymap.set("n", "<leader>er", "<cmd>NvimTreeRefresh<CR>", { desc = "Refresh file explorer" }) -- refresh file explorer
		keymap.set("n", "<leader>el", "<cmd>NvimTreeResize +20<CR>", { desc = "Increase size" }) -- refresh file explorer
		keymap.set("n", "<leader>eh", "<cmd>NvimTreeResize -20<CR>", { desc = "Decrease size" }) -- refresh file explorer
	end,
}

Steps to reproduce

all i do is enter nvim, open nvim-tree, open a folder or file, ex package.json, then :q, and neovim hangs in there for 1~ min

Expected behavior

No response

Actual behavior

No response

Activity

alex-courtis

alex-courtis commented on Oct 5, 2024

@alex-courtis
Member

Hypothesis: when git is enabled, .gitignore is read and those files are not enumerated. When disabled, all files such as node_modules or target are enumerated.

Please provide diagnostic/performance logs: https://github.com/nvim-tree/nvim-tree.lua/wiki/Troubleshooting#diagnostic-logging

I imagine these might be private so you may want to sanitize them before posting.

Alternatively, try reproducing via the massive react facebook example react app: #1931

AlejandroSanchez90

AlejandroSanchez90 commented on Oct 5, 2024

@AlejandroSanchez90
Author
alex-courtis

alex-courtis commented on Oct 5, 2024

@alex-courtis
Member

fzf ended up hard-coding them: junegunn/fzf#3649

I'm tempted to do the same. Which ignore list did you add them to?

AlejandroSanchez90

AlejandroSanchez90 commented on Oct 5, 2024

@AlejandroSanchez90
Author

fzf ended up hard-coding them: junegunn/fzf#3649

I'm tempted to do the same. Which ignore list did you add them to?

https://github.com/AlejandroSanchez90/dotfiles/blob/main/dot_config%2Fnvim%2Flua%2Falex%2Fplugins%2Fnvim-tree.lua#L43-L46

added a commit that references this issue on Oct 5, 2024
added 3 commits that reference this issue on Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    performanceperformance enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @alex-courtis@AlejandroSanchez90

      Issue actions

        Nvim freezes when i disable git files · Issue #2938 · nvim-tree/nvim-tree.lua