Sunday 22 June 2008

Emacs Quick Introduction

Installing emacs in a Ubuntu or Debian distro
$sudo aptitude install emacs

Launching emacs
$emacs

If you want to launch emacs in a console without X support, simply exec:
$emacs -nw

Notation:
C-x means mantain pressed control key and then press x key.

Reseting input buffer
C-g resets command input buffer. It is great if you mistyped a command.

Displacement commands:
C-n goes to next line
C-p goes to previous line
C-f goes to next character
C-b goes to previous character
C-a goes to the begining of the line
C-e goes to the end of the line

Deleting, cutting and pasting text
C-d deletes character under the cursor
C-k cuts from the cursor position until the end of the line.
C-y pastes previous cut text.

Undo command
C-x u undoes previous command.

Dealing with files
C-x C-f opens a file
C-x C-w saves current file.

Closing emacs
C-x C-c closes emacs.

Passing arguments to commands:
E.g: C-u 8 C-n Advances eight lines.

Reading emacs self-documentation:
C-h t opens emacs tutorial


These are the minimal set of commands to work with emacs like a notepad.

Emacs is an extremely powerful and flexible text editor. You are not even on the surface of emacs potential. I recommend you to study and use it.