ungleich-learning-circle/balazs/orgfiles/emacs_learning.org

2.8 KiB

Organisation #5: Emacs refresher

Lecture content
Objective: get confident with emacs commands
Find out and document how to do the following steps

Resources:

C-h b A searchable list of commands and shortcuts, very helpful

https://www.gnu.org/software/emacs/manual/html_node/emacs/ https://www.emacswiki.org/emacs/ https://www.gnu.org/software/emacs/refcards/pdf/refcard.pdf

Search for something forward: C-s

I've been using it, it's great!

How to continue searching

C-s multiple times.

Search for something backward

C-r

Search for regular expressions instead of string (forward, backward)

urxvt scrollback-search is already bound for : C-M-s there is no easy way to disable it atm note: maybe i'll try the suckless terminal or xterm

C-M-r is working note: need to learn regex

Go to the beginning of the line

C-a

Go to the end of the line

C-e

Delete a word in front (to the right of the cursor)

C-del

Delete a word in back (to the left of the cursor)

M-backspace

List all "occurences" of a word in a file

M-x grep or grep-find - Return

enter string and/or specify a file (default directory is set to the currently edited file) - Return

The result will show up in a new windows. C-x-o to switch windows

You can copy above instructions into an emacs buffer
And test it by showing all occurences of the word "Search"
Search (GREP) for a word in all files in a directory RECURSIVELY

M-x grep(-find) - Return add "-r" to the executed grep command

Save the CURRENT buffer

C-x C-s

Save ALL open files

C-x s

Split the window/buffer vertically

C-x 2

Split the window/buffer horizontally

C-x 3

Switch between the different windows

C-x o

Close all buffers besides the active one
Don't kill it!

C-x 1

Close only the active buffer

There is no "Close buffer" per se (spent 10 minutes finding it)

The way is to Close the Window: C-x 0

List the buffers by: C-x C-b (you can switch to the buffers from this buffer (ret))

Don't kill it

C-x k to kill it

Kill the active buffer

C-x k

Describe/Explain the difference between closing and killing

It's like tmux:

"Closing" just stops the rendering, and it will continue to run in the background. Killing stops the process and frees up the memory.

Switch between buffers that are not shown

C-x b (tab to list buffers)

Document two very similar, but slightly different ways

Switch buffers quickly: C-x <left> C-x <right>

ido mode should speed up buffer switching (haven't tried)

Outcome
Document all above commands in your learning org sheet
Share your documentation at the end of the session (not before)