Editing History
The Moving Finger writes; and, having writ,
Moves on: - Omar Khayyam.
You've used arrow keys and the backspace/delete keys to edit command lines. They're just the tip of the iceberg.
To give you access to the most powerful command-editing facilities, I have to give you a new viewpoint. Let me see if I can take you there.
Imagine all the commands you've issued as a file.
history
shows you this file, with line numbers.Next, imagine that when you type, you're actually editing that file. There's an empty line at the bottom of the file; as you type, you're typing into that empty line. When you press the carriage return, you move on to the next empty line.
You're in a text editor with a screen so narrow it only displays a single line.
As you press the arrow keys, you're navigating through a file.
But since you are in an editor, you can edit the lines you see. Like most editors you've used, it understands the arrow keys, backspace, and delete, but it understands a lot more -- the Home and End keys for example.
How powerful an editor is it? I'll cut to the chase: it's emacs. Want to go to the beginning of the line? ^A (control-A). End of line? ^E. Delete to end of line? ^K.
Most familiar emacs commands will work.
One-line emacs.
0 Comments:
Post a Comment
<< Home