Add mapping for toggling ignored folders visibility.
This commit is contained in:
@@ -48,6 +48,7 @@ let g:lua_tree_bindings = {
|
|||||||
\ 'edit_vsplit': '<C-v>',
|
\ 'edit_vsplit': '<C-v>',
|
||||||
\ 'edit_split': '<C-x>',
|
\ 'edit_split': '<C-x>',
|
||||||
\ 'edit_tab': '<C-t>',
|
\ 'edit_tab': '<C-t>',
|
||||||
|
\ 'toggle_ignored': 'I',
|
||||||
\ 'preview': '<Tab>',
|
\ 'preview': '<Tab>',
|
||||||
\ 'cd': '<C-]>',
|
\ 'cd': '<C-]>',
|
||||||
}
|
}
|
||||||
@@ -99,6 +100,7 @@ highlight LuaTreeFolderIcon guibg=blue
|
|||||||
- `<C-x>` will open the file in a horizontal split
|
- `<C-x>` will open the file in a horizontal split
|
||||||
- `<C-t>` will open the file in a new tab
|
- `<C-t>` will open the file in a new tab
|
||||||
- `<Tab>` will open the file as a preview (keeps the cursor in the tree)
|
- `<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|
|
||||||
- `gx` opens the file with the `open` command on MACOS and `xdg-open` in linux
|
- `gx` opens the file with the `open` command on MACOS and `xdg-open` in linux
|
||||||
- Double left click acts like `<CR>`
|
- Double left click acts like `<CR>`
|
||||||
- Double right click acts like `<C-]>`
|
- Double right click acts like `<C-]>`
|
||||||
|
|||||||
@@ -145,6 +145,7 @@ INFORMATIONS *nvim-tree-info*
|
|||||||
- '<C-x>' will open the file in a horizontal split
|
- '<C-x>' will open the file in a horizontal split
|
||||||
- '<C-t>' will open the file in a new tab
|
- '<C-t>' will open the file in a new tab
|
||||||
- '<Tab>' will open the file as a preview (keeps the cursor in the tree)
|
- '<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|
|
||||||
- 'gx' opens the file with the `open` command on macos and `xdg-open`
|
- 'gx' opens the file with the `open` command on macos and `xdg-open`
|
||||||
on linux.
|
on linux.
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ function M.get_bindings()
|
|||||||
edit_split = keybindings.edit_split or '<C-x>',
|
edit_split = keybindings.edit_split or '<C-x>',
|
||||||
edit_tab = keybindings.edit_tab or '<C-t>',
|
edit_tab = keybindings.edit_tab or '<C-t>',
|
||||||
preview = keybindings.preview or '<Tab>',
|
preview = keybindings.preview or '<Tab>',
|
||||||
|
toggle_ignored = keybindings.toggle_ignored or 'I',
|
||||||
cd = keybindings.cd or '<C-]>',
|
cd = keybindings.cd or '<C-]>',
|
||||||
create = keybindings.create or 'a',
|
create = keybindings.create or 'a',
|
||||||
remove = keybindings.remove or 'd',
|
remove = keybindings.remove or 'd',
|
||||||
|
|||||||
@@ -205,6 +205,7 @@ local function set_mappings()
|
|||||||
[bindings.edit_vsplit] = 'on_keypress("vsplit")';
|
[bindings.edit_vsplit] = 'on_keypress("vsplit")';
|
||||||
[bindings.edit_split] = 'on_keypress("split")';
|
[bindings.edit_split] = 'on_keypress("split")';
|
||||||
[bindings.edit_tab] = 'on_keypress("tabnew")';
|
[bindings.edit_tab] = 'on_keypress("tabnew")';
|
||||||
|
[bindings.toggle_ignored] = 'on_keypress("toggle_ignored")';
|
||||||
[bindings.create] = 'on_keypress("create")';
|
[bindings.create] = 'on_keypress("create")';
|
||||||
[bindings.remove] = 'on_keypress("remove")';
|
[bindings.remove] = 'on_keypress("remove")';
|
||||||
[bindings.rename] = 'on_keypress("rename")';
|
[bindings.rename] = 'on_keypress("rename")';
|
||||||
@@ -278,4 +279,9 @@ function M.win_open()
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M.toggle_ignored()
|
||||||
|
pops.show_ignored = not pops.show_ignored
|
||||||
|
return M.refresh_tree()
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ local icon_config = config.get_icon_state()
|
|||||||
local api = vim.api
|
local api = vim.api
|
||||||
local luv = vim.loop
|
local luv = vim.loop
|
||||||
|
|
||||||
local M = {}
|
local M = {
|
||||||
|
show_ignored = false
|
||||||
|
}
|
||||||
|
|
||||||
local path_to_matching_str = require'lib.utils'.path_to_matching_str
|
local path_to_matching_str = require'lib.utils'.path_to_matching_str
|
||||||
|
|
||||||
@@ -63,7 +65,7 @@ local function gen_ignore_check()
|
|||||||
end
|
end
|
||||||
|
|
||||||
return function(path)
|
return function(path)
|
||||||
return ignore_list[path] == true
|
return not M.show_ignored and ignore_list[path] == true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,10 @@ function M.on_keypress(mode)
|
|||||||
return lib.open_file(mode, node.absolute_path)
|
return lib.open_file(mode, node.absolute_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if mode == 'toggle_ignored' then
|
||||||
|
return lib.toggle_ignored()
|
||||||
|
end
|
||||||
|
|
||||||
if node.name == ".." then
|
if node.name == ".." then
|
||||||
return lib.change_dir("..")
|
return lib.change_dir("..")
|
||||||
elseif mode == "cd" and node.entries ~= nil then
|
elseif mode == "cd" and node.entries ~= nil then
|
||||||
|
|||||||
Reference in New Issue
Block a user