add smart-paste plugin from the docs (#107)
Co-authored-by: sxyazi <sxyazi@gmail.com>
This commit is contained in:
@@ -20,6 +20,7 @@ For specific installation commands and configuration instructions, check the ind
|
|||||||
- [smart-filter.yazi](smart-filter.yazi) - Makes filters smarter: continuous filtering, automatically enter unique directory, open file on submitting.
|
- [smart-filter.yazi](smart-filter.yazi) - Makes filters smarter: continuous filtering, automatically enter unique directory, open file on submitting.
|
||||||
- [chmod.yazi](chmod.yazi) - Execute `chmod` on the selected files to change their mode.
|
- [chmod.yazi](chmod.yazi) - Execute `chmod` on the selected files to change their mode.
|
||||||
- [mime-ext.yazi](mime-ext.yazi) - A mime-type provider based on a file extension database, replacing the builtin `file(1)` to speed up mime-type retrieval at the expense of accuracy.
|
- [mime-ext.yazi](mime-ext.yazi) - A mime-type provider based on a file extension database, replacing the builtin `file(1)` to speed up mime-type retrieval at the expense of accuracy.
|
||||||
|
- [smart-paste.yazi](smart-paste.yazi) - Paste files into the hovered directory or to the CWD if hovering over a file.
|
||||||
- [diff.yazi](diff.yazi) - Diff the selected file with the hovered file, create a living patch, and copy it to the clipboard.
|
- [diff.yazi](diff.yazi) - Diff the selected file with the hovered file, create a living patch, and copy it to the clipboard.
|
||||||
- [no-status.yazi](no-status.yazi) - Remove the status bar.
|
- [no-status.yazi](no-status.yazi) - Remove the status bar.
|
||||||
- [mactag.yazi](mactag.yazi) - Bring macOS's awesome tagging feature to Yazi! The plugin is only available for macOS just like the name says.
|
- [mactag.yazi](mactag.yazi) - Bring macOS's awesome tagging feature to Yazi! The plugin is only available for macOS just like the name says.
|
||||||
|
|||||||
1
smart-paste.yazi/LICENSE
Normal file
1
smart-paste.yazi/LICENSE
Normal file
@@ -0,0 +1 @@
|
|||||||
|
../LICENSE
|
||||||
26
smart-paste.yazi/README.md
Normal file
26
smart-paste.yazi/README.md
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# smart-paste.yazi
|
||||||
|
|
||||||
|
Paste files into the hovered directory or to the CWD if hovering over a file.
|
||||||
|
|
||||||
|
https://github.com/user-attachments/assets/b3f6348e-abbe-42fe-9a67-a96e68f11255
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```sh
|
||||||
|
ya pack -a yazi-rs/plugins:smart-paste
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Add this to your `~/.config/yazi/keymap.toml`:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[[manager.prepend_keymap]]
|
||||||
|
on = "p"
|
||||||
|
run = "plugin smart-paste"
|
||||||
|
desc = "Paste into the hovered directory or CWD"
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This plugin is MIT-licensed. For more information check the [LICENSE](LICENSE) file.
|
||||||
13
smart-paste.yazi/main.lua
Normal file
13
smart-paste.yazi/main.lua
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
--- @sync entry
|
||||||
|
return {
|
||||||
|
entry = function()
|
||||||
|
local h = cx.active.current.hovered
|
||||||
|
if h and h.cha.is_dir then
|
||||||
|
ya.mgr_emit("enter", {})
|
||||||
|
ya.mgr_emit("paste", {})
|
||||||
|
ya.mgr_emit("leave", {})
|
||||||
|
else
|
||||||
|
ya.mgr_emit("paste", {})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user