-
-
Notifications
You must be signed in to change notification settings - Fork 629
feat: add option to set last active window as target for file actions #3008
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -232,6 +232,17 @@ local function setup_autocommands(opts) | |
end, | ||
}) | ||
end | ||
|
||
if opts.actions.set_last_win_as_target then | ||
create_nvim_tree_autocmd("BufLeave", { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please avoid autocommands; this should be done in |
||
callback = function() | ||
local buf_name = vim.api.nvim_buf_get_name(0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. bufnr / bufname should come from the |
||
if not string.find(buf_name, "NvimTree_") then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
require("nvim-tree.lib").set_target_win() | ||
end | ||
end, | ||
}) | ||
end | ||
end | ||
|
||
local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS | ||
|
@@ -429,6 +440,7 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS | |
}, | ||
actions = { | ||
use_system_clipboard = true, | ||
set_last_win_as_target = true, | ||
change_dir = { | ||
enable = true, | ||
global = false, | ||
|
@@ -490,8 +502,7 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS | |
default_yes = false, | ||
}, | ||
}, | ||
experimental = { | ||
}, | ||
experimental = {}, | ||
log = { | ||
enable = false, | ||
truncate = false, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be a change to existing behaviour; we'll need to default to false.