Wednesday, December 07, 2005

History at Full Speed

If the command-line editor is really a full-featured history editor, then history should be searchable.

Is this possible? Yes sirree.

In emacs mode, type ^R, then start typing the string you're looking for. You'll get the normal, emacs incremental search. If you find the string you want, but it's not the command you want, press ^R again to get the next instance.

In vi mode, use vi's search command, /. Find the next command containing that string with n.

If there's a command you issued a few minutes ago and you want to bring it back, you don't have to type up-arrow after up-arrow to find it. You can recall it by just typing in a few characters from the command and searching.

vi doesn't have incremental search, but it turns out that some of the emacs-mode commands, like ^R, still work in vi-mode, so it's often worth trying them.

No, this isn't logical. Oh, well.

Happy Pearl Harbor Day!

0 Comments:

Post a Comment

<< Home