No description
- Lua 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| lua/yank-file | ||
| LICENSE | ||
| README.md | ||
| yank-file.lua | ||
yank_file.nvim
Copy a file and its contents from nvim-tree, then paste it elsewhere inside the tree.
What this plugin does
- Copy any file from the current cursor position in
nvim-treeusingY[default]. - Stores the copied file_name and the contents in the memory.
- Paste it into any directory inside the
nvim-treeusingP[default].
Deps
- Neovim >= 0.8
- nvim-tree
Usage
Inside your nvim-tree:
- Press
Yon any file to copy its name and its contents. - Move to any directory or file inside
nvim-tree. - Press
Pto paste all of it.
Paste behavior:
- If the cursor is on a directory, the paste will be inside that directory.
- If the cursor is on a file, the paste will be on the parent directory of the file.
Default config
require("yank_file").setup({
copy_keymap = "Y",
paste_keymap = "P",
debug = true,
})
Installation
LazyVim
{
"mani-arjunan/yank-file.nvim",
dependencies = { "nvim-tree/nvim-tree.lua" },
config = function()
require("yank-file").setup({
copy_keymap = "Y",
paste_keymap = "P",
})
end,
}
Packer
use({
"mani-arjunan/yank-file.nvim",
requires = { "nvim-tree/nvim-tree.lua" },
config = function()
require("yank-file").setup({
copy_keymap = "Y",
paste_keymap = "P",
})
end,
})
Setup
local function custom_on_attach(bufnr)
local api = require("nvim-tree.api")
api.config.mappings.default_on_attach(bufnr)
require("yank_file").on_attach(bufnr)
end
require("nvim-tree").setup({
on_attach = custom_on_attach,
})