05.01.2013 Views

Mac OS X Leopard - ARCAism

Mac OS X Leopard - ARCAism

Mac OS X Leopard - ARCAism

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.

316<br />

CHAPTER 18 INTRODUCING DARWIN AND THE SHELL<br />

Table 18-5. Continued<br />

Keystroke Action<br />

Saving and Quitting<br />

:w [filename] Save file as filename (if no file name is specified, the file will be saved with the<br />

current name)<br />

:q Quit Vim<br />

:x, :wq or ZZ Save file and quit<br />

:w! Force save read-only file (if you have proper permissions)<br />

:q! Force quit changed file without saving<br />

Other Commands<br />

Esc Return Vim to command mode<br />

u Undo<br />

J Join two lines into one<br />

:.= Display current line number<br />

Emacs<br />

Emacs (or “GNU Emacs,” as the faithful like to refer to it) is another popular text editor (perhaps<br />

it may be best described as a powerful runtime system with text editing capabilities). Emacs<br />

can do wonderful things provided you take the time to learn a rather large number of mystical<br />

key combinations (and learning a little Lisp helps too). In fact, people who love and use Emacs<br />

(who really should have a name to describe them—like “Trekkies” or something—since they<br />

tend to share the same sort of devotion) won’t settle for anything less.<br />

Unlike Vi, Emacs is a single-mode text editor; so, in that way, it’s probably similar to most<br />

GUI text editors you may have used. However, since it lacks a GUI, you can’t use your mouse to<br />

access the fancy features. That’s where the crazy keystrokes come into play. In general, these keystrokes<br />

take the form of either the Ctrl key or the Meta key plus some other key (in Emacs, the<br />

shorthand for this would be something like C-k for Ctrl+K, or M-k for Meta+K). Usually, you<br />

would hold these keys at the same time. The gotcha here is that the <strong>Mac</strong> keyboard doesn’t have<br />

a Meta key. You can fix this by selecting the “Use option as meta key” option in Terminal’s Settings<br />

preferences (on the Keyboard tab, as shown in Figure 18-2).

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

Saved successfully!

Ooh no, something went wrong!