Emacs basic usage: Difference between revisions
From wikinotes
(→Modes) |
No edit summary |
||
Line 1: | Line 1: | ||
= Documentation = | |||
<blockquote> | |||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
| digitalocean tutorial || https://www.digitalocean.com/community/tutorials/how-to-use-the-emacs-editor-in-linux | | digitalocean tutorial || https://www.digitalocean.com/community/tutorials/how-to-use-the-emacs-editor-in-linux | ||
|- | |||
|} | |} | ||
</blockquote><!-- Documentation --> | |||
= Modes = | = Modes = | ||
<blockquote> | |||
* major-mode (generally associated with language. only one active at a time) | * major-mode (generally associated with language. only one active at a time) | ||
* minor-mode (multiple minor modes can be activated at once) | * minor-mode (multiple minor modes can be activated at once) | ||
Line 24: | Line 30: | ||
menu-bar-mode: This can switch the main menu on or off. | menu-bar-mode: This can switch the main menu on or off. | ||
</source> | </source> | ||
</blockquote><!-- Modes --> | |||
= Command = | = Command = | ||
<blockquote> | |||
<source lang="bash"> | <source lang="bash"> | ||
Alt-x # enter command (enter) - then pass arguments | Alt-x # enter command (enter) - then pass arguments | ||
Line 38: | Line 46: | ||
ielm ;; Simply Access Lisp Interpreter | ielm ;; Simply Access Lisp Interpreter | ||
</source> | </source> | ||
</blockquote><!-- Command --> | |||
= Basics = | = Basics = |
Revision as of 05:30, 4 February 2023
Documentation
digitalocean tutorial https://www.digitalocean.com/community/tutorials/how-to-use-the-emacs-editor-in-linux
Modes
- major-mode (generally associated with language. only one active at a time)
- minor-mode (multiple minor modes can be activated at once)
emacs uses modes associated with different languages. (like filetypes in vim).
M-x # set a major or minor mode (ex: python-mode, c-mode, java-mode, ...)# major modes python-mode java-mode # minor modes line-number-mode: This toggles the display of current line number in the status bar. menu-bar-mode: This can switch the main menu on or off.
Command
Alt-x # enter command (enter) - then pass arguments;; Commands goto-line ;; go to line term ;; A full terminal-emulator. You can even run vim. eshell ;; LISP shell (emulates coreutils like ls, find but can evaluate LISP) ielm ;; Simply Access Lisp Interpreter
Basics
Files
Ctrl-x s # save (as current name) Ctrl-x w # save (indicate name) Ctrl-x, Ctrl-f # open file Ctrl-x Ctrl-c # close
# ======== # vertical # ======== Ctrl-n/p # line (prev/next) Alt-</> # buffer (start/end) (use shift) Alt/Ctrl-v # page (up/down) # ========== # horizontal # ========== Ctrl f/b # char (fwd/bkwd) Alt-f/b # word (fwd/bkwd) Ctrl a/e # line (start/end)Buffers
Ctrl-x, b # switch buffer Ctrl-x, Ctrl-b # list buffers Ctrl-x, o # toggle buffer selection (switch panes)Misc
Ctrl-space # selection (mark start/finish) Ctrl-s/r # search (down/up) # ==== # menu # ==== F10 # open file-menu Esc,Esc,Esc # exit file-menu Ctrl-h,r # emacs help manual # ========= # undo/redo # ========= Ctrl-x u # undo Ctrl-/ # redo # =========== # copy/paste # =========== E-w # copy Ctrl-w # cut Ctrl-y # yank Ctrl k # (kill) remove line until \n Ctrl y # paste all killed lines
Text
Alt-c # capitalize word after cursor Alt-u/l # word (upper/lower case)