4

EMACS FUNDAMENTALS

In order to do any Lisp coding at all, you need to be able to edit text (duh). With Doom Emacs, you have three options: Use Emacs keybindings, use Evil keybindings, or use Emacs as much as possible like VSCode or other editors you're likely familiar with. We'll call the last one Survival Mode. So far, you've been in Survival Mode.

  1. You've typed C-z to enable Evil Emacs State, which enables editing using standard Emacs keybindings.
  2. You probably turned off lispy-mode to avoid confusing behavior.
  3. You edited text as usual: type, mouse click around, scroll wheel up and down, click and drag to highlight text, copy/paste with the keybindings you already know, etc.
  4. You've used the top menu bar or mode line to browse commands you can use while editing Lisp files.

If you're still on the fence about this whole Emacs/Lisp thing, there is no shame in staying in Survival Mode. However, you probably ended up using some keybindings already for frequently used commands that you learned in the menu. This is the perfect start to learning Emacs–gradually incorporating more and more keybindings/functionality into your workflow as your power grows.

This chapter will help you increase your mastery of Emacs by introducing you to keybindings for many of the most common and useful functions in Doom Emacs, starting with text and Lisp editing, then moving on to buffers, windows, and projects.

SUPPORT LEVEL DISCLAIMER

None of the functionality here is necessary to continue this book. Instead, you should consider this chapter a reference to return to whenever you are ready to add a little more Emacs functionality into your workflow.

However, I won't be including any more references to the menu or using the mode line to navigate to and execute commands. For the rest of this book, I will refer to keybindings and give the names of the commands as well so that you can become familiar with the different packages and commands that are associated with different parts of Doom Emacs' functionality.

I will also assume that you are using Evil Normal State at least partially. If you are in Emacs State and the keybindings aren't working, type M-x and type in the name of the command I am referencing. Some commands may not have keybindings in Emacs State, or they may be confusing.

Example: evil-delete-line will not have a keybinding in Emacs State and org-kill-line in Normal State is bound to <deleteline>.

I won't be testing any of the keybindings in Emacs State. If you want to use Emacs State exclusively you might be able to run some keybindings using M-SPC instead of SPC, but not all commands have such alternative bindings.

I will only test keybindings in lisp-mode; other modes may have different bindings, or commands that do similar but subtly different things may share bindings in different major modes.

SETTING EXPECTATIONS

Learning Evil bindings + Doom Emacs exclusive bindings will take time. Expect to stumble around for two weeks, feel somewhat productive in two months, and proficient in about 6-12 months. As always, focus on the keybindings and features that seem most useful to the task at hand–learning Common Lisp–and learn more Emacs as you learn more Common Lisp.

TEXT EDITING

First, let's start with text editing.

By default, evil-mode is available and active in Doom Emacs. This means that you have access to both Emac's default bindings as well as bindings typical of Vim/Neovim.

If you don't already know how to use the Neovim keybindings, you can check out https://openvim.com or https://vim-adventures.com/. Both provide an interactive experience for learning the VIM text navigation keybindings.

evil uses several different editing states. The three most common are Normal, Insert, and Visual. In Normal State, you navigate and run commands, often starting with SPC. In Insert State, you can edit text. In Visual State, you can select and act upon regions of text.

These states are set on a per-buffer basis. The state of the current buffer is displayed on the left side of the mode line.

Whenever a keybinding in this book mentions a keybinding starting with SPC, I assume you are in Evil Normal State.

Inserting

Type i to enter Evil Insert State and type as usual.

Cutting/Copying/Pasting

To cut some text, you must kill it.

The simplest way to kill some text is to kill the entire contents right of the cursor with D (lispyville-delete-line) while in Normal State.

To kill a whole line, type d d in Normal State.

You can kill single characters with x, single words with k i w or M-backspace. You can kill the contents within some textual boundaries like () or "" with k i ( or k i quotemark. You can include the boundaries with k o instead of k i.

To copy something, you must yank it.

Use y y in Evil Normal State to yank a line. You can yank a word with y i w or a symbol with y i o.

To paste some text, type p in Evil Normal State, or s-v (or whatever keyboard shortcut you're accustomed to using to paste text).

Marking Text

You can mark regions of text to work on using Visual State. Type v and then navigate text to select it from where you first entered.

Marked text can be killed or yanked. There are plenty of other operations that you can do on marked text, but we'll save that for another time.

Simple Searching

You can search for some text in a buffer with SPC s s (+default/search-buffer).

Aborting A command

Let's say you pressed SPC f, but you decided you don't want to continue. To abort the command, press C-g (doom/escape).

It's common to accidently hit a key or combination of keys you didn't mean to. If you are "stuck" inside some command, or in the middle of a keybinding, the quickest solution is to press C-g a few times.

Undoing An Action

C-/ (undo-fu-only-undo) will undo the previous action. Doom also includes the s-z keybinding, which is the same as undo in the browser, MS Word, etc.

Doing An Action Multiple Times

In Doom Emacs, if you press a number while in Normal State before running a command, entering Evil Insert State, etc. Emacs will run the action the same number of times as the number you typed.

If you don't know VIM/evil keybindings, you probably won't want to do this, but you may accidently do so. For example, you may be in Evil Normal State, press 9, enter Insert State and type something, then return to Normal State with ESC, at which point you now have inserted the same text 9 times. It might look something like this:

(+ 1 1(+ 1 1(+ 1 1(+ 1 1(+ 1 1(+ 1 1(+ 1 1(+ 1 1(+ 1 1)))))))))

The best thing to do in this situation is just undo and retype.

This functionality can be quite useful. For example, if you want to navigate down 10 lines, you can type 10 j in Normal State to navigate down ten lines. It also makes it easy to type decorative dividers in comments like this:

;; ==============================

Multiple Cursors

Type g z z (+multiple-cursors/evil-mc-toggle-cursor-here) to create a cursor. Move your cursor and the one you created stays in place. You can create arbitrary numbers of cursors. Once you've made all the cursors you need, you can begin editing them by entering Evil Insert State.

If you need to pause the cursors, type g z t (+multiple-cursors/evil-mc-toggle-cursors). If you need to undo the creation of the last cursor, type g z u (+multiple-cursors/evil-mc-undo-cursor).

Multiediting

If you like multicursor editing in other editors, you're going to love multiediting in Doom Emacs. With multiple cursors, you can place cursors in arbitrary locations. The downside is that you need to move the cursor to each location you want to place the cursor. With multiediting, you can search and highlight text and edit all highlighted areas simultaneously. You can leave the highlighted regions and edit other text, then return to the highlighted region an

Place the cursor or mark a region. Type M-d (evil-multiedit-match-symbol-and-next) to begin multiediting. If you type M-d again, you will mark the next symbol or region that matches the first one. You can continue that as many times as you want.

You can also match backwards with M-D (evil-multiedit-match-symbol-and-prev).

While multiediting, if you press Enter, you will remove a match from being edited. C-g to quit multiediting. Typing Enter again will toggle the match back on.

After marking several matches, you can navigate directly between them with C-n (evil-multiedit-next) and C-p (evil-multiedit-prev).

To unmark all matches and quit multiediting, type C-g (maybe a few times).

Searching & Replacing

When you want to rename a few instances of a symbol in a defun, multiediting is the right tool for the job. If you want to rename a function throughout a file, there is a better tool for the job: VIM search and replace.

To begin using it, just type : (evil-ex). How you proceed from there depends on how sophisticated your search and replace operation needs to be. The simplest case is replacing all instances of some text throughout the buffer:

:%s/TEXT TO REPLACE/TEXT TO REPLACE IT WITH/g

This search and replace tool is very powerful, but a full treatment is out of the scope of this book. A good place to learn more is the Vim tips wiki (https://vim.fandom.com/wiki/Search_and_replace).

Running Commands/Functions With No Keybindings

There are many commands that don't have keybindings. There are also many commands you don't know the keybindings for.

To find and run those commands, type M-x. A minibuffer will open with a list of commands and a short description. If they have a keybinding, it will be displayed in parentheses next to the command itself.

C-n will move the cursor down a line inside that minibuffer. C-p will move the cursor up a line.

Quick Reference Table

Here's a quick reference table for everything covered in this section:

Action Emacs Binding Evil Binding (Normal State)
enter Insert State   i
delete character   x
delete to end of line   D
delete whole line   dd
delete inner word   diw
delete a word   daw
delete inner parentheses   di(
delete inner quotes   di"
delete around parentheses   da(
delete around quotes   da"
delete with alt-backspace M-Backspace M-Backspace
yank (copy) line   yy
yank (copy) inner word   yiw
yank (copy) inner symbol   yis
paste after cursor   p
paste from system clipboard C-v s-v
enter Visual State   v
search in buffer   SPC s s
abort command C-g C-g
undo C-/ s-z or C-/
repeat action N times   <number> then command
multiedit: match symbol and next M-d M-d
multiedit: match symbol and prev M-D M-D
multiedit: toggle match Enter Enter
multiedit: next match C-n C-n
multiedit: previous match C-p C-p
quit multiediting C-g C-g
start ex command (search & replace)   :
execute command (M-x) M-x M-x
navigate down in minibuffer C-n C-n
navigate up in minibuffer C-p C-p

BUFFER NAVIGATION & MANAGEMENT

Buffers are the most fundamental abstraction in Emacs. A buffer is a named place that displays some data. Usually buffers display the contents of text files, but they can also point to Emacs-specific functionality like the *scratch*, *Messages*, or *Org-Agenda* buffers. Some buffers may be called minibuffers. Minibuffers are typically designed to be ephemeral, like the buffer that appears when you type M-x to run some command.

Once you're done learning the essentials of buffer navigation and management, you'll be able to:

  • Open & Close buffers.
  • Open a "scratch" buffer.
  • Switch between buffers.
  • View lists of buffers.
  • Save Files.
  • Get more information about buffers.

Opening Buffers

To open a file buffer, type C-x C-f or SPC f f to run find-file. You can open a file that already exists, or you can navigate to a directory and/or file that doesn't exist, type Enter, and create a buffer for that location. The file/directory doesn't exist until you save the buffer.

Besides file buffers, there are many other kinds of buffers. The most important buffer to know as a beginner is the M-x command minibuffer. There you can get a list of function you can (possibly) run. There are many commands that aren't bound to keybindings that you may want to use on occasion (or perhaps you would like bind them to a custom key command).

Scratch Buffer

The scratch buffer is a buffer that can be opened to use the same way "scratch" paper is use–to do a little work that you'll quickly save somewhere else or discard after a short time. You can open it with SPC x. Once in the buffer, you can change the mode using M-x and typing in the mode.

Switching Buffers

You can switch buffers by typing C-x b or SPC b B (consult-buffer). You will be presented with a minibuffer listing all buffers that are open. Unlike list-buffers, you can navigate the list of buffers using C-n/C-p and peak at the buffer before switching to it. The minibuffer is smaller and disappears after you select a buffer to switch to.

You can't mouse click buffers in the list to switch to them. You have to either type the name (often the ideal way to switch to a buffer anyway) or use Emacs keybindings to move the cursor up and down the list with C-n an C-p and select with Enter.

Closing Buffers

To close the active buffer, type s-k or SPC b k. If you want to close multiple buffers, you can type C-x C-b to run list-buffers. Inside the *Buffer List* buffer, you can mark a buffer to close with d. After marking all of the buffers you want to close, you can "execute" the closing with x.

Different minibuffers often can be closed with simpler keybindings like ESC or q.

Saving File Buffers

You can save the current file buffer with C-x C-s or s-s.

Getting More Information About A Buffer

As you get more experience with Emacs, you may want to know how something works. Many functions–especially in a distribution like Doom–are not native functions. They are often available because of a major or minor mode created by a certain package that's installed. Thus, learning more about the environment can help you come to grips with what package does what and what other functionality is available but "hidden".

You can get more information about the major and minor modes of the active buffer using C-h m or SPC h m (describe-mode). A minibuffer listing all the modes–including all of the functions/keybindings those modes provide–will appear.

You can go deeper and find information about a function with C-h o or SPC h o (describe-symbol) and then typing in an Emacs Lisp symbol or function name. Documentation and the actual code of the function will be made available in a minibuffer.

The documentation that describe-symbol shows includes keybindings for the function. Unlike the M-x minibuffer, you can see all of the bindings for a single function (many functions have multiple bindings, as you've probably noticed already). The M-x minibuffer will only show one binding.

Maybe you know a keybinding but don't know or remember the function that the keybinding calls? Maybe you hit a key that did something surprising and want to know what the heck it was?

In that case, you can use C-h k or SPC h k (describe-key). You will be prompted to type the keybinding you want to know more about.

Browse Buffer Keybindings

To browse keybindings and functions, you can either type M-x to open a list of all commands, or you can open embark-bindings with C-h b b or SPC h b b. The embark-bindings command is especially useful because it only shows the keybindings available in the current buffer. describe-mode also shows all of the functions a mode provides, but only shows a maximum of one binding per function. The embark-bindings command, on the other hand, shows you all of the bindings. Additionally, embark-bindings lets you search keybindings. For example, you can search for "C-c" and find all keybindings that include C-c in any of them. This will be especially useful for fuzzy searching keybindings, or if you're looking for an open keybinding in a buffer you want to make a custom shortcut for.

Quick Reference Table

Here's a quick reference for everything in this section:

Action Emacs Binding Evil Binding
find file / open buffer C-x C-f SPC f f
open scratch buffer   SPC x
switch buffers C-x b SPC b B
close active buffer   s-k or SPC b k
list buffers C-x C-b  
mark buffer to close (in list) d d
execute closing (in list) x x
save current file buffer C-x C-s s-s
describe mode C-h m SPC h m
describe symbol C-h o SPC h o
describe key C-h k SPC h k
embark bindings C-h b b SPC h b b
close minibuffer ESC or q ESC or q

WINDOW NAVIGATION & MANAGEMENT

In Emacs, a "frame" is what most people would call a window: an operating system-level defined space to display the contents of an application.

Emacs uses the word "window" differently from how operating systems do. Emacs windows are separate places where buffers can be displayed. Buffers, of course, show either file contents or things like the Lisp REPL. A frame can be subdivided into many windows, each displaying a single buffer at a time.

Opening, closing, and navigating between windows are essential skills for using Emacs. Now that you know the basics of Lisp, it's time to become more familiar with windows.

Splitting & Closing Windows

You can split a window vertically or horizontally (creating another window).

To split vertically, type C-x 2 or SPC w s. To split horizontally, type C-x 3 or SPC w v.

You can delete a window with C-x 0 or SPC w d, or you can close all except the currently selected window with C-x 1 or C-w C-o.

Moving Between Windows

While you can use the mouse to move the cursor around, eventually you'll want to learn to use keybindings instead. Trust me, it's nice.

You can use the ace-window packages' functionality to switch windows. Type C-x o or C-w C-w to run ace-window. If there are only two windows open, then it will move the cursor to the one that isn't currently active. If however, you have three or more windows open, ace-window will display letters at the top left of each buffer. Typing the letter displayed in a window will move the cursor to that window.

This method is my preferred method of switching windows because it works regardless of what Evil state or Emacs major mode I'm in. It's also more direct. However, it does require some getting used to. As a beginner, you can't predict what letter you can use to switch to a window. Thus, in the beginning this method will often be slower then the next method I'll introduce to you.

The next method uses evil-window keybindings. With evil navigation, in Normal State, you navigate the cursor one line up and down with j and k, and one character left and right with h and l.

Using this familiar navigation method, you switch windows like this:

  • SPC w l or C-w l (evil-window-right), move the cursor one window to the right.
  • SPC w h or C-w h (evil-window-left), move the cursor one window to the left.
  • SPC w j or C-w j (evil-window-down), move the cursor one window down.
  • SPC w k or C-w k (evil-window-down), move the cursor one window up.

It's simple and effective. Even with experience, you may prefer it over using ace-window. However, as I said above, all of these shortcuts require you to be in Evil Normal State (C-w in Insert State is mapped to evil-delete-backward-word).

Moving Window Positions

The above commands move the cursor from one window to another. It's also possible to move a window from one position to another.

  • SPC w L or C-w L (+evil/window-move-right)
  • SPC w H or C-w H (+evil/window-move-left)
  • SPC w J or C-w J (+evil/window-move-down)
  • SPC w K or C-w K (+evil/window-move-up)

Technically, it's more like you are switching buffers between windows. What this means is that all windows maintain their current size; if you have one large window and one small window, if you run one of the above commands while the cursor is in the large window, the buffer in that window will appear in the smaller window

Resizing Windows

You probably won't find yourself resizing windows very often. Sometimes Emacs will do some weird resizing of windows for certain actions (keep an eye out when using sly-sticker-replay, introduced in a later chapter) that you need to fix, you might want to dedicate a window to a certain buffer (such as the org-agenda buffer, introduced in a later chapter) and keep it open, and thus want to make the window smaller. Or maybe you really need to micro-adjust everything.

You can use the mouse to resize windows (click and drag the border between windows). It's honestly not such a bad idea since it will likely be an infrequent activity. However, it's also possible to resize windows with keybindings.

  • C-x { (shrink-window-horizontally) or SPC w > or C-w > (evil-window-increase-width).
  • C-x } (enlarge-window-horizontally) or SPC w < or C-w < (evil-window-decrease-width).
  • SPC w + or C-w + (evil-window-increase-height)
  • SPC w - or C-w - (evil-window-decrease-height)

Each of the above commands will resize by one line or character. If you are in evil Normal State, you can type a number n and then run the command n times. In Normal State, typing 50 SPC w > will increase the window width by 50 characters.

You can also make one window larger than all your other windows using C-w o or SPC w o (doom/window-enlargen).

You can make all windows equal in size with SPC w = or C-w = (balance-windows).

Undoing Changes

Undoing any change is simple: C-w u or SPC w u (winner-undo).

This is useful not only for typos (for example, maybe you accidentally typed C-x C-x a and accidently closed all but one window) or for strange changes made by Emacs (sometimes closing a minibuffer drastically resizes other windows for no known reason), but also for intentional changes. For example, the above doom/window-enlargen command drastically resizes all windows. You can undo that change with winner-undo.

winner-undo no only undoes window resizes, but any changes to windows. If you accidentally closed a window, you can undo with winner-undo. If you move a window, you can undo the move. It's perhaps one of the most essential commands for beginners who are most likely to make mistakes or be faced with strange changes in window arrangements they weren't expecting.

Of course, you can also run winner-redo with C-w C-r or SPC w C-r

More About Windows

If you want to learn more about what's possible with windows, just type C-w and look at the list of commands available in the minibuffer.

Quick Reference Table

Here's a quick reference table for everything covered in this section:

Action Emacs Binding Evil Binding
split window vertically C-x 3 C-w C-v
split window horizontally C-x 2 C-w C-s
kill window C-x 0 C-w d
split window vertically C-x 2 SPC w s
split window horizontally C-x 3 SPC w v
delete window C-x 0 SPC w d
close all except the currently selected window C-x 1 C-w C-o
run ace-window C-x o C-w C-w
move the cursor one window to the right C-w l SPC w l
move the cursor one window to the left C-w h SPC w h
move the cursor one window down C-w j SPC w j
move the cursor one window up C-w k SPC w k
move window right C-w L SPC w L
move window left C-w H SPC w H
move window down C-w J SPC w J
move window up C-w K SPC w K
shrink window horizontally C-x { SPC w > or C-w >
enlarge window horizontally C-x } SPC w < or C-w <
increase window height   SPC w + or C-w +
decrease window height   SPC w - or C-w -
make one window larger than all your other windows C-w o SPC w o
make all windows equal in size C-w = SPC w =
undoing any change C-w u SPC w u
redoing any change C-w C-r SPC w C-r

PROJECT NAVIGATION & MANAGEMENT

Beyond buffers and windows are projects–groups of buffers and windows related to a project. Using projects will provide the following benefits:

  • Project-focused find-file searches.
  • Project-focused buffer switching/listing.
  • Project-focused text searches.
  • Project buffer saving.
  • Project state saving/loading.
  • Project switching.
  • Project file tree view.

And probably more I'm not aware of.

Creating & Removing Emacs Projects

To create a project:

  • Create an empty .project file in the project root directory.
  • Type SPC p a (project-add-known-project), navigate to the project root directory and then type Enter.

Now if you type SPC p p (projectile-switch-project) you will find your project in a list of projects you can open or switch to.

Switching Between Projects

After creating and switching to a project, a small label at the bottom will appear with the name of the project (the name of the project root directory). That label is a workspace.

If you have multiple projects open, you can switch between them via several means.

  • SPC TAB [ (+workspace/switch-left) to switch to the workspace to the right in the list of workspaces.
  • SPC TAB ] (+workspace/switch-right)
  • SPC TAB . (+workspace/switch-to) to choose from a list of open workspaces.
  • SPC TAB <number> Switch to the nth workspace.

Saving & Loading Project Workspaces

Workspaces are not strictly speaking exclusive to projects. A workspace can be created independent of projects using SPC TAB n (+workspace/new). If open some buffers, windows, etc. and then save the workspace with SPC TAB s, you can close the workspace and reopen it with SPC TAB l.

If you have a complex setup that you want to save, the ability to save the state of your workspace is a useful feature.

Saving Project Files

Once you have a project/workspace open and start editing, you may find several files in your project haven't been saved. This is especially true in Common Lisp projects where you update them by compiling files or individual functions–with no need to save the application files in order to update them in memory.

To save all the files in your project, type SPC p s (projectile-save-project-buffers).

Switching Project Buffers

Using C-x b or SPC b B you can switch between all buffers. However, if you want switch between project buffers, you can use C-c p b or SPC b b. The exact function is called depends on the :completion library you chose in the init.el file when we first installed Doom Emacs.

:completion
company           ; the ultimate code completion backend
;;helm ; the *other* search engine for love and life ido ; the other
;;*other* search engine... ivy ; a search engine for love and life
vertico           ; the search engine of the future

I recommended vertico, but helm, ido, and ivy will all have similar functionality.

The vertico command called is +vertico/switch-workspace-buffer.

Searching In Projects

There are two kinds of searches: filename searches and text searches.

Filename searches

You can search for a file within your project using SPC SPC (projectile-find-file). Searching with the normal find-file begins with a view of files within a directory, then you need to navigate to the directory and file you want. With projectile-find-file, all files in your project root directory–including subdirectories–will be available to search.

This is a very powerful feature allowing quick searching. If you know you have a file in src/system/components/ui/button.lisp, you can type SPC SPC ui but Enter and open the file without doing any scrolling or navigation of your filesystem.

Project text search & replace

You can search for some text within the files of your project using SPC / (+default/search-project).

While searching, you can type C-c C-e (embark-export) to export all the search matches to an editable buffer. Inside the buffer, you can type Enter on individual matches to go to the file to see context. In the Embark buffer, after editing the buffer, you can save changes to all of the files with C-c C-c, or discard changes with C-c C-k.

Project Tree View

treemacs provides a tree view of your project. Open it with SPC o p (+treemacs/toggle).

Switching to treemacs buffer

If you have a treemacs buffer open and move away from it into another buffer, if you use ace-window, ace-window won't give you the option of switching to the treemacs buffer. You either need to use one of the evil-window- commands from the previous chapter, or toggle the treemacs buffer closed and reopen it.

Opening Files

In addition to using treemacs to browse your project, you can open files by typing Enter while highlighting a file.

Renaming Files

While highlighting a file, type R to rename it.

The advantage of using treemacs to rename files is this: if the file is open in a buffer, treemacs will automatically (or in some cases, provide you the option to) rename the open buffer for the file, too. The other usual means of renaming files (rename-file) doesn't automatically rename the buffer.

If you rename a directory, and you have files in the directory open in buffers, those buffers will also be renamed.

Moving Files

While highlighting a file, type m to move it. You will be asked where to move it.

When you move a file that is currently open in a buffer, treemacs will ask if you want to delete the open buffer. If you don't delete it and save the buffer, you will recreate the file in the old location.

Unfortunately, if you move a directory with files from that directory open in buffers, those buffers won't be renamed and you won't be prompted to kill them, so you will need to do that yourself.

Deleting Files

While highlighting a file or directory, type d to delete it. You'll be prompted to confirm you want to delete the file.

Similarly for moving directories, if you have files open from a directory you delete, treemacs will not delete the buffers for you.

Bulk Actions

If you need to delete, copy, or move multiple files, you can type M-m to be given options for the currently highlighted file.

Quick Reference Table

Here's a quick reference table for everything covered in this section:

Action Emacs Binding Evil Binding
add known project   SPC p a
switch project   SPC p p
switch workspace left   SPC TAB [
switch workspace right   SPC TAB ]
switch to workspace   SPC TAB .
switch to nth workspace   SPC TAB <number>
create new workspace   SPC TAB n
save workspace   SPC TAB s
load workspace   SPC TAB l
save all project buffers   SPC p s
switch between all buffers C-x b SPC b B
switch between project buffers C-c p b SPC b b
find file in project   SPC SPC
search text in project   SPC /
embark export C-c C-e  
save changes in embark buffer C-c C-c  
discard changes in embark buffer C-c C-k  
toggle treemacs   SPC o p
open file in treemacs Enter Enter
rename file in treemacs R R
move file in treemacs m m
delete file in treemacs d d
bulk actions in treemacs M-m M-m

LEARNING MORE

Type M-x to open that minibuffer. Type describe. "Describing" is how you get more information about something in Emacs. This feature makes it "self-documenting".

C-h k will run the command describe-key. You will be prompted to enter a keybinding you want described.

Type SPC f f in that prompt. It will tell you that the keybinding is for the find-file function and lots of other information. It will tell you if there are other keybindings, for example. You may prefer an evil binding or a Emacs binding.

C-h m will run the command describe-mode. This will provide detailed information about all of the modes that are active in a given buffer.

C-h b b will run the command embark-bindings. This will show all of the bindings available in the current buffer. Useful especially for discovering Evil keybindings that may only be one character long.

Type C-h i or SPC h i (info) to open the Emacs manual.