分类: C/C++
2008-10-23 15:15:34
08.10.20
C-x C-f File --> Open File
C-x C-v File --> Find alternate file
C-x i File --> Insert File
C-x C-w File --> Save File
C-x C-c --> Exit emacs
C-h --> Help command
C-h f --> Describe function
C-h k --> Describe key
C-h t --> Emacs tutorial
C-h i --> Browse Manuals
M-x refill-mode Enter
M-x auto-fill-mode Enter
C-x u --> undo
M-x paragraph-indent-text-mode Enter
M-x fill-region Enter
M-x fill-paragraph Enter
C-p
(previous line)
^
|
C-b <- -> C-f
(backward char)| (forward char)
v
C-n
(next line)
M-f forward a word
M-b backward a word
C-a beginning of the line
C-e end of the line
M-a backward one sentence
M-e forward one sentence
M-} forward a paragraph
M-{ backward a paragrah
C-x ] forward a page
C-x [ backward a page
C-q C-l insert page breaks
08.10.21
C-v page through a file one screen at a time
M-v show you the previous screen
M-> go to the end of a buffer
M-< go to the beginning of a buffer
M-x goto-line Enter n Enter moves the cursor to line n of the file
M-x goto-char Enter n Enter goes the n th character of the file
M-500 C-n the cursor would move down 500 lines
C-u 500 C-n the cursor would move down 500 lines
C-l puts the current line in the center of window vertically
C-x u undoes your last edit, type undo again undoes the edit before
C-_ undoes your last edit, type undo again undoes the edit before
C-d deletes the character under the cursor
M-d kill word
M-backspace backward kill word
C-k kill line
M-k kill sentence
C-y yank
M-x kill-paragraph kill next paragraph
M-x backward-kill-paragraph kill previous paragraph
C-@ set the mark at one end of the region
C-x C-x swaps the locations of the mark and the point
C-w Edit kill-region
M-h sets the mark at the end of paragrah and place the cursor
at the beginning automatically.
C-x h mark the entire buffer; the cursor goes to the beginning, and
the mark is placed at the end.
C-x C-p marks the current page
M-w to copy text, mark a region, then press M-w
M-y deletes the text you just yanked and gets the next most recent
text from the kill ring.
08.10.22
C-t transposes two letters, to put them in the right order
put the cursor on the second of the two letters to be transposed.
M-t transpose two words, put the cursor between the two words
emacs moves words, but not punctuation.
C-x C-t transpose two lines, put the cursor anywhere on the second of the
two
M-c capitalize the first letter of any word, put the cursor on the
first letter
M-l put a word in lower case
M-u put a word in upper case
C-g Canceling Commands
C-x u Undoing Changes
M-x revert-buffer Enter undo all changes made since you last saved the file
M-x recover-file Enter recover text from an auto-save file
C-x C-s start auto-saving
08.10.23
Simple search
You give Emacs a search string, and it finds the next occurrence. You will
find this search in almost any editor.
Incremental search
With incremental search, Emacs starts to search the file as soon as you type
the first character of a search string. It continues to search as you type more
characters.
Word search
A word search is like a simple search, except that Emacs searches only for
full words and phrases. For example, if you are searching for the words hat,
you don't have to worry about finding the word that. A word search is also
useful when you need to find a phrase that is spread across two lines.
Regular expression search
To search for patterns, you can use a regular expression search. For example,
if you wanted to find all instances of B1 and B2, you could search for them
using the regular expression B[12].
Incremental regular expression search
This search procedure is a combination of an incremental search and a regular
expression search.
Replacement operations are closely related to searches. As with searches, Emacs
offers you several different flavors:
Simple search and replace
Emacs replaces all occurences of one string with another.
Query-replace
With query-replace, Emacs conditionally replaces a string throughout a file.
Emacs finds all occurrences of the search string, and for each one it asks you
whether or not to perform the replacement.
Regular expression replace
Regular expression replacement uses the powerful pattern matching facility
of the same name to find strings and replace them.
C-s incremental search
C-s search string's next occurence
C-r search back
C-g cancel search
C-s C-w copy text from the cursor position through the next space or
punctuation mark into search string.
C-s C-y copy text from the cursor to the end of the line into the
search string.
C-s M-y copy text from the kill ring to the search string
C-s Enter searchstring Enter forward simple search
C-r Enter searchstring Enter backward simple search
C-s Enter C-w word-search-forward
C-r Enter C-w word-search-backward