Basic Emacs operations

Source: Internet
Author: User
Tags ftp file

Emacs shortcut
Mastering the shortcut keys of Emacs is a basic skill for Emacs fans and a must for improving the editing speed and quality.
But beginners may not be able to remember that many shortcut keys can be turned over if necessary, the number of the most commonly used Shortcut Keys is dozens
. Emacs shortcut keys are bound to CTRL and ALT (or Meta). For example, C-X is Ctrl + X, and m-X is
Alt + X. Of course, all buttons can be customized.
File Operations
C-x C-F open the file. When prompted, enter/username @ host: filepath to edit the FTP file.
C-x C-V open a file to replace the current Buffer
C-x C-s save the file
C-x C-W is saved as a new file.
C-x I insert a file
Switch C-x C-Q to read-only or read-write mode
C-x C-C Exit Emacs
Edit operation
C-F advances one character
C-B returns one character
M-F forward a word
M-B returns a word
C-a move to the beginning of the line
C-e move to the end of the row
M-a move to the beginning of the sentence
M-e move to the end of the sentence
C-P: return a row
C-N forward line
M-x goto-line jump to the specified row
C-v FLIP down
M-V Page up
M-<buffer Header
M-> buffer tail
C-m-F forward matching brackets
C-m-B: backward matching brackets
C-l center the current row
M-N or c-u n repeat the subsequent command n times
C-u repeat the subsequent command four times
C-U c-u repeat the subsequent command eight times
C-x ESC run history Command records, M-P select the previous command, M-N select the next command
C-d: delete a character.
M-D delete a word
C-k deletes a row
M-K delete a sentence
C-W: Delete the marked area
C-Y: paste the deleted content
Note: C-y can be used to paste the deleted content of c-k consecutively. Press C-y first, and then press m-y to choose to paste the deleted content.
Content
C-@ mark the start Area
C-x H mark all text
C-x switch cursor position and start of area marking area
M-W copy tag Area
C-_ or C-x u Undo operation
Execute shell commands
M-x shell Open Shell
M -! Execute shell commands (shell-command)
M-1 M -! Run the shell command to insert the cursor position in the Command output without opening the new output window.
M-| execute commands (shell-command-on-region) for a specific region, such as C-x h m-| uencode
Window operations
C-x 0 close this window
C-x 1 only leaves one window
C-x 2 vertical evenly distributed Window
C-x 3 average water distribution window
Switch C-x O to another window
C-x s saves the buffer of all windows
C-x B select the buffer in the current window
C-x ^ vertically expanded window
C-x} horizontal expansion window
Buffer list operations
C-x C-B open the buffer list
D or K marked as Delete
~ Marked as not modified
% Mark as read-only
S save Buffer
U unmark
X: Mark the operation.
F Open the buffer in the current window
O open the buffer in other windows
Directory operations
C-x d Open Directory Mode
S display by date/file name order
V. Read the file where the cursor is located.
Q: exit the Read File.
D. Mark as Delete
X execution mark
D. Delete the current file immediately.
C. Copy the current file.
R re-name the current file
+ Create a folder
Z compressed file
! Execute shell command on the file where the cursor is located
G refresh display
I insert sub-directory content at the end of the current Buffer
[N] M indicates the file where the cursor is located. If n is specified, the last n files are marked from the file where the cursor is located.
[N] U cancels the file marked by the current cursor. The meaning of N is the same as above.
T reverse mark file
%-M Regular mark
Q: Exit directory Mode
Note: In directory mode, if you enter !, Include * Or? In the command line ?, It has special meanings. * Match the current light
Mark files and all marked files ,? Run this command on each marked file.
Program Compilation
M-x compile
M-x GDB troubleshooting
M-x DBX troubleshooting
M-x XDB troubleshooting
Troubleshooting M-x SDB
Search Mode
C-s key forward search
C-s find the next
Enter to stop searching
C-r key reverse search
C-s c-W search by the word at the cursor position
C-s c-s repeat the previous search
C-R c-r repeat the previous reverse search
C-s enter C-W to enter the word search mode
C-r enter C-W to enter the reverse word search mode
M-x replace-string Enter search-string enter replace
M-% search-string enter replace-string enter interactive replacement
After c-r enters the search/replace mode, the command enters the iterative editing mode.
C-m-x exits the iterative editing mode and returns the search/replace mode.
C-m-s forward Regular Expression search
C-m-r backward regular search
C-M-% regular interaction replacement
Shell Mode
C-c is equivalent to C-C in bash.
C-c-Z is equivalent to C-Z in bash.
C-c-d is equivalent to c-d in bash.
M-P: Execute the previous command.
C-N: Execute the next command
C-c-o deletes the output produced by the last command.
The c-r screen is scrolled to the beginning of the last command output.
The c-e screen is scrolled to the end of the last command output.
View the output of the previous command in c-P.
View the output of the last command in c-N.
Print materials
M-x print-buffer first uses PR, and then uses LPR
M-x LPR-buffer directly uses LPR
M-x print-region
M-x LPR-region
Send and receive emails
M-x mail sends emails, c-s sends, c-c sends and exits
M-x rmail accepts emails
Customization
Emacs users can customize the editor based on their own needs and preferences. Powerful and free Customization
It is one of the important reasons why Emacs is popular. Emacs can be customized in three ways.
The first method is to use Emacs's interactive customization function. Emacs provides a graphical interactive interface for you
Customizes public variables. This method makes Emacs beginners do not need to contact Emacs lisp generation.
Code to complete the customization.
The second method is to record a series of buttons as macros. Calling this macro can repeat a series of complex operations that have already been recorded.
. Macros can be saved and named for calling by name, but only one anonymous macro can exist at a time.
The third method is to use emasc LISP to customize Emacs. This method is the most complex, but it is also mentioned
More flexibility and powerful functions are provided. You usually save the customized Emacs lisp code in a file named.
In the Emacs configuration file, the file is read at the beginning of the Emacs program, and the configuration required by the user is completed. Users can
You can use the. emacs file to reset variables, redefine key bindings, and define new commands,
To facilitate your personal use. Many advanced users have personalized configuration of. emacs files up to hundreds of lines or even more.
Some personal customization makes their Emacs not only different from the default configuration, but also different from each other's Emacs.
This difference can meet the preferences of different personalities and the needs of different jobs.
If an Emacs lisp code is indeed useful, it is usually packaged and published to other users. On the internet
Find many elisp libraries from third parties, such as Wikipedia-mode that can be used to edit Wikipedia entries. Use
. Net News group GNU. emacs. sources released a new elisp library. Some Third-Party code eventually becomes E
Part of Macs "standard library.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.