Top 50 Emacs Commands and Emacs Shortcuts
This article will be solely about serving you with the best Emacs commands and Emacs shortcuts.
Certainly, Emacs is one of the most common text editors we have around these days. Its amazing features, for example, extensibility, customizability, plugins, and self-documentation make it an excellent tool among developers. In addition, Emacs is also called a real-time display text editor.
Moreover, it is a free/libre editor that is compatible with more than one platform. In other words, Emacs supports the Windows, macOS, BSDs, and GNU/Linux operating systems.
It’s interesting to know that almost all keystrokes in emacs yield out into a command. That is to say; a command is always called upon any time users press a key or more keys together.
So, therefore, there are about 3000 emacs commands and the most popularly used commands got a key shortcut. For example, searching the text, opening and closing a file, moving the cursor, etc.
1. Kill-line
This is used for getting rid of every character from the cursor to the end of the line.
Ctrl + k
Features:
- In addition, all you need do is to press “Ctrl+k.”
2. Backward-kill-word
Its duty is to delete the previous word.
Alt + backspace
Features:
Most importantly, users only need to enter “Alt+backspace“.
3. Kill-word
This does the deleting of words to the right.
Alt + d
Features:
Furthermore, press “Alt+d” to activate this.
4. Scroll-down-command
To sum up, press “Alt+v” to page up.
Alt + v
5. Stroll-up-command
In short, Everything you need to do to page down is to enter “Ctrl+v“.
Ctrl + v
6. Backward-char
This is simply the use of “Ctrl+b” to move the cursor a character towards the left direction.
Ctrl + b
7. Forward-char
This does directly the opposite of what the above command does.
Ctrl + f
Features:
- In other words, users are allowed to press “Ctrl+f” in moving the cursor a character in the right direction.
8. End-of-buffer
Here, for example, you are allowed to use “Ctrl+End” or “Ctrl+>” to put an end to a document.
Ctrl + End / Ctrl + >
9. Forward-word
Users are free to use “Alt+f” to move the cursor towards the right side of a word.
Alt + f
10. Backward-word
This does the same function as the forward-word command but in the opposite direction.
Alt + b
Features:
- That is to say, you are free to enter “Alt+b” to navigate the cursor towards the left side of a word.
11. Beginning-of-buffer
This is all about pressing “Ctrl+Home” or “Alt+<” in getting to the beginning of the file.
Ctrl + Home / Alt + <
12. Yank
Yank in this regard simply means to paste something already copied. In addition, you perform this by entering “Ctrl+p“.
Ctrl + p
13. Kill-region
So, therefore, you can simply press “Ctrl+w” to cut anything of your interest.
Ctrl + w
14. Kill-ring-save
You can simply use “Alt+w” to copy anything of your choice.
Alt + w
15. Undo
To perform undo, simply press “Ctrl+_“.
Ctrl + _
Features:
- In addition, you need to enter ” Ctrl+g” or any other character to perform a Redo.
16. Kill-buffer
This is done for closing a file.
Ctrl + x k
Features:
- In addition, all you need to do is press “Ctrl+xk“.
17. Save-buffer
This involves entering “Ctrl+x Ctrl+s” to save a file.
Ctrl + x Ctrl + s
18. Find-file
Press “Ctrl+x Ctrl+f” whenever you want to save a file.
Ctrl + x Ctrl + f
19. Mark-whole-buffer
It is simply about using “Ctrl+xh” for selecting all texts.
Ctrl + x h
20. Split-window-below
This is performed for splitting the window up/down. In addition, you will need to press “Ctrl+x2” to activate this.
Ctrl + x 2
21. Split-window-right
Splitting window side by side is simply done by pressing “Ctrl+x3“.
Ctrl + x 3
22. Delete-other-windows
This command is used for getting rid of all split panes.
Ctrl + x 1
Features:
- Furthermore, press “Ctrl+x1” to activate this.
23. Other-window
This involves the use of “Ctrl+xo” for moving the cursor to the other pane.
Ctrl + x o
24. Cua-mode
You will need to press “Alt+x” to activate this mode. In addition, cua-mode serves the purpose of using standard keys to copy, cut, and paste.
Alt + x
Features:
- For instance,”Ctrl+c” to copy, “Ctrl+x” to cut, “Ctrl+z” to undo and “Ctrl+v” to paste.
25. New-empty-buffer
This is simply the use of “Ctrl+n” to open a new file.
Ctrl + n
26. Write-file
Press “Ctrl+shift+s” any time you want to perform Save-As.
Ctrl + shift + s
Features:
- That is to say, you are free to use this command if you want to newly save a file.
27. Switch-to-next-frame
Simply use “Alt+`” to get to the next window.
Alt + `
28. Switch-to-previous-frame
This does the direct opposite of the previously explained command above.
Ctrl + ~
Features:
- In other words, press “Ctrl+~” to reach the previous window.
29. Next-user-buffer
This is all about using “Ctrl+⇟PageDown▽” for getting to the next tab.
Ctrl + ⇟PageDown▽
30. Previous-user-buffer
This is simply the use of “Ctrl+⇞PageUp△” to get back to the previous tab.
Ctrl + ⇞PageUp△
31. Shrink-whitespaces
This is simply the use of “Alt+w” for taking out spaces or tabs around the cursor.
Alt + w
32. Compact-uncompact-block
This shortcut, “Alt+q“, is used for hard wrapping or unwrapping text users have changed.
Alt + q
33. Toggle-letter-case
This is simply the use of “Alt+/” for changing capitalization.
Alt + /
34. Switch-to-buffer
This is simply the use of “Ctrl+xb” for selecting another buffer.
Ctrl + x b
35. List-buffers
This involves using “Ctrl+x Ctrl+b” for listing the entire buffers.
Ctrl + x Ctrl + b
36. Next-buffer
Users use this to navigate to the next buffer. Furthermore, all you need do is to enter “Ctrl+x [right]” to perform this.
Ctrl + x[right]
37. Previous-buffer
This is almost similar to the command explained above but with some slight difference.
Ctrl + x[left]
Features:
- That is to say, you need to press “Ctrl+x [left]” to move to the previous buffer.
38. Help-for-help
You need to enter “Ctrl+h?” to view all the commands in other to get help on Emacs.
Ctrl + h ?
39. Describe-function
This is simply the use of “Ctrl+hf” to describe a given function.
Ctrl + h f
40. Describe-variable
In short, simply press “Ctrl+hv” to describe a variable.
Ctrl + h v
41. Describe-mode
This command is used for describing mode. In addition, the binding keys for this are “Ctrl+hm“.
Ctrl + h m
42. Describe-syntax
This command helps in telling the Emacs users all they need to know about the syntax.
Ctrl + h s
Features:
- Furthermore, press “Ctrl+hs” to achieve this.
43. Describe-bindings
To sum up, this is simply the use of “Ctrl+hb” to acquire every detail about key bindings for the current buffer.
Ctrl + h b
44. Describe-key
This is used for describing a specific key binding. In addition, all you need do to perform this is to press “Ctrl+hk“.
Ctrl + h k
45. Alt-x dired
This is simply the use of “Ctrl+xd” for opening directory and entering the dired mode.
Ctrl + x d
46. Alt-x dired-other-window
This is specifically for opening directory in other window.
Ctrl + 4 d
Features:
- In addition, press “Ctrl-x 4 d” to make this happen.
47. Alt-x dired-other-frame
This is simply the use of “Ctrl-x 5 d” to open a directory in another frame.
Ctrl + 5 d
48. Ctrl-a
This is simply used for taking the cursor to the starting point of a line.
Ctrl-a
49. Ctrl-e
This shortcut is different from the one discussed above.
Ctrl-e
Features:
- In other words, it helps in moving the cursor to the end of a line.
50. Ctrl-x r m
In short, this is simply used for creating bookmarks.
Ctrl-x r m
Conclusion
Understanding and knowing how these amazing Emacs commands and Emacs shortcuts work in Emacs is key but also knows that practice makes perfect. Look at each of them carefully and familiarize yourself with them using Emacs.