-
When I try to open any directory using neovim, nvim-tree is fired up. This is intended. But it takes up the whole neovim window. How can I make nvim-tree opened in regular size instead? |
Beta Was this translation helpful? Give feedback.
Answered by
Rid1FZ
Nov 16, 2024
Replies: 1 comment 5 replies
-
Got the solution. Nvim-tree actually hijacks current window if it is a directory (like netrw does). The default behaviour of Nvim-tree is to occupy the whole window (I don't know why!). So firstly, we need to disable the behaviour of hijacking: hijack_directories = {
enable = false,
auto_open = false,
}, Now to open Nvim-tree when current window/buffer is a directory, we will use an vim.api.nvim_create_autocmd({ "VimEnter" }, {
callback = function(data)
if not (vim.fn.isdirectory(data.file) == 1) then
return
end
vim.cmd.cd(data.file)
require("nvim-tree.api").tree.open()
end,
}) |
Beta Was this translation helpful? Give feedback.
5 replies
Answer selected by
Rid1FZ
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Got the solution. Nvim-tree actually hijacks current window if it is a directory (like netrw does). The default behaviour of Nvim-tree is to occupy the whole window (I don't know why!). So firstly, we need to disable the behaviour of hijacking:
Now to open Nvim-tree when current window/buffer is a directory, we will use an
autocommand
: