mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-21 00:11:26 +02:00
Emacs Editor
- Framework: https://github.com/doomemacs/doomemacs
- Chinese(rime) support: https://github.com/DogLooksGood/emacs-rime
- modal editing:
- https://github.com/emacs-evil/evil: evil mode, enabled by default in doom-emacs.
- https://github.com/meow-edit/meow
- LSP Client: https://github.com/manateelazycat/lsp-bridge
- Emacs Wiki: https://www.emacswiki.org/emacs/SiteMap
- Awesome Emacs: https://github.com/emacs-tw/awesome-emacs#lsp-client
Emacs daemon:
- https://github.com/nix-community/home-manager/blob/master/modules/services/emacs.nix
- https://github.com/LnL7/nix-darwin/blob/1a41453cba42a3a1af2fff003be455ddbd75386c/modules/services/emacs.nix
Install or Update
After deploying this nix flake, run the following command to install or update emacs:
doom sync
when in doubt, run doom sync!
Why emacs?
- Explore the unknown, just for fun!
- Better support for Lisp-like Languages.
- Org Mode
Terminal Related
zellij provides a more powerful and stable terminal experience, so here is zellij's terminal shortcuts I use frequently now:
| Action | Zellij's Shortcut |
|---|---|
| Floating Terminal | Ctrl + <p> + <w> |
| Horizontal Split Terminal | Ctrl + <p> + <d> |
| Vertical Split Terminal | Ctrl + <p> + <n> |
| Open file tree sidebar | SPC + o + p |
| Exit | M-x C-c |
Visual Modes
The same as neovim/vim:
| Action | Shortcut |
|---|---|
| Toggle visual mode | v |
| Toggle visual block mode | <Ctrl> + v (select a block vertically) |
Text Manipulation
-
Add at the end of multiple lines:
:normal A<text>-
Execublock:
:A<text> -
visual block mode(ctrl + v)
-
Append text at the end of each line in the selected block
-
If position exceeds line end, neovim adds spaces automatically
-
-
Delete the last char of multivle lines:
:normal $x- Execute
$xon each line - visual mode(v)
$moves cursor to the end of linexdeletes the character under the cursor
- Execute
-
Delete the last word of multiple lines:
:normal $bD- Execute
$bDon each line - visual mode(v)
$moves cursor to the end of linebmoves cursor to the beginning of the last wordDdeletes from cursor to the end of line
- Execute
Splitting and Buffers
| Action | Shortcut |
|---|---|
| Next Buffer (Tab) | ]b |
| Previous Buffer (Tab) | [b |
| Buffer List | <Space> + , |
| Save all buffers(Tab) | <Space> + b + S |
| Kill the current buffer | <Space> + b + k |
| Kill all buffers | <Space> + b + K |
Editing and Formatting
| Action | Shortcut |
|---|---|
| Format Document | <Space> + cf |
| Code Actions | <Space> + ca |
| Rename | <Space> + cr |
| Opening LSP symbols | <Space> + cS |
| Show all LSP Errors | <Space> + c + x/X |
| Jump to Definition | gd |
| Jump to References | gD |
| (Un)Comment the selected context | gc |
| (Un)Comment the current line | gcc |
| Open filepath/URL at cursor | gf |
| Find files by keyword in path | <Space> + <Space> |
| Grep string in files (vertico + ripgrep) | <Space> + sd |
Text Manipulation
| Action | |
|---|---|
| Join Selection of Lines With Space | J |
Search & replace
SPC s p foo C-; E C-c C-p :%s/foo/bar/g RET Z Z
SPC s p: search in projectfoo: the keyword to searchC-; E: exports what you’re looking at into a new buffer in grep-modeC-c C-pto run wgrep-change-to-wgrep-mode to make the search results writable.:%s/foo/bar/g RET: replace in the current buffer(just like neovim/vim)Z Z: to write all the changes to their respective files