init
This commit is contained in:
128
cheatsheets/emacs/emacs.code-completion.cheatsheet.md
Normal file
128
cheatsheets/emacs/emacs.code-completion.cheatsheet.md
Normal file
@@ -0,0 +1,128 @@
|
||||
# Doom Emacs Code Completion & Lookup Cheatsheet
|
||||
|
||||
## 🚀 **What You Have (Like nvim-cmp + blink.cmp)**
|
||||
|
||||
If your Doom config includes:
|
||||
- **Company Mode** - Auto-completion framework
|
||||
- **LSP Mode** - Language Server Protocol support
|
||||
- **Tree-sitter** - Advanced syntax parsing
|
||||
- **Lookup tools** - Documentation and definition lookup
|
||||
|
||||
## ⌨️ **Code Completion (Company)**
|
||||
|
||||
### **Auto-completion Controls:**
|
||||
- `TAB` or `C-SPC` - **Accept completion**
|
||||
- `C-n` / `j` - **Next completion** (evil mode)
|
||||
- `C-p` / `k` - **Previous completion** (evil mode)
|
||||
- `C-w` - **Show documentation** for completion
|
||||
- `C-s` - **Search/filter completions**
|
||||
- `ESC` or `C-g` - **Cancel completion**
|
||||
|
||||
### **Manual Completion:**
|
||||
- `M-/` - **Complete at point** (manual trigger)
|
||||
- `C-M-/` - **Expand abbreviation**
|
||||
|
||||
## 🔍 **Code Lookup & Navigation**
|
||||
|
||||
### **Go to Definition/References:**
|
||||
- `gd` - **Go to definition** (evil mode)
|
||||
- `gD` - **Go to declaration**
|
||||
- `gr` - **Go to references**
|
||||
- `SPC c d` - **Find definition**
|
||||
- `SPC c D` - **Find references**
|
||||
- `SPC c i` - **Find implementations**
|
||||
|
||||
### **Documentation Lookup:**
|
||||
- `K` - **Lookup documentation** (evil mode)
|
||||
- `SPC c k` - **Lookup documentation**
|
||||
- `SPC c K` - **Lookup in docsets**
|
||||
- `C-h f` - **Describe function**
|
||||
- `C-h v` - **Describe variable**
|
||||
|
||||
### **Symbol Navigation:**
|
||||
- `SPC c j` - **Jump to symbol in buffer**
|
||||
- `SPC c J` - **Jump to symbol in project**
|
||||
- `SPC s i` - **Search for symbol**
|
||||
|
||||
## 🛠️ **LSP Features (Language Server)**
|
||||
|
||||
### **LSP Actions:**
|
||||
- `SPC c a` - **Code actions** (refactor, fix, etc.)
|
||||
- `SPC c r` - **Rename symbol**
|
||||
- `SPC c f` - **Format buffer/region**
|
||||
- `SPC c o` - **Organize imports**
|
||||
|
||||
### **Error Navigation:**
|
||||
- `]e` - **Next error**
|
||||
- `[e` - **Previous error**
|
||||
- `SPC c x` - **List errors**
|
||||
|
||||
### **LSP Info:**
|
||||
- `SPC c l` - **LSP menu**
|
||||
- `SPC c h` - **Show hover info**
|
||||
- `SPC c s` - **Show signature**
|
||||
|
||||
## 🎯 **Language-Specific Features**
|
||||
|
||||
### **C/C++ (clang-tools)**
|
||||
- Full completion for functions, variables, types
|
||||
- Go to definition across files
|
||||
- Error checking and diagnostics
|
||||
- Code formatting with clang-format
|
||||
|
||||
### **Nix (nil LSP)**
|
||||
- Nix language completion
|
||||
- Function documentation
|
||||
- Syntax checking
|
||||
- Go to definition for Nix expressions
|
||||
|
||||
### **JSON (vscode-json-languageserver)**
|
||||
- Schema-based completion
|
||||
- Validation and error checking
|
||||
- Go to definition in JSON files
|
||||
|
||||
## ⚡ **Pro Tips**
|
||||
|
||||
### **Fuzzy Search Everything:**
|
||||
- `SPC f f` - **Find files**
|
||||
- `SPC /` - **Search in project**
|
||||
- `SPC s s` - **Search buffer**
|
||||
- `SPC p p` - **Switch projects**
|
||||
|
||||
### **Better Navigation:**
|
||||
- `C-o` - **Go back** (after jumping to definition)
|
||||
- `C-i` - **Go forward**
|
||||
- `SPC j j` - **Jump to character** (like easymotion)
|
||||
|
||||
### **Completion Tweaks:**
|
||||
- Completions appear after 0.2 seconds of typing
|
||||
- Minimum 1 character to trigger
|
||||
- Shows documentation in popup
|
||||
- Works with both Company and LSP
|
||||
|
||||
## 🔧 **Troubleshooting**
|
||||
|
||||
### **If completion isn't working:**
|
||||
1. Check if LSP server is running: `SPC c l`
|
||||
2. Restart LSP: `SPC c l r`
|
||||
3. Check syntax errors: `SPC c x`
|
||||
|
||||
### **Performance:**
|
||||
- LSP servers auto-start when you open supported files
|
||||
- Completion is optimized for fast response
|
||||
- Use `SPC h r r` to reload Doom config after changes
|
||||
|
||||
## 🚀 **Quick Start Workflow**
|
||||
|
||||
1. **Open a code file** (`.c`, `.nix`, `.json`)
|
||||
2. **Start typing** - completions appear automatically
|
||||
3. **Navigate with `j/k`** and **accept with `TAB`**
|
||||
4. **Use `gd`** to jump to definitions
|
||||
5. **Use `K`** to see documentation
|
||||
6. **Use `SPC c a`** for code actions
|
||||
|
||||
## 📚 **Language Servers Included**
|
||||
- **C/C++**: `clang-tools` (clangd)
|
||||
- **Nix**: `nil`
|
||||
- **JSON**: `vscode-json-languageserver`
|
||||
- More can be added per language as needed!
|
||||
305
cheatsheets/emacs/emacs.file-explorer.cheatsheet.md
Normal file
305
cheatsheets/emacs/emacs.file-explorer.cheatsheet.md
Normal file
@@ -0,0 +1,305 @@
|
||||
# Doom Emacs File Explorer Cheatsheet
|
||||
|
||||
## 🗂️ **What is Dired?**
|
||||
|
||||
Dired (Directory Editor) is Emacs' built-in file manager that allows you to navigate, manage, and manipulate files and directories efficiently.
|
||||
- Browse directories with keyboard navigation
|
||||
- Mark, copy, move, and delete files
|
||||
- Execute commands on multiple files at once
|
||||
- Integrate with other Emacs tools and buffers
|
||||
|
||||
## 📋 **Requirements**
|
||||
- Doom Emacs (Dired is built-in)
|
||||
- **Treemacs**: Must be enabled in `~/.doom.d/init.el` (uncomment `treemacs` line)
|
||||
- Optional tools for enhanced functionality:
|
||||
- `rsync` - Fast file synchronization and copying
|
||||
- `fd` or `find` - Enhanced file finding
|
||||
- `rg` (ripgrep) or `ag` (the_silver_searcher) - Fast text search
|
||||
- `exa` or `lsd` - Enhanced directory listings
|
||||
- `trash-cli` - Safe file deletion to trash
|
||||
- `zip`/`unzip`, `tar`, `gzip` - Archive handling
|
||||
|
||||
## ⌨️ **Opening File Explorers**
|
||||
|
||||
### **Dired (Built-in File Manager):**
|
||||
- `SPC .` - **Open Dired** in current directory
|
||||
- `SPC f d` - **Find directory** (open Dired in specific path)
|
||||
- `C-x d` - **Open Dired** (classic Emacs binding)
|
||||
|
||||
### **Project File Navigation:**
|
||||
- `SPC SPC` - **Find file** in project
|
||||
- `SPC f f` - **Find file** anywhere
|
||||
- `SPC f r` - **Recent files**
|
||||
- `SPC p f` - **Find file** in project
|
||||
|
||||
### **Tree-style Explorers:**
|
||||
- `SPC o p` - **Toggle project sidebar** (Treemacs)
|
||||
- `SPC f t` - **Find file** in tree
|
||||
|
||||
## 🧭 **Navigation in Dired**
|
||||
|
||||
### **Basic Movement:**
|
||||
- `j/k` or `n/p` - **Move up/down** between files
|
||||
- `h` - **Go up** one directory (parent)
|
||||
- `l` or `RET` - **Enter directory** or open file
|
||||
- `^` - **Go to parent directory**
|
||||
- `g` - **Refresh** directory listing
|
||||
|
||||
### **Jumping Around:**
|
||||
- `gg` - **Go to top** of listing
|
||||
- `G` - **Go to bottom** of listing
|
||||
- `/` - **Search** for file/directory name
|
||||
- `SPC s s` - **Search within** directory
|
||||
|
||||
### **File Information:**
|
||||
- `(` - **Toggle details** (show/hide file info)
|
||||
- `s` - **Sort** files (by name, date, size)
|
||||
- `C-h m` - **Show help** for current mode
|
||||
|
||||
## 📁 **File Operations**
|
||||
|
||||
### **Opening Files:**
|
||||
- `RET` - **Open file** in current window
|
||||
- `o` - **Open file** in other window
|
||||
- `C-o` - **Open file** in other window (keep cursor in Dired)
|
||||
- `v` - **View file** (read-only)
|
||||
- `f` - **Find file** (same as RET)
|
||||
|
||||
### **Creating Files & Directories:**
|
||||
- `+` - **Create directory**
|
||||
- `SPC f c` - **Create file** (when in Dired buffer)
|
||||
- `C-x C-f` - **Find/create file** (from Dired)
|
||||
|
||||
## 🏷️ **Marking Files**
|
||||
|
||||
### **Basic Marking:**
|
||||
- `m` - **Mark file** for operations
|
||||
- `u` - **Unmark file**
|
||||
- `U` - **Unmark all** files
|
||||
- `t` - **Toggle marks** (mark unmarked, unmark marked)
|
||||
- `* %` - **Mark by regex** pattern
|
||||
|
||||
### **Quick Marking:**
|
||||
- `* .` - **Mark by extension** (e.g., *.txt)
|
||||
- `* /` - **Mark directories**
|
||||
- `* @` - **Mark symlinks**
|
||||
- `* *` - **Mark executables**
|
||||
|
||||
### **Advanced Marking:**
|
||||
- `% m` - **Mark files** matching regex
|
||||
- `% d` - **Mark for deletion** files matching regex
|
||||
- `* c` - **Change marks** (change one mark to another)
|
||||
|
||||
## ✂️ **File Management Operations**
|
||||
|
||||
### **Copy, Move, Delete:**
|
||||
- `C` - **Copy** marked files (or file under cursor)
|
||||
- `R` - **Rename/Move** marked files
|
||||
- `D` - **Delete** marked files immediately
|
||||
- `d` - **Mark for deletion** (use `x` to execute)
|
||||
- `x` - **Execute deletions** (delete files marked with `d`)
|
||||
|
||||
### **Deletion Options:**
|
||||
- `d` then `x` - **Safe deletion** (mark first, then execute)
|
||||
- `D` - **Immediate deletion** (bypass mark step)
|
||||
- **Trash integration**: If `trash-cli` is installed, files go to trash instead of permanent deletion
|
||||
|
||||
### **Advanced Operations:**
|
||||
- `Z` - **Compress/uncompress** files (uses `gzip`, `zip`, `tar` automatically)
|
||||
- `A` - **Search** in marked files (uses `grep` or `rg` if available)
|
||||
- `Q` - **Query replace** in marked files
|
||||
- `!` - **Run shell command** on marked files
|
||||
- `&` - **Run async shell command** on marked files
|
||||
|
||||
## 📋 **Copying & Moving**
|
||||
|
||||
### **Copy Operations:**
|
||||
- `C` - **Copy files** (prompts for destination)
|
||||
- Works with marked files or single file under cursor
|
||||
- Uses `rsync` if available for faster, resumable copying
|
||||
- Supports copying to different drives/partitions
|
||||
|
||||
### **Move/Rename Operations:**
|
||||
- `R` - **Rename/Move** files
|
||||
- Can rename single files or move multiple marked files
|
||||
- Supports moving across directories
|
||||
|
||||
### **Tips for Copy/Move:**
|
||||
- Mark multiple files first, then use `C` or `R`
|
||||
- Tab completion works for destination paths
|
||||
- Use relative paths (`.`, `..`) for quick navigation
|
||||
|
||||
## 🔍 **Search & Filter**
|
||||
|
||||
### **Finding Files:**
|
||||
- `/` - **Search** file names in current listing
|
||||
- `n/N` - **Next/previous** search match
|
||||
|
||||
### **Enhanced Search (with external tools):**
|
||||
- `A` - **Search inside files** (uses `rg` > `ag` > `grep` in priority order)
|
||||
- Much faster with `ripgrep` or `the_silver_searcher`
|
||||
- Supports regex patterns and file type filtering
|
||||
|
||||
### **Filtering Display:**
|
||||
- `(` - **Toggle** detailed view
|
||||
- `s` - **Sort** by different criteria
|
||||
- `C-u s` - **Sort** with custom options
|
||||
|
||||
### **Content Search:**
|
||||
- `A` - **Search inside** marked files
|
||||
- `Q` - **Query replace** across marked files
|
||||
|
||||
## 🔧 **Advanced Features**
|
||||
|
||||
### **Wdired (Writable Dired):**
|
||||
- `C-x C-q` - **Edit filenames** directly (like renaming)
|
||||
- Edit filenames as text, then `C-c C-c` to apply changes
|
||||
- `C-c C-k` to cancel edits
|
||||
|
||||
### **Multiple Windows:**
|
||||
- `o` - **Open in other window**
|
||||
- `C-o` - **Display in other window** (stay in Dired)
|
||||
- `2` - **Split window** vertically for two Dired views
|
||||
|
||||
### **Subdirectories:**
|
||||
- `i` - **Insert subdirectory** in same buffer
|
||||
- `$` - **Hide/show** subdirectory contents
|
||||
- `M-$` - **Hide all** subdirectories
|
||||
|
||||
## 📊 **File Comparison**
|
||||
|
||||
### **Diff Operations:**
|
||||
- `=` - **Diff file** with another
|
||||
- `M-=` - **Diff** marked files against each other
|
||||
- Works with external diff tools
|
||||
|
||||
## 🗜️ **Archive Operations**
|
||||
|
||||
### **Compression & Archives:**
|
||||
- `Z` - **Compress/decompress** automatically detects format
|
||||
- Supports: `.gz`, `.zip`, `.tar`, `.tar.gz`, `.tar.xz`, `.7z`
|
||||
- Uses appropriate tools: `gzip`, `zip`, `tar`, `7z`
|
||||
|
||||
### **Archive Viewing:**
|
||||
- Open `.zip`, `.tar`, etc. files directly to browse contents
|
||||
- Extract specific files from archives
|
||||
|
||||
## 🎛️ **Customization & Settings**
|
||||
|
||||
### **View Options:**
|
||||
- `(` - **Toggle** between simple and detailed view
|
||||
- `s` - **Cycle** through sort orders (name, date, size)
|
||||
- Enhanced listings with `exa` or `lsd` if available
|
||||
|
||||
### **Useful Settings:**
|
||||
- Dired reuses buffers by default in Doom
|
||||
- Auto-refresh on file changes
|
||||
- Integration with Evil mode keybindings
|
||||
|
||||
## ⚡ **Treemacs (Tree Explorer)**
|
||||
|
||||
### **Basic Treemacs:**
|
||||
- `SPC o p` - **Toggle** Treemacs sidebar
|
||||
- `j/k` - **Navigate** up/down in tree
|
||||
- `RET` - **Open file** or expand/collapse directory
|
||||
- `TAB` - **Expand/collapse** directory
|
||||
|
||||
### **Treemacs File Operations:**
|
||||
- `cf` - **Create file**
|
||||
- `cd` - **Create directory**
|
||||
- `R` - **Rename**
|
||||
- `d` - **Delete**
|
||||
- `yy` - **Copy** path to clipboard
|
||||
|
||||
## 🚀 **Quick Start Workflow**
|
||||
|
||||
### **Basic File Management:**
|
||||
1. **Press `SPC .`** - Open Dired in current directory
|
||||
2. **Navigate with `j/k`** - Move between files
|
||||
3. **Mark files with `m`** - Select multiple files
|
||||
4. **Use `C` to copy** or `R` to move/rename
|
||||
5. **Press `g`** to refresh when done
|
||||
|
||||
### **Efficient File Operations:**
|
||||
1. **Mark multiple files** with `m`
|
||||
2. **Execute batch operations** (`C` for copy, `R` for move)
|
||||
3. **Use `!`** to run shell commands on marked files
|
||||
4. **Toggle details with `(`** for more/less information
|
||||
|
||||
## 📚 **Essential Keybind Summary**
|
||||
|
||||
| Action | Key | Description |
|
||||
|--------|-----|-------------|
|
||||
| Open Dired | `SPC .` | Open file explorer |
|
||||
| Navigate | `j/k` | Move up/down |
|
||||
| Enter/Open | `RET` or `l` | Open file/directory |
|
||||
| Parent Dir | `h` or `^` | Go up one directory |
|
||||
| Mark | `m` | Mark file for operations |
|
||||
| Copy | `C` | Copy marked files |
|
||||
| Move/Rename | `R` | Move or rename files |
|
||||
| Delete | `d` then `x` | Mark for deletion, execute |
|
||||
| Create Dir | `+` | Create new directory |
|
||||
| Compress | `Z` | Compress/decompress |
|
||||
| Search Files | `A` | Search inside files |
|
||||
| Refresh | `g` | Refresh directory listing |
|
||||
| Help | `?` | Show available commands |
|
||||
|
||||
## 🔧 **Troubleshooting**
|
||||
|
||||
### **Common Issues:**
|
||||
- **Dired buffer not updating?** Press `g` to refresh
|
||||
- **Can't see file details?** Press `(` to toggle detailed view
|
||||
- **Operations feel slow?** Use marking (`m`) for batch operations
|
||||
- **Wrong sort order?** Press `s` to cycle through sort options
|
||||
|
||||
### **Performance Tips:**
|
||||
- Install `fd` for faster file finding
|
||||
- Install `rg` (ripgrep) for faster text search
|
||||
- Use `rsync` for efficient file copying
|
||||
- Consider `exa` or `lsd` for enhanced directory listings
|
||||
|
||||
### **Getting Help:**
|
||||
- `?` - **Context help** in any Dired buffer
|
||||
- `C-h m` - **Mode-specific help**
|
||||
- `SPC h d f dired` - **Full Dired documentation**
|
||||
|
||||
## 📋 **Comparison: Dired vs Treemacs**
|
||||
|
||||
### **Use Dired when:**
|
||||
- Managing multiple files at once
|
||||
- Need detailed file information
|
||||
- Performing batch operations
|
||||
- Working with file permissions/ownership
|
||||
|
||||
### **Use Treemacs when:**
|
||||
- Quick project overview
|
||||
- Simple file navigation
|
||||
- Prefer visual tree structure
|
||||
- Need persistent sidebar
|
||||
|
||||
## 🛠️ **External Tool Integration**
|
||||
|
||||
### **Recommended Tools:**
|
||||
- **`rsync`** - Fast, reliable file copying with resume capability
|
||||
- **`ripgrep` (rg)** - Extremely fast text search, much faster than grep
|
||||
- **`fd`** - Fast alternative to find with better defaults
|
||||
- **`exa`** - Modern replacement for ls with colors and git integration
|
||||
- **`trash-cli`** - Safe deletion to trash instead of permanent removal
|
||||
- **`7z`** - Handle 7zip archives and other compression formats
|
||||
|
||||
### **Installation (Debian/Ubuntu):**
|
||||
```bash
|
||||
sudo apt install rsync ripgrep fd-find exa trash-cli p7zip-full
|
||||
```
|
||||
|
||||
## 🎯 **Pro Tips**
|
||||
|
||||
- **Batch operations**: Mark files first (`m`), then execute operations
|
||||
- **Quick navigation**: Use `/` to search for files by name
|
||||
- **Edit filenames**: Use `C-x C-q` for Wdired mode to rename multiple files
|
||||
- **Shell integration**: Use `!` to run shell commands on files
|
||||
- **Multiple directories**: Use `i` to show subdirectories in same buffer
|
||||
- **Safe deletion**: Install `trash-cli` to send files to trash instead of permanent deletion
|
||||
- **Fast search**: Install `ripgrep` for lightning-fast text search in files
|
||||
|
||||
Dired provides a comprehensive file management experience that integrates well with external Linux tools, making file operations both efficient and powerful.
|
||||
294
cheatsheets/emacs/emacs.getting-started.top10.md
Normal file
294
cheatsheets/emacs/emacs.getting-started.top10.md
Normal file
@@ -0,0 +1,294 @@
|
||||
# Top 10 Things New Doom Emacs Users Should Know
|
||||
|
||||
## 🚀 **Getting Started with Doom Emacs**
|
||||
|
||||
Welcome to Doom Emacs! Here are the 10 most essential things every new user
|
||||
should master to get productive quickly.
|
||||
|
||||
---
|
||||
|
||||
## 1. 🗝️ **Master the Leader Key: `SPC`**
|
||||
|
||||
**The Space key is your gateway to everything in Doom Emacs.**
|
||||
|
||||
- `SPC` is called the "leader key" - it opens menus for almost every action
|
||||
- After pressing `SPC`, you'll see helpful hints showing available commands
|
||||
- Commands are organized logically: `SPC f` for files, `SPC g` for git, `SPC p`
|
||||
for projects
|
||||
|
||||
**Essential starter commands:**
|
||||
|
||||
- `SPC f f` - Find/open files
|
||||
- `SPC f s` - Save current file
|
||||
- `SPC q q` - Quit Emacs
|
||||
- `SPC h` - Help menu (very important!)
|
||||
|
||||
**Pro Tip:** If you forget what comes next, just press `SPC` and wait - Doom
|
||||
will show you the options!
|
||||
|
||||
---
|
||||
|
||||
## 2. 📁 **Navigate Files Like a Pro**
|
||||
|
||||
**File navigation is fundamental to productivity.**
|
||||
|
||||
- `SPC .` - **Open file explorer** (Dired) in current directory
|
||||
- `SPC f f` - **Find file** anywhere on your system
|
||||
- `SPC f r` - **Recent files** you've worked on
|
||||
- `SPC SPC` - **Find file in current project** (super useful!)
|
||||
|
||||
📋 _See the complete guide: `emacs.file-explorer.cheatsheet.md`_
|
||||
|
||||
**Quick workflow:**
|
||||
|
||||
1. Open your project directory in terminal
|
||||
2. Start Emacs: `emacs` or `doom run`
|
||||
3. Use `SPC .` to browse files or `SPC SPC` to quickly find files
|
||||
|
||||
---
|
||||
|
||||
## 3. ⌨️ **Understand Evil Mode (Vim Keybindings)**
|
||||
|
||||
**Doom Emacs uses Vim-style keybindings by default.**
|
||||
|
||||
**Basic movement (in Normal mode):**
|
||||
|
||||
- `h j k l` - Left, down, up, right
|
||||
- `w` - Jump to next word
|
||||
- `b` - Jump back one word
|
||||
- `gg` - Go to top of file
|
||||
- `G` - Go to bottom of file
|
||||
|
||||
**Mode switching:**
|
||||
|
||||
- `i` - Enter Insert mode (to type text)
|
||||
- `ESC` - Return to Normal mode
|
||||
- `v` - Visual mode (to select text)
|
||||
|
||||
**If you're not familiar with Vim:** Don't panic! You can learn gradually. The
|
||||
basics above will get you started.
|
||||
|
||||
---
|
||||
|
||||
## 4. 🔍 **Search and Replace Efficiently**
|
||||
|
||||
**Finding and changing text is a daily task.**
|
||||
|
||||
- `/` - Search forward in current buffer
|
||||
- `?` - Search backward in current buffer
|
||||
- `n/N` - Next/previous search result
|
||||
- `SPC s s` - Search in current buffer (interactive)
|
||||
- `SPC s p` - Search in entire project
|
||||
- `SPC s r` - Search and replace in current buffer
|
||||
|
||||
**For project-wide search:** `SPC s p` is incredibly powerful for finding code
|
||||
across your entire project.
|
||||
|
||||
---
|
||||
|
||||
## 5. 🗂️ **Work with Buffers and Windows**
|
||||
|
||||
**Buffers are open files, windows are how you view them.**
|
||||
|
||||
**Buffer management:**
|
||||
|
||||
- `SPC b b` - Switch between open buffers
|
||||
- `SPC b k` - Kill (close) current buffer
|
||||
- `SPC b s` - Save current buffer
|
||||
|
||||
**Window management:**
|
||||
|
||||
- `SPC w v` - Split window vertically
|
||||
- `SPC w s` - Split window horizontally
|
||||
- `SPC w c` - Close current window
|
||||
- `SPC w w` - Switch between windows
|
||||
- `C-h j/k/h/l` - Navigate between windows (Vim-style)
|
||||
|
||||
**Think of it this way:** You can have many files open (buffers) but only see
|
||||
some of them at once (windows).
|
||||
|
||||
---
|
||||
|
||||
## 6. 🛠️ **Configure and Customize Doom**
|
||||
|
||||
**Doom is highly configurable, but start simple.**
|
||||
|
||||
**Key files to know about:**
|
||||
|
||||
- `~/.doom.d/config.el` - Your personal configuration
|
||||
- `~/.doom.d/init.el` - Enable/disable Doom modules
|
||||
- `~/.doom.d/packages.el` - Add extra packages
|
||||
|
||||
**Essential commands:**
|
||||
|
||||
- `SPC h r r` - Reload Doom configuration
|
||||
- `SPC h d h` - Doom help and documentation
|
||||
- `doom doctor` - Check for configuration issues (run in terminal)
|
||||
- `doom upgrade` - Update Doom (run in terminal)
|
||||
|
||||
**Start small:** Don't try to customize everything at once. Use Doom's defaults
|
||||
first, then gradually tweak things.
|
||||
|
||||
---
|
||||
|
||||
## 7. 📝 **Master Text Editing Basics**
|
||||
|
||||
**Essential editing commands that work in any mode.**
|
||||
|
||||
**In Normal mode (Evil):**
|
||||
|
||||
- `x` - Delete character under cursor
|
||||
- `dd` - Delete entire line
|
||||
- `yy` - Copy (yank) entire line
|
||||
- `p` - Paste after cursor
|
||||
- `u` - Undo
|
||||
- `C-r` - Redo
|
||||
|
||||
**In Insert mode:**
|
||||
|
||||
- `C-w` - Delete word backward
|
||||
- `C-u` - Delete to beginning of line
|
||||
|
||||
**Selection and manipulation:**
|
||||
|
||||
- `v` - Start visual selection
|
||||
- `V` - Select entire line
|
||||
- `d` - Delete selected text
|
||||
- `y` - Copy selected text
|
||||
|
||||
---
|
||||
|
||||
## 8. 💻 **Use Code Completion and Language Features**
|
||||
|
||||
**Doom comes with excellent code support out of the box.**
|
||||
|
||||
**Auto-completion:**
|
||||
|
||||
- Just start typing - completions appear automatically
|
||||
- `TAB` - Accept completion
|
||||
- `C-n/C-p` or `j/k` - Navigate completion options
|
||||
|
||||
**Code navigation:**
|
||||
|
||||
- `gd` - Go to definition
|
||||
- `gr` - Find references
|
||||
- `K` - Show documentation
|
||||
- `SPC c a` - Code actions (refactor, fix, etc.)
|
||||
|
||||
📋 _See the complete guide: `emacs.code-completion.cheatsheet.md`_
|
||||
|
||||
**Languages supported:** Most popular languages work out of the box (Python,
|
||||
JavaScript, C/C++, Rust, Go, etc.)
|
||||
|
||||
---
|
||||
|
||||
## 9. 📚 **Use Built-in Help System**
|
||||
|
||||
**Doom has excellent built-in documentation.**
|
||||
|
||||
- `SPC h` - **Main help menu**
|
||||
- `SPC h d h` - **Doom-specific help**
|
||||
- `SPC h k` - **Describe key** (what does this key do?)
|
||||
- `SPC h f` - **Describe function**
|
||||
- `SPC h v` - **Describe variable**
|
||||
- `C-h m` - **Show help for current mode**
|
||||
|
||||
**When you're lost:** Press `SPC h` and explore. The help system is
|
||||
comprehensive and always available.
|
||||
|
||||
**Pro Tip:** If you press a key combination and don't know what happened, use
|
||||
`SPC h l` to see recent commands.
|
||||
|
||||
---
|
||||
|
||||
## 10. 🔧 **Learn Git Integration (Magit)**
|
||||
|
||||
**Magit is one of the best Git interfaces available anywhere.**
|
||||
|
||||
- `SPC g g` - Open Magit status (your main Git command!)
|
||||
- `s` - Stage files or hunks
|
||||
- `c c` - Commit changes
|
||||
- `P P` - Push to remote
|
||||
- `F F` - Pull from remote
|
||||
|
||||
📋 _See the complete guide: `emacs.magit.cheatsheet.md`_
|
||||
|
||||
**Basic workflow:**
|
||||
|
||||
1. `SPC g g` - See what's changed
|
||||
2. `s` on files to stage them
|
||||
3. `c c` to commit (write message, then `C-c C-c`)
|
||||
4. `P P` to push
|
||||
|
||||
**Why it's essential:** If you work with Git, Magit will transform your
|
||||
workflow. It's visual, fast, and incredibly powerful.
|
||||
|
||||
---
|
||||
|
||||
## 🎯 **Quick Start Checklist**
|
||||
|
||||
Once you've read through the above, try this 5-minute workflow:
|
||||
|
||||
1. ✅ **Open Doom:** `emacs` in terminal
|
||||
2. ✅ **Find a file:** `SPC f f` and open any text file
|
||||
3. ✅ **Edit something:** Press `i`, type text, press `ESC`
|
||||
4. ✅ **Save:** `SPC f s`
|
||||
5. ✅ **Open file explorer:** `SPC .`
|
||||
6. ✅ **Get help:** `SPC h`
|
||||
7. ✅ **Split window:** `SPC w v`
|
||||
8. ✅ **Switch buffers:** `SPC b b`
|
||||
9. ✅ **Search project:** `SPC s p` (if in a project)
|
||||
10. ✅ **Quit:** `SPC q q`
|
||||
|
||||
---
|
||||
|
||||
## 📖 **Next Steps: Dive Deeper**
|
||||
|
||||
Once you're comfortable with the basics above:
|
||||
|
||||
1. **Read the specific cheatsheets:**
|
||||
- `emacs.file-explorer.cheatsheet.md` - File management
|
||||
- `emacs.code-completion.cheatsheet.md` - Coding features
|
||||
- `emacs.magit.cheatsheet.md` - Git integration
|
||||
- `emacs.markdown.cheatsheet.md` - Markdown editing
|
||||
|
||||
2. **Customize gradually:** Start tweaking your `config.el`
|
||||
3. **Learn your language:** Explore language-specific features
|
||||
4. **Join the community:** Doom Discord, Reddit, GitHub discussions
|
||||
|
||||
---
|
||||
|
||||
## 🆘 **When You're Stuck**
|
||||
|
||||
**Emergency commands:**
|
||||
|
||||
- `C-g` - Cancel current command (like pressing ESC)
|
||||
- `SPC q q` - Quit Emacs
|
||||
- `SPC h d h` - Doom help
|
||||
- `:q` - Quit current buffer (Vim command)
|
||||
|
||||
**Remember:** Every expert was once a beginner. Don't try to learn everything at
|
||||
once. Master these 10 things first, then gradually explore more advanced
|
||||
features.
|
||||
|
||||
**Most important tip:** Use `SPC` and explore the menus. Doom is designed to be
|
||||
discoverable - let it guide you!
|
||||
|
||||
---
|
||||
|
||||
## 🎓 **Learning Philosophy**
|
||||
|
||||
**Start with workflows, not features:** Instead of memorizing every keybinding,
|
||||
learn complete workflows for tasks you do daily (editing files, committing code,
|
||||
searching projects).
|
||||
|
||||
**Use the defaults first:** Doom's defaults are excellent. Resist the urge to
|
||||
customize everything immediately.
|
||||
|
||||
**One thing at a time:** Master file navigation before diving into advanced code
|
||||
features. Build your skills incrementally.
|
||||
|
||||
**Practice daily:** Use Doom for real work, even if you're slower at first.
|
||||
Muscle memory develops with practice.
|
||||
|
||||
Welcome to Doom Emacs! 🚀
|
||||
276
cheatsheets/emacs/emacs.magit.cheatsheet.md
Normal file
276
cheatsheets/emacs/emacs.magit.cheatsheet.md
Normal file
@@ -0,0 +1,276 @@
|
||||
# Doom Emacs Magit Cheatsheet
|
||||
|
||||
## 🚀 **What is Magit?**
|
||||
|
||||
Magit is an extremely powerful tool for managing your Git project
|
||||
|
||||
- Visual, interactive Git workflows
|
||||
- Stage hunks, lines, or entire files with ease
|
||||
- Commit, push, pull, merge, rebase - all from intuitive menus
|
||||
- See your repo status at a glance
|
||||
|
||||
## 📋 **Requirements**
|
||||
|
||||
- Git installed on your system
|
||||
- Doom Emacs with Magit enabled (included by default)
|
||||
- Working inside a Git repository
|
||||
|
||||
## ⌨️ **Opening Magit**
|
||||
|
||||
### **Main Magit Interface:**
|
||||
|
||||
- `SPC g g` - **Magit status** (your main command!)
|
||||
- `SPC g d` - **Magit file dispatch**
|
||||
- `SPC g f` - **Magit file commands**
|
||||
- `SPC g l` - **Magit log**
|
||||
- `SPC g b` - **Magit blame**
|
||||
|
||||
## 🎯 **The Magit Status Buffer** (Your Command Center)
|
||||
|
||||
### **Navigation:**
|
||||
|
||||
- `j/k` or `n/p` - **Move up/down** between sections
|
||||
- `TAB` - **Expand/collapse** section under cursor
|
||||
- `M-TAB` - **Expand/collapse** all sections
|
||||
- `g` - **Refresh** status buffer
|
||||
|
||||
### **Section Overview:**
|
||||
|
||||
```
|
||||
Untracked files - Files not in Git
|
||||
Unstaged changes - Modified files not staged
|
||||
Staged changes - Files ready to commit
|
||||
Recent commits - Your commit history
|
||||
Stashes - Your saved work-in-progress
|
||||
```
|
||||
|
||||
## 📝 **Staging & Unstaging**
|
||||
|
||||
### **Stage Files:**
|
||||
|
||||
- `s` - **Stage** file/hunk under cursor
|
||||
- `S` - **Stage all** unstaged changes
|
||||
- `i` - **Ignore** file (add to .gitignore)
|
||||
|
||||
### **Unstage Files:**
|
||||
|
||||
- `u` - **Unstage** file/hunk under cursor
|
||||
- `U` - **Unstage all** staged changes
|
||||
|
||||
### **Discard Changes:**
|
||||
|
||||
- `k` - **Discard** changes in file/hunk under cursor
|
||||
- `K` - **Discard all** changes in working directory
|
||||
|
||||
### **Staging Hunks & Lines:**
|
||||
|
||||
- `RET` or `SPC` - **Show diff** of file under cursor
|
||||
- In diff view:
|
||||
- `s` - **Stage hunk** under cursor
|
||||
- `u` - **Unstage hunk** under cursor
|
||||
- `k` - **Discard hunk** under cursor
|
||||
- `+/-` - **Show more/less context** lines
|
||||
|
||||
## 💾 **Committing**
|
||||
|
||||
### **Create Commits:**
|
||||
|
||||
- `c c` - **Commit** (opens commit message buffer)
|
||||
- `c a` - **Amend** last commit
|
||||
- `c e` - **Extend** last commit (no message change)
|
||||
- `c w` - **Reword** last commit message
|
||||
- `c f` - **Fixup** commit
|
||||
- `c s` - **Squash** commit
|
||||
|
||||
### **In Commit Message Buffer:**
|
||||
|
||||
- `C-c C-c` - **Finish commit**
|
||||
- `C-c C-k` - **Cancel commit**
|
||||
- `M-p/M-n` - **Previous/next** commit message from history
|
||||
|
||||
## 🌿 **Branching & Switching**
|
||||
|
||||
### **Branch Operations:**
|
||||
|
||||
- `b b` - **Switch branch** (checkout)
|
||||
- `b c` - **Create new branch**
|
||||
- `b n` - **Create branch** from current HEAD
|
||||
- `b s` - **Create branch** and switch to it
|
||||
- `b r` - **Rename branch**
|
||||
- `b k` - **Delete branch**
|
||||
|
||||
### **Remote Branches:**
|
||||
|
||||
- `b a` - **Set upstream** for current branch
|
||||
- `b u` - **Set upstream** and push
|
||||
|
||||
## 🔄 **Remote Operations**
|
||||
|
||||
### **Fetch & Pull:**
|
||||
|
||||
- `f f` - **Fetch** from default remote
|
||||
- `f a` - **Fetch from all** remotes
|
||||
- `F F` - **Pull** from upstream
|
||||
- `F u` - **Pull from upstream** (rebase)
|
||||
|
||||
### **Push:**
|
||||
|
||||
- `P P` - **Push** to upstream
|
||||
- `P u` - **Push and set upstream**
|
||||
- `P f` - **Force push** (use carefully!)
|
||||
- `P t` - **Push tags**
|
||||
|
||||
## 📚 **Viewing History & Logs**
|
||||
|
||||
### **Log Views:**
|
||||
|
||||
- `l l` - **Show log** for current branch
|
||||
- `l o` - **Show log** for other branches
|
||||
- `l h` - **Show log** for HEAD
|
||||
- `l a` - **Show log** for all branches
|
||||
- `l f` - **Show log** for file under cursor
|
||||
|
||||
### **In Log View:**
|
||||
|
||||
- `RET` - **Show commit** details
|
||||
- `d d` - **Show diff** for commit
|
||||
- `c c` - **Create new commit**
|
||||
- `r r` - **Revert commit**
|
||||
|
||||
## 🔍 **Diffs & Comparisons**
|
||||
|
||||
### **Diff Commands:**
|
||||
|
||||
- `d d` - **Diff working directory** vs staged
|
||||
- `d s` - **Diff staged** vs HEAD
|
||||
- `d u` - **Diff unstaged** changes
|
||||
- `d r` - **Diff range** between commits
|
||||
|
||||
### **In Diff Views:**
|
||||
|
||||
- `j/k` - **Navigate** between hunks
|
||||
- `n/p` - **Next/previous** file
|
||||
- `TAB` - **Toggle** visibility of diff section
|
||||
- `+/-` - **Increase/decrease** context lines
|
||||
|
||||
## 🔧 **Rebasing & Merging**
|
||||
|
||||
### **Merge:**
|
||||
|
||||
- `m m` - **Merge** branch
|
||||
- `m a` - **Abort merge**
|
||||
- `m c` - **Continue merge**
|
||||
|
||||
### **Rebase:**
|
||||
|
||||
- `r i` - **Interactive rebase**
|
||||
- `r r` - **Rebase** branch
|
||||
- `r a` - **Abort rebase**
|
||||
- `r c` - **Continue rebase**
|
||||
|
||||
### **During Interactive Rebase:**
|
||||
|
||||
- `j/k` - **Move** between commits
|
||||
- `p` - **Pick** commit (default)
|
||||
- `r` - **Reword** commit message
|
||||
- `e` - **Edit** commit
|
||||
- `s` - **Squash** commit
|
||||
- `f` - **Fixup** commit
|
||||
- `d` - **Drop** commit
|
||||
|
||||
## 📦 **Stashing**
|
||||
|
||||
### **Stash Operations:**
|
||||
|
||||
- `z z` - **Stash** current changes
|
||||
- `z i` - **Stash** with message
|
||||
- `z a` - **Apply stash**
|
||||
- `z p` - **Pop stash** (apply and delete)
|
||||
- `z k` - **Drop stash**
|
||||
- `z l` - **List stashes**
|
||||
|
||||
## 🏷️ **Tags**
|
||||
|
||||
### **Tag Operations:**
|
||||
|
||||
- `t t` - **Create tag**
|
||||
- `t a` - **Create annotated tag**
|
||||
- `t k` - **Delete tag**
|
||||
- `t p` - **Push tag**
|
||||
|
||||
## ⚡ **Pro Tips & Workflows**
|
||||
|
||||
### **Daily Git Workflow:**
|
||||
|
||||
1. `SPC g g` - **Open Magit status**
|
||||
2. Review changes, stage with `s`
|
||||
3. `c c` - **Commit changes**
|
||||
4. `P P` - **Push to remote**
|
||||
|
||||
### **Power User Tricks:**
|
||||
|
||||
- Use `M-x magit-find-file` to quickly open files from Git history
|
||||
- `SPC g f s` - **Stage current file** without opening Magit
|
||||
- `SPC g f u` - **Unstage current file**
|
||||
- `SPC g f d` - **Show file diff**
|
||||
|
||||
### **Staging Granularity:**
|
||||
|
||||
- Stage entire files with `s` in status buffer
|
||||
- Stage individual hunks by entering diff view (`RET`) then `s`
|
||||
- Stage individual lines by selecting region in diff then `s`
|
||||
|
||||
### **Commit Best Practices:**
|
||||
|
||||
- Use `c c` for normal commits
|
||||
- Use `c a` to fix up your last commit
|
||||
- Use `c f` to create fixup commits for interactive rebase later
|
||||
|
||||
## 🔧 **Troubleshooting**
|
||||
|
||||
### **Common Issues:**
|
||||
|
||||
- **Magit won't open?** Make sure you're in a Git repository
|
||||
- **Performance slow?** Try `M-x magit-refresh` or restart Emacs
|
||||
- **Merge conflicts?** Magit highlights conflicts - resolve them and use `m c`
|
||||
|
||||
### **Getting Help:**
|
||||
|
||||
- `?` - **Show help** in any Magit buffer
|
||||
- `C-h m` - **Show mode help**
|
||||
- `SPC h d m magit` - **Full Magit documentation**
|
||||
|
||||
## 🚀 **Quick Start Workflow**
|
||||
|
||||
1. **Navigate to your Git repo** in Doom Emacs
|
||||
2. **Press `SPC g g`** - Opens Magit status
|
||||
3. **Stage files** with `s`, review diffs with `RET`
|
||||
4. **Commit** with `c c`, write message, finish with `C-c C-c`
|
||||
5. **Push** with `P P`
|
||||
|
||||
## 📚 **Essential Keybind Summary**
|
||||
|
||||
| Action | Key | Description |
|
||||
| ------- | --------- | ------------------ |
|
||||
| Status | `SPC g g` | Open Magit status |
|
||||
| Stage | `s` | Stage file/hunk |
|
||||
| Unstage | `u` | Unstage file/hunk |
|
||||
| Commit | `c c` | Create commit |
|
||||
| Push | `P P` | Push to upstream |
|
||||
| Pull | `F F` | Pull from upstream |
|
||||
| Branch | `b b` | Switch branch |
|
||||
| Log | `l l` | Show log |
|
||||
| Diff | `d d` | Show diff |
|
||||
| Stash | `z z` | Stash changes |
|
||||
| Help | `?` | Show context help |
|
||||
|
||||
## 🎉 **Why Magit is Amazing**
|
||||
|
||||
- **Visual**: See your entire repo state at a glance
|
||||
- **Interactive**: Stage hunks, lines, or files with simple keystrokes
|
||||
- **Fast**: Navigate Git operations faster than any CLI
|
||||
- **Powerful**: Access every Git feature through intuitive menus
|
||||
- **Integrated**: Works seamlessly with Doom Emacs and Evil mode
|
||||
|
||||
**Pro Tip**: Once you learn Magit, you'll never want to use Git from the command
|
||||
line again! 🚀
|
||||
85
cheatsheets/emacs/emacs.markdown.cheatsheet.md
Normal file
85
cheatsheets/emacs/emacs.markdown.cheatsheet.md
Normal file
@@ -0,0 +1,85 @@
|
||||
# Doom Emacs Markdown Cheatsheet
|
||||
|
||||
## 📝 **Getting Started**
|
||||
- Open any `.md` file - Doom automatically enables `markdown-mode`
|
||||
- You'll get syntax highlighting, proper indentation, and markdown-specific features
|
||||
|
||||
## ⌨️ **Key Markdown Commands** (with Evil/Vim bindings)
|
||||
|
||||
### **Formatting Text:**
|
||||
- `SPC m b` - **Bold** text
|
||||
- `SPC m i` - *Italic* text
|
||||
- `SPC m c` - `Inline code`
|
||||
- `SPC m C` - Code block
|
||||
- `SPC m s` - ~~Strikethrough~~
|
||||
|
||||
### **Headers:**
|
||||
- `SPC m h` - Insert header (prompts for level 1-6)
|
||||
- `SPC m H` - Insert header with underline style
|
||||
|
||||
### **Lists:**
|
||||
- `SPC m l` - Insert unordered list item
|
||||
- `SPC m L` - Insert ordered list item
|
||||
|
||||
### **Links & Images:**
|
||||
- `SPC m l l` - Insert link
|
||||
- `SPC m l i` - Insert image
|
||||
- `SPC m l u` - Insert URL
|
||||
|
||||
### **Navigation:**
|
||||
- `]]` - Next header
|
||||
- `[[` - Previous header
|
||||
- `SPC m o` - Open outline/table of contents
|
||||
|
||||
## 👁️ **Live Preview**
|
||||
- `SPC m p` - Preview in browser
|
||||
- `SPC m P` - Export to HTML
|
||||
|
||||
## 📊 **Tables**
|
||||
- `SPC m t` - Table commands
|
||||
- `SPC m t t` - Insert table
|
||||
- `TAB` - Navigate between cells
|
||||
- `S-TAB` - Navigate backward between cells
|
||||
|
||||
## 🎯 **Useful Evil Bindings in Markdown**
|
||||
- `TAB` - Cycle folding of headers
|
||||
- `S-TAB` - Cycle folding globally
|
||||
- `RET` - Follow links
|
||||
- `M-RET` - Insert new list item
|
||||
|
||||
## 🧪 **Test Examples**
|
||||
|
||||
### Sample Formatting
|
||||
This is **bold text** and this is *italic text*.
|
||||
|
||||
Here's some `inline code` and a code block:
|
||||
|
||||
```bash
|
||||
# Code block example
|
||||
echo "Hello from markdown!"
|
||||
```
|
||||
|
||||
### Sample List
|
||||
- [ ] Checkbox item 1
|
||||
- [x] Completed checkbox
|
||||
- Regular bullet point
|
||||
|
||||
### Sample Table
|
||||
| Feature | Shortcut | Description |
|
||||
|---------|----------|-------------|
|
||||
| Bold | SPC m b | Make text bold |
|
||||
| Italic | SPC m i | Make text italic |
|
||||
| Preview | SPC m p | Preview in browser |
|
||||
|
||||
## 🚀 **Pro Tips**
|
||||
1. Use `SPC m o` to get an outline view for navigation
|
||||
2. `TAB` on headers to fold/unfold sections
|
||||
3. `RET` on links to follow them
|
||||
4. Use `SPC m p` to preview your markdown in a browser
|
||||
5. Create checklists with `- [ ]` syntax
|
||||
|
||||
## 📚 **Quick Reference**
|
||||
- All markdown commands start with `SPC m`
|
||||
- Use `SPC m ?` or `C-h m` to see all available commands
|
||||
- Navigation between headers: `]]` (next) and `[[` (previous)
|
||||
- Toggle folding: `TAB` (local) and `S-TAB` (global)
|
||||
Reference in New Issue
Block a user