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
6 changed files with 36 additions and 20 deletions

View File

@@ -45,18 +45,19 @@ end
function M.get_bindings()
local keybindings = vim.g.lua_tree_bindings or {}
return {
edit = keybindings.edit or '<CR>',
edit_vsplit = keybindings.edit_vsplit or '<C-v>',
edit_split = keybindings.edit_split or '<C-x>',
edit_tab = keybindings.edit_tab or '<C-t>',
preview = keybindings.preview or '<Tab>',
cd = keybindings.cd or '<C-]>',
create = keybindings.create or 'a',
remove = keybindings.remove or 'd',
rename = keybindings.rename or 'r',
cut = keybindings.cut or 'x',
copy = keybindings.copy or 'c',
paste = keybindings.paste or 'p',
edit = keybindings.edit or '<CR>',
edit_vsplit = keybindings.edit_vsplit or '<C-v>',
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',
rename = keybindings.rename or 'r',
cut = keybindings.cut or 'x',
copy = keybindings.copy or 'c',
paste = keybindings.paste or 'p',
}
end

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