@@ -0,0 +1,105 @@ |
| 1 | +# Neovim Keybind Guide for Modern Usage |
| 2 | + |
| 3 | +This guide provides a concise reference for keybindings in Neovim (version 0.7 or later), focusing on quick navigation, jumping between words and lines, and handling multiple cursors or selections. Master these to enhance your productivity in this powerful text editor. |
| 4 | + |
| 5 | +## Neovim Modes Overview |
| 6 | + |
| 7 | +Neovim operates in distinct modes, each serving specific purposes. Understanding these is essential for effective editing. |
| 8 | + |
| 9 | +| Mode | Description | How to Enter | |
| 10 | +|-----------------|--------------------------------------------------|----------------------------------| |
| 11 | +| **Normal Mode** | Default mode for navigation and commands | Press `Esc` from other modes | |
| 12 | +| **Insert Mode** | For typing and inserting text | Press `i`, `a`, `o`, etc. from Normal Mode | |
| 13 | +| **Visual Mode** | For selecting text (line, block, or character) | Press `v`, `V`, or `Ctrl+v` from Normal Mode | |
| 14 | +| **Command Mode**| For entering Ex commands (e.g., saving, quitting)| Press `:` from Normal Mode | |
| 15 | + |
| 16 | +## Navigation Keybindings |
| 17 | + |
| 18 | +These keybindings are primarily for **Normal Mode** and help you move around your editor efficiently. |
| 19 | + |
| 20 | +### Basic Movement |
| 21 | +| Keybind | Action | |
| 22 | +|---------------|-----------------------------------| |
| 23 | +| `h` | Move left one character | |
| 24 | +| `j` | Move down one line | |
| 25 | +| `k` | Move up one line | |
| 26 | +| `l` | Move right one character | |
| 27 | +| `w` | Jump to start of next word | |
| 28 | +| `b` | Jump to start of previous word | |
| 29 | +| `e` | Jump to end of current/next word | |
| 30 | +| `0` | Jump to start of line | |
| 31 | +| `$` | Jump to end of line | |
| 32 | +| `gg` | Jump to first line of file | |
| 33 | +| `G` | Jump to last line of file | |
| 34 | +| `{number}G` | Jump to specific line number (e.g., `5G` for line 5) | |
| 35 | + |
| 36 | +### Scrolling and Larger Jumps |
| 37 | +| Keybind | Action | |
| 38 | +|---------------|-----------------------------------| |
| 39 | +| `Ctrl+u` | Scroll up half a screen | |
| 40 | +| `Ctrl+d` | Scroll down half a screen | |
| 41 | +| `Ctrl+b` | Scroll up a full screen (backward)| |
| 42 | +| `Ctrl+f` | Scroll down a full screen (forward)| |
| 43 | +| `%` | Jump to matching bracket/parenthesis | |
| 44 | + |
| 45 | +### Search-Based Navigation |
| 46 | +| Keybind | Action | |
| 47 | +|---------------|-----------------------------------| |
| 48 | +| `/` + `text` + `Enter` | Search forward for text; use `n` for next, `N` for previous | |
| 49 | +| `?` + `text` + `Enter` | Search backward for text; use `n` for next, `N` for previous | |
| 50 | +| `*` | Jump to next occurrence of word under cursor | |
| 51 | +| `#` | Jump to previous occurrence of word under cursor | |
| 52 | + |
| 53 | +## Editing and Multi-Cursor Techniques |
| 54 | + |
| 55 | +Neovim lacks native multi-cursor support, but Visual Mode and other features provide powerful alternatives. These are mostly **Normal Mode** commands unless noted. |
| 56 | + |
| 57 | +### Basic Editing |
| 58 | +| Keybind | Action | |
| 59 | +|---------------|-----------------------------------| |
| 60 | +| `i` | Enter Insert Mode before cursor | |
| 61 | +| `a` | Enter Insert Mode after cursor | |
| 62 | +| `o` | Open new line below, enter Insert Mode | |
| 63 | +| `O` | Open new line above, enter Insert Mode | |
| 64 | +| `x` | Delete character under cursor | |
| 65 | +| `dd` | Delete current line | |
| 66 | +| `yy` | Yank (copy) current line | |
| 67 | +| `p` | Paste after cursor | |
| 68 | +| `P` | Paste before cursor | |
| 69 | + |
| 70 | +### Visual Mode for Selections (Multi-Cursor Alternative) |
| 71 | +| Keybind | Action | |
| 72 | +|---------------|-----------------------------------| |
| 73 | +| `v` | Start character-wise Visual Mode | |
| 74 | +| `V` | Start line-wise Visual Mode | |
| 75 | +| `Ctrl+v` | Start block-wise Visual Mode (for columnar edits) | |
| 76 | +| After selection, `I` | Insert at start of each selected line/block (block mode) | |
| 77 | +| After selection, `A` | Append at end of each selected line/block (block mode) | |
| 78 | + |
| 79 | +**Note:** For block edits, select with `Ctrl+v`, move with `j`/`k`, then use `I` or `A` to edit multiple lines at once. Press `Esc` to apply changes. |
| 80 | + |
| 81 | +### Repeating Commands for Efficient Edits |
| 82 | +| Keybind | Action | |
| 83 | +|---------------|-----------------------------------| |
| 84 | +| `.` | Repeat the last command | |
| 85 | +| `{number}{command}` | Repeat command a specific number of times (e.g., `5dd` deletes 5 lines) | |
| 86 | + |
| 87 | +## Plugin for True Multi-Cursor Support |
| 88 | + |
| 89 | +For a modern multi-cursor experience (like VS Code), install the `vim-visual-multi` plugin. |
| 90 | + |
| 91 | +| Plugin | Keybind | Action | |
| 92 | +|---------------|---------------|-----------------------------------| |
| 93 | +| `vim-visual-multi` | `Ctrl+n` | Start multi-cursor or add cursor at next word occurrence | |
| 94 | +| `vim-visual-multi` | `Ctrl+p` | Add cursor at previous occurrence | |
| 95 | +| `vim-visual-multi` | `Ctrl+x` | Skip an occurrence | |
| 96 | + |
| 97 | +**Installation:** Add via plugin manager, e.g., `Plug 'mg979/vim-visual-multi'` with vim-plug. |
| 98 | + |
| 99 | +## Quick Tips for Efficiency |
| 100 | +- **Practice Normal Mode:** Use it for navigation to minimize mode-switching. |
| 101 | +- **Leverage `.` for Repetition:** Repeat edits quickly with the dot operator. |
| 102 | +- **Combine Commands:** Use motions with actions, e.g., `d2w` (delete 2 words) or `c$` (change to end of line). |
| 103 | +- **Use `:help`:** Type `:help key-notation` or `:help motion` in Neovim for detailed docs. |
| 104 | + |
| 105 | +This tabulated guide focuses on default Neovim keybindings and practical workflows. For customizations or plugin setup help, let me know! |