Dotfiles/docs/md/editors.md

232 lines
7.3 KiB
Markdown

# Editors
Three editors are configured and deployed by the `shell` component: Neovim (primary), Micro (lightweight), and Yazi (terminal file manager).
---
## Neovim
Config lives in `nvim/`. Deployed to `~/.config/nvim/` during `shell` module install.
### Plugin Manager
[vim-plug](https://github.com/junegunn/vim-plug) is auto-installed on first launch. Run `:PlugInstall` after the first start to fetch all plugins.
### Plugins
#### Language & Completion
| Plugin | Purpose |
|--------|---------|
| `neoclide/coc.nvim` | LSP client, auto-completion, diagnostics |
| `rust-lang/rust.vim` | Rust filetype support |
| `nvim-telescope/telescope.nvim` | Fuzzy finder (files, grep, LSP symbols) |
#### UI
| Plugin | Purpose |
|--------|---------|
| `vim-airline/vim-airline` | Status bar |
| `vim-airline/vim-airline-themes` | Airline theme collection |
| `junegunn/goyo.vim` | Distraction-free writing mode |
| `voldikss/vim-floaterm` | Floating terminal windows |
| `norcalli/nvim-colorizer.lua` | Inline colour preview |
#### Navigation
| Plugin | Purpose |
|--------|---------|
| `preservim/nerdtree` | File tree sidebar |
| `junegunn/fzf` + `fzf.vim` | Fuzzy file/buffer search |
| `elihunter173/dirbuf.nvim` | Editable directory buffer |
#### Snippets
| Plugin | Purpose |
|--------|---------|
| `SirVer/ultisnips` | Snippet engine |
| `honza/vim-snippets` | Snippet collection |
#### Database
| Plugin | Purpose |
|--------|---------|
| `tpope/vim-dadbod` | Database query runner |
| `kristijanhusak/vim-dadbod-ui` | GUI for vim-dadbod |
#### Markdown
| Plugin | Purpose |
|--------|---------|
| `tadmccorkle/markdown.nvim` | Enhanced Markdown support |
| `ellisonleao/glow.nvim` | Markdown preview in terminal |
#### Theme
| Plugin | Purpose |
|--------|---------|
| `the_miro/cyberqueer.nvim` | CyberQueer colour scheme (local) |
#### AI
| Plugin | Purpose |
|--------|---------|
| `coder/claudecode.nvim` | Native WebSocket bridge to the Claude Code CLI — inline diff review, buffer/selection context, model switching. Runs with `terminal.provider = "native"` (no `snacks.nvim` dependency). Replaces the older `greggh/claude-code.nvim` terminal-only wrapper. |
### CoC LSP Settings
`nvim/coc-settings.json` configures language servers for:
- Python (pyright)
- Lua (lua-language-server)
- Rust (rust-analyzer via rust.vim)
### CyberQueer Airline Theme
`nvim/cyberqueer-airline.vim` — a custom vim-airline theme using the CyberQueer palette, providing hot-pink/violet segments in the status bar.
### Keybindings
All custom bindings live in `nvim/init.lua`. Leader is `<Space>` (`vim.g.mapleader = " "`) — Space otherwise duplicates `l` (move right) in normal mode, so it was free to claim.
#### Window navigation
| Key | Mode | Action |
|-----|------|--------|
| `Ctrl+h` / `Ctrl+j` / `Ctrl+k` | Normal, Terminal | Move to the split left/below/above |
| `Ctrl+l` | Normal, Terminal | Cycle to the next split (wraps) |
Also restored inside `calendar.vim` buffers, which otherwise steal `Ctrl+hjkl` for month navigation.
#### Quick app toggles (single key, normal mode)
| Key | Action |
|-----|--------|
| `t` | Open a new floating terminal (`vim-floaterm`) |
| `e` | Toggle the NERDTree file-tree sidebar |
| `s` | Toggle the `vim-dadbod-ui` database browser |
| `q` | Save & quit; falls back to force-quit on unsaved/read-only buffers |
| `m` | Toggle a centered floating `alot` (email) terminal |
| `g` | Toggle a centered floating `khal interactive` (calendar) terminal |
| `f` | Toggle a centered floating `abook` (contacts) terminal |
| `x` | Toggle the sideward-T PIM overlay (`alot` + `abook` + `khal` panes at once) |
`m` was previously `n` — moved to free up `n` for its default Vim meaning (repeat last search).
#### Claude Code (`coder/claudecode.nvim`)
All under the `<leader>a` ("AI") prefix — a namespace that was otherwise completely unused, so nothing above was disturbed.
| Key | Mode | Action |
|-----|------|--------|
| `<leader>ac` | Normal | Toggle the Claude Code terminal |
| `<leader>af` | Normal | Focus the Claude Code terminal |
| `<leader>ar` | Normal | Resume the last Claude session (`--resume`) |
| `<leader>aC` | Normal | Continue the last Claude session (`--continue`) |
| `<leader>am` | Normal | Select the Claude model |
| `<leader>ab` | Normal | Add the current buffer to Claude's context |
| `<leader>as` | Visual | Send the selection to Claude as context |
| `<leader>ay` | Normal | Accept the proposed diff |
| `<leader>an` | Normal | Deny the proposed diff |
| `<leader>aq` | Normal | Close all pending diffs |
| `<leader>aS` | Normal | Show Claude connection status |
#### Insert mode
| Key | Action |
|-----|--------|
| `Tab` | Next completion entry (CoC popup menu if visible, else built-in keyword completion) |
| `Shift+Tab` | Previous completion entry (CoC popup menu if visible, else literal tab) |
| `Enter` | Confirm the CoC completion if the popup menu is visible |
| `Ctrl+Tab` | Expand an UltiSnips snippet trigger |
| `Ctrl+b` / `Ctrl+z` | Jump forward/backward through UltiSnips snippet placeholders |
| `Ctrl+l` | Expand a CoC snippet |
| `Ctrl+j` | Expand-and-jump a CoC snippet |
#### Other
| Key | Mode | Action |
|-----|------|--------|
| `<leader>x` | Visual/Select | Convert selection to a UltiSnips snippet (via CoC) |
| `:Vb` | Command | Enter visual-block mode (alternative to `Ctrl+v`, which some terminals intercept) |
| `:w!!` | Command | Save the current file through `sudo tee`, for read-only files |
---
## Micro
A modern, keyboard-friendly terminal editor. Config in `micro/`. Deployed to `~/.config/micro/`.
### Settings (`settings.json`)
| Setting | Value | Effect |
|---------|-------|--------|
| `colorscheme` | `miro-darcula` | Custom dark colour scheme |
| Various | — | File-type-specific settings |
### Keybindings (`bindings.json`)
Custom keybindings extending Micro's defaults. See `micro/bindings.json` for the full list.
### Colour Schemes
`micro/colorschemes/` contains additional colour scheme definitions including the custom `miro-darcula` scheme.
### Plugins (`micro/plug/`)
| Plugin | Purpose |
|--------|---------|
| `filemanager` | Sidebar file browser |
| `mlsp` | Language Server Protocol integration |
---
## Yazi
A fast, feature-rich terminal file manager written in Rust.
Config in `yazi/`. Deployed to `~/.config/yazi/`.
### Configuration Files
| File | Purpose |
|------|---------|
| `yazi.toml` | Core settings (openers, file rules, display) |
| `theme.toml` | CyberQueer colour palette |
| `keymap.toml` | Keybindings (17 KB, extensively customised) |
### Theme
`yazi/theme.toml` maps the CyberQueer colours to Yazi's theme variables. It is a colour-substitution target in `apply-theme.sh`, so it updates automatically when you change the palette.
### File Openers
| File type | Opens with |
|-----------|-----------|
| `*.svg` | Inkscape |
| Text files | Neovim |
| Everything else | `xdg-open` (system default) |
### Display Options
- Hidden files visible by default
- Symlinks shown and followed
- Three-pane layout (parent, current, preview)
---
## Launching Editors
From the Hyprland desktop:
| Shortcut | Action |
|----------|--------|
| `Super + M` | Open Micro in Kitty |
| `Super + E` | Open Yazi in Kitty |
| `Super + T` then `nvim` | Neovim in terminal |
From the shell:
```bash
nvim file.rs # Neovim
micro config.yaml # Micro
yazi # Yazi file manager
```