A tool to learn vi/vim or to be used as a quick reference tool - vic short for vi commands.
New to linux? Just made the switch from NetWare to OES and would like to quickly edit files from a putty session? vi/vim is a great text editor that has been around for years. Once you understand a few commands getting around in vi/vim is easy to do, but you may not always remember some of the complex commands or a command you use all the time slips your mind. You could open a browser and search for the command or use vic (VI Commands) from a terminal session.
VI Commands displays a quick list of options, from editing, to searching and replacing, to deleting text.
Starting vic displays an organized list of options
Start with option 1
Need to know how to begin editing in vi, the Input text will show you how, press i to insert before the marker or a to insert after the marker. When you are finished looking at the options press enter to return to the main menu.
Common questions I get for editing a file with vi is how do I delete a row or delete the next 5 rows, or delete the next 5 words? Press 4
As you can see, x will delete the character under the marker.
5dd will delete 5 rows - starting from the marker down.
5dw will delete the next 5 words starting from the marker.
Searching and replacing can be easy to do. Select option 7 - Search and replace text
The basic syntax for a search and replace is :s/old/new/. This searches for old and replaces with new only on the current row.
Expand that to one of my favorites, search and replace the entire file, but ask for confirmation before applying the change.
The g is global and the c is confirmation. Add an i to ignore the case.
Once you get the hang of it, editing with vi gets easier and easier. If you are familiar with regular expressions then many of the commands will look familiar to you.
For a time saver, give up the gui and start learning text editor like vi. With vic, learning vi will be easy. Refreshing your memory is a few key strokes away. And the best part, you didn't need to open a browser to learn the command.
Install the rpm:
rpm -ivh vic-1.0-1.noarch.rpm
Simple type vic to start learning vi.
If you receive the following message when starting vic "-bash: /root/bin/vic: No such file or directory"
Log in as the user again or use su.
vic has been tested on OES11SP1 and OES11SP2