13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

2.2 Eye to Eye with vi35of their commands . . . and did they make good use of those keys! Virtuallyevery letter is used, both lower and upper case, to mean something unique invi. But d<strong>on</strong>’t be put off by the large number of commands to learn; they fitsome patterns that will make it easy for you to become proficient in a shorttime by learning a few commands and applying the patterns.NOTEIf you really can’t bear to part with your mouse and menus, try gvim. We haven’tused it, but we hear that it has support for mice to help with cut and paste andthe like. After you learn vi and get a little practice, though, you may find thatyou’re never reaching for your mouse any more when you edit.There are three modes to vi: the regular vi mode, some extendedcommands in the ex mode, and the input mode.The simplest mode is the input mode. In input mode, every character youtype becomes part of the text of the file. It’s how you enter the bulk of the textfor your Java programs. But vi doesn’t start up in input mode; you have to “getinto” input mode, and then get back out. Once out, you can use other vicommands to save the text and exit vi. More about those in a bit.NOTEGet out of input mode by pressing the Escape key. You can press it more than<strong>on</strong>ce, too, just to be sure that you are no l<strong>on</strong>ger in input mode. If you are nol<strong>on</strong>ger in input mode and you press escape, it will beep at you—with an audibleor visual notificati<strong>on</strong>, depending <strong>on</strong> how your terminal window is set to resp<strong>on</strong>d.In both vim and elvis (two popular vi cl<strong>on</strong>es) there is a status line at thebottom of the window that will show if you are in input mode. In vim, lookin the lower left and elvis, the lower right. When in input mode, you will seea status word displayed like insert or replace.In the vi mode, the default mode that you start in, all the keystrokes areinterpreted as commands to the editor. They are not displayed as characters. Sowhen we describe a command, such as dt;, you can type those three charactersbut will not see those characters <strong>on</strong> your screen. Instead you will see some acti<strong>on</strong>taken by vi—in this case it will delete text from your cursor up to the firstsemicol<strong>on</strong> <strong>on</strong> that line, if any (otherwise it will just beep).

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!