Add command to print clipboard content.
This commit is contained in:
parent
7ddee0a79c
commit
89df407737
@ -45,6 +45,10 @@ 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
|
(if you opened a file with something else than the LuaTree, like `fzf` or
|
||||||
`:split`)
|
`:split`)
|
||||||
|
|
||||||
|
|:LuaTreeClipboard| *:LuaTreeClipboard*
|
||||||
|
|
||||||
|
Print clipboard content for both cut and copy
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
OPTIONS *nvim-tree-options*
|
OPTIONS *nvim-tree-options*
|
||||||
|
|
||||||
|
|||||||
@ -262,4 +262,22 @@ function M.paste(node)
|
|||||||
return do_paste(node, 'copy', do_copy)
|
return do_paste(node, 'copy', do_copy)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M.print_clipboard()
|
||||||
|
local content = {}
|
||||||
|
if #clipboard.move > 0 then
|
||||||
|
table.insert(content, 'Cut')
|
||||||
|
for _, item in pairs(clipboard.move) do
|
||||||
|
table.insert(content, ' * '..item.absolute_path)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if #clipboard.copy > 0 then
|
||||||
|
table.insert(content, 'Copy')
|
||||||
|
for _, item in pairs(clipboard.copy) do
|
||||||
|
table.insert(content, ' * '..item.absolute_path)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return api.nvim_out_write(table.concat(content, '\n')..'\n')
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
@ -79,6 +79,10 @@ function M.refresh()
|
|||||||
lib.refresh_tree()
|
lib.refresh_tree()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M.print_clipboard()
|
||||||
|
fs.print_clipboard()
|
||||||
|
end
|
||||||
|
|
||||||
function M.on_enter()
|
function M.on_enter()
|
||||||
local bufnr = api.nvim_get_current_buf()
|
local bufnr = api.nvim_get_current_buf()
|
||||||
local bufname = api.nvim_buf_get_name(bufnr)
|
local bufname = api.nvim_buf_get_name(bufnr)
|
||||||
|
|||||||
@ -22,6 +22,7 @@ command! LuaTreeOpen lua require'tree'.open()
|
|||||||
command! LuaTreeClose lua require'tree'.close()
|
command! LuaTreeClose lua require'tree'.close()
|
||||||
command! LuaTreeToggle lua require'tree'.toggle()
|
command! LuaTreeToggle lua require'tree'.toggle()
|
||||||
command! LuaTreeRefresh lua require'tree'.refresh()
|
command! LuaTreeRefresh lua require'tree'.refresh()
|
||||||
|
command! LuaTreeClipboard lua require'tree'.print_clipboard()
|
||||||
command! LuaTreeFindFile lua require'tree'.find_file()
|
command! LuaTreeFindFile lua require'tree'.find_file()
|
||||||
|
|
||||||
let &cpo = s:save_cpo
|
let &cpo = s:save_cpo
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user