Files
Blog_and_Personal_Page/content/knowledge-base/basic-doom-emacs-commands.md
T
2024-12-03 15:38:07 +01:00

63 lines
2.5 KiB
Markdown

+++
date = '2022-11-07T13:42:02'
draft = false
title = 'Basic Doom Emacs Commands'
type = 'post'
tags = ['Emacs']
+++
This is basically just a collection of various commands I discovered while learning to use Doom Emacs.
All Sources will be listed at the bottom of this page.
Also. This side does not provide a lot of explanation regarding the function of the commands.
It is just intended as a cheat sheet.
Updates/ Changes **will** be added to this post.
# Navigation
## Workspaces
- switch between workspaces: '**SPC TAB .**'
- load workspace: '**SPC TAB l**'
- create new workspace: '**SPC TAB n**'
- rename workspace: '**SPC TAB r**'
- save workspace: '**SPC TAB s**'
- select project for workspace: '**SPC p p**'
### File Switching inside Workspaces
- switch to file within current project: '**SPC SPC**'
- '**SPC .**' provides the save functionality but can also search outside the current project
- switch to buffer within current project: '**SPC ,**'
- switch to a buffer outside the current project: '**SPC b B**'
- load recently viewed file: '**SPC fr**'
## Finding Text
- search all files in the current project: '**SPC sp**'
- search inside the current buffer: '**/**' (normal Vim navigation)
### Moving to Text
- jump to line (faster then relative line numbers): '**gsj**'
- '**s**' and two chars to jump to the nearest match
- '**S**' to jump backwards
- '**,**' or '**;**' to cycle through the matches (forwards/ backwards)
**NOTE:** this navigation can be combined with (almost) all of the standard Vim commands (e.g. '**vs\\<chars\\>**' visualizes all the text to the nearest match for \\<chars\\>)
## Source Code
- go to definition: '**gd**'
- list references: '**gD**'
### Fancy Delete
**NOTE:** all these commands should also work for 'change' ('**c**')
- delete inside the same indent (e.g. *function* of if statement): '**dii**'
- delete inside the same indent + line above (e.g. *complete* if statement in python): '**dik**'
- delete inside the same indent + line above and below (e.g. *complete* if statement in java): '**dij**'
## Compilation Errors
- next and previous flycheck error: '**\\]e**' and '**\\[e**'
- list current errors: '**SPC c x**'
# Miscellaneous
- compile: '**SPC p c**'
- open [Magit](https://magit.vc/): '**SPC gg**'
- comment/ uncomment a line: '**gcc**'
# Sources
- https://github.com/doomemacs/doomemacs/
- https://noelwelsh.com/posts/doom-emacs/
- https://medium.com/@aria_39488/the-niceties-of-evil-in-doom-emacs-cabb46a9446b