Home /

Doom Emacs Zaiste Programming Tutorial

Link to youtube video series

Table of Contents

  1. Command Abbreviations
  2. Emacs Doom E02 - Projects with Projectile, File Explorer with Treemacs & EShell
  3. Emacs Doom E03 - A short intro to Dired
  4. Emacs Doom E04 - Buffers, Windows and Basic Navigation
  5. Emacs Doom E05: Installing Packages with org-super-agenda as an example
  6. Emacs Doom E06: Quick, horizontal movements with evil-snipe
  7. Emacs Doom E07: Moving around the screen with Avy
  8. Emacs Doom E08: Multiple cursor in Emacs with evil-multiedit
  9. Emacs Doom E09: Org Mode, Basic Outlines
  10. Emacs Doom E10: Org Mode, - Links, Hyperlinks and more
  11. Emacs Doom E11: Org Mode - Custom Link Types
  12. Emacs Doom E12: Org Mode - Linking to words & Bookmarks
  13. Emacs Doom E13: Org Mode, Code Snippets 101
  14. Emacs Doom E14: Org Mode, Getting Organized with Tasks
  15. Emacs Doom E15: Org Mode, Priorities for Tasks
    1. buy strawberries
  16. Emacs Doom E16: Org Mode, Marking Tasks with Tags
    1. play more games:fun:
  17. Emacs Org Mode - Using Checkboxes - Emacs Doom 17
    1. You can see how many are done with a cookie
      [1/2]
  18. Emacs Magit - Getting Started - Emacs Doom 18
  19. Emacs Magit - The Git Commit Flow in More Detail - Emacs Doom 19
  20. Emacs Magit with Forge for Issuing Pull Requests - Emacs Doomcasts 20

Command Abbreviations

  • C - Control key
  • M - Meta or option/alt key
  • s - Command key
  • SPC - Space key

Emacs Doom E02 - Projects with Projectile, File Explorer with Treemacs & EShell

  • Common commands for Projectile Projects
  • SPC p p to open a project
  • SPC SPC to open a file in a project
  • SPC o p to open the file explorer
  • SPC o e to open the shell in fullscreen
  • SPC o E to open the shell in a popup window
  • SPC f r recently visited files
  • SPC f R recently visited files in a project
  • M-x projectile-discover-projects-in-directory to find projects within given folder using Projectile
  • M-x projectile-discover-projects-in-search-path to find projects in the folder defined by the projectile-project-search-path variable using Projectile

Emacs Doom E03 - A short intro to Dired

  • Dired is how you interfaces with a directory
  • Directory Editor
  • Move with h,j,k,l
  • toggle ( for simple view
  • enter to go into a directory
  • - to go back up
  • + and enter a file name to create a directory
  • d to mark for deletion, x to delete
  • space . to create or find a file
  • \*/ to select all directories, t to switch between files and directories
  • U to unselect all
  • m to mark a specific file or directory
  • CTRL + w + v window split vertically
  • CTRL + w + w to switch windows
  • C copy to another window
  • R move to another window
  • dired-do-what-i-mean-target set to true
  • i to edit file/dir name

Emacs Doom E04 - Buffers, Windows and Basic Navigation

  • Buffers are a special concept in emacs they can be terminals, files, directories, etc
  • space b b to open another buffer
    • workspace buffer
  • space b B you can see all the buffer
  • space , to switch buffers (its an alias)
  • space shift , to switch to all buffers
  • space b X You can create a scratch buffer and space b s to save and name it
  • CTRL w v window split vertically
  • CTRL w w to switch windows
  • CTRL w s window split horizonal
  • you can use the vim motion keys to navigate between open windows
  • Windows are panes in your screen
  • CTLR + = to make the windows equal size

Emacs Doom E05: Installing Packages with org-super-agenda as an example

  • space f p to open the config.
  • to add a package, add the package to .doom.d/package.el
  • then close and doom refresh
  • then go to .doom.d/config.el to configure the package
  • def-package! is a macro you can use to configure packages
    • space h help you can look up method man pages
    • :init is used for setting the package up
    • :config to set configuration after the package has been initialized
    • :after lets you set which package it should load after
  • you can use :after! to configure packages that are already there

Emacs Doom E06: Quick, horizontal movements with evil-snipe

  • enables vim navigation
  • f and then the letter you want to navigate to. , will go backward and ; will go forward after that find
  • tis the same thing except for a character you want to jump to before the one you insert
  • evil snipe lets you go to all the occuranses in your document
  • s to do a double character search
  • F or T to go backwards
  • evil snipe will remember your last search so , and ; will navigate
  • v puts you in visual mode. You can select text by with v f some-char-you-navigate-to

Emacs Doom E07: Moving around the screen with Avy

  • avy for long distance movement.
  • g s space and then select the letter that avy gives you to nagivage to that spot
    • these letters are on your home row so they are easy to click
  • space h v for variable, to set the avy variable to search all open windows
  • avy-all-windows lets you search in all windows open.
  • you can remove a word with g s space select-one-letter x select-the-removal-spot
    • you can use X to stay in your original spot of search
  • you can go g s space select-one-letter i select-the-correction-spot to correct the spelling of the search
    • brew install ispell
  • you can yank a word from one place to another with g s space select-one-letter y select-the-correction-spot-to-paste
  • use t to teleport the word from one place to another

Emacs Doom E08: Multiple cursor in Emacs with evil-multiedit

  • make selections and then edit those selections interactively
  • meta d will select the current word, and again will find another occurance
  • meta D will find the occurence upward
  • you can use a visual selection to select multiple words. R will select all occurances
  • crtl n for next selection ctrl p for previous
  • exclude matches with enter
  • you can make an edit and the changes will be reflected in all the selection

Emacs Doom E09: Org Mode, Basic Outlines

  • org mode gives you structure to your document
  • \* for a h1 \*\* for an h2 etc
  • you can tab a section to fold a subtree (hide it)
  • you can use shift tab to cycle through folded states
  • ctrl return to create a headline of the same type
  • meta arrow up lets you shift the position of the section
  • meta h promotes a headline to the next level
  • meta l demotes
  • you can create lists
    1. onw
    2. 2
    3. wooo
    4. 3

Emacs Doom E10: Org Mode, - Links, Hyperlinks and more

Emacs Doom E11: Org Mode - Custom Link Types

Emacs Doom E12: Org Mode - Linking to words & Bookmarks

  • SPC n l stores a link to a particular headline

Emacs Doom E13: Org Mode, Code Snippets 101

  • <s TAB is a snippet for ##+BEGINSRC ##+ENDSRC

    (+ 2 3 4 5) (defun great (name) (concat "Hello " name))

    function great(name){ console.log("Hello ", name) return "Hello " + name } great("Zac")

  • SPC m &rsquo; opens the code snipped in a separate buffer

    • press C-c C-c to exit the buffer and include the changes
    • abort the snippet change with C-c C-k
  • Execute the code snippet with C-c C-c Results will show up in a ##+RESULTS header

  • This feature is called Babel

  • One snippet can consume the output of another snippet

  • Zaiste uses Kulfon to generate static html from his notes.

Emacs Doom E14: Org Mode, Getting Organized with Tasks

  • Create a task by prefixing any heading with TODO

  • DONE means the task is done

  • You can create your custom key words by changes a variable: org-todo-keywords

    • remember you can get to your variables through SPC h v (M-x counsel-describe-variable)

    • these values are already set with Doom Emacs

      ((sequence "TODO(t)" "PROJ(p)" "STRT(s)" "WAIT(w)" "HOLD(h)" "|" "DONE(d)" "KILL(k)")
      (sequence "[ ](T)" "[-](S)" "[?](W)" "|" "[X](D)"))
  • SPC m t to change a status of a todo

  • If you close the task with a command, org mode will add a date that you closed the task

  • SPC o a t to open the agenda -> todo list

  • q to quit

  • org-agenda-files is a variable you can set so you filter which files agenda searches todos in.

Emacs Doom E15: Org Mode, Priorities for Tasks

  • SHIFT up will toggle the priority of tasks

TODO buy strawberries

  • org-fancy-priorities gives you fancy looking priorities

Emacs Doom E16: Org Mode, Marking Tasks with Tags

  • tags can be attached to any headlines
  • SPC m q to tag a headline

TODO play more games :fun:

  • tags are hierarchical so nested headings will be tagged with the parent header tag
  • org-tag-sparce-tree will search for headings that only have a specific tag

Emacs Org Mode - Using Checkboxes - Emacs Doom 17

  • two types of lists, ordered and unordered lists
  • you can change an unorded list by changing the first item to 1. and then typing CTRL c CTRL c
  • This is still todo
  • [-] this is in progress
  • this is a done task

You can see how many are done with a cookie
[1/2]

  • [-] task 1
  • task 2
  • you can do this by adding
    [0/0]
    and pressing CTRL c CTRL c
  • you cant assign a tag or a priority

Emacs Magit - Getting Started - Emacs Doom 18

  • magit is configured for you
  • SPC g g to show Magit status Page
  • most commands are done from the status page
  • press ? to see what you can do
  • git add -p lets you stage in hunks
  • Open and close with the TAB
  • Open diff view for a file with TAB
  • s to stage a change
  • u to undo a change
  • c to commit
  • b s for branch and spinoff to create another branch, rewinding the commits you made to master
  • b b to switch branches

Emacs Magit - The Git Commit Flow in More Detail - Emacs Doom 19

  • t t to create a tag, default place is the commit you are currently selecting
  • V to select a change in a diff and x to discard that change.
  • s to stage
  • c to commit, you can q to quit the commit screen
  • P to push and then p to your remote or u to a another remote

Emacs Magit with Forge for Issuing Pull Requests - Emacs Doomcasts 20

  • forge is installed in emacs doom
  • @ for forge
  • set up forge with M x forge-pull
    • the first time you will get a token from github
  • @ c p to create a pull request with forge
    • select the base branch
    • then select the target branch
    • then provide a short description
    • CTRL c CTRL c to finish the pull request
  • now there will be a pull requests tab