Emacs is the bese editor I have ever used. It's very good at speed and language format.
.emacs setting
.emacs is a configure file for emacs. When emacs starts, it will run .emacs first. Usually .emacs is at ~/.emacs. Actually .emacs is something like LISP language.
- (setq inhibit-startup-message t) is used to shut down the welcome massage when you open emacs. its boring to see a welcome page every time you use emacs.
- t means true.
- nil means false.
- (setq-default make-backup-files nil) is used to shut down the backup automatically. But I recommend you open this function.
- (setq require-final-newline nil) will not require a new line in the end of file.
- But sometime, (setq require-final-newline nil) does not work. Because /usr/share/emacs/site-lisp/default.el will run after .emacs. At this time, you should switch off the default.el by using (setq inhibit-default-init t). I spent plenty of time on this stupid new line query. Now I can shut it down. But you have to open one thing[7] in .emacs.
- (when window-system
;; enable wheelmouse support by default
(mwheel-install)
;; make switching frames works properly under the default click- to-focus
(setq focus-follows-mouse nil) )
-----------------------------------------------------------------------------------------------
Find and Replace
- Find a string : C-s
- Find backward : C-r
- Find forward : C-s
- How to replace a string. M-x replace-string
- How to do query replace. M-x query-replace.
- You also can do query replace by. M-%
Rectangular Operations
Sometimes it's very convenient to use the rectangular selection in emacs. When you are learning how to do it, it's painful. But after you get it, it will save you much more time.
- Select a rectangular area and copy(cut) it to another place. Go to the left-top of the rectangular you want to select. Hit C-space. Then this point is mark set. Then go to the right-bottom of your rectangular area, and click C-x r r(C-x r k for cut) and Enter. This rectangular area has been copied to register. Move your cursor to the place where you want to put this area, and click C-x r i and Enter. After click enter, the content in register will be copied to the new place.
- Select a rectangular area and insert some strings. Hit C-space and click C-x r t and Enter. Then you will enter the text you want insert this area. After hit enter, you will see the text has been inserted.
Cursor Movement
- Move cursor to the beginning of a line : C-a
- Move cursor to the and of a line : C-e
- Move cursor to the beginning of this file: C-x [
- Move cursor to the end of this file: C-x ]
Multi-Windows
In emacs, you can split the window in to several windows.
- C-x 3 will split the window in two columns.
- C-x 2 will split the window horizontally.
- C-x 0 will shut down one window.
- C-x o will change the cursor between different windows.
Some very useful links
Ted's Blog for emacs
Emacs Keyboard Shortcuts
JW's Tips and Notes: Emacs Example Tutorial: insert a block of text
emacs-fu: working with rectangular selections





