From bafee954acabdc72874c107d99b66830bd044569 Mon Sep 17 00:00:00 2001 From: Santos Gallegos Date: Sun, 2 Aug 2020 11:05:05 -0500 Subject: [PATCH] KeyBindings: add refresh --- doc/nvim-tree-lua.txt | 55 ++++++++++++++++++++++--------------------- lua/lib/config.lua | 1 + lua/lib/lib.lua | 1 + lua/tree.lua | 1 + 4 files changed, 31 insertions(+), 27 deletions(-) diff --git a/doc/nvim-tree-lua.txt b/doc/nvim-tree-lua.txt index 744e4ab9..70188361 100644 --- a/doc/nvim-tree-lua.txt +++ b/doc/nvim-tree-lua.txt @@ -41,7 +41,7 @@ refresh the tree The command will change the cursor in the tree for the current bufname. -It will also open the leafs of the tree leading to the file in the buffer +It will also open the leafs of the tree leading to the file in the buffer (if you opened a file with something else than the LuaTree, like `fzf` or `:split`) @@ -156,6 +156,7 @@ INFORMATIONS *nvim-tree-info* - '' will open the file in a new tab - '' will open the file as a preview (keeps the cursor in the tree) - 'I' will toggle visibility of folders hidden via |g:lua_tree_ignore| +- 'R' will refresh the tree - 'gx' opens the file with the `open` command on macos and `xdg-open` on linux. @@ -222,36 +223,36 @@ You should have 'termguicolors' enabled, otherwise, colors will not be applied. LuaTreeSymlink -LuaTreeFolderName -LuaTreeFolderIcon -LuaTreeExecFile -LuaTreeSpecialFile -LuaTreeImageFile -LuaTreeMarkdownFile +LuaTreeFolderName +LuaTreeFolderIcon +LuaTreeExecFile +LuaTreeSpecialFile +LuaTreeImageFile +LuaTreeMarkdownFile LuaTreeIndentMarker -LuaTreeLicenseIcon -LuaTreeYamlIcon -LuaTreeTomlIcon -LuaTreeGitignoreIcon -LuaTreeJsonIcon +LuaTreeLicenseIcon +LuaTreeYamlIcon +LuaTreeTomlIcon +LuaTreeGitignoreIcon +LuaTreeJsonIcon -LuaTreeLuaIcon -LuaTreePythonIcon -LuaTreeShellIcon -LuaTreeJavascriptIcon -LuaTreeCIcon -LuaTreeReactIcon -LuaTreeHtmlIcon -LuaTreeRustIcon -LuaTreeVimIcon -LuaTreeTypescriptIcon +LuaTreeLuaIcon +LuaTreePythonIcon +LuaTreeShellIcon +LuaTreeJavascriptIcon +LuaTreeCIcon +LuaTreeReactIcon +LuaTreeHtmlIcon +LuaTreeRustIcon +LuaTreeVimIcon +LuaTreeTypescriptIcon -LuaTreeGitDirty -LuaTreeGitStaged -LuaTreeGitMerge -LuaTreeGitRenamed -LuaTreeGitNew +LuaTreeGitDirty +LuaTreeGitStaged +LuaTreeGitMerge +LuaTreeGitRenamed +LuaTreeGitNew There are also links to normal bindings to style the tree itself. diff --git a/lua/lib/config.lua b/lua/lib/config.lua index 0e8e262c..91fd7597 100644 --- a/lua/lib/config.lua +++ b/lua/lib/config.lua @@ -51,6 +51,7 @@ function M.get_bindings() edit_tab = keybindings.edit_tab or '', preview = keybindings.preview or '', toggle_ignored = keybindings.toggle_ignored or 'I', + refresh = keybindings.refresh or 'R', cd = keybindings.cd or '', create = keybindings.create or 'a', remove = keybindings.remove or 'd', diff --git a/lua/lib/lib.lua b/lua/lib/lib.lua index 9fd095d9..a3bb530d 100644 --- a/lua/lib/lib.lua +++ b/lua/lib/lib.lua @@ -212,6 +212,7 @@ local function set_mappings() [bindings.edit_split] = 'on_keypress("split")'; [bindings.edit_tab] = 'on_keypress("tabnew")'; [bindings.toggle_ignored] = 'on_keypress("toggle_ignored")'; + [bindings.refresh] = 'on_keypress("refresh")'; [bindings.create] = 'on_keypress("create")'; [bindings.remove] = 'on_keypress("remove")'; [bindings.rename] = 'on_keypress("rename")'; diff --git a/lua/tree.lua b/lua/tree.lua index 9dd1cd25..64ea5097 100644 --- a/lua/tree.lua +++ b/lua/tree.lua @@ -46,6 +46,7 @@ local keypress_funcs = { cut = fs.cut, paste = fs.paste, toggle_ignored = lib.toggle_ignored, + refresh = lib.refresh_tree, prev_git_item = gen_go_to('prev_git_item'), next_git_item = gen_go_to('next_git_item'), preview = function(node)