From 50b3e1b0b3bd7075d4fce520ac960b08dc32f9da Mon Sep 17 00:00:00 2001 From: W Riddle Date: Sat, 29 Oct 2022 18:10:11 -0400 Subject: [PATCH 1/3] feat: command to clear the clipboard --- lua/nvim-tree/actions/fs/copy-paste.lua | 6 ++++++ lua/nvim-tree/api.lua | 1 + 2 files changed, 7 insertions(+) diff --git a/lua/nvim-tree/actions/fs/copy-paste.lua b/lua/nvim-tree/actions/fs/copy-paste.lua index 0742ad1d639..10afc2ed1a9 100644 --- a/lua/nvim-tree/actions/fs/copy-paste.lua +++ b/lua/nvim-tree/actions/fs/copy-paste.lua @@ -129,6 +129,12 @@ local function add_to_clipboard(node, clip) utils.notify.info(node.absolute_path .. " added to clipboard.") end +function M.clear_clipboard() + clipboard.move = {} + clipboard.copy = {} + utils.notify.info("Clipboard has been emptied.") +end + function M.copy(node) add_to_clipboard(node, clipboard.copy) end diff --git a/lua/nvim-tree/api.lua b/lua/nvim-tree/api.lua index 4d9798e1bec..0b1ade7e7b3 100644 --- a/lua/nvim-tree/api.lua +++ b/lua/nvim-tree/api.lua @@ -46,6 +46,7 @@ Api.fs.rename = inject_node(require("nvim-tree.actions.fs.rename-file").fn(false Api.fs.rename_sub = inject_node(require("nvim-tree.actions.fs.rename-file").fn(true)) Api.fs.cut = inject_node(require("nvim-tree.actions.fs.copy-paste").cut) Api.fs.paste = inject_node(require("nvim-tree.actions.fs.copy-paste").paste) +Api.fs.clear_clipboard = require("nvim-tree.actions.fs.copy-paste").clear_clipboard Api.fs.print_clipboard = require("nvim-tree.actions.fs.copy-paste").print_clipboard Api.fs.copy.node = inject_node(require("nvim-tree.actions.fs.copy-paste").copy) Api.fs.copy.absolute_path = inject_node(require("nvim-tree.actions.fs.copy-paste").copy_absolute_path) From 8d8a2ad0fd4eece0ec732b8b42c4ddf507ba2d3f Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Mon, 31 Oct 2022 15:42:14 +1100 Subject: [PATCH 2/3] feat: command to clear the clipboard: stylua --- lua/nvim-tree/actions/fs/copy-paste.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/nvim-tree/actions/fs/copy-paste.lua b/lua/nvim-tree/actions/fs/copy-paste.lua index 10afc2ed1a9..1fb4bc533f9 100644 --- a/lua/nvim-tree/actions/fs/copy-paste.lua +++ b/lua/nvim-tree/actions/fs/copy-paste.lua @@ -132,7 +132,7 @@ end function M.clear_clipboard() clipboard.move = {} clipboard.copy = {} - utils.notify.info("Clipboard has been emptied.") + utils.notify.info "Clipboard has been emptied." end function M.copy(node) From 60a3066f57794d6f766ea858c6655ec017b23461 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Mon, 31 Oct 2022 15:46:10 +1100 Subject: [PATCH 3/3] feat: command to clear the clipboard: add to :help --- doc/nvim-tree-lua.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/nvim-tree-lua.txt b/doc/nvim-tree-lua.txt index 82538cdf5e2..93e03ab8f12 100644 --- a/doc/nvim-tree-lua.txt +++ b/doc/nvim-tree-lua.txt @@ -1125,6 +1125,7 @@ exists. - rename_sub - cut - paste + - clear_clipboard - print_clipboard - copy.node - copy.absolute_path