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.

36Chapter 2An Embarrassment of Riches: EditorsThere are several ways to get into input mode, depending <strong>on</strong> where youwant to do the insert. When the file you’re editing is completely empty, allthese commands are equivalent, but for n<strong>on</strong>empty files, each command willbegin input mode in a different place in the file:• i inserts before the cursor.• I inserts at the beginning of the line.• a appends after the cursor.• A appends at the end of the line.• o “opens” a line for input after the line <strong>on</strong> which the cursor sits.• O “opens” a line for input before the line <strong>on</strong> which the cursor sits.Remember that this is character-based editing, before the days of mice andI-bars. So there is no meta-character for the cursor to show its positi<strong>on</strong> betweentwo characters in the file. Instead, the cursor sits <strong>on</strong> top of a character, and thusinserts or appends will happen before or after that character.Reminder: Get out of input mode by pressing the Escape key.Next, let’s move the cursor around. The simplest way to do that is <strong>on</strong>echaracter at a time. Using the (lowercase) h, j, k, and l keys—notice thatthey’re all in a row <strong>on</strong> QWERTY keyboards—you have the “arrow” keys forleft, down, up, and right. One of the comm<strong>on</strong> enhancements for vi cl<strong>on</strong>es isto include support for the arrow keys <strong>on</strong> standard PC keyboards. Even so, thec<strong>on</strong>venience of having the moti<strong>on</strong> keys <strong>on</strong> the “home row” for touch typistscan be a great speedup.• h moves left <strong>on</strong>e character.• j moves down <strong>on</strong>e line.• k moves up <strong>on</strong>e line.• l moves right <strong>on</strong>e character; same as a space.Often, character- or line-at-a-time is too slow. Move to the beginning ofthe line that you are <strong>on</strong> with 0 (zero), or to the end of the line with $. Moveto the top and bottom of the window with H (think “High”) and L (think“Low”). So first type L then hold down j. To move back in a file, first type Hthen hold down k. That gets the display moving down or up respectively.• H (“high”) moves to the top line of the window.• M (“middle”) moves to the middle line of the window.

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

Saved successfully!

Ooh no, something went wrong!