yazi/Q/In yazi, if nvim is my $EDITOR, is there a key which can open it up in my editor in read-only mode?
Properties
- logseq-entity
- Logseq/Entity/Question
In yazi, if nvim is my
$EDITOR, is there a key which can open it up in my editor in read-only mode?AI Answer
- AI/Response
- Short answer: No built-in default key exists for this. Add a custom
shellbinding that callsnvim -Rwith the%hplaceholder (hovered file path). - Why there's no default key: Yazi's default opener for text files runs
${EDITOR:-vi} %s(writable). The default keymap bindso/<Enter>toopen(which triggers that opener), andO/<S-Enter>toopen --interactive. Neither has a read-only variant out of the box. - Checking the default
[mgr]keymap:eis not mapped;ris mapped torename. Soealone is a clean, free key in[mgr]. - Add a key binding in
~/.config/yazi/keymap.toml: - toml
[[mgr.prepend_keymap]] on = "e" run = "shell 'nvim -R %h' --block" desc = "Open hovered file in nvim read-only" %hexpands to the hovered file's path (shell-quoted automatically).--blocksuspends yazi until nvim exits.- Chord alternative:
on = [ "e", "r" ]is a single chord binding (pressethenrin sequence, like[ "g", "g" ]). It does not conflict with standaloner → renamesince yazi only enters chord mode after the first key. - Alternative — use
view: nvim ships aviewalias that is identical tonvim -R: - toml
[[mgr.prepend_keymap]] on = [ "e", "r" ] run = "shell 'view %h' --block" desc = "Open hovered file in view (nvim read-only)" - Docs: keymap — shell, yazi-default.toml opener.edit
- Short answer: No built-in default key exists for this. Add a custom
- AI/Response