.comment-link {margin-left:.6em;}

David @ Tokyo

Perspective from Japan on whaling and whale meat, a spot of gourmet news, and monthly updates of whale meat stockpile statistics

4/02/2005

 

Another cool thing: command line editing

I half discovered this while taping away on my Solaris machine at work yesterday: Command Line Editing.

Mistyping a really long command can be a pain in the butt especially if you make a mistake along the way. Until now I have always been copying the correct part of the string, pasting, adding correct characters, and copying and pasting the remaining correct part of the string. This works, but involves reaching for the mouse. No more! I finally found out how to "edit the command line".

By default, bash uses commands to edit, like f to go forward a character, b to go back a character, a and e to go the start and end of the command respectively. I use the vi(m) editor, so I didn't realise that these commands were actually emacs style cursor movement commands. But no problem, I can apparently set bash to use vi style editing instead:
$ set -o vi
Excellent!
Another command which I will have to explore is
$ bind -v

...
set editing-mode vi
...

This command seems to dump information about a whole load of other goodies, which I will have to check out. The only one I understand so far is the one above, indicating that I have set my command line editing mode to vi style...

Comments: Post a Comment



<< Home

Archives

June 2004   July 2004   August 2004   September 2004   October 2004   November 2004   December 2004   January 2005   March 2005   April 2005   May 2005   June 2005   July 2005   August 2005   September 2005   October 2005   November 2005   December 2005   January 2006   February 2006   March 2006   April 2006   May 2006   June 2006   July 2006   August 2006   September 2006   October 2006   November 2006   December 2006   January 2007   February 2007   March 2007   April 2007   May 2007   June 2007   July 2007   August 2007   September 2007   October 2007   November 2007   December 2007   January 2008   February 2008   April 2008   May 2008   June 2008   July 2008   August 2008   September 2008   October 2008   November 2008   December 2008   January 2009   February 2009   March 2009   April 2009   May 2009   June 2009   July 2009   August 2009   September 2009   October 2009   November 2009   January 2010   February 2010   April 2010   May 2010   June 2010   July 2010   August 2010   September 2010   February 2011   March 2011   May 2013   June 2013  

This page is powered by Blogger. Isn't yours?