Merge branch 'master' into feature/cut-copy-paste

This commit is contained in:
Kristijan Husak 2020-07-20 17:59:15 +02:00 committed by GitHub
commit 37748e7c97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 36 additions and 20 deletions

View File

@ -48,6 +48,7 @@ let g:lua_tree_bindings = {
\ 'edit_vsplit': '<C-v>',
\ 'edit_split': '<C-x>',
\ 'edit_tab': '<C-t>',
\ 'toggle_ignored': 'I',
\ 'preview': '<Tab>',
\ 'cd': '<C-]>',
}
@ -102,6 +103,7 @@ highlight LuaTreeFolderIcon guibg=blue
- `<C-x>` will open the file in a horizontal split
- `<C-t>` will open the file in a new tab
- `<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
- Double left click acts like `<CR>`
- Double right click acts like `<C-]>`

View File

@ -149,6 +149,7 @@ INFORMATIONS *nvim-tree-info*
- '<C-x>' will open the file in a horizontal split
- '<C-t>' will open the file in a new tab
- '<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`
on linux.

View File

@ -50,6 +50,7 @@ function M.get_bindings()
edit_split = keybindings.edit_split or '<C-x>',
edit_tab = keybindings.edit_tab or '<C-t>',
preview = keybindings.preview or '<Tab>',
toggle_ignored = keybindings.toggle_ignored or 'I',
cd = keybindings.cd or '<C-]>',
create = keybindings.create or 'a',
remove = keybindings.remove or 'd',

View File

@ -205,6 +205,7 @@ local function set_mappings()
[bindings.edit_vsplit] = 'on_keypress("vsplit")';
[bindings.edit_split] = 'on_keypress("split")';
[bindings.edit_tab] = 'on_keypress("tabnew")';
[bindings.toggle_ignored] = 'on_keypress("toggle_ignored")';
[bindings.create] = 'on_keypress("create")';
[bindings.remove] = 'on_keypress("remove")';
[bindings.rename] = 'on_keypress("rename")';
@ -281,4 +282,9 @@ function M.win_open()
return false
end
function M.toggle_ignored()
pops.show_ignored = not pops.show_ignored
return M.refresh_tree()
end
return M

View File

@ -5,7 +5,9 @@ local icon_config = config.get_icon_state()
local api = vim.api
local luv = vim.loop
local M = {}
local M = {
show_ignored = false
}
local path_to_matching_str = require'lib.utils'.path_to_matching_str
@ -63,7 +65,7 @@ local function gen_ignore_check()
end
return function(path)
return ignore_list[path] == true
return not M.show_ignored and ignore_list[path] == true
end
end

View File

@ -51,6 +51,10 @@ function M.on_keypress(mode)
return lib.open_file(mode, node.absolute_path)
end
if mode == 'toggle_ignored' then
return lib.toggle_ignored()
end
if node.name == ".." then
return lib.change_dir("..")
elseif mode == "cd" and node.entries ~= nil then