Files
nvim-tree.lua/lua/nvim-tree/_meta/api/fs.lua
Uanela Como c760c92667 feat(#1549): p will paste files from another nvim-tree instance, gp will cut/paste (#3336)
* feat: add copy absolute path with protocol into public api

* feat: add helper get_basename into node

* feat: add gby keymap, and allow visual mode for copy.basename|absolute_path

* feat(clipboard): add opts for adding protocol in reg operations

* feat(api): allow visual operation in absolute_path*

* feat: add paste with protocol to keymap+api

* feat: add paste with protocol to clipboard

* feat: add configurable clipboard protocol

* fix: filter descendant nodes on copy_absolute_path_with_protocol

* refactor: change clip protocol keymaps to bgy and bgp

* wip

* fix(clipboad): correctly show the number of copied nodes on bgy

* chore: remove bgy, bgp and add gp + gx

* chore: update api/fs.lua and api impl.lua to match new keymaps

* fix: correctly pass the function to new keymaps

* chore: remove use_protocol and use use_register + cut options

* chore: update docs

* chore: move node:get_basename to cliboard_

* chore(clipboard): remove vim.cmd workaround in favor of vim.fn.setreg

* chore: use newline as separator instead of comma

* refactor(clipboard): simplify copying node attribute and allow all to work in visual mode

* refactor(keymap): remove gx, use gp to move

* feat(clipboard): always copy/cut to register and make `p` pick local data or register data

* refactor(docs): update api docs and rename paste_while_cutting to move

* fix: correctly format keymaps

* chore: regenerate docs

* fix: remove unused apis

* chore: copy clipboard.data to register on copy/cut

* chore: revert copy_node_attribute

* refactor: remove visual mode from copy.basename|filename|path

* chore: update docs

* chore: add fs.move api and update docs

* chore: destroy dummy nodes and prevent empty paths nodes parsing

* fix: _meta/api/fs.lua and docs

* fix(clipboard): destroy dummy nodes from register on paste

* fix(clipboard): correctly check for local paste operation
2026-07-01 10:11:03 +10:00

131 lines
3.2 KiB
Lua

---@meta
local nvim_tree = { api = { fs = {} } }
---
---Clear the nvim-tree clipboard.
---
function nvim_tree.api.fs.clear_clipboard() end
nvim_tree.api.fs.copy = {}
---
---Copy the absolute path to the system clipboard.
---
---@param node? nvim_tree.api.Node
function nvim_tree.api.fs.copy.absolute_path(node) end
---
---Copy the name with extension omitted to the system clipboard.
---
---@param node? nvim_tree.api.Node
function nvim_tree.api.fs.copy.basename(node) end
---
---Copy the name to the system clipboard.
---
---@param node? nvim_tree.api.Node
function nvim_tree.api.fs.copy.filename(node) end
---
---Copy to the nvim-tree clipboard.
---In visual mode, copies all nodes in the visual selection.
---
---@param node? nvim_tree.api.Node
function nvim_tree.api.fs.copy.node(node) end
---
---Copy the path relative to the tree root to the system clipboard.
---
---@param node? nvim_tree.api.Node
function nvim_tree.api.fs.copy.relative_path(node) end
---
---Prompt to create a file or directory.
---
---When {node} is a file it will be created in the parent directory.
---
---Use a trailing `"/"` to create a directory e.g. `"foo/"`
---
---Multiple directories/files may be created e.g. `"foo/bar/baz"`
---
---@param node? nvim_tree.api.Node
function nvim_tree.api.fs.create(node) end
---
---Cut to the nvim-tree clipboard.
---In visual mode, cuts all nodes in the visual selection.
---
---@param node? nvim_tree.api.Node
function nvim_tree.api.fs.cut(node) end
---
---Paste files from:
---- current nvim-tree clipboard (if present)
---- another nvim-tree instance via system clipboard
---
---If {node} is a file it will pasted in the parent directory.
---
---@param node? nvim_tree.api.Node
function nvim_tree.api.fs.paste(node) end
---
---Paste while cutting files from:
---- current nvim-tree clipboard (if present)
---- another nvim-tree instance via system clipboard
---
---If {node} is a file it will pasted in the parent directory.
---
---@param node? nvim_tree.api.Node
function nvim_tree.api.fs.move(node) end
---
---Print the contents of the nvim-tree clipboard.
---
function nvim_tree.api.fs.print_clipboard() end
---
---Delete from the file system.
---In visual mode, deletes all nodes in the visual selection with a single prompt.
---
---@param node? nvim_tree.api.Node
function nvim_tree.api.fs.remove(node) end
---
---Prompt to rename by name.
---
---@param node? nvim_tree.api.Node
function nvim_tree.api.fs.rename(node) end
---
---Prompt to rename by name with extension omitted.
---
---@param node? nvim_tree.api.Node
function nvim_tree.api.fs.rename_basename(node) end
---
---Prompt to rename by absolute path.
---
---@param node? nvim_tree.api.Node
function nvim_tree.api.fs.rename_full(node) end
---
---Prompt to rename.
---
---@param node? nvim_tree.api.Node
function nvim_tree.api.fs.rename_node(node) end
---
---Prompt to rename by absolute path with name omitted.
---
---@param node? nvim_tree.api.Node
function nvim_tree.api.fs.rename_sub(node) end
---
---Trash as per |nvim_tree.config.trash|.
---In visual mode, trashes all nodes in the visual selection with a single prompt.
---
---@param node? nvim_tree.api.Node
function nvim_tree.api.fs.trash(node) end
return nvim_tree.api.fs