Closed
Description
- Navigate to my project directory. Nvim-tree displays instead of Netrw(intended behavior)
- Open telescope git_files
- Select file
- Attempt to open nvim-tree
map('n', 'nf', ':NvimTreeFindFile<CR>', { noremap = false, silent = true })
- Receive this error in the command line
...nvim-tree/view.lua:345 Vim:E44: Cannot close last window
However, if I navigate to a file from the root. I am able to toggle nvim-tree fine.
Lua config:
local function setup_nvim_tree()
vim.g.nvim_tree_icons = {
default = "",
git = {
unstaged = "",
staged = "",
unmerged = "",
renamed = "",
untracked = "",
deleted = "",
},
}
vim.g.nvim_tree_special_files = {}
vim.g.nvim_tree_indent_markers = 1
vim.g.nvim_tree_gitignore = 0
vim.g.nvim_tree_highlight_opened_files = 2
vim.g.nvim_tree_ignore = { ".git", "node_modules", ".cache", ".vscode", ".DS_Store", ".un" }
local present, nvimtree = pcall(require, "nvim-tree")
if not present then
return
end
nvimtree.setup({
ignore_ft_on_setup = { "dashboard", "terminal", "quickfix" },
view = {
allow_resize = true,
width = 45,
side = "right",
hide_root_folder = false
},
auto_close = true,
disable_netrw = true,
hijack_cursor = true,
update_cwd = true,
})
end
Lua mappings:
map('n', '<C-n>', ':NvimTreeToggle<CR>', { noremap = true })
map('n', 'nf', ':NvimTreeFindFile<CR>', { noremap = false, silent = true })
map('n', 'nc', ':NvimTreeClose<CR>', { noremap = false, silent = true })
map('n', 'nr', ':NvimTreeRefresh<CR>', { noremap = false, silent = true })
Metadata
Metadata
Assignees
Labels
No labels