Skip to content

Commit cbb5313

Browse files
attridalex-courtis
andauthored
feat(api): add api.fs.clear_clipboard (#1706)
* feat: command to clear the clipboard * feat: command to clear the clipboard: stylua * feat: command to clear the clipboard: add to :help Co-authored-by: Alexander Courtis <alex@courtis.org>
1 parent fba9751 commit cbb5313

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

doc/nvim-tree-lua.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,6 +1125,7 @@ exists.
11251125
- rename_sub
11261126
- cut
11271127
- paste
1128+
- clear_clipboard
11281129
- print_clipboard
11291130
- copy.node
11301131
- copy.absolute_path

lua/nvim-tree/actions/fs/copy-paste.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,12 @@ local function add_to_clipboard(node, clip)
129129
utils.notify.info(node.absolute_path .. " added to clipboard.")
130130
end
131131

132+
function M.clear_clipboard()
133+
clipboard.move = {}
134+
clipboard.copy = {}
135+
utils.notify.info "Clipboard has been emptied."
136+
end
137+
132138
function M.copy(node)
133139
add_to_clipboard(node, clipboard.copy)
134140
end

lua/nvim-tree/api.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Api.fs.rename = inject_node(require("nvim-tree.actions.fs.rename-file").fn(false
4646
Api.fs.rename_sub = inject_node(require("nvim-tree.actions.fs.rename-file").fn(true))
4747
Api.fs.cut = inject_node(require("nvim-tree.actions.fs.copy-paste").cut)
4848
Api.fs.paste = inject_node(require("nvim-tree.actions.fs.copy-paste").paste)
49+
Api.fs.clear_clipboard = require("nvim-tree.actions.fs.copy-paste").clear_clipboard
4950
Api.fs.print_clipboard = require("nvim-tree.actions.fs.copy-paste").print_clipboard
5051
Api.fs.copy.node = inject_node(require("nvim-tree.actions.fs.copy-paste").copy)
5152
Api.fs.copy.absolute_path = inject_node(require("nvim-tree.actions.fs.copy-paste").copy_absolute_path)

0 commit comments

Comments
 (0)