# Neovim Configuration

Keybinds reference for window management, file navigation, autocompletion, LSP,
linting, formatting, and AI features. Leader key is `<Space>`. Local leader is `\`.

## General & Window Management

| Keybind      | Mode   | Description                              |
| ------------ | ------ | ---------------------------------------- |
| `<leader>sn` | Normal | Save without formatting                  |
| `<leader>w`  | Normal | Toggle line wrapping                     |
| `<leader>tt` | Normal | Alternate light/dark theme (Themery)     |
| `x`          | Nor/Vis| Remove char under cursor without yank    |
| `p`          | Visual | Paste without yanking underlying text    |
| `<` / `>`    | Visual | Indent left / right                      |
| `gl`         | Normal | Jump to last change                      |
| `<C-up/down>`| Nor/Vis| Move screen up / down one line           |

## Buffer Management

| Keybind      | Mode   | Description                              |
| ------------ | ------ | ---------------------------------------- |
| `<Tab>`      | Normal | Switch to next buffer                    |
| `<S-Tab>`    | Normal | Switch to previous buffer                |
| `<leader>x`  | Normal | Close buffer                             |
| `<leader>b`  | Normal | Open new buffer                          |

## Splits & Navigation (Tmux Integrated)

| Keybind      | Mode   | Description                              |
| ------------ | ------ | ---------------------------------------- |
| `<leader>v`  | Normal | Split vertical                           |
| `<leader>h`  | Normal | Split horizontal                         |
| `<leader>xs` | Normal | Close split                              |
| `<leader>se` | Normal | Reset split sizes                        |
| `<S-up>`     | Normal | Move to split above                      |
| `<S-down>`   | Normal | Move to split below                      |
| `<S-left>`   | Normal | Move to split left                       |
| `<S-right>`  | Normal | Move to split right                      |
| `<C-\>`      | Normal | Move to last active split                |
| `<C-Space>`  | Normal | Move to next split                       |

## File Explorer & Fuzzy Finding (Fzf-Lua / Oil)

| Keybind          | Mode   | Description                          |
| ---------------- | ------ | ------------------------------------ |
| `<leader>pv`     | Normal | Open file explorer (Oil)             |
| `<leader>pf`     | Normal | Fuzzy find project files             |
| `<leader>ps`     | Normal | Live grep project text               |
| `<leader><space>`| Normal | Fuzzy find open buffers              |
| `<leader>gf`     | Normal | Fuzzy find tracked Git files         |
| `<leader>f`      | N/X/O  | Jump to label                        |

## Git Integration

| Keybind      | Mode   | Description                              |
| ------------ | ------ | ---------------------------------------- |
| `<leader>gs` | Normal | Open Git status (Fugitive)               |
| `<leader>gk` | Normal | Toggle inline Git blame                  |

## Autocompletion (blink.cmp)

| Keybind   | Mode    | Description                                |
| --------- | ------- | ------------------------------------------ |
| `Tab`     | Command | Show and accept cmdline completion         |

Completion is handled natively via Blink and Neovim 0.11+ built-in
`vim.snippet`. CodeCompanion and LSP provide the completion sources.

## LSP & Navigation

| Keybind      | Mode   | Description                              |
| ------------ | ------ | ---------------------------------------- |
| `K`          | Normal | Hover documentation                      |
| `gd`         | Normal | Go to definition (Fzf-Lua)               |
| `gD`         | Normal | Go to declaration                        |
| `gr`         | Normal | Go to references (Fzf-Lua)               |
| `gI`         | Normal | Go to implementation (Fzf-Lua)           |
| `<leader>th` | Normal | Toggle Inlay Hints                       |

## Linting, Diagnostics & Code Actions

| Keybind      | Mode   | Description                              |
| ------------ | ------ | ---------------------------------------- |
| `<leader>cf` | Normal | Apply quickfix at cursor                 |
| `<leader>l`  | Normal | Trigger linting for current file         |
| `<leader>d`  | Normal | Toggle inline diagnostics                |
| `<leader>cd` | Normal | Copy diagnostic to clipboard             |

Linting runs automatically on `BufEnter`, `BufWritePost`, and `InsertLeave`.

## Formatting

| Keybind      | Mode          | Description                       |
| ------------ | ------------- | --------------------------------- |
| `<leader>mp` | Normal/Visual | Format file or range              |

## Debugging (nvim-dap)

Supports C, C++, Rust (via gdb/rust-gdb) and Go (via delve).

| Keybind       | Mode          | Description                       |
| ------------- | ------------- | --------------------------------- |
| `<leader>gdc` | Normal        | Continue / Launch                 |
| `<leader>gdb` | Normal        | Toggle breakpoint                 |
| `<leader>gdB` | Normal        | Set conditional breakpoint        |
| `<leader>gds` | Normal        | Step over                         |
| `<leader>gdi` | Normal        | Step into                         |
| `<leader>gdo` | Normal        | Step out                          |
| `<leader>gdh` | Normal/Visual | Hover variable under cursor       |
| `<leader>gdS` | Normal        | Show scopes (all variables)       |
| `<leader>gdF` | Normal        | Show call stack frames            |
| `<leader>gdr` | Normal        | Open REPL                         |
| `<leader>gdl` | Normal        | Re-run last debug session         |
| `<leader>gdt` | Normal        | Terminate session                 |

## AI (CodeCompanion)

| Keybind      | Mode          | Description                       |
| ------------ | ------------- | --------------------------------- |
| `<leader>a`  | Normal/Visual | Toggle CodeCompanion Chat         |
| `<leader>ca` | Visual        | Add visual selection to Chat      |
| `<leader>ci` | Normal/Visual | Open inline prompt                |
| `<leader>cp` | Normal/Visual | Open Action Palette               |

Active provider is automatically selected: **Gemini** (if `GEMINI_API_KEY` is set) or **Kiro** (local model).
