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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2.3 Editors Galore45affected by this setting. The default for vi is noignorecase, which means caseis significant.The autoindent setting (can be abbreviated ai) means that when you doan o or O to open a line after or before (o versus O) the line <strong>on</strong> which your cursorrests, vi will automatically add whitespace so that the text that you enter beginsat the same column where the current line begins.For example, suppose you are editing an if statement like this:if (userBalance < minDaily) {userAccount.chargeFees();}With your cursor <strong>on</strong> the middle line, if you type an o or O, the new (blank)line will open with your cursor at the fifth character positi<strong>on</strong>, right in line withthe “u” of userAccount. If you find that your cursor is flush left when you trythis, then you need to set autoindent. You can do this from within vi by typing:set ai or the l<strong>on</strong>ger :set autoindent. The leading “:” is important—itgets you to ex mode. (D<strong>on</strong>’t forget to press Enter at the end of the command.)The shiftwidth setting tells vi how many character positi<strong>on</strong>s to movetext left or right with each > (right) command, as well as whentyping ^D and ^T in input mode. When typing text in input mode, people oftenuse the Tab key to indent their text, for example inside an if or for statement.You can do this in vi, and the actual tab character will be the character in yourtext. But if you want tighter indenting, use the ^T (that’s C<strong>on</strong>trol-T, “T” forTab, we suppose) to increase your indent and ^D to decrease your indent whilein input mode. The vi editor will automatically compute how much whitespaceto use and will put an optimal combinati<strong>on</strong> of tabs and spaces as needed to linethings up. Alternately, you can have vi always expand tabs into spaces and notmix tabs and spaces, but just use spaces, with set expandtab. (Remember toadd a “:” if you want to type this from the command line.)2.3EDITORS GALOREThere are many editors available to a programmer <strong>on</strong> a <strong>Linux</strong> system. Some aretext-based editors, typically antedating GUI interfaces. Many have graphicalinterfaces, with mouse-based cut and paste and the like. We will menti<strong>on</strong> severalhere and encourage you to find the <strong>on</strong>e with which you are comfortable.

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

Saved successfully!

Ooh no, something went wrong!