Add a mode that allows edit without the picker (#873)
This commit is contained in:
parent
1ac3502290
commit
14bdf134f9
@ -243,6 +243,7 @@ These are the default bindings:
|
|||||||
-- default mappings
|
-- default mappings
|
||||||
local list = {
|
local list = {
|
||||||
{ key = {"<CR>", "o", "<2-LeftMouse>"}, action = "edit" },
|
{ key = {"<CR>", "o", "<2-LeftMouse>"}, action = "edit" },
|
||||||
|
{ key = {"O"}, action = tree_cb("edit_no_picker") },
|
||||||
{ key = {"<2-RightMouse>", "<C-]>"}, action = "cd" },
|
{ key = {"<2-RightMouse>", "<C-]>"}, action = "cd" },
|
||||||
{ key = "<C-v>", action = "vsplit" },
|
{ key = "<C-v>", action = "vsplit" },
|
||||||
{ key = "<C-x>", action = "split" },
|
{ key = "<C-x>", action = "split" },
|
||||||
|
|||||||
@ -579,6 +579,7 @@ Defaults to:
|
|||||||
lua <<EOF
|
lua <<EOF
|
||||||
local list = {
|
local list = {
|
||||||
{ key = {"<CR>", "o", "<2-LeftMouse>"}, action = "edit" },
|
{ key = {"<CR>", "o", "<2-LeftMouse>"}, action = "edit" },
|
||||||
|
{ key = {"O"}, action = tree_cb("edit_no_picker") },
|
||||||
{ key = {"<2-RightMouse>", "<C-]>"}, action = "cd" },
|
{ key = {"<2-RightMouse>", "<C-]>"}, action = "cd" },
|
||||||
{ key = "<C-v>", action = "vsplit" },
|
{ key = "<C-v>", action = "vsplit" },
|
||||||
{ key = "<C-x>", action = "split" },
|
{ key = "<C-x>", action = "split" },
|
||||||
@ -621,11 +622,11 @@ The `list` option in `view.mappings.list` is a table of
|
|||||||
>
|
>
|
||||||
lua <<EOF
|
lua <<EOF
|
||||||
local tree_cb = require'nvim-tree.config'.nvim_tree_callback
|
local tree_cb = require'nvim-tree.config'.nvim_tree_callback
|
||||||
|
|
||||||
local function print_node_path(node) {
|
local function print_node_path(node) {
|
||||||
print(node.absolute_path)
|
print(node.absolute_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
local list = {
|
local list = {
|
||||||
{ key = {"<CR>", "o" }, action = "edit", mode = "n"},
|
{ key = {"<CR>", "o" }, action = "edit", mode = "n"},
|
||||||
{ key = "p", action = "print_path", action_cb = print_node_path },
|
{ key = "p", action = "print_path", action_cb = print_node_path },
|
||||||
|
|||||||
@ -8,6 +8,7 @@ local nvim_tree_callback = require'nvim-tree.config'.nvim_tree_callback
|
|||||||
local M = {
|
local M = {
|
||||||
mappings = {
|
mappings = {
|
||||||
{ key = {"<CR>", "o", "<2-LeftMouse>"}, action = "edit" },
|
{ key = {"<CR>", "o", "<2-LeftMouse>"}, action = "edit" },
|
||||||
|
{ key = {"O"}, action = nvim_tree_callback("edit_no_picker") },
|
||||||
{ key = {"<2-RightMouse>", "<C-]>"}, action = "cd" },
|
{ key = {"<2-RightMouse>", "<C-]>"}, action = "cd" },
|
||||||
{ key = "<C-v>", action = "vsplit" },
|
{ key = "<C-v>", action = "vsplit" },
|
||||||
{ key = "<C-x>", action = "split"},
|
{ key = "<C-x>", action = "split"},
|
||||||
|
|||||||
@ -131,7 +131,7 @@ function M.fn(mode, filename)
|
|||||||
local win_ids = api.nvim_tabpage_list_wins(tabpage)
|
local win_ids = api.nvim_tabpage_list_wins(tabpage)
|
||||||
|
|
||||||
local target_winid
|
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
|
target_winid = lib.Tree.target_winid
|
||||||
else
|
else
|
||||||
target_winid = pick_window()
|
target_winid = pick_window()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user