elves / elvish

Powerful scripting language & versatile interactive shell
https://elv.sh/
BSD 2-Clause "Simplified" License
5.67k stars 300 forks source link

Document the limited vi editing mode #971

Open krader1961 opened 4 years ago

krader1961 commented 4 years ago

Someone asked on IRC if Elvish supported vi mode editing. I couldn't find any mention in the documentation and grep'ing the source didn't return any promising results. It turns out that doing

edit:insert:binding[Ctrl-'['] = $edit:command:start~

will enable a very limited vi editing mode. See also #730 for why the features are currently limited. The currently support vi commands can be found here: https://github.com/elves/elvish/blob/f30a2b6837a792727aa665a96229e1c0a1e71d91/edit/insert.go#L99

What's interesting about the current implementation is that it still leaves most (all?) of the emacs bindings in effect; e.g., [ctrl-A] moves to the start of the line in insert mode.

prologic commented 2 years ago

It would be great if we could improve the vi-mode support for editing in Elvish 👌