Skip to content

Commit

Permalink
docs: new smart-paste tip
Browse files Browse the repository at this point in the history
  • Loading branch information
sxyazi committed Apr 26, 2024
1 parent 0c1eb50 commit b21c9f1
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions docs/tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,34 @@ run = "plugin --sync smart-enter"
desc = "Enter the child directory, or open the file"
```

### Smart paste: `paste` files without entering the directory {#smart-paste}

Save these lines as `~/.config/yazi/plugins/smart-paste.yazi/init.lua`:

```lua
return {
entry = function()
local h = cx.active.current.hovered
if h and h.cha.is_dir then
ya.manager_emit("enter", {})
ya.manager_emit("paste", {})
ya.manager_emit("leave", {})
else
ya.manager_emit("paste", {})
end
end,
}
```

Then bind it for <kbd>p</kbd> key, in your `keymap.toml`:

```toml
[[manager.prepend_keymap]]
on = [ "p" ]
run = "plugin --sync smart-paste"
desc = "Paste into the hovered directory or CWD"
```

## Drag and drop via [`dragon`](https://github.com/mwh/dragon) {#drag-and-drop}

Original post: https://github.com/sxyazi/yazi/discussions/327
Expand Down

0 comments on commit b21c9f1

Please sign in to comment.