[an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] Skip to the content of the web site.

Command-Line Editing

Contents Previous Topic Next Topic

Now that you have learned the vi editor, you can use it to edit the commands you are typing. While typing, you can treat the current command and all previous commands as if it were a file which you were editing using vi. By default, you are in Insert Mode. To move to Command Mode, you must use Ctrl-[.

For example, suppose we tried listing all html, jpg, and png files in the working directory. We could test our pattern as follows:

{ecelinux:1} bindkey -v
{ecelinux:2} ls
banner.png  dwh.jpg  index.html  SingleList.h  SingleNode.h  tmp/  
{ecelinux:3} echo *.html * .jpg *.png
index.html index.html .jpg banner.png
{ecelinux:4}

Realizing that our pattern is wrong, we could retype the command or we could edit the previous command. At the command line, escape into Command Mode using Ctrl-[. Next, press k a few times, just to notice that you are scrolling back through the history of commands. Use j to move back down to the erroneous command:

{ecelinux:4} echo *.html * .jpg *.png

Use h to move back to the space between * and .jpg and press x to delete that character. Now press Enter:

{ecelinux:4} echo *.html *.jpg *.png
index.html dwh.jpg banner.png
{ecelinux:5}

You can add bindkey -v into your .tcshrc file. You can use bindkey -e if you prefer emacs.

Contents Previous Topic Next Topic

Copyright ©2005-2008 by Douglas Wilhelm Harder. All rights reserved.

[an error occurred while processing this directive]