Some commands that I often use in Emacs

Posted by – August 18, 2005

Before the end of June, 2005. I never heard of `Emacs‘ despite graduating with a computer science degree. Thanks to Daniel who told me such an excellent Editor and who taught me lots of tricks.


Each Emacs command can be invoked by M-x. (Alt key + x) with a command name. or C-x (Ctrl + x) followed by another key combination. For example , M-x shell will open a shell window with the Emacs editor. Here are some useful shortcuts of commonly used commands for a beginner.

Basis
C-x C-c End the Emacs session.
C-x C-f Open a file.
C-x C-s Save the file.
C-g Cancel the unfinished command.
M-~ Open the top menu.


Cursor moving
M-f Move forward a word
M-b Move backward a word
C-a Move to beginning of line
C-e Move to end of line
M-a Move back to beginning of sentence
M-e Move forward to end of sentence
M-< Go to beginning of file M-> Go to end of file


Edit
M-w Copy
C-y Paste
C-w Cut
C-d Delete the next character after the cursor
M-d Kill the next word after the cursor
C-k Kill from the cursor position to end of line
M-k Kill to the end of the current sentence


Select
C-[space] Set mark
First use command `set-mark' to mark the start point then move the cursor
wherever you want.


Searching
C-s Start a search (You can type C-s to find the next occurrence)
C-r Search back.
M-% Replace.


Buffer
C-x C-b List all the buffers.
C-x-b Change to next buffer.


Others
C-M-n (Ctrl+Alt+n) Move forward across one balanced group of parentheses.
C-x C+l Change the selected region to lowercase
C-x C+u Contrarily, upcase the region.

 

WeChatWhatsAppEvernoteLineInstapaperFacebookTwitterGoogle+LinkedInBaidu

Leave a Reply

Your email address will not be published. Required fields are marked *