Add option for disabling bindings

This commit is contained in:
rickysaurav 2020-06-20 03:08:37 +05:30
parent fbe5d6d1f7
commit 080c86618f
3 changed files with 17 additions and 0 deletions

View File

@ -49,6 +49,12 @@ let g:lua_tree_bindings = {
\ 'edit_tab': '<C-t>', \ 'edit_tab': '<C-t>',
\ 'preview': '<Tab>', \ 'preview': '<Tab>',
\ 'cd': '<C-]>', \ 'cd': '<C-]>',
}
" 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 will show icon by default if no icon is provided
" default shows no icon by default " default shows no icon by default
let g:lua_tree_icons = { let g:lua_tree_icons = {

View File

@ -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. close the tree if it's the last window.
Default is 0 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* INFORMATIONS *nvim-tree-info*

View File

@ -195,6 +195,10 @@ function M.change_dir(foldername)
end end
local function set_mappings() local function set_mappings()
if vim.g.lua_tree_disable_keybindings == 1 then
return
end
local buf = M.Tree.bufnr local buf = M.Tree.bufnr
local bindings = config.get_bindings() local bindings = config.get_bindings()