Skip to content

Commit 37748e7

Browse files
Merge branch 'master' into feature/cut-copy-paste
2 parents 9b20fcb + 8e0eff2 commit 37748e7

File tree

6 files changed

+36
-20
lines changed

6 files changed

+36
-20
lines changed

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,13 @@ let g:lua_tree_show_icons = {
4444
" You don't have to define all keys.
4545
" NOTE: the 'edit' key will wrap/unwrap a folder and open a file
4646
let g:lua_tree_bindings = {
47-
\ 'edit': '<CR>',
48-
\ 'edit_vsplit': '<C-v>',
49-
\ 'edit_split': '<C-x>',
50-
\ 'edit_tab': '<C-t>',
51-
\ 'preview': '<Tab>',
52-
\ 'cd': '<C-]>',
47+
\ 'edit': '<CR>',
48+
\ 'edit_vsplit': '<C-v>',
49+
\ 'edit_split': '<C-x>',
50+
\ 'edit_tab': '<C-t>',
51+
\ 'toggle_ignored': 'I',
52+
\ 'preview': '<Tab>',
53+
\ 'cd': '<C-]>',
5354
}
5455
5556
" Disable default mappings by plugin
@@ -102,6 +103,7 @@ highlight LuaTreeFolderIcon guibg=blue
102103
- `<C-x>` will open the file in a horizontal split
103104
- `<C-t>` will open the file in a new tab
104105
- `<Tab>` will open the file as a preview (keeps the cursor in the tree)
106+
- `I` will toggle visibility of folders hidden via |g:lua_tree_ignore|
105107
- `gx` opens the file with the `open` command on MACOS and `xdg-open` in linux
106108
- Double left click acts like `<CR>`
107109
- Double right click acts like `<C-]>`

doc/nvim-tree-lua.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ INFORMATIONS *nvim-tree-info*
149149
- '<C-x>' will open the file in a horizontal split
150150
- '<C-t>' will open the file in a new tab
151151
- '<Tab>' will open the file as a preview (keeps the cursor in the tree)
152+
- 'I' will toggle visibility of folders hidden via |g:lua_tree_ignore|
152153
- 'gx' opens the file with the `open` command on macos and `xdg-open`
153154
on linux.
154155

lua/lib/config.lua

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,19 @@ end
4545
function M.get_bindings()
4646
local keybindings = vim.g.lua_tree_bindings or {}
4747
return {
48-
edit = keybindings.edit or '<CR>',
49-
edit_vsplit = keybindings.edit_vsplit or '<C-v>',
50-
edit_split = keybindings.edit_split or '<C-x>',
51-
edit_tab = keybindings.edit_tab or '<C-t>',
52-
preview = keybindings.preview or '<Tab>',
53-
cd = keybindings.cd or '<C-]>',
54-
create = keybindings.create or 'a',
55-
remove = keybindings.remove or 'd',
56-
rename = keybindings.rename or 'r',
57-
cut = keybindings.cut or 'x',
58-
copy = keybindings.copy or 'c',
59-
paste = keybindings.paste or 'p',
48+
edit = keybindings.edit or '<CR>',
49+
edit_vsplit = keybindings.edit_vsplit or '<C-v>',
50+
edit_split = keybindings.edit_split or '<C-x>',
51+
edit_tab = keybindings.edit_tab or '<C-t>',
52+
preview = keybindings.preview or '<Tab>',
53+
toggle_ignored = keybindings.toggle_ignored or 'I',
54+
cd = keybindings.cd or '<C-]>',
55+
create = keybindings.create or 'a',
56+
remove = keybindings.remove or 'd',
57+
rename = keybindings.rename or 'r',
58+
cut = keybindings.cut or 'x',
59+
copy = keybindings.copy or 'c',
60+
paste = keybindings.paste or 'p',
6061
}
6162
end
6263

lua/lib/lib.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ local function set_mappings()
205205
[bindings.edit_vsplit] = 'on_keypress("vsplit")';
206206
[bindings.edit_split] = 'on_keypress("split")';
207207
[bindings.edit_tab] = 'on_keypress("tabnew")';
208+
[bindings.toggle_ignored] = 'on_keypress("toggle_ignored")';
208209
[bindings.create] = 'on_keypress("create")';
209210
[bindings.remove] = 'on_keypress("remove")';
210211
[bindings.rename] = 'on_keypress("rename")';
@@ -281,4 +282,9 @@ function M.win_open()
281282
return false
282283
end
283284

285+
function M.toggle_ignored()
286+
pops.show_ignored = not pops.show_ignored
287+
return M.refresh_tree()
288+
end
289+
284290
return M

lua/lib/populate.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ local icon_config = config.get_icon_state()
55
local api = vim.api
66
local luv = vim.loop
77

8-
local M = {}
8+
local M = {
9+
show_ignored = false
10+
}
911

1012
local path_to_matching_str = require'lib.utils'.path_to_matching_str
1113

@@ -63,7 +65,7 @@ local function gen_ignore_check()
6365
end
6466

6567
return function(path)
66-
return ignore_list[path] == true
68+
return not M.show_ignored and ignore_list[path] == true
6769
end
6870
end
6971

lua/tree.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ function M.on_keypress(mode)
5151
return lib.open_file(mode, node.absolute_path)
5252
end
5353

54+
if mode == 'toggle_ignored' then
55+
return lib.toggle_ignored()
56+
end
57+
5458
if node.name == ".." then
5559
return lib.change_dir("..")
5660
elseif mode == "cd" and node.entries ~= nil then

0 commit comments

Comments
 (0)