How to edit a file

  • There are a couple traditional ways to edit files on Unix/Linux computers: Vi (Vim) and Emacs (or XEmacs).

    Vi (or Vim)

  • Vi is a relatively old-school editor that uses only key-strokes (no cursors or mouses) to edit files.
  • Broadly speaking, vi has two modes: insert mode (start this by typing "i"; exit this by hitting "escape") and normal mode (moving around, not typing).
  • Some introductory information is available here, here and here.
  • Vim is "Vi IMproved" (vim.org) -- mostly transparent. In fact, these days you mostly get Vim when you type Vi.

    Emacs (or XEmacs)

  • Emacs is another file-editing program that might look and act a little more normal. Naturally, it's not the one that I use.
  • To start Emacs (might be XEmacs), type
    %> emacs
  • To quit Emacs, type Ctrl-x Ctrl-c (yeah, that's awkward).
  • Useful information is found here, here, here (but kind of obscure), and, of course, here.
  • XEmacs works like Emacs but with a (possible) mouse interface -- perhaps more like what most people are used to.
  • XEmacs info can be found here, among other places.

    Hints

  • Both of these programs have lots of nuances, but mostly you can just start typing. Then, you can do your compiling/executing of your code in a separate xterm or terminal window.
  • Both of them are "syntax aware" -- this helps a lot with your coding.
  • If oyu are starting from complete scratch, (X)Emacs is probably a better place to start.
  • If you want to impress people with your hacker cred, use vi.

    Other choices

  • There's lots of other choices for editing files. Things like OpenOffice are generally NOT good choices because they are not "syntax aware" -- but in a pinch, they'll do.