Don't forget, all the basics such as copy, paste, open, save … are in the graphical menus. The menu also shows you their keyboard shortcuts.
First, turn on the CUA mode, under the menu 〖Options ▸ C-x/C-c/C-v Cut and Paste (CUA)〗. The CUA mode will activate the following shortcuts:
Also, it will highlight when a region of a text is selected. And, when a text is selected, typing any text will automatically replace the current selection. Pressing the ⌫ Backspace key will also delete the selection.
|【Ctrl+x Ctrl+f】||Open a new file|
|【Ctrl+x Ctrl+s】||Save file|
|【Ctrl+x k】||Close the current file|
Use the arrow keys ↑ ↓ ← →, and ↖ Home, ↘ End, ⇞ Page △, ⇟ Page ▽ keys.
|【Ctrl+←】||Move cursor left by word.|
|【Ctrl+→】||Move cursor right by word.|
|【Ctrl+↖ Home】||Beginning of document.|
|【Ctrl+↘ End】||End of document.|
|【Alt+d】||Delete the next word|
|【Alt+⌫ Backspace】||Delete the previous word|
|【Ctrl+k】||Delete all characters from cursor to end of line|
First pull the menu 〖Options ▸ C-x/C-c/C-v Cut and Paste (CUA)〗, then pull the menu 〖Options ▸ Save Options〗.
|【Ctrl+z】||Undo. (To redo, type any character then do undo twice.)|
|【Ctrl+x h】||Select All|
|【Ctrl+Space】||Mark the starting point for copy/cut a text|
|【Ctrl+x 2】||Split window into 2 panes|
|【Ctrl+x 1】||Make the cursor pane fill window|
|【Ctrl+x o】||Move cursor to the other pane|
To search a word, press 【Ctrl+s】, then type your search text, emacs will move the cursor to the location of the matched text as you type. Press 【Ctrl+s】 again to jump to the next occurrence, press 【Ctrl+r】 to jump to the previous occurrence.
Once you found what you are looking for, press a arrow key to exit.
To exit search and leave the cursor at the place before search started, press 【Ctrl+g】.
See: advanced emacs tips.
In emacs, every keystroke actually executes a command. For example, when you type a key e, emacs actually runs the command
self-insert-command. Any key or key combination sequence you press ultimately calls a command. There are 2.5k commands in emacs. Most commonly used commands have a keyboard shortcut, such as moving the cursor, opening file, copy paste, close a file, search text. To run a command by name, type 【Alt+x】 followed by the command name.
|【Ctrl+g】||Cancel a command in progress, or cancel unfinished keyboard keystroke sequence|
|【Alt+x】||execute a command by name|
If you know a command's name, you can find out its keyboard shortcut (if there is one).
If you know a keyboard shortcut, you can find out what command it calls.
The commands for these are
|【F1 k】||Find the command name of a key|
|【F1 f】||Find the key of a command|
In emacs, a selection of text is called “region”. Many commands acts on the selected text. Here are some examples of commands that act on the region.
Not all commands acts on region. Here are some commands that do not necessary need a region:
list-matching-lines(acts on whole file)
delete-matching-lines(acts on region if exist, else work from cursor point to end of file.)
delete-non-matching-lines(acts on region if exist, else work from cursor point to end of file.)
highlight-phrase(color a word you want. Acts on the whole file)
The above are just some examples. There are 2.5k commands in emacs by default.Disqus