Problem with opening new files when :help
window is opened
#3005
-
DescriptionWhile opening and closing files and Neovim version
Operating system and versionDistro: Linux Mint 21 Vanessa, base: Ubuntu 22.04 jammy Windows variantNo response nvim-tree versionClean room replicationvim.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({})
end
-- UNCOMMENT this block for diagnostics issues, substituting pattern and cmd as appropriate.
-- Requires diagnostics.enable = true in setup.
--[[
vim.api.nvim_create_autocmd("FileType", {
pattern = "lua",
callback = function()
vim.lsp.start {
name = "my-luals",
cmd = { "lua-language-server" },
root_dir = vim.loop.cwd(),
}
end,
})
]] Steps to reproduce
Expected behaviorThe newly opened file should replace the Actual behaviorThe newly opened file opens in a vertical split (either when opening using |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Default vim behaviour is help splitting horizontally above all windows. Have you got any other configuration that places the help window (I do https://github.com/alex-courtis/arch/blob/735510bdd95635e129ce34e072f9f0da4874a977/config/nvim/lua/amc/windows.lua#L144) This doesn't address the issue though. |
Beta Was this translation helpful? Give feedback.
-
nvim-tree won't open files in windows with "special" buffers. See {
filetype = {
"notify",
"packer",
"qf",
"diff",
"fugitive",
"fugitiveblame",
},
buftype = {
"nofile",
"terminal",
"help",
},
} This could be documented better. |
Beta Was this translation helpful? Give feedback.
-
Hello @alex-courtis,
Well, this doesn't seem to be exactly true as I can also create a sequence of actions like this:
And now the newly opened file does actually replace the But back to my original problem, like you have written in your last comment I have removed to help buffer from the list of excluded buffers by adding this to my nvim-tree configuration:
and now everything works precisely as I expected it to. So thank you very much for help, I have solved the problem which I originally had at the beginning. Well, since my problem is solved, should I close this issue now? I don't know, this my first issue ever on GitHub. |
Beta Was this translation helpful? Give feedback.
-
Many thanks for raising and please do continue. I'm moving this to a Q/A discussion, so that others may benefit. In the future, if you have a general question, please ask in there. |
Beta Was this translation helpful? Give feedback.
Hello @alex-courtis,
Well, this doesn't seem to be exactly true as I can also create a sequence of actions like this:
nvim -nu /tmp/nvt-min.lua
:help
to open help and then<C-w>o
to make :help the only window:NvimTreeOpen
to open nvim-tree and open any file by navigating to it and usingEnter
And now the newly opened file does actually replace the
:help
buffer.But back to my original problem, like you have written in your last comment I have removed to help buffer from the list of excluded buffers by adding this to my nvim-tree configuration: