fish-shell/fish-shell — pull request #1218 by furunkel (2013-12-31 16:14:19+00:00)
Title: Bind modes and basic vi mode

This pull request implements "bind modes", a first step towards a usable vi mode.
In short, the following changes were made:
* add `-M mode` and `-m new_mode ` switches (both optional) to the `bind` command. `-M` specifies the mode in which this binding is active, -m specifies the mode that is switched into, after command execution. An arbitrary identifier can be given for the mode name. `-M` works also in combination with erase (`-e`) and list (`-a`).
* add a new builtin `bind_mode` that returns the current mode.
* made a few changes, so that bindings can be strings (e.g. make it possible to bind ':q', 'dd' etc.)
(see input.cpp, around line 512, I hope this doesn't break anything ? )
* add a new `force-repaint` command, which essentially is a non-coalescing `repaint`.

I added some example scripts that show how a vi mode could be built around this. Some mappings are not 100% vi-compatible, so the vim mode is probably not really usable at this point.
It's maybe a bit early to pull this in, but I hoped that once this feature is implemented others would finish the vi stuff, which can probably be implemented (at least mostly) in "fish-script".