| 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 |