Krolyxon
Commit 27e23c7

Branches

Refs →

aurora27e23c7

yazi: include plugins as well

Author
krolxon
Date
2025-09-10 20:02 +0530
Parent
c7ffe6e
Commit
27e23c7b32b54fb1d3006ced8adda69631a961f6

+79 −0

4 files changed

  1. A .config/yazi/package.toml +7 −0
  2. A .config/yazi/plugins/smart-enter.yazi/LICENSE +21 −0
  3. A .config/yazi/plugins/smart-enter.yazi/README.md +40 −0
  4. A .config/yazi/plugins/smart-enter.yazi/main.lua +11 −0
A .config/yazi/package.toml View
@@ -0,0 +1,7 @@
1+[[plugin.deps]]
2+use = "yazi-rs/plugins:smart-enter"
3+rev = "d7588f6"
4+hash = "56fdabc96fc1f4d53c96eb884b02a5be"
5+
6+[flavor]
7+deps = []
A .config/yazi/plugins/smart-enter.yazi/LICENSE View
@@ -0,0 +1,21 @@
1+MIT License
2+
3+Copyright (c) 2023 yazi-rs
4+
5+Permission is hereby granted, free of charge, to any person obtaining a copy
6+of this software and associated documentation files (the "Software"), to deal
7+in the Software without restriction, including without limitation the rights
8+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+copies of the Software, and to permit persons to whom the Software is
10+furnished to do so, subject to the following conditions:
11+
12+The above copyright notice and this permission notice shall be included in all
13+copies or substantial portions of the Software.
14+
15+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+SOFTWARE.
A .config/yazi/plugins/smart-enter.yazi/README.md View
@@ -0,0 +1,40 @@
1+# smart-enter.yazi
2+
3+[`Open`][open] files or [`enter`][enter] directories all in one key!
4+
5+## Installation
6+
7+```sh
8+ya pkg add yazi-rs/plugins:smart-enter
9+```
10+
11+## Usage
12+
13+Bind your <kbd>l</kbd> key to the plugin, in your `~/.config/yazi/keymap.toml`:
14+
15+```toml
16+[[mgr.prepend_keymap]]
17+on = "l"
18+run = "plugin smart-enter"
19+desc = "Enter the child directory, or open the file"
20+```
21+
22+## Advanced
23+
24+By default, `--hovered` is passed to the [`open`][open] command, make the behavior consistent with [`enter`][enter] avoiding accidental triggers,
25+which means both will only target the currently hovered file.
26+
27+If you still want `open` to target multiple selected files, add this to your `~/.config/yazi/init.lua`:
28+
29+```lua
30+require("smart-enter"):setup {
31+ open_multi = true,
32+}
33+```
34+
35+## License
36+
37+This plugin is MIT-licensed. For more information check the [LICENSE](LICENSE) file.
38+
39+[open]: https://yazi-rs.github.io/docs/configuration/keymap/#mgr.open
40+[enter]: https://yazi-rs.github.io/docs/configuration/keymap/#mgr.enter
A .config/yazi/plugins/smart-enter.yazi/main.lua View
@@ -0,0 +1,11 @@
1+--- @since 25.5.31
2+--- @sync entry
3+
4+local function setup(self, opts) self.open_multi = opts.open_multi end
5+
6+local function entry(self)
7+ local h = cx.active.current.hovered
8+ ya.emit(h and h.cha.is_dir and "enter" or "open", { hovered = not self.open_multi })
9+end
10+
11+return { entry = entry, setup = setup }