Command | Description |
emacs | The best way to get started with emacs is to do the tutorial. If you start emacs with no file name in the command line, you will get instructions on how to run the tutorial. |
emacs filename | This will create and edit a file with the emacs editor. For example, this will create a C program: emacs program.c |
Arrow keys | You can use the arrow keys and also page up and page down to move the cursor. |
C-x C-s | Save the file. C-x means to press the control (Ctrl) key and while you are holding it down, press x. Other notations use ^X or Ctrl-X. |
C-x C-c | Quit emacs and save the file. |
C-d (or Delete key) |
Delete the character at the cursor. |
Backspace key | Delete the character preceding the cursor. |
C-k | Delete from the cursor to the end of the line. |
C-s | It does an "incremental search". For example, if you are looking for "hello", you type h and it looks for the first h. Then you type e and i\ t looks for "he". etc. Type C-s again, and it will look for the next occurrence of the word. |
C-v | Not to be confused with "paste", this scolls down in the file. Useful for longer programs. |
M-v | This scolls up in the file. The M stands for the Meta key, which is the Esc key on most keyboards. |
C-x u | This will undo the previous command. |
Multiple windows | With SSH, you can have any number of windows. I recommend that you start by opening one window in which you run a program and another window for editing. Edit a program in the edit window. Then save it - use C-x C-s--and then compile it and run it in the other window. Just click in a window to make it active. Note that you don't have to exit the editor - you have to save, but you can leave the editor there while you run the program. It is convenient to be able to see the program while you run it. It is also convenient to be able to start editing by just clicking in the edit window. Sometimes it helps to be able to see the execution output while you are editing. This is especially true if you compile and get a bunch of error messages - you can see the error messages while you edit the program to make the corrections. |
Customize your Emacs |
To enable the backspace key, disable tabs, and set the indention to 2 spaces, put the following statements in your .emacs file: ; disable the binding that has backspace call "help" ; enable it do the same as delete (global-set-key [?\C-h] 'delete-backward-char) (global-set-key [?\C-x ?h] 'help-command) ;; overrides mark-whole-buffer ;set indenting to 2 places (defun indentk () (setq c-basic-offset 2)) (add-hook 'c-mode-hook 'indentk) ;display column numbers (setq column-number-mode t) |
Click to validate the HTML code
Click to validate the CSS code