diff --git a/README.md b/README.md index 34dc5f44..2a1945b6 100644 --- a/README.md +++ b/README.md @@ -243,6 +243,7 @@ These are the default bindings: -- default mappings local list = { { key = {"", "o", "<2-LeftMouse>"}, action = "edit" }, + { key = {"O"}, action = tree_cb("edit_no_picker") }, { key = {"<2-RightMouse>", ""}, action = "cd" }, { key = "", action = "vsplit" }, { key = "", action = "split" }, diff --git a/doc/nvim-tree-lua.txt b/doc/nvim-tree-lua.txt index 5abd9216..301fd2a4 100644 --- a/doc/nvim-tree-lua.txt +++ b/doc/nvim-tree-lua.txt @@ -579,6 +579,7 @@ Defaults to: lua <", "o", "<2-LeftMouse>"}, action = "edit" }, + { key = {"O"}, action = tree_cb("edit_no_picker") }, { key = {"<2-RightMouse>", ""}, action = "cd" }, { key = "", action = "vsplit" }, { key = "", action = "split" }, @@ -621,11 +622,11 @@ The `list` option in `view.mappings.list` is a table of > lua <", "o" }, action = "edit", mode = "n"}, { key = "p", action = "print_path", action_cb = print_node_path }, diff --git a/lua/nvim-tree/actions/init.lua b/lua/nvim-tree/actions/init.lua index a11243a8..f124c98a 100644 --- a/lua/nvim-tree/actions/init.lua +++ b/lua/nvim-tree/actions/init.lua @@ -8,6 +8,7 @@ local nvim_tree_callback = require'nvim-tree.config'.nvim_tree_callback local M = { mappings = { { key = {"", "o", "<2-LeftMouse>"}, action = "edit" }, + { key = {"O"}, action = nvim_tree_callback("edit_no_picker") }, { key = {"<2-RightMouse>", ""}, action = "cd" }, { key = "", action = "vsplit" }, { key = "", action = "split"}, diff --git a/lua/nvim-tree/actions/open-file.lua b/lua/nvim-tree/actions/open-file.lua index 2df13fc5..9fe64d15 100644 --- a/lua/nvim-tree/actions/open-file.lua +++ b/lua/nvim-tree/actions/open-file.lua @@ -131,7 +131,7 @@ function M.fn(mode, filename) local win_ids = api.nvim_tabpage_list_wins(tabpage) local target_winid - if vim.g.nvim_tree_disable_window_picker == 1 then + if vim.g.nvim_tree_disable_window_picker == 1 or mode == "edit_no_picker" then target_winid = lib.Tree.target_winid else target_winid = pick_window()