|
| 1 | +# pcode-editor User Guide |
| 2 | + |
| 3 | +Welcome to pcode-editor, a lightweight, Vim-inspired code editor built with Dear ImGui. |
| 4 | + |
| 5 | +## Version |
| 6 | + |
| 7 | +This guide covers **pcode-editor version 0.2.28**. |
| 8 | + |
| 9 | +--- |
| 10 | + |
| 11 | +## Getting Started |
| 12 | + |
| 13 | +### Launching the Editor |
| 14 | + |
| 15 | +```bash |
| 16 | +# Windows |
| 17 | +.\build\Release\pcode-editor.exe |
| 18 | + |
| 19 | +# Linux/macOS/BSD |
| 20 | +./build/pcode-editor |
| 21 | +``` |
| 22 | + |
| 23 | +### Opening Files |
| 24 | + |
| 25 | +- **Command Line**: `pcode-editor filename.cpp` |
| 26 | +- **Menu**: File > Open (Ctrl+O) |
| 27 | +- **Drag & Drop**: Drop files onto the editor window |
| 28 | + |
| 29 | +--- |
| 30 | + |
| 31 | +## Interface Overview |
| 32 | + |
| 33 | +``` |
| 34 | ++------------------------------------------------------------------+ |
| 35 | +| File Edit View Help [_][X] | |
| 36 | ++------------------------------------------------------------------+ |
| 37 | +| [+][~] untitled [X] | |
| 38 | ++------------------------------------------------------------------+ |
| 39 | +| | | |
| 40 | +| 1 #include <stdio.h> | 1 #include | |
| 41 | +| 2 | 2 | |
| 42 | +| 3 int main() { | 3 int main | |
| 43 | +| 4 printf("Hello\n"); | 4 print | |
| 44 | +| 5 return 0; | 5 retur | |
| 45 | +| 6 } | 6 } | |
| 46 | +| | | |
| 47 | +| +------------+ |
| 48 | ++------------------------------------------------------------------+ |
| 49 | +| NORMAL | Ln 1, Col 1 | UTF-8 | LC | 100% | main.cpp | 0.2.28 | |
| 50 | ++------------------------------------------------------------------+ |
| 51 | +``` |
| 52 | + |
| 53 | +### Key Interface Elements |
| 54 | + |
| 55 | +| Element | Description | |
| 56 | +|---------|-------------| |
| 57 | +| **Tab Bar** | Shows open files; click to switch, drag to reorder | |
| 58 | +| **Editor Area** | Main code editing area with syntax highlighting | |
| 59 | +| **Minimap** | Right-side overview; click to navigate | |
| 60 | +| **Gutter** | Left margin with line numbers and change indicators | |
| 61 | +| **Status Bar** | Vim mode, cursor position, file encoding, zoom level | |
| 62 | +| **Split Windows** | Edit multiple files side-by-side | |
| 63 | + |
| 64 | +--- |
| 65 | + |
| 66 | +## Vim Mode |
| 67 | + |
| 68 | +pcode-editor supports Vim-style editing with multiple modes. |
| 69 | + |
| 70 | +### Mode Types |
| 71 | + |
| 72 | +| Mode | Description | Indicator | |
| 73 | +|------|------------|-----------| |
| 74 | +| **NORMAL** | Default mode for navigation and commands | `NORMAL` | |
| 75 | +| **INSERT** | Type to insert text | `INSERT` | |
| 76 | +| **COMMAND** | Ex commands (`:w`, `:q`, etc.) | `:` | |
| 77 | + |
| 78 | +### Switching Modes |
| 79 | + |
| 80 | +| Key | Action | |
| 81 | +|-----|-------| |
| 82 | +| `Esc` | Return to NORMAL | |
| 83 | +| `i` | Enter INSERT mode | |
| 84 | +| `:` | Enter COMMAND mode | |
| 85 | +| `v` | Enter VISUAL mode | |
| 86 | +| `V` | Enter VISUAL LINE mode | |
| 87 | + |
| 88 | +### Normal Mode Commands |
| 89 | + |
| 90 | +#### Navigation |
| 91 | + |
| 92 | +| Key | Action | |
| 93 | +|-----|-------| |
| 94 | +| `h` | Move left | |
| 95 | +| `j` | Move down | |
| 96 | +| `k` | Move up | |
| 97 | +| `l` | Move right | |
| 98 | +| `w` | Word forward | |
| 99 | +| `b` | Word backward | |
| 100 | +| `e` | Word end | |
| 101 | +| `0` | Line start | |
| 102 | +| `$` | Line end | |
| 103 | +| `gg` | File start | |
| 104 | +| `G` | File end | |
| 105 | +| `:{n}` | Go to line n | |
| 106 | + |
| 107 | +#### Editing |
| 108 | + |
| 109 | +| Key | Action | |
| 110 | +|-----|-------| |
| 111 | +| `x` | Delete character | |
| 112 | +| `dd` | Delete line | |
| 113 | +| `yy` | Yank (copy) line | |
| 114 | +| `p` | Paste | |
| 115 | +| `u` | Undo | |
| 116 | +| `Ctrl+r` | Redo | |
| 117 | + |
| 118 | +#### Search |
| 119 | + |
| 120 | +| Key | Action | |
| 121 | +|-----|-------| |
| 122 | +| `/` | Search forward | |
| 123 | +| `?` | Search backward | |
| 124 | +| `n` | Next match | |
| 125 | +| `N` | Previous match | |
| 126 | + |
| 127 | +--- |
| 128 | + |
| 129 | +## Keyboard Shortcuts |
| 130 | + |
| 131 | +### File Operations |
| 132 | + |
| 133 | +| Shortcut | Action | |
| 134 | +|----------|--------| |
| 135 | +| `Ctrl+N` | New tab | |
| 136 | +| `Ctrl+O` | Open file | |
| 137 | +| `Ctrl+S` | Save | |
| 138 | +| `Ctrl+Shift+S` | Save as | |
| 139 | +| `Ctrl+W` | Close tab | |
| 140 | +| `Ctrl+Q` | Quit | |
| 141 | + |
| 142 | +### Edit Operations |
| 143 | + |
| 144 | +| Shortcut | Action | |
| 145 | +|----------|--------| |
| 146 | +| `Ctrl+C` | Copy | |
| 147 | +| `Ctrl+V` | Paste | |
| 148 | +| `Ctrl+X` | Cut | |
| 149 | +| `Ctrl+Z` | Undo | |
| 150 | +| `Ctrl+Y` | Redo | |
| 151 | +| `Ctrl+F` | Find | |
| 152 | +| `Ctrl+H` | Find and replace | |
| 153 | +| `Ctrl+A` | Select all | |
| 154 | + |
| 155 | +### View Operations |
| 156 | + |
| 157 | +| Shortcut | Action | |
| 158 | +|----------|--------| |
| 159 | +| `Ctrl++` | Zoom in | |
| 160 | +| `Ctrl+-` | Zoom out | |
| 161 | +| `Ctrl+0` | Reset zoom | |
| 162 | +| `Ctrl+P` | Command palette | |
| 163 | +| `Ctrl+\`` | Toggle terminal | |
| 164 | + |
| 165 | +### Split Windows |
| 166 | + |
| 167 | +| Shortcut | Action | |
| 168 | +|----------|--------| |
| 169 | +| `:sp` | Horizontal split | |
| 170 | +| `:vsp` | Vertical split | |
| 171 | +| `Ctrl+W` then `h` | Focus left split | |
| 172 | +| `Ctrl+W` then `j` | Focus down split | |
| 173 | +| `Ctrl+W` then `k` | Focus up split | |
| 174 | +| `Ctrl+W` then `l` | Focus right split | |
| 175 | +| `Ctrl+W` then `o` | Close other splits | |
| 176 | + |
| 177 | +--- |
| 178 | + |
| 179 | +## Command Palette |
| 180 | + |
| 181 | +Open with `Ctrl+P` or `:palette`. |
| 182 | + |
| 183 | +### Searching |
| 184 | + |
| 185 | +- Type to filter commands |
| 186 | +- Arrow keys to navigate |
| 187 | +- Enter to execute |
| 188 | + |
| 189 | +### Available Commands |
| 190 | + |
| 191 | +Type these in the palette: |
| 192 | + |
| 193 | +| Command | Action | |
| 194 | +|---------|--------| |
| 195 | +| `new tab` | Create new file | |
| 196 | +| `open` | Open file dialog | |
| 197 | +| `save` | Save current file | |
| 198 | +| `save as` | Save with new name | |
| 199 | +| `close tab` | Close current tab | |
| 200 | +| `toggle terminal` | Show/hide terminal | |
| 201 | +| `toggle sidebar` | Show/hide file explorer | |
| 202 | +| `toggle minimap` | Show/hide minimap | |
| 203 | +| `toggle theme` | Switch dark/light | |
| 204 | +| `font size` | Open font settings | |
| 205 | + |
| 206 | +--- |
| 207 | + |
| 208 | +## Terminal Integration |
| 209 | + |
| 210 | +Open terminal with `:term`, `:shell`, or `:sh`. |
| 211 | + |
| 212 | +### Features |
| 213 | + |
| 214 | +- Direct keyboard input to shell |
| 215 | +- Command history with up/down arrows |
| 216 | +- Independent font zoom (Ctrl++/-) |
| 217 | +- Close with `exit` or X button |
| 218 | + |
| 219 | +### Shell Commands |
| 220 | + |
| 221 | +| Command | Action | |
| 222 | +|---------|--------| |
| 223 | +| `:term` | Open terminal | |
| 224 | +| `:term cmd` | Run specific command | |
| 225 | +| `:shell` | Open default shell | |
| 226 | +| `:sh` | Open default shell | |
| 227 | + |
| 228 | +--- |
| 229 | + |
| 230 | +## Settings |
| 231 | + |
| 232 | +Settings are stored in `pcode-settings.json` in the editor's directory. |
| 233 | + |
| 234 | +### Adjustable Settings |
| 235 | + |
| 236 | +| Setting | Default | Description | |
| 237 | +|---------|---------|-------------| |
| 238 | +| `font_size` | 18 | Editor font size | |
| 239 | +| `font_name` | "" | Font family (empty = system default) | |
| 240 | +| `tab_size` | 4 | Tab width in spaces | |
| 241 | +| `word_wrap` | true | Enable word wrap | |
| 242 | +| `show_line_numbers` | true | Show line numbers | |
| 243 | +| `show_minimap` | true | Show minimap | |
| 244 | +| `show_spaces` | true | Show whitespace | |
| 245 | +| `show_status_bar` | true | Show status bar | |
| 246 | +| `dark_theme` | true | Dark/light theme | |
| 247 | + |
| 248 | +### Set Commands |
| 249 | + |
| 250 | +| Command | Action | |
| 251 | +|---------|--------| |
| 252 | +| `:set nu` | Show line numbers | |
| 253 | +| `:set nonu` | Hide line numbers | |
| 254 | +| `:set wrap` | Enable word wrap | |
| 255 | +| `:set nowrap` | Disable word wrap | |
| 256 | +| `:set nu` | Show line numbers | |
| 257 | + |
| 258 | +--- |
| 259 | + |
| 260 | +## Bookmarks and Change History |
| 261 | + |
| 262 | +### Bookmarks |
| 263 | + |
| 264 | +| Key | Action | |
| 265 | +|-----|-------| |
| 266 | +| `Ctrl+Shift+F2` | Toggle bookmark on current line | |
| 267 | +| `F2` | Next bookmark | |
| 268 | +| `Shift+F2` | Previous bookmark | |
| 269 | + |
| 270 | +### Change History |
| 271 | + |
| 272 | +Changes are tracked in the gutter: |
| 273 | +- **Pink** — Modified line |
| 274 | +- **Green** — Added line |
| 275 | +- **Yellow** — Deleted portion |
| 276 | + |
| 277 | +--- |
| 278 | + |
| 279 | +## Code Folding |
| 280 | + |
| 281 | +| Key | Action | |
| 282 | +|-----|-------| |
| 283 | +| `zc` | Fold content | |
| 284 | +| `zo` | Open fold | |
| 285 | +| `zR` | Open all folds | |
| 286 | +| `zM` | Fold all | |
| 287 | +| `za` | Toggle fold | |
| 288 | + |
| 289 | +--- |
| 290 | + |
| 291 | +## External Tools |
| 292 | + |
| 293 | +### Open in Terminal |
| 294 | + |
| 295 | +You can open the current file's directory in a terminal: |
| 296 | + |
| 297 | +```bash |
| 298 | +:term |
| 299 | +``` |
| 300 | + |
| 301 | +### Run Commands |
| 302 | + |
| 303 | +Execute commands in the integrated terminal: |
| 304 | + |
| 305 | +```bash |
| 306 | +:!make |
| 307 | +``` |
| 308 | + |
| 309 | +--- |
| 310 | + |
| 311 | +## Troubleshooting |
| 312 | + |
| 313 | +### Editor Not Responding |
| 314 | + |
| 315 | +1. Press `Esc` to return to NORMAL mode |
| 316 | +2. If frozen, check terminal for errors |
| 317 | + |
| 318 | +### Files Not Saving |
| 319 | + |
| 320 | +- Check file permissions |
| 321 | +- Ensure disk space available |
| 322 | +- Verify path is correct |
| 323 | + |
| 324 | +### Slow Performance |
| 325 | + |
| 326 | +- Disable minimap (`:set nowrap`) |
| 327 | +- Reduce recent files list |
| 328 | +- Close unused tabs |
| 329 | + |
| 330 | +--- |
| 331 | + |
| 332 | +## License |
| 333 | + |
| 334 | +BSD 2-Clause License — see LICENSE file. |
0 commit comments