Skip to content

feat: add actions.open_file.eject #2341

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion doc/nvim-tree-lua.txt
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ applying configuration.
},
open_file = {
quit_on_open = false,
eject = true,
resize_window = true,
window_picker = {
enable = true,
Expand Down Expand Up @@ -1203,9 +1204,12 @@ Configuration for various actions.

*nvim-tree.actions.open_file.quit_on_open*
Closes the explorer when opening a file.
It will also disable preventing a buffer overriding the tree.
Type: `boolean`, Default: `false`

*nvim-tree.actions.open_file.eject*
Prevent new opened file from opening in the same window as the tree.
Type: `boolean`, Default: `true`

*nvim-tree.actions.open_file.resize_window* (previously `view.auto_resize`)
Resizes the tree when opening a file.
Type: `boolean`, Default: `true`
Expand Down
3 changes: 2 additions & 1 deletion lua/nvim-tree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ local function setup_autocommands(opts)
create_nvim_tree_autocmd("BufWipeout", {
pattern = "NvimTree_*",
callback = function()
if utils.is_nvim_tree_buf(0) then
if utils.is_nvim_tree_buf(0) and opts.actions.open_file.eject then
view._prevent_buffer_override()
end
end,
Expand Down Expand Up @@ -545,6 +545,7 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS
},
open_file = {
quit_on_open = false,
eject = true,
resize_window = true,
window_picker = {
enable = true,
Expand Down