3 ms·
No, all you need is a file called ~/.inputrc with at least the following contents: set editing-mode vi This causes any program that has its own command line
by a3n 11y ago
No, all you need is a file called ~/.inputrc with at least the following contents:
set editing-mode vi
This causes any program that has its own command line (like bash, psql, etc) and uses the readline library (like bash, psql, etc) to have an editable command line with vi edit behavior.
In man bash, search for /^READLINE (READLINE at the beginning of a line).
Side note: if you want a nice TOC of bash or anything else, run this from the command line:
man -P cat bash |grep -E "^[^ ]"
Or if you're into the whole minimalism thing:
man -P "grep -E '^[^ ]'" bash
Or if you're into the whole reusability/automation thing:
$ cat ~/bin/toc
#! /usr/bin/env bash
man -P "grep -E '^[^ ]'" $1
And then
$ toc bash
- shabble 11y agoThe biggest issue[1] I've found with vi(m)-like modes in shells and readline is the lack of any feedback as to which mode you're in. That, and my tendency to use C-c as an alternative to esc in vim has...unfortunate consequences in the shell, although I could potentially rebind it. [1] Actually, the biggest is 'discovered it set by default on a server you occasionally adminster, and taking far too long to realise why you're typing largely gibberish'
- a3n 11y agoesc esc esc generally assures me that I'm in normal mode, even on the command line. :)