From 080c86618f450dc0a98823b22b4f415d243bfa02 Mon Sep 17 00:00:00 2001 From: rickysaurav Date: Sat, 20 Jun 2020 03:08:37 +0530 Subject: [PATCH] Add option for disabling bindings --- README.md | 6 ++++++ doc/nvim-tree-lua.txt | 7 +++++++ lua/lib/lib.lua | 4 ++++ 3 files changed, 17 insertions(+) diff --git a/README.md b/README.md index 2ddce829..e3de66d8 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,12 @@ let g:lua_tree_bindings = { \ 'edit_tab': '', \ 'preview': '', \ 'cd': '', + } + +" Disable default mappings by plugin +" Bindings are enable by default, disabled on any non-zero value +" let lua_tree_disable_keybindings=1 + " default will show icon by default if no icon is provided " default shows no icon by default let g:lua_tree_icons = { diff --git a/doc/nvim-tree-lua.txt b/doc/nvim-tree-lua.txt index 3c2c2288..411276df 100644 --- a/doc/nvim-tree-lua.txt +++ b/doc/nvim-tree-lua.txt @@ -115,6 +115,13 @@ Can be `0` or `1`. When `1`, will bind |BufEnter| to automatically close the tree if it's the last window. Default is 0 +|g:lua_tree_disable_keybindings| *g:lua_tree_disable_keybindings* + +Can be `0` or `1`. When `1`, will disable all keybindings by the plugin. +|g:lua_tree_bindings| as well as default bindings will not take effect. +Default is 0 + + ============================================================================== INFORMATIONS *nvim-tree-info* diff --git a/lua/lib/lib.lua b/lua/lib/lib.lua index 0850aed8..576c2202 100644 --- a/lua/lib/lib.lua +++ b/lua/lib/lib.lua @@ -195,6 +195,10 @@ function M.change_dir(foldername) end local function set_mappings() + if vim.g.lua_tree_disable_keybindings == 1 then + return + end + local buf = M.Tree.bufnr local bindings = config.get_bindings()