|
71 | 71 | ---@deprecated
|
72 | 72 | M.on_keypress = require("nvim-tree.actions.dispatch").dispatch
|
73 | 73 |
|
74 |
| -function M.toggle(find_file, no_focus, cwd) |
| 74 | +function M.toggle(find_file, no_focus, cwd, bang) |
75 | 75 | if view.is_visible() then
|
76 | 76 | view.close()
|
77 | 77 | else
|
78 | 78 | local previous_buf = api.nvim_get_current_buf()
|
79 | 79 | M.open(cwd)
|
80 | 80 | if _config.update_focused_file.enable or find_file then
|
81 |
| - M.find_file(false, previous_buf) |
| 81 | + M.find_file(false, previous_buf, bang) |
82 | 82 | end
|
83 | 83 | if no_focus then
|
84 | 84 | vim.cmd "noautocmd wincmd p"
|
@@ -310,8 +310,8 @@ local function setup_vim_commands()
|
310 | 310 | M.find_file(true, nil, res.bang)
|
311 | 311 | end, { bang = true, bar = true })
|
312 | 312 | api.nvim_create_user_command("NvimTreeFindFileToggle", function(res)
|
313 |
| - M.toggle(true, false, res.args) |
314 |
| - end, { nargs = "?", complete = "dir" }) |
| 313 | + M.toggle(true, false, res.args, res.bang) |
| 314 | + end, { bang = true, nargs = "?", complete = "dir" }) |
315 | 315 | api.nvim_create_user_command("NvimTreeResize", function(res)
|
316 | 316 | M.resize(res.args)
|
317 | 317 | end, { nargs = 1, bar = true })
|
|
0 commit comments