Java Tutorial - Java Script :
The Attack of the Vi Clones: Vim
Vim is a mode-oriented editor. It has four modes: insert, replace, command, and ex (or colon command) mode. Vim normally displays the mode it is in at the bottom of the screen (although this feature can be disabled). When it is in command mode, most letters on the keyboard correspond to commands that operate on the text at the current cursor location. For example, pressing the X key will delete the character under the cursor. Most commands can be preceded by a number to repeat the command that number of times, or by a cursor movement command to apply the command until the cursor stops moving.
For example, typing 5x deletes the character under the cursor and four additional characters to the right. To undo the last command, type a lowercase u.You can undo all changes to the current line by typing an uppercase U.The command i (among others) puts the editor into Insert mode where text can be entered. Vim differs from Vi in insert mode because Vim allows full cursor movement in insert mode without returning to command mode. The command puts Vi into replace mode. This is similar to overtype in most editors.
Instead of inserting new characters for each keystroke, Vi overtypes, or replaces, the characters under the cursor. You can toggle between insert and replace modes by pressing the Escape (ESC) key.Vim also has a command mode that is started with a colon. This is a holdover from the original Vi, which had a line editor mode called ex. For this reason, these colon commands are called ex commands and the mode is called ex command mode. ex commands provide access to a number of editor configuration attributes and other advanced features such as keyboard mapping.For example, to change the number of spaces represented by a tab from the default of eight to four, you would enter the following::set tabstop=4
Vim comes preconfigured to support compiling Java using Ant or the Jikes compiler. To compile code using the Ant build tool (Ant is discussed in more detail later in this chapter), prepare Vim by entering the command::compile ant Then, when you are ready to compile the code, just enter the command::make
Vim also supports a simple yet powerful macro language. The Vim macro language reflects the fact that Vi commands are mostly single-letter commands.A macro in Vim can be as simple as repeating the same set of keystrokes that would have been typed if the command were being entered manually. There are also some simple extensions that provide for repeating steps a specific number of times and performing tests and conditional branching.As it turns out, these are often not needed due to the richness of the Vim
command set.
