feat: nvim config tracks the live tree
Port the live ~/.config/nvim working tree (bcherb2/nvim master plus its uncommitted git.lua and minimap.lua edits): adds claudecode, eslint, lsp, typescript, meow-yarn and refactoring-fix specs, drops the files the live repo deleted, and takes live for everything else. Kept from public: lazy.lua with luarocks disabled, the ai_assist cond guard (nvim-ai-assist is not anonymously clonable, so a fresh box only gets it from the private clone list), and the scrubbed endpoint comment in place of live's LAN address.
This commit is contained in:
1 parent
9baaf78522
commit
0aaaf51421
28 files changed
+1001
-611
No files matched your search
@@ -1,210 +1,192 @@
|
|||||||
# LazyVim Plugin Cheatsheet
|
# Neovim Cheatsheet
|
||||||
|
|
||||||
Quick reference for the custom plugins in your configuration.
|
What this LazyVim config adds or changes. `<leader>` is Space. Everything else is stock LazyVim:
|
||||||
|
`<leader>sk` searches all keymaps, `<leader>?` shows the current buffer's keymaps.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Git Tools (`lua/plugins/git.lua`)
|
## Markdown (md-render.nvim, `lua/plugins/image.lua`)
|
||||||
|
|
||||||
### git-blame.nvim
|
Opening a `.md` file shows the **rendered view** (a separate read-only buffer, images and
|
||||||
Shows git blame information at the end of each line.
|
mermaid/PlantUML diagrams drawn inline). The source buffer is what you edit.
|
||||||
|
|
||||||
**Commands:**
|
| Key / command | What it does |
|
||||||
- `:GitBlameToggle` - Toggle git blame on/off
|
|---|---|
|
||||||
- `:GitBlameEnable` - Enable git blame
|
| `i` `I` `a` `A` `o` `O` | Jump to the source line and start inserting; leaving Insert re-renders. Fast typing keeps its order; a count works (`3o`) |
|
||||||
- `:GitBlameDisable` - Disable git blame
|
| `dd` `x` `p` `u` `<C-r>` `.` `J` `>` `gUU` `gq` … | Editing keys jump to the matching source line and run there |
|
||||||
- `:GitBlameOpenCommitURL` - Open commit in browser
|
| (wait ~200 ms) | After a normal-mode edit, the view returns to rendered once Neovim is idle |
|
||||||
- `:GitBlameCopySHA` - Copy commit SHA to clipboard
|
| `yy`, Visual `y` / `Y` | Copy the **markdown source** behind the rows (linewise); the view stays rendered. A charwise selection inside one row is a normal yank |
|
||||||
|
| `v` / `V` | Jump to source and start Visual there. For a selection *in* the rendered view use a mouse drag, `<C-v>` or `gv` |
|
||||||
|
| `<leader>mr` | Render ⇄ source in place (mapped in the markdown source buffer) |
|
||||||
|
| `<leader>mp` / `<leader>mt` / `<leader>ms` | Preview in a wide float / a tab / a source+render split (source buffer) |
|
||||||
|
| `<leader>md` | md-render demo |
|
||||||
|
| `:MdRender toggle\|split\|tab\|float\|auto on\|off` | Same from the command line (works in the rendered view too) |
|
||||||
|
|
||||||
**Default:** Enabled on startup
|
- **Diagram guard:** a destructive key (`dd`, `x`, `J`, `gUU`, …) on a rendered diagram does *not*
|
||||||
|
edit. It jumps to the diagram's opening fence and says so; edit the block there.
|
||||||
|
- A changed diagram re-renders in the background; you briefly see "Rendering mermaid diagram...".
|
||||||
|
- **Limits:** `dd` on a reflowed paragraph deletes only its first source line; `i`/`a` on a
|
||||||
|
diagram row insert at the closing fence.
|
||||||
|
- **Turn off return-to-render:** `vim.g.md_render_hop_return = false` (e.g. in `options.lua`).
|
||||||
|
- **render-markdown.nvim** only decorates floats (LSP hover, completion docs). Source buffers stay
|
||||||
|
plain; `:RenderMarkdown buf_toggle` turns it on for one buffer.
|
||||||
|
- No linters for markdown / mdx (`markdown.lua`); marksman diagnostics are muted.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### diffview.nvim
|
## Clipboard and selections
|
||||||
Advanced git diff and history viewer.
|
|
||||||
|
|
||||||
**Key Bindings:**
|
`clipboard=unnamedplus` everywhere, so `y`/`p` use the system clipboard.
|
||||||
- `<leader>gd` - Open diff view of current changes
|
|
||||||
- `<leader>gh` - View current file's git history
|
|
||||||
- `<leader>gH` - View entire repo's git history
|
|
||||||
|
|
||||||
**Commands:**
|
| Where nvim runs | Copy (`y`) | Paste (`p`) |
|
||||||
- `:DiffviewOpen` - Open diff view
|
|---|---|---|
|
||||||
- `:DiffviewClose` - Close diff view
|
| **Inside tmux** | tmux buffer (`load-buffer -w`: also the outer terminal if tmux's `set-clipboard` allows) | tmux buffer; first asks the outer terminal (`refresh-client -l`), which may prompt (Ghostty) or not answer (Warp) |
|
||||||
- `:DiffviewFileHistory` - View repo history
|
| **SSH / herdr** (no tmux) | One OSC 52 copy to your Mac's clipboard | The last yank from **any nvim on this host** (`~/.local/state/nvim/clipboard/last`, mode 0600, survives reboots). Never reads the Mac clipboard |
|
||||||
- `:DiffviewFileHistory %` - View current file history
|
| **Local macOS** | `pbcopy` | `pbpaste` |
|
||||||
- `:DiffviewRefresh` - Refresh the diff view
|
|
||||||
|
|
||||||
**In Diffview:**
|
- **Mac → nvim over SSH:** paste with the terminal, **Cmd-V** (works in every mode). There is no
|
||||||
- `]c` / `[c` - Jump to next/previous change
|
runtime hint for this.
|
||||||
- `<tab>` / `<S-tab>` - Select next/previous file
|
- Over 512 KiB a yank warns that the terminal may drop the OSC 52 payload; over 8 MiB it is not
|
||||||
- `gf` - Open file in new tab
|
shared with other instances.
|
||||||
- `q` - Close diffview
|
|
||||||
|
| Selection | How you get it | Keys |
|
||||||
|
|---|---|---|
|
||||||
|
| **Select mode** | Shift+arrows | Typing replaces the selection at once (Space too). `<C-c>` copy, `<C-x>` cut, `<C-g>` switch to Visual |
|
||||||
|
| **Visual mode** | Mouse drag, `v`, `V`, `<C-v>` | `y` `d` `p` as usual; `<C-c>` also copies (`<C-x>` stays decrement) |
|
||||||
|
|
||||||
|
- `<leader>p` yank history (yanky). Over SSH the yank ring doesn't sync with the clipboard.
|
||||||
|
Yanks from the md-render view don't enter the ring.
|
||||||
|
- `<leader>cy` / `<leader>cY` copy the file's relative / absolute path.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## UI Enhancements (`lua/plugins/ui-enhancements.lua`)
|
## Search and replace (`lua/plugins/search.lua`)
|
||||||
|
|
||||||
### render-markdown.nvim
|
| Key | What it does |
|
||||||
Renders markdown with better formatting while editing.
|
|---|---|
|
||||||
|
| `n` / `N` | Next / previous match, **always forward / backward** (even after `?`), opens folds, shows the hlslens `[i/n]` lens |
|
||||||
|
| `*` `#` `g*` `g#` | Word search with the lens |
|
||||||
|
| `<leader>Rs` (Visual) / `<leader>Ro` / `<leader>Rw` / `<leader>RW` / `<leader>Re` / `<leader>Rf` | search-replace.nvim, current buffer: selection / prompt / word / WORD / expression / filename |
|
||||||
|
| `<leader>Rbs` (Visual) / `<leader>Rbo` / `<leader>Rbw` / `<leader>RbW` / `<leader>Rbe` / `<leader>Rbf` | Same across all buffers |
|
||||||
|
| `<leader>sr` | LazyVim's grug-far search and replace (project-wide) |
|
||||||
|
| `<leader>rs` | Refactoring menu (LazyVim refactoring extra; `<leader>rf` extract function, `<leader>rx` extract variable, `<leader>ri` inline variable) |
|
||||||
|
|
||||||
**Features:**
|
- refactoring.nvim is pinned to `8bcf893` while Neovim is older than 0.12.5
|
||||||
- Automatically styles headers, lists, code blocks
|
(`lua/plugins/refactoring-fix.lua`). Newer commits call `vim.range`/`vim.pos` with the 0.12.5
|
||||||
- Works only in markdown files
|
signature and every refactor fails with `E5108 … vim/range.lua:98` on 0.12.1. After upgrading
|
||||||
- No commands needed - always active in `.md` files
|
Neovim, delete that file and run `:Lazy update refactoring.nvim`.
|
||||||
|
|
||||||
**Toggle:** Disable by setting `enabled = false` in config
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### hlargs.nvim
|
## Completion and AI
|
||||||
Highlights function arguments with different colors.
|
|
||||||
|
|
||||||
**Features:**
|
| Item | State |
|
||||||
- Automatically highlights function parameters
|
|---|---|
|
||||||
- Helps distinguish arguments visually
|
| blink.cmp | On; sources LSP, path, snippets (no buffer words). Markdown: LSP + path only. friendly-snippets' global snippets (dates, lorem) off |
|
||||||
- Works across all supported languages
|
| `<leader>uk` | Toggle all insert-mode completion on/off (global) |
|
||||||
|
| Inline ghost text | **Off** (`vim.g.ai_cmp = false` in `options.lua`). Command-line ghost text is still on (not AI) |
|
||||||
**No commands needed** - always active
|
| nvim_ai_assist (`:AI`) | **Disabled** (see below) |
|
||||||
|
| Claude Code (LazyVim extra) | `<leader>ac` toggle, `<leader>af` focus, `<leader>ar` resume, `<leader>aC` continue, `<leader>ab` add buffer, `<leader>as` send selection (Visual) / add file (neo-tree), `<leader>aa` / `<leader>ad` accept / deny diff |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### twilight.nvim
|
## Git
|
||||||
Dims inactive code to focus on current block.
|
|
||||||
|
|
||||||
**Key Bindings:**
|
| Key / command | What it does |
|
||||||
- `<leader>ut` - Toggle Twilight mode
|
|---|---|
|
||||||
|
| git-blame.nvim | Blame as virtual text at column 80; `:GitBlameToggle`, `:GitBlameCopySHA`, `:GitBlameOpenCommitURL` |
|
||||||
|
| `<leader>gd` / `<leader>gh` / `<leader>gH` | Diffview: changes / file history / repo history |
|
||||||
|
| `<leader>dv` / `<leader>ds` / `<leader>dh` / `<leader>dH` | Diffview: open / staged / file history / all history |
|
||||||
|
| `<leader>go` / `<leader>uG` | mini.diff overlay / signs |
|
||||||
|
| `<leader>gb` / `<leader>gg` | Blame line / lazygit (LazyVim) |
|
||||||
|
|
||||||
**Commands:**
|
In Diffview: `]c` `[c` hunks, `<Tab>` `<S-Tab>` files, `q` close (`:DiffviewClose`).
|
||||||
- `:Twilight` - Toggle twilight
|
|
||||||
- `:TwilightEnable` - Enable twilight
|
|
||||||
- `:TwilightDisable` - Disable twilight
|
|
||||||
|
|
||||||
**Best for:** Focusing on specific functions or code blocks
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### theme-hub.nvim
|
## UI
|
||||||
Browse and switch colorschemes with live preview.
|
|
||||||
|
|
||||||
**Key Bindings:**
|
| Key | What it does |
|
||||||
- `<leader>uT` - Open Theme Hub
|
|---|---|
|
||||||
|
| `<leader>um` / `<leader>uM` | Minimap (neominimap, on at start; shows diagnostics, mini.diff changes, search) toggle / focus |
|
||||||
|
| `<leader>uf` | LazyVim's auto-format toggle (global) |
|
||||||
|
| `<leader>ut` | Twilight (dim inactive code). Hides LazyVim's treesitter-context toggle: use `:TSContext toggle` |
|
||||||
|
| `<leader>uT` | Themery theme picker (`:Themery`). Hides LazyVim's treesitter-highlight toggle: use `:lua Snacks.toggle.treesitter():toggle()`. `<leader>uC` is LazyVim's colorscheme picker |
|
||||||
|
| `<leader>ug` | Indent guides (snacks.indent) |
|
||||||
|
|
||||||
**Commands:**
|
Always on: hlargs (argument colours), smear-cursor, treesitter-context.
|
||||||
- `:ThemeHub` - Open theme browser
|
|
||||||
|
|
||||||
**In Theme Hub:**
|
|
||||||
- `j` / `k` - Navigate themes
|
|
||||||
- `<CR>` - Apply selected theme
|
|
||||||
- `<Esc>` / `q` - Close without applying
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Search Tools (`lua/plugins/search.lua`)
|
## Files and navigation
|
||||||
|
|
||||||
### nvim-hlslens
|
| Key | What it does |
|
||||||
Enhanced search highlighting with match counts.
|
|---|---|
|
||||||
|
| `<leader>e` / `<leader>E` | neo-tree (root / cwd); shows dotfiles, gitignored files and `*.log` |
|
||||||
|
| `<leader>ff` / `<leader><space>` | Find files (Telescope; includes hidden and gitignored files) |
|
||||||
|
| `<leader>/` / `<leader>sg` | Grep (includes gitignored files) |
|
||||||
|
| `<leader>fg` / `<leader>fb` / `<leader>fr` | Git files / buffers / recent |
|
||||||
|
| `<leader>sh` / `<leader>sk` | Help / keymaps |
|
||||||
|
| `<leader>H` / `<leader>h` / `<leader>1`–`<leader>9` | Harpoon: add file / menu / jump |
|
||||||
|
| `<leader>cs` / `<leader>ss` | Aerial outline / symbol search |
|
||||||
|
| `<leader>fp` | Projects |
|
||||||
|
| `<leader>cv` | CSV/TSV aligned view (in `.csv` / `.tsv` buffers) |
|
||||||
|
| `<leader>t…` | Tests (neotest, incl. vitest) |
|
||||||
|
| `<leader>sz` | chezmoi files |
|
||||||
|
|
||||||
**Key Bindings:**
|
TypeScript uses the `tsc` LSP from the lang.typescript.tsc extra (project-local TypeScript 7 when present).
|
||||||
- `n` - Next search result (enhanced)
|
|
||||||
- `N` - Previous search result (enhanced)
|
|
||||||
- `*` - Search word under cursor (enhanced)
|
|
||||||
- `#` - Search word backward (enhanced)
|
|
||||||
- `g*` / `g#` - Search without word boundaries
|
|
||||||
|
|
||||||
**Features:**
|
|
||||||
- Shows match count (e.g., "3/15")
|
|
||||||
- Floating window near cursor
|
|
||||||
- Automatically clears after cursor movement
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### search-replace.nvim
|
## Disabled on purpose (and how to undo)
|
||||||
Advanced multi-buffer search and replace.
|
|
||||||
|
|
||||||
**Single Buffer Operations:**
|
| Plugin / feature | Why | Re-enable |
|
||||||
- `<leader>rs` - Search/replace in visual selection
|
|---|---|---|
|
||||||
- `<leader>ro` - Search/replace (open prompt)
|
| nvim-tree | neo-tree is the explorer; both fought over `<leader>e` | Delete `enabled = false` in `lua/plugins/nvim-tree.lua` |
|
||||||
- `<leader>rw` - Search/replace word under cursor
|
| indent-blankline | snacks.indent already draws guides | Delete `enabled = false` in `lua/plugins/indent.lua` |
|
||||||
- `<leader>rW` - Search/replace WORD under cursor
|
| nvim_ai_assist (`:AI`) | AI off | Delete `enabled = false` in `lua/plugins/ai_assist.lua` |
|
||||||
- `<leader>re` - Search/replace expression
|
| noice.nvim | Caused treesitter errors | Delete `lua/plugins/noice-fix.lua` |
|
||||||
- `<leader>rf` - Search/replace filename
|
| Inline AI ghost text | AI off | `vim.g.ai_cmp = true` in `lua/config/options.lua` |
|
||||||
|
| md-render return-to-render | — (on) | `vim.g.md_render_hop_return = false` turns it off |
|
||||||
**Multi-Buffer Operations:**
|
| render-markdown in source buffers | md-render owns the rendered view | Remove the `overrides` line in `ui-enhancements.lua`, or `:RenderMarkdown buf_toggle` |
|
||||||
- `<leader>rbs` - Search/replace selections (all buffers)
|
| refactoring.nvim updates | Pinned to `8bcf893`: newer commits need Neovim 0.12.5 | Upgrade Neovim, delete `lua/plugins/refactoring-fix.lua`, `:Lazy update refactoring.nvim` |
|
||||||
- `<leader>rbo` - Search/replace open (all buffers)
|
|
||||||
- `<leader>rbw` - Search/replace word (all buffers)
|
|
||||||
- `<leader>rbW` - Search/replace WORD (all buffers)
|
|
||||||
- `<leader>rbe` - Search/replace expression (all buffers)
|
|
||||||
- `<leader>rbf` - Search/replace filename (all buffers)
|
|
||||||
|
|
||||||
**Commands:**
|
|
||||||
- `:SearchReplaceSingleBuffer` - Single buffer mode
|
|
||||||
- `:SearchReplaceMultiBuffer` - Multi-buffer mode
|
|
||||||
- `:SearchReplaceWithinVisualSelection` - Within selection
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## File Type Tools (`lua/plugins/filetypes.lua`)
|
## Files
|
||||||
|
|
||||||
### csvview.nvim
|
|
||||||
Formats and aligns CSV/TSV files for better readability.
|
|
||||||
|
|
||||||
**Key Bindings:**
|
|
||||||
- `<leader>cv` - Toggle CSV view (only in CSV/TSV files)
|
|
||||||
|
|
||||||
**Commands:**
|
|
||||||
- `:CsvViewEnable` - Enable CSV formatting
|
|
||||||
- `:CsvViewDisable` - Disable CSV formatting
|
|
||||||
- `:CsvViewToggle` - Toggle CSV view
|
|
||||||
|
|
||||||
**File Types:** Automatically works with `.csv` and `.tsv` files
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Built-in LazyVim Extras
|
|
||||||
|
|
||||||
These are enabled via `lazyvim.json` and have their own keybindings:
|
|
||||||
|
|
||||||
### Telescope
|
|
||||||
- `<leader>ff` - Find files
|
|
||||||
- `<leader>fg` - Live grep
|
|
||||||
- `<leader>fb` - Browse buffers
|
|
||||||
- `<leader>fh` - Help tags
|
|
||||||
|
|
||||||
### Neo-tree
|
|
||||||
- `<leader>e` - Toggle file explorer
|
|
||||||
- `<leader>E` - Toggle file explorer (current file)
|
|
||||||
|
|
||||||
### Harpoon2
|
|
||||||
- `<leader>h` - Harpoon menu
|
|
||||||
- `<leader>a` - Add file to harpoon
|
|
||||||
|
|
||||||
### Aerial (Code Outline)
|
|
||||||
- `<leader>cs` - Open symbols outline
|
|
||||||
|
|
||||||
### Project Management
|
|
||||||
- `<leader>fp` - Find project
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Tips
|
|
||||||
|
|
||||||
1. **Enable/Disable Plugins:** Edit the respective file in `lua/plugins/` and set `enabled = false`
|
|
||||||
2. **View All Keymaps:** Press `<leader>sk` (search keymaps) in Telescope
|
|
||||||
3. **Check Plugin Status:** Run `:Lazy` to see installed plugins
|
|
||||||
4. **Update Plugins:** Run `:Lazy update`
|
|
||||||
5. **View Help:** Most plugins have `:help <plugin-name>` documentation
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Plugin Files Location
|
|
||||||
|
|
||||||
```
|
```
|
||||||
~/.config/nvim/lua/plugins/
|
~/.config/nvim/
|
||||||
├── git.lua # Git blame & diffview
|
├── init.lua # loads config.lazy
|
||||||
├── ui-enhancements.lua # Render-markdown, hlargs, twilight, theme-hub
|
├── lazyvim.json # enabled LazyVim extras
|
||||||
├── search.lua # Hlslens, search-replace
|
├── lazy-lock.json # plugin versions
|
||||||
├── filetypes.lua # CSV viewer
|
└── lua/
|
||||||
└── markdown.lua # Markdown-specific config
|
├── config/
|
||||||
|
│ ├── options.lua # ai_cmp off, clipboard providers, Select/Visual setup
|
||||||
|
│ ├── keymaps.lua # <leader>cy/cY, <C-c>/<C-x> copy/cut
|
||||||
|
│ ├── autocmds.lua # (empty)
|
||||||
|
│ └── lazy.lua # lazy.nvim bootstrap
|
||||||
|
└── plugins/
|
||||||
|
├── image.lua # md-render: auto render, hop keys, yank, mermaid, image transport
|
||||||
|
├── ui-enhancements.lua # render-markdown (floats only), hlargs, twilight, themery
|
||||||
|
├── themes.lua # colorscheme plugins for themery
|
||||||
|
├── search.lua # hlslens n/N, search-replace (<leader>R)
|
||||||
|
├── git.lua # git-blame, diffview (options + <leader>g keys)
|
||||||
|
├── diffview.lua # diffview <leader>d keys
|
||||||
|
├── minimap.lua # neominimap (<leader>um / <leader>uM)
|
||||||
|
├── blink.lua # completion sources, <leader>uk
|
||||||
|
├── claudecode.lua # Claude Code selection maps in Visual only
|
||||||
|
├── ai_assist.lua # nvim_ai_assist (disabled)
|
||||||
|
├── yanky.lua # no ring/clipboard sync over SSH
|
||||||
|
├── telescope.lua # show hidden + ignored files
|
||||||
|
├── neo-tree-extras.lua # show dotfiles / gitignored / *.log
|
||||||
|
├── filetypes.lua # csvview
|
||||||
|
├── markdown.lua # no markdown linting / marksman diagnostics
|
||||||
|
├── lsp.lua # gD only where the server supports it
|
||||||
|
├── refactoring-fix.lua # pin refactoring.nvim on Neovim < 0.12.5
|
||||||
|
├── typescript.lua # neotest-vitest
|
||||||
|
├── smear_cursor.lua # smear-cursor options
|
||||||
|
├── indent.lua # indent-blankline (disabled)
|
||||||
|
├── nvim-tree.lua # nvim-tree (disabled)
|
||||||
|
└── noice-fix.lua # noice (disabled)
|
||||||
```
|
```
|
||||||
@@ -4,8 +4,6 @@
|
|||||||
"lazyvim.plugins.extras.coding.yanky",
|
"lazyvim.plugins.extras.coding.yanky",
|
||||||
"lazyvim.plugins.extras.editor.aerial",
|
"lazyvim.plugins.extras.editor.aerial",
|
||||||
"lazyvim.plugins.extras.editor.harpoon2",
|
"lazyvim.plugins.extras.editor.harpoon2",
|
||||||
"lazyvim.plugins.extras.editor.illuminate",
|
|
||||||
"lazyvim.plugins.extras.editor.mini-diff",
|
|
||||||
"lazyvim.plugins.extras.editor.neo-tree",
|
"lazyvim.plugins.extras.editor.neo-tree",
|
||||||
"lazyvim.plugins.extras.editor.refactoring",
|
"lazyvim.plugins.extras.editor.refactoring",
|
||||||
"lazyvim.plugins.extras.editor.telescope",
|
"lazyvim.plugins.extras.editor.telescope",
|
||||||
@@ -13,7 +11,9 @@
|
|||||||
"lazyvim.plugins.extras.lang.go",
|
"lazyvim.plugins.extras.lang.go",
|
||||||
"lazyvim.plugins.extras.lang.json",
|
"lazyvim.plugins.extras.lang.json",
|
||||||
"lazyvim.plugins.extras.lang.python",
|
"lazyvim.plugins.extras.lang.python",
|
||||||
|
"lazyvim.plugins.extras.lang.typescript.tsc",
|
||||||
"lazyvim.plugins.extras.lang.yaml",
|
"lazyvim.plugins.extras.lang.yaml",
|
||||||
|
"lazyvim.plugins.extras.test.core",
|
||||||
"lazyvim.plugins.extras.ui.smear-cursor",
|
"lazyvim.plugins.extras.ui.smear-cursor",
|
||||||
"lazyvim.plugins.extras.ui.treesitter-context",
|
"lazyvim.plugins.extras.ui.treesitter-context",
|
||||||
"lazyvim.plugins.extras.util.chezmoi",
|
"lazyvim.plugins.extras.util.chezmoi",
|
||||||
@@ -25,4 +25,4 @@
|
|||||||
"NEWS.md": "11866"
|
"NEWS.md": "11866"
|
||||||
},
|
},
|
||||||
"version": 8
|
"version": 8
|
||||||
}
|
}
|
||||||
@@ -13,3 +13,27 @@ vim.keymap.set("n", "<leader>cY", function()
|
|||||||
vim.fn.setreg("+", vim.fn.expand("%:p"))
|
vim.fn.setreg("+", vim.fn.expand("%:p"))
|
||||||
print("Copied absolute path: " .. vim.fn.expand("%:p"))
|
print("Copied absolute path: " .. vim.fn.expand("%:p"))
|
||||||
end, { desc = "Copy absolute path" })
|
end, { desc = "Copy absolute path" })
|
||||||
|
|
||||||
|
-- Select mode (Shift+arrows) replaces the selection with what you type, so `y`
|
||||||
|
-- types a "y". Conventional copy/cut instead (<C-g> switches to Visual first).
|
||||||
|
-- The `y`/`d` is fed remappable so buffer maps still apply (md-render's render
|
||||||
|
-- view copies markdown source); `"+` is fed noremap so which-key's `"` trigger
|
||||||
|
-- stays out. Both go to the front of typeahead, in this order.
|
||||||
|
local function clipboard_op(prefix, op)
|
||||||
|
return function()
|
||||||
|
vim.api.nvim_feedkeys(op, "mi", false)
|
||||||
|
vim.api.nvim_feedkeys(vim.keycode(prefix) .. '"+', "ni", false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vim.keymap.set("s", "<C-c>", clipboard_op("<C-g>", "y"), { desc = "Copy selection to clipboard" })
|
||||||
|
vim.keymap.set("s", "<C-x>", clipboard_op("<C-g>", "d"), { desc = "Cut selection to clipboard" })
|
||||||
|
vim.keymap.set("x", "<C-c>", clipboard_op("", "y"), { desc = "Copy selection to clipboard" })
|
||||||
|
|
||||||
|
-- VS Code's terminal toggle (Ctrl+`, the ~ key), mirroring LazyVim's <C-/>.
|
||||||
|
-- Only reaches nvim when the terminal sends CSI u / kitty keys; the legacy
|
||||||
|
-- encoding of Ctrl+` is NUL, which is <C-Space> (flash) and is left alone.
|
||||||
|
local function toggle_terminal()
|
||||||
|
Snacks.terminal.focus(nil, { cwd = LazyVim.root() })
|
||||||
|
end
|
||||||
|
vim.keymap.set({ "n", "t" }, "<C-`>", toggle_terminal, { desc = "Terminal (Root Dir)" })
|
||||||
|
vim.keymap.set({ "n", "t" }, "<C-~>", toggle_terminal, { desc = "which_key_ignore" })
|
||||||
@@ -2,10 +2,16 @@
|
|||||||
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
|
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
|
||||||
-- Add any additional options here
|
-- Add any additional options here
|
||||||
|
|
||||||
|
-- No AI/inline completion: LazyVim's blink extra sets
|
||||||
|
-- completion.ghost_text.enabled = vim.g.ai_cmp (grey inline preview of the top
|
||||||
|
-- item). Must be set here, before LazyVim imports its extras.
|
||||||
|
vim.g.ai_cmp = false
|
||||||
|
|
||||||
-- Clipboard provider. LazyVim disables `clipboard=unnamedplus` under SSH, so
|
-- Clipboard provider. LazyVim disables `clipboard=unnamedplus` under SSH, so
|
||||||
-- select the right provider and explicitly re-enable clipboard-linked yanks:
|
-- select the right provider and explicitly re-enable clipboard-linked yanks:
|
||||||
-- * tmux -> tmux's own clipboard buffer (readable)
|
-- * tmux -> tmux buffer (p first asks the outer terminal via
|
||||||
-- * SSH/remote -> OSC 52 copy-only (see note below)
|
-- `refresh-client -l`; only works if it allows OSC 52 reads)
|
||||||
|
-- * SSH/remote -> OSC 52 copy + host-local paste cache (see below)
|
||||||
-- * local macOS -> native pbcopy/pbpaste.
|
-- * local macOS -> native pbcopy/pbpaste.
|
||||||
-- Do NOT use OSC 52 locally: yanky's `sync_with_ring` reads the system
|
-- Do NOT use OSC 52 locally: yanky's `sync_with_ring` reads the system
|
||||||
-- clipboard, and OSC 52 reads depend on the terminal answering a query, which
|
-- clipboard, and OSC 52 reads depend on the terminal answering a query, which
|
||||||
@@ -17,34 +23,97 @@ elseif vim.env.SSH_CONNECTION then
|
|||||||
-- Remote session (bare SSH, or a multiplexer like herdr that exports no env
|
-- Remote session (bare SSH, or a multiplexer like herdr that exports no env
|
||||||
-- var of its own). Copy via OSC 52 so yanks reach the OUTER terminal's
|
-- var of its own). Copy via OSC 52 so yanks reach the OUTER terminal's
|
||||||
-- clipboard, but NEVER read the clipboard back: OSC 52 reads require the
|
-- clipboard, but NEVER read the clipboard back: OSC 52 reads require the
|
||||||
-- terminal to answer a query, which Warp/herdr don't, so a read returns stale
|
-- terminal to answer a query, which Warp/herdr/Ghostty don't, and the runtime
|
||||||
-- data (or hangs) and blows up yanky's ring sync. Trade-off: pasting FROM the
|
-- reader then blocks for up to 10 s. Pasting FROM the Mac INTO nvim is the
|
||||||
-- local host INTO nvim over SSH won't work here -- use the terminal's own
|
-- terminal's own paste (Cmd-V, bracketed paste; works in every mode).
|
||||||
-- paste in insert mode.
|
--
|
||||||
|
-- `p` returns the last copy made by ANY nvim on this host: copy() also writes
|
||||||
|
-- {regtype, lines...} to stdpath("state")/clipboard/last (dir 0700, file 0600,
|
||||||
|
-- atomic rename; writefile/readfile "b" keep NUL bytes and trailing empty
|
||||||
|
-- lines), so a yank in one herdr pane pastes in another. Falls back to this
|
||||||
|
-- instance's last copy. Over 8 MiB the shared file is removed, not left stale.
|
||||||
|
-- No "nothing to paste" hint: yanky reads "+ when it loads, so paste() can't
|
||||||
|
-- tell a user's `p` from a plugin's read.
|
||||||
--
|
--
|
||||||
-- The paste function below must NOT call vim.fn.getreg('"')/'*'/'+' itself:
|
-- The paste function below must NOT call vim.fn.getreg('"')/'*'/'+' itself:
|
||||||
-- Neovim's clipboard provider (autoload/provider/clipboard.vim) guards
|
-- Neovim's clipboard provider (autoload/provider/clipboard.vim) guards
|
||||||
-- against re-entrant provider calls (`s:here`, see nvim#7184), so a getreg()
|
-- against re-entrant provider calls (`s:here`, see nvim#7184), so a getreg()
|
||||||
-- of a clipboard-linked register issued from *inside* a registered paste()
|
-- of a clipboard-linked register issued from *inside* a registered paste()
|
||||||
-- callback is swallowed and silently returns empty -- not the register's
|
-- callback is swallowed and silently returns empty -- not the register's
|
||||||
-- real content. Cache what copy() was last given instead, and have paste()
|
-- real content. It reads the shared file or what copy() was last given.
|
||||||
-- return that cached value directly.
|
-- Neither function may throw: an error would land in the middle of a yank.
|
||||||
local osc52 = require("vim.ui.clipboard.osc52")
|
local osc52_send = require("vim.ui.clipboard.osc52").copy("+")
|
||||||
local last = { lines = {}, regtype = "" }
|
local share_dir = vim.fn.stdpath("state") .. "/clipboard"
|
||||||
local function make_copy(reg)
|
local share_file = share_dir .. "/last"
|
||||||
local osc52_copy = osc52.copy(reg)
|
local SHARE_MAX, OSC52_WARN = 8 * 1024 * 1024, 512 * 1024
|
||||||
return function(lines, regtype)
|
local last, dir_mode_set = { lines = {}, regtype = "v" }, false
|
||||||
last.lines, last.regtype = lines, regtype
|
local stale -- identity of a shared file we failed to replace or remove
|
||||||
osc52_copy(lines, regtype)
|
local function file_id()
|
||||||
|
local st = vim.uv.fs_stat(share_file)
|
||||||
|
return st and ("%d:%d.%d:%d"):format(st.ino, st.mtime.sec, st.mtime.nsec, st.size)
|
||||||
|
end
|
||||||
|
local function share(lines, regtype, size)
|
||||||
|
local tmp = ("%s.%d.tmp"):format(share_file, vim.uv.os_getpid())
|
||||||
|
local ok = pcall(function()
|
||||||
|
if size > SHARE_MAX then error("too large to share") end
|
||||||
|
if vim.fn.isdirectory(share_dir) == 0 then
|
||||||
|
vim.fn.mkdir(share_dir, "p", tonumber("700", 8))
|
||||||
|
dir_mode_set = false
|
||||||
|
end
|
||||||
|
if not dir_mode_set then -- once per process, also for a pre-existing dir
|
||||||
|
dir_mode_set = true
|
||||||
|
vim.uv.fs_chmod(share_dir, tonumber("700", 8))
|
||||||
|
end
|
||||||
|
local data = { regtype }
|
||||||
|
vim.list_extend(data, lines)
|
||||||
|
if vim.fn.writefile(data, tmp, "bS") ~= 0 then error("write failed") end
|
||||||
|
assert(vim.uv.fs_chmod(tmp, tonumber("600", 8)))
|
||||||
|
assert(vim.uv.fs_rename(tmp, share_file))
|
||||||
|
end)
|
||||||
|
stale = nil
|
||||||
|
if not ok then -- never serve a stale shared copy
|
||||||
|
pcall(os.remove, tmp)
|
||||||
|
pcall(os.remove, share_file)
|
||||||
|
stale = file_id() -- still there (read-only dir): ignore it until replaced
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local function paste_from_cache()
|
local function remember(lines, regtype)
|
||||||
|
last.lines, last.regtype = lines, regtype
|
||||||
|
local size = 0
|
||||||
|
for _, l in ipairs(lines) do size = size + #l + 1 end
|
||||||
|
share(lines, regtype, size)
|
||||||
|
return size
|
||||||
|
end
|
||||||
|
local function copy_plus(lines, regtype)
|
||||||
|
local size = remember(lines, regtype)
|
||||||
|
pcall(osc52_send, lines, regtype)
|
||||||
|
if size > OSC52_WARN then
|
||||||
|
vim.schedule(function()
|
||||||
|
vim.notify(("Copied %d KiB via OSC 52; the terminal may drop payloads this large (nvim `p` on this host still has it)."):format(math.floor(size / 1024)), vim.log.levels.WARN)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- OSC 52 'p' (primary selection) means nothing on the Mac, so "* only updates
|
||||||
|
-- the paste cache. A yank that fans out to "+ AND "* (provider:
|
||||||
|
-- s:copy['*'] != s:copy['+'], i.e. 'clipboard' has unnamed) still sends
|
||||||
|
-- exactly one OSC 52 sequence.
|
||||||
|
local function copy_star(lines, regtype)
|
||||||
|
remember(lines, regtype)
|
||||||
|
end
|
||||||
|
local function paste()
|
||||||
|
if vim.fn.filereadable(share_file) == 1 and (not stale or file_id() ~= stale) then
|
||||||
|
local ok, data = pcall(vim.fn.readfile, share_file, "b")
|
||||||
|
if ok and type(data) == "table" and #data > 0 and data[1]:match("^[vVb]$") then
|
||||||
|
local regtype = table.remove(data, 1)
|
||||||
|
return { data, regtype }
|
||||||
|
end
|
||||||
|
end
|
||||||
return { last.lines, last.regtype }
|
return { last.lines, last.regtype }
|
||||||
end
|
end
|
||||||
vim.g.clipboard = {
|
vim.g.clipboard = {
|
||||||
name = "osc52-copyonly",
|
name = "osc52-copyonly",
|
||||||
copy = { ["+"] = make_copy("+"), ["*"] = make_copy("*") },
|
copy = { ["+"] = copy_plus, ["*"] = copy_star },
|
||||||
paste = { ["+"] = paste_from_cache, ["*"] = paste_from_cache },
|
paste = { ["+"] = paste, ["*"] = paste },
|
||||||
cache_enabled = 0,
|
cache_enabled = 0,
|
||||||
}
|
}
|
||||||
elseif vim.fn.has("mac") == 1 then
|
elseif vim.fn.has("mac") == 1 then
|
||||||
@@ -76,7 +145,10 @@ vim.opt.scrolloff = 8 -- Keep 8 lines visible above/below cursor
|
|||||||
vim.opt.sidescrolloff = 8 -- Keep 8 columns visible left/right
|
vim.opt.sidescrolloff = 8 -- Keep 8 columns visible left/right
|
||||||
vim.opt.smoothscroll = true -- Smooth scrolling
|
vim.opt.smoothscroll = true -- Smooth scrolling
|
||||||
|
|
||||||
-- Make Shift+movement and mouse selections behave like a conventional editor.
|
-- Shift+arrows start Select mode like a conventional editor: typing replaces
|
||||||
-- Keep `cmd` out of selectmode so v/V continue to enter Vim's Visual mode.
|
-- the selection; <C-c>/<C-x> copy/cut it to the clipboard (keymaps.lua).
|
||||||
|
-- Mouse drags start Visual mode so y/d/p work as usual (over SSH with
|
||||||
|
-- mouse=a the terminal can't copy a drag itself). Keep `cmd` out of
|
||||||
|
-- selectmode so v/V continue to enter Vim's Visual mode.
|
||||||
vim.opt.keymodel = { "startsel", "stopsel" }
|
vim.opt.keymodel = { "startsel", "stopsel" }
|
||||||
vim.opt.selectmode = { "key", "mouse" }
|
vim.opt.selectmode = { "key" }
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
local completion_state = {
|
|
||||||
enabled = true, -- current state
|
|
||||||
backup = { -- store the original values so we can restore them
|
|
||||||
omnifunc = nil,
|
|
||||||
completefunc = nil,
|
|
||||||
completeopt = nil,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>co", function()
|
|
||||||
if completion_state.enabled then
|
|
||||||
-- ----- DISABLE -----
|
|
||||||
completion_state.backup.omnifunc = vim.opt_local.omnifunc:get()
|
|
||||||
completion_state.backup.completefunc = vim.opt_local.completefunc:get()
|
|
||||||
completion_state.backup.completeopt = vim.opt_local.completeopt:get()
|
|
||||||
|
|
||||||
-- Clear the sources
|
|
||||||
vim.opt_local.omnifunc = ""
|
|
||||||
vim.opt_local.completefunc = ""
|
|
||||||
|
|
||||||
-- Hide the menu even if something tries to show it
|
|
||||||
vim.opt_local.completeopt = { "noinsert", "noselect" }
|
|
||||||
|
|
||||||
completion_state.enabled = false
|
|
||||||
print("⛔ Autocompletion disabled")
|
|
||||||
else
|
|
||||||
-- ----- ENABLE -----
|
|
||||||
vim.opt_local.omnifunc = completion_state.backup.omnifunc
|
|
||||||
vim.opt_local.completefunc = completion_state.backup.completefunc
|
|
||||||
|
|
||||||
-- Restore the previous `completeopt` (or a safe default)
|
|
||||||
vim.opt_local.completeopt = completion_state.backup.completeopt or { "menu", "preview", "noinsert", "noselect" }
|
|
||||||
|
|
||||||
completion_state.enabled = true
|
|
||||||
print("✅ Autocompletion re‑enabled")
|
|
||||||
end
|
|
||||||
end, { desc = "Toggle all autocompletion (omnifunc, completefunc, menu)" })
|
|
||||||
@@ -15,7 +15,7 @@ return {
|
|||||||
require("nvim_ai_assist").setup({
|
require("nvim_ai_assist").setup({
|
||||||
-- Active: Z.AI Coding Plan (uses ZAI_API_KEY from env)
|
-- Active: Z.AI Coding Plan (uses ZAI_API_KEY from env)
|
||||||
provider = "zai-coding",
|
provider = "zai-coding",
|
||||||
model = "glm-4.7",
|
model = "glm-5-turbo",
|
||||||
max_tokens = 300,
|
max_tokens = 300,
|
||||||
temperature = 0.05,
|
temperature = 0.05,
|
||||||
debug = true, -- writes request/response to ~/.cache/nvim/nvim_ai_assist.log; :AILog to view
|
debug = true, -- writes request/response to ~/.cache/nvim/nvim_ai_assist.log; :AILog to view
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
-- * drop the `buffer` (next-word) source everywhere
|
-- * drop the `buffer` (next-word) source everywhere
|
||||||
-- * markdown/md-render buffers use LSP+path only (no snippet callout noise)
|
-- * markdown/md-render buffers use LSP+path only (no snippet callout noise)
|
||||||
-- * disable friendly-snippets' global snippets (datetime/dateMDY/lorem/...)
|
-- * disable friendly-snippets' global snippets (datetime/dateMDY/lorem/...)
|
||||||
-- Inline AI suggestions are handled by minuet instead (see minuet.lua).
|
-- Inline LLM ghost-text (minuet-ai.nvim) was removed; blink is the only completion source.
|
||||||
return {
|
return {
|
||||||
"saghen/blink.cmp",
|
"saghen/blink.cmp",
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
@@ -28,5 +28,27 @@ return {
|
|||||||
opts.sources.providers.snippets = opts.sources.providers.snippets or {}
|
opts.sources.providers.snippets = opts.sources.providers.snippets or {}
|
||||||
opts.sources.providers.snippets.opts = opts.sources.providers.snippets.opts or {}
|
opts.sources.providers.snippets.opts = opts.sources.providers.snippets.opts or {}
|
||||||
opts.sources.providers.snippets.opts.global_snippets = {}
|
opts.sources.providers.snippets.opts.global_snippets = {}
|
||||||
|
|
||||||
|
-- Global on/off switch for completion (<leader>uk below). While it's on,
|
||||||
|
-- blink's own `enabled` check still applies.
|
||||||
|
local prev = opts.enabled
|
||||||
|
opts.enabled = function()
|
||||||
|
if vim.g.thembones_completion == false then return false end
|
||||||
|
if type(prev) == "function" then return prev() end
|
||||||
|
return true
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>uk",
|
||||||
|
function()
|
||||||
|
vim.g.thembones_completion = vim.g.thembones_completion == false
|
||||||
|
if not vim.g.thembones_completion then
|
||||||
|
pcall(function() require("blink.cmp").hide() end)
|
||||||
|
end
|
||||||
|
vim.notify("Completion " .. (vim.g.thembones_completion and "on" or "off"))
|
||||||
|
end,
|
||||||
|
desc = "Toggle Completion (global)",
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
-- LazyVim's ai.claudecode extra maps "<leader>a" (group) and "<leader>as" (Send to
|
||||||
|
-- Claude) with mode "v", which also covers Select mode. A space typed over a
|
||||||
|
-- Shift+arrow selection (selectmode=key) then waits 'timeoutlen' for the rest of
|
||||||
|
-- a <leader> map instead of replacing the selection at once. Keep those maps in
|
||||||
|
-- Visual mode only ("x"); Visual <leader>as behaves exactly as before.
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"coder/claudecode.nvim",
|
||||||
|
optional = true,
|
||||||
|
keys = function(_, keys)
|
||||||
|
local function visual_only(mode)
|
||||||
|
if mode == "v" then
|
||||||
|
return "x"
|
||||||
|
end
|
||||||
|
if type(mode) == "table" then
|
||||||
|
return vim.tbl_map(function(m)
|
||||||
|
return m == "v" and "x" or m
|
||||||
|
end, mode)
|
||||||
|
end
|
||||||
|
return mode
|
||||||
|
end
|
||||||
|
return vim.tbl_map(function(k)
|
||||||
|
if type(k) ~= "table" or k.mode == nil then
|
||||||
|
return k
|
||||||
|
end
|
||||||
|
return vim.tbl_extend("force", k, { mode = visual_only(k.mode) })
|
||||||
|
end, keys)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -7,8 +7,6 @@ return {
|
|||||||
{ "<leader>dh", "<cmd>DiffviewFileHistory %<cr>", desc = "File history (current)" },
|
{ "<leader>dh", "<cmd>DiffviewFileHistory %<cr>", desc = "File history (current)" },
|
||||||
{ "<leader>dH", "<cmd>DiffviewFileHistory<cr>", desc = "File history (all)" },
|
{ "<leader>dH", "<cmd>DiffviewFileHistory<cr>", desc = "File history (all)" },
|
||||||
},
|
},
|
||||||
config = function()
|
-- No `config` here: lazy calls require("diffview").setup(opts) with the
|
||||||
require("diffview").setup({})
|
-- options from lua/plugins/git.lua (a setup({}) here discarded them).
|
||||||
-- removed the vim.keymap.set lines from here
|
|
||||||
end,
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
-- In-editor ESLint diagnostics via the eslint language server (Mason: eslint-lsp,
|
||||||
|
-- i.e. vscode-eslint-language-server). Added 2026-10-23 for the TS code-walkthrough prep.
|
||||||
|
--
|
||||||
|
-- Diagnostics only, NO format/fix on save: eslint attaches and shows lint squiggles
|
||||||
|
-- inline, but will not silently rewrite the buffer when you save (which would bury your
|
||||||
|
-- real diff in a walkthrough). Fix manually with <leader>ca (code action -> "Fix all
|
||||||
|
-- ESLint problems") or :EslintFixAll when you actually want it.
|
||||||
|
--
|
||||||
|
-- Note: eslint runs the project's own eslint + typescript-eslint. typescript-eslint does
|
||||||
|
-- not yet support TypeScript 7, so on a TS 7 project the server errors out — that is the
|
||||||
|
-- project's toolchain, not this config. Projects pinned to TS 5.x work normally.
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = {
|
||||||
|
servers = {
|
||||||
|
eslint = {
|
||||||
|
settings = {
|
||||||
|
-- find eslint config even when it lives in a subfolder, not the cwd root
|
||||||
|
workingDirectories = { mode = "auto" },
|
||||||
|
format = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -1,197 +0,0 @@
|
|||||||
-- since this is just an example spec, don't actually load anything here and return an empty spec
|
|
||||||
-- stylua: ignore
|
|
||||||
if true then return {} end
|
|
||||||
|
|
||||||
-- every spec file under the "plugins" directory will be loaded automatically by lazy.nvim
|
|
||||||
--
|
|
||||||
-- In your plugin files, you can:
|
|
||||||
-- * add extra plugins
|
|
||||||
-- * disable/enabled LazyVim plugins
|
|
||||||
-- * override the configuration of LazyVim plugins
|
|
||||||
return {
|
|
||||||
-- add gruvbox
|
|
||||||
{ "ellisonleao/gruvbox.nvim" },
|
|
||||||
|
|
||||||
-- Configure LazyVim to load gruvbox
|
|
||||||
{
|
|
||||||
"LazyVim/LazyVim",
|
|
||||||
opts = {
|
|
||||||
colorscheme = "gruvbox",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
-- change trouble config
|
|
||||||
{
|
|
||||||
"folke/trouble.nvim",
|
|
||||||
-- opts will be merged with the parent spec
|
|
||||||
opts = { use_diagnostic_signs = true },
|
|
||||||
},
|
|
||||||
|
|
||||||
-- disable trouble
|
|
||||||
{ "folke/trouble.nvim", enabled = false },
|
|
||||||
|
|
||||||
-- override nvim-cmp and add cmp-emoji
|
|
||||||
{
|
|
||||||
"hrsh7th/nvim-cmp",
|
|
||||||
dependencies = { "hrsh7th/cmp-emoji" },
|
|
||||||
---@param opts cmp.ConfigSchema
|
|
||||||
opts = function(_, opts)
|
|
||||||
table.insert(opts.sources, { name = "emoji" })
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- change some telescope options and a keymap to browse plugin files
|
|
||||||
{
|
|
||||||
"nvim-telescope/telescope.nvim",
|
|
||||||
keys = {
|
|
||||||
-- add a keymap to browse plugin files
|
|
||||||
-- stylua: ignore
|
|
||||||
{
|
|
||||||
"<leader>fp",
|
|
||||||
function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end,
|
|
||||||
desc = "Find Plugin File",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
-- change some options
|
|
||||||
opts = {
|
|
||||||
defaults = {
|
|
||||||
layout_strategy = "horizontal",
|
|
||||||
layout_config = { prompt_position = "top" },
|
|
||||||
sorting_strategy = "ascending",
|
|
||||||
winblend = 0,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
-- add pyright to lspconfig
|
|
||||||
{
|
|
||||||
"neovim/nvim-lspconfig",
|
|
||||||
---@class PluginLspOpts
|
|
||||||
opts = {
|
|
||||||
---@type lspconfig.options
|
|
||||||
servers = {
|
|
||||||
-- pyright will be automatically installed with mason and loaded with lspconfig
|
|
||||||
pyright = {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
-- add tsserver and setup with typescript.nvim instead of lspconfig
|
|
||||||
{
|
|
||||||
"neovim/nvim-lspconfig",
|
|
||||||
dependencies = {
|
|
||||||
"jose-elias-alvarez/typescript.nvim",
|
|
||||||
init = function()
|
|
||||||
require("lazyvim.util").lsp.on_attach(function(_, buffer)
|
|
||||||
-- stylua: ignore
|
|
||||||
vim.keymap.set( "n", "<leader>co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" })
|
|
||||||
vim.keymap.set("n", "<leader>cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer })
|
|
||||||
end)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
---@class PluginLspOpts
|
|
||||||
opts = {
|
|
||||||
---@type lspconfig.options
|
|
||||||
servers = {
|
|
||||||
-- tsserver will be automatically installed with mason and loaded with lspconfig
|
|
||||||
tsserver = {},
|
|
||||||
},
|
|
||||||
-- you can do any additional lsp server setup here
|
|
||||||
-- return true if you don't want this server to be setup with lspconfig
|
|
||||||
---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
|
|
||||||
setup = {
|
|
||||||
-- example to setup with typescript.nvim
|
|
||||||
tsserver = function(_, opts)
|
|
||||||
require("typescript").setup({ server = opts })
|
|
||||||
return true
|
|
||||||
end,
|
|
||||||
-- Specify * to use this function as a fallback for any server
|
|
||||||
-- ["*"] = function(server, opts) end,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
-- for typescript, LazyVim also includes extra specs to properly setup lspconfig,
|
|
||||||
-- treesitter, mason and typescript.nvim. So instead of the above, you can use:
|
|
||||||
{ import = "lazyvim.plugins.extras.lang.typescript" },
|
|
||||||
|
|
||||||
-- add more treesitter parsers
|
|
||||||
{
|
|
||||||
"nvim-treesitter/nvim-treesitter",
|
|
||||||
opts = {
|
|
||||||
ensure_installed = {
|
|
||||||
"bash",
|
|
||||||
"html",
|
|
||||||
"javascript",
|
|
||||||
"json",
|
|
||||||
"lua",
|
|
||||||
"markdown",
|
|
||||||
"markdown_inline",
|
|
||||||
"python",
|
|
||||||
"query",
|
|
||||||
"regex",
|
|
||||||
"tsx",
|
|
||||||
"typescript",
|
|
||||||
"vim",
|
|
||||||
"yaml",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
-- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above
|
|
||||||
-- would overwrite `ensure_installed` with the new value.
|
|
||||||
-- If you'd rather extend the default config, use the code below instead:
|
|
||||||
{
|
|
||||||
"nvim-treesitter/nvim-treesitter",
|
|
||||||
opts = function(_, opts)
|
|
||||||
-- add tsx and treesitter
|
|
||||||
vim.list_extend(opts.ensure_installed, {
|
|
||||||
"tsx",
|
|
||||||
"typescript",
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- the opts function can also be used to change the default opts:
|
|
||||||
{
|
|
||||||
"nvim-lualine/lualine.nvim",
|
|
||||||
event = "VeryLazy",
|
|
||||||
opts = function(_, opts)
|
|
||||||
table.insert(opts.sections.lualine_x, {
|
|
||||||
function()
|
|
||||||
return "😄"
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- or you can return new options to override all the defaults
|
|
||||||
{
|
|
||||||
"nvim-lualine/lualine.nvim",
|
|
||||||
event = "VeryLazy",
|
|
||||||
opts = function()
|
|
||||||
return {
|
|
||||||
--[[add your custom lualine config here]]
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- use mini.starter instead of alpha
|
|
||||||
{ import = "lazyvim.plugins.extras.ui.mini-starter" },
|
|
||||||
|
|
||||||
-- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc
|
|
||||||
{ import = "lazyvim.plugins.extras.lang.json" },
|
|
||||||
|
|
||||||
-- add any tools you want to have installed below
|
|
||||||
{
|
|
||||||
"williamboman/mason.nvim",
|
|
||||||
opts = {
|
|
||||||
ensure_installed = {
|
|
||||||
"stylua",
|
|
||||||
"shellcheck",
|
|
||||||
"shfmt",
|
|
||||||
"flake8",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -1,16 +1,67 @@
|
|||||||
-- Git enhancement plugins
|
-- Git enhancement plugins
|
||||||
|
--
|
||||||
|
-- Change markers and blame both come from gitsigns.nvim (LazyVim's default; the
|
||||||
|
-- editor.mini-diff extra is off in lazyvim.json because it disables gitsigns).
|
||||||
|
local MIN_BLAME_ROOM = 12 -- columns needed before the summary is worth showing
|
||||||
|
local blame_hl = "GitSignsCurrentLineBlame"
|
||||||
|
|
||||||
|
-- Current-line blame that fits the window: "author, 3 days ago · summary". The
|
||||||
|
-- summary is cut to the room left after the line's text, and dropped when the
|
||||||
|
-- line nearly fills the window, so the annotation never runs off screen.
|
||||||
|
local function blame_formatter(_, info)
|
||||||
|
if info.author == "Not Committed Yet" then
|
||||||
|
return { { " ● Uncommitted change", "GitSignsChange" } }
|
||||||
|
end
|
||||||
|
local util = require("gitsigns.util")
|
||||||
|
local head = (" %s, %s"):format(info.author, util.get_relative_time(tonumber(info.author_time)))
|
||||||
|
|
||||||
|
local win = vim.api.nvim_get_current_win()
|
||||||
|
local textoff = vim.fn.getwininfo(win)[1].textoff
|
||||||
|
local room = vim.api.nvim_win_get_width(win) - textoff
|
||||||
|
- vim.api.nvim_strwidth(vim.api.nvim_get_current_line()) - vim.api.nvim_strwidth(head) - 4
|
||||||
|
if room < MIN_BLAME_ROOM then
|
||||||
|
return { { head, blame_hl } }
|
||||||
|
end
|
||||||
|
local summary = info.summary or ""
|
||||||
|
if vim.api.nvim_strwidth(summary) > room then
|
||||||
|
summary = vim.fn.strcharpart(summary, 0, room - 1) .. "…"
|
||||||
|
end
|
||||||
|
return { { head, blame_hl }, { " · " .. summary, blame_hl } }
|
||||||
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
-- Git blame annotations in virtual text
|
|
||||||
-- Shows git blame info at the end of each line
|
|
||||||
-- Toggle with :GitBlameToggle
|
|
||||||
{
|
{
|
||||||
"f-person/git-blame.nvim",
|
"lewis6991/gitsigns.nvim",
|
||||||
event = "VeryLazy",
|
|
||||||
opts = {
|
opts = {
|
||||||
enabled = true, -- Start enabled
|
-- Heavy bars in the sign column, VS Code style. Unstaged changes use
|
||||||
message_template = " <summary> • <date> • <author>",
|
-- GitSignsAdd/Change/Delete; staged ones get gitsigns' dimmer variants.
|
||||||
date_format = "%r",
|
signs = {
|
||||||
virtual_text_column = 80,
|
add = { text = "┃" },
|
||||||
|
change = { text = "┃" },
|
||||||
|
delete = { text = "▁" },
|
||||||
|
topdelete = { text = "▔" },
|
||||||
|
changedelete = { text = "┃" },
|
||||||
|
untracked = { text = "┆" },
|
||||||
|
},
|
||||||
|
signs_staged = {
|
||||||
|
add = { text = "┃" },
|
||||||
|
change = { text = "┃" },
|
||||||
|
delete = { text = "▁" },
|
||||||
|
topdelete = { text = "▔" },
|
||||||
|
changedelete = { text = "┃" },
|
||||||
|
},
|
||||||
|
numhl = true, -- also color the line number of every changed line
|
||||||
|
attach_to_untracked = true,
|
||||||
|
current_line_blame = true,
|
||||||
|
current_line_blame_opts = { virt_text_pos = "eol", delay = 300, ignore_whitespace = true },
|
||||||
|
current_line_blame_formatter = blame_formatter,
|
||||||
|
current_line_blame_formatter_nc = blame_formatter,
|
||||||
|
},
|
||||||
|
keys = {
|
||||||
|
{ "<leader>gb", "<cmd>Gitsigns blame<cr>", desc = "Blame panel (every line)" },
|
||||||
|
{ "<leader>gL", function() require("gitsigns").blame_line({ full = true }) end, desc = "Blame line (full commit)" },
|
||||||
|
{ "<leader>uB", "<cmd>Gitsigns toggle_current_line_blame<cr>", desc = "Toggle inline blame" },
|
||||||
|
{ "<leader>uN", "<cmd>Gitsigns toggle_numhl<cr>", desc = "Toggle git line-number colors" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,22 @@ local function image_debug(message)
|
|||||||
vim.fn.writefile({ line }, path, "a")
|
vim.fn.writefile({ line }, path, "a")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Rendered mermaid/PlantUML rows all map to the block's CLOSING fence. If
|
||||||
|
-- `lnum` is the closing fence of such a block, return the opening-fence line,
|
||||||
|
-- else nil.
|
||||||
|
local DIAGRAM_LANGS = { mermaid = true, plantuml = true, puml = true }
|
||||||
|
local function diagram_open_fence(buf, lnum)
|
||||||
|
local function get(l) return vim.api.nvim_buf_get_lines(buf, l - 1, l, false)[1] or "" end
|
||||||
|
if not get(lnum):match("^%s*[`~][`~][`~]+%s*$") then return nil end
|
||||||
|
for l = lnum - 1, math.max(1, lnum - 5000), -1 do
|
||||||
|
local fence, info = get(l):match("^%s*([`~][`~][`~]+)%s*(%S*)")
|
||||||
|
if fence then
|
||||||
|
local lang = (info:match("^{?%.?([%w_-]+)") or ""):lower()
|
||||||
|
return DIAGRAM_LANGS[lang] and l or nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"delphinus/md-render.nvim",
|
"delphinus/md-render.nvim",
|
||||||
@@ -32,6 +48,10 @@ return {
|
|||||||
{ "nvim-tree/nvim-web-devicons", version = "*" },
|
{ "nvim-tree/nvim-web-devicons", version = "*" },
|
||||||
},
|
},
|
||||||
init = function()
|
init = function()
|
||||||
|
-- Rendered width: follows the window, capped at this many columns. A
|
||||||
|
-- per-call `max_width` would pin it instead and overflow narrow windows.
|
||||||
|
vim.g.md_render_max_width = 100
|
||||||
|
|
||||||
-- Ghostty does not normally forward TERM_PROGRAM /
|
-- Ghostty does not normally forward TERM_PROGRAM /
|
||||||
-- GHOSTTY_RESOURCES_DIR into the remote shell. Neovim 0.12 therefore
|
-- GHOSTTY_RESOURCES_DIR into the remote shell. Neovim 0.12 therefore
|
||||||
-- cannot prove Kitty graphics support from the remote side on its own.
|
-- cannot prove Kitty graphics support from the remote side on its own.
|
||||||
@@ -40,7 +60,9 @@ return {
|
|||||||
--
|
--
|
||||||
-- Keep the terminal identity as Ghostty. md-render uses that identity to
|
-- Keep the terminal identity as Ghostty. md-render uses that identity to
|
||||||
-- avoid Ghostty's flaky stored-image re-placement path during redraws.
|
-- avoid Ghostty's flaky stored-image re-placement path during redraws.
|
||||||
if use_direct_kitty_bytes() and not vim.env.TERM_PROGRAM then
|
-- herdr >= 0.9.5 sets TERM_PROGRAM=herdr, which md-render doesn't know,
|
||||||
|
-- so supports_kitty() went false and mermaid fell back to code blocks.
|
||||||
|
if use_direct_kitty_bytes() and (not vim.env.TERM_PROGRAM or vim.env.TERM_PROGRAM == "herdr") then
|
||||||
vim.env.TERM_PROGRAM = "ghostty"
|
vim.env.TERM_PROGRAM = "ghostty"
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -57,8 +79,21 @@ return {
|
|||||||
-- drops to source on the right line and performs the edit. (Pure-motion
|
-- drops to source on the right line and performs the edit. (Pure-motion
|
||||||
-- keys h/j/k/w/G/… are deliberately NOT mapped, so you can still navigate
|
-- keys h/j/k/w/G/… are deliberately NOT mapped, so you can still navigate
|
||||||
-- the render freely.) Yank keys stay in the read-only render buffer so
|
-- the render freely.) Yank keys stay in the read-only render buffer so
|
||||||
-- copying text does not dismiss rendered diagrams. Visual-entry keys hop
|
-- copying text does not dismiss rendered diagrams, but yy and linewise /
|
||||||
-- to source so the resulting selection can be changed safely.
|
-- multi-line Visual y/Y copy the markdown SOURCE behind those rows (see
|
||||||
|
-- MdRenderSourceYank below). Visual-entry keys hop to source so the
|
||||||
|
-- resulting selection can be changed safely. Redo,
|
||||||
|
-- case, increment, filter and format keys (<C-r> U ~ <C-a> <C-x> & !
|
||||||
|
-- gu gU g~ g? gq gw gJ gp gP) hop too; on the render buffer they would
|
||||||
|
-- only fail with E21.
|
||||||
|
--
|
||||||
|
-- Diagram guard: every row of a rendered mermaid/PlantUML image maps to
|
||||||
|
-- the block's closing fence, so a destructive key there (dd, x, J, …)
|
||||||
|
-- would delete/alter that fence and the unbalanced fence would swallow
|
||||||
|
-- the rest of the document. For those keys (DIAGRAM_UNSAFE) we hop to
|
||||||
|
-- the OPENING fence instead and don't replay, so you can edit the
|
||||||
|
-- diagram source deliberately. p/gp (paste below the fence), u/<C-r>/U
|
||||||
|
-- and v/V are still replayed.
|
||||||
-- NOTE: the plugin sets the render buffer's filetype under
|
-- NOTE: the plugin sets the render buffer's filetype under
|
||||||
-- `eventignore=all` (preview.lua, so markdown ftplugins/treesitter don't
|
-- `eventignore=all` (preview.lua, so markdown ftplugins/treesitter don't
|
||||||
-- clobber the pre-rendered content), so a `FileType md-render` autocmd
|
-- clobber the pre-rendered content), so a `FileType md-render` autocmd
|
||||||
@@ -68,7 +103,46 @@ return {
|
|||||||
local HOP_KEYS = {
|
local HOP_KEYS = {
|
||||||
"d", "D", "c", "C", "x", "X", "s", "S", "r", "R",
|
"d", "D", "c", "C", "x", "X", "s", "S", "r", "R",
|
||||||
"p", "P", "J", ">", "<", "=", "u", "v", "V", ".",
|
"p", "P", "J", ">", "<", "=", "u", "v", "V", ".",
|
||||||
|
"<C-r>", "U", "~", "<C-a>", "<C-x>", "&", "!",
|
||||||
|
"gu", "gU", "g~", "g?", "gq", "gw", "gJ", "gp", "gP",
|
||||||
}
|
}
|
||||||
|
local DIAGRAM_UNSAFE = {}
|
||||||
|
for _, key in ipairs({
|
||||||
|
"d", "D", "c", "C", "x", "X", "s", "S", "r", "R", "J", ">", "<", "=",
|
||||||
|
".", "~", "<C-a>", "<C-x>", "&", "!",
|
||||||
|
"gu", "gU", "g~", "g?", "gq", "gw", "gJ", "P", "gP",
|
||||||
|
}) do
|
||||||
|
DIAGRAM_UNSAFE[key] = true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Auto mode only returns to render on InsertLeave, so a normal-mode hop
|
||||||
|
-- (dd, x, u, p, V…d, .) used to strand you in raw source ("images
|
||||||
|
-- disappear after editing"). After a hop, go back to render the next
|
||||||
|
-- time Neovim is idle in Normal mode (CursorHold; LazyVim 'updatetime'
|
||||||
|
-- = 200ms). Disable with: vim.g.md_render_hop_return = false
|
||||||
|
local function arm_return_to_render(src_buf)
|
||||||
|
if vim.g.md_render_hop_return == false then return end
|
||||||
|
local group = vim.api.nvim_create_augroup("MdRenderHopReturn" .. src_buf, { clear = true })
|
||||||
|
local function disarm() pcall(vim.api.nvim_del_augroup_by_id, group) end
|
||||||
|
vim.api.nvim_create_autocmd("CursorHold", {
|
||||||
|
group = group,
|
||||||
|
buffer = src_buf,
|
||||||
|
callback = function()
|
||||||
|
if vim.api.nvim_get_mode().mode ~= "n" then return end -- e.g. still in Visual
|
||||||
|
disarm()
|
||||||
|
local preview = require("md-render").preview
|
||||||
|
if type(preview._schedule_auto_transition) == "function" then
|
||||||
|
preview._schedule_auto_transition(src_buf, "render") -- no-op unless auto mode is on
|
||||||
|
elseif vim.b[src_buf].md_render_auto and vim.api.nvim_get_current_buf() == src_buf then
|
||||||
|
preview.toggle()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
-- Insert-entering hops (c/s/C/S/R) return via md-render's own
|
||||||
|
-- InsertLeave; leaving the buffer cancels.
|
||||||
|
vim.api.nvim_create_autocmd({ "InsertEnter", "BufLeave" }, { group = group, buffer = src_buf, callback = disarm })
|
||||||
|
end
|
||||||
|
|
||||||
local hop_group = vim.api.nvim_create_augroup("MdRenderEditHop", { clear = true })
|
local hop_group = vim.api.nvim_create_augroup("MdRenderEditHop", { clear = true })
|
||||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
||||||
group = hop_group,
|
group = hop_group,
|
||||||
@@ -93,10 +167,23 @@ return {
|
|||||||
-- before any follow-up keystroke. That keeps multi-key operators
|
-- before any follow-up keystroke. That keeps multi-key operators
|
||||||
-- in order — `d` becomes operator-pending and your next key (e.g.
|
-- in order — `d` becomes operator-pending and your next key (e.g.
|
||||||
-- the second `d`, or `w`, `ip`) completes it natively in source.
|
-- the second `d`, or `w`, `ip`) completes it natively in source.
|
||||||
-- (The plugin schedules its insert-entry hop because those are
|
-- (md-render's own insert-entry hop scheduled its feed and lost
|
||||||
-- single keys that immediately switch to Insert mode; operators
|
-- keys typed in the same burst; patch_auto_insert_hop in
|
||||||
-- need the ordering guarantee a sync feed provides.)
|
-- `config` makes it feed the same way as this.)
|
||||||
require("md-render").preview.toggle()
|
require("md-render").preview.toggle()
|
||||||
|
local src_buf = vim.api.nvim_get_current_buf()
|
||||||
|
if vim.bo[src_buf].filetype == "md-render" then return end -- toggle refused
|
||||||
|
|
||||||
|
if DIAGRAM_UNSAFE[key] then
|
||||||
|
local fence = diagram_open_fence(src_buf, vim.api.nvim_win_get_cursor(0)[1])
|
||||||
|
if fence then
|
||||||
|
vim.api.nvim_win_set_cursor(0, { fence, 0 })
|
||||||
|
vim.notify(("md-render: '%s' not applied to a rendered diagram; jumped to its source fence. "
|
||||||
|
.. "Edit here (<leader>mr, or leaving Insert mode, re-renders)."):format(key), vim.log.levels.INFO)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if key == "v" or key == "V" then
|
if key == "v" or key == "V" then
|
||||||
-- Enter Visual mode before the user's next queued key arrives.
|
-- Enter Visual mode before the user's next queued key arrives.
|
||||||
-- feedkeys() would put v/V behind that key, turning `Vd` into
|
-- feedkeys() would put v/V behind that key, turning `Vd` into
|
||||||
@@ -104,8 +191,13 @@ return {
|
|||||||
local visual_count = count > 0 and tostring(count) or ""
|
local visual_count = count > 0 and tostring(count) or ""
|
||||||
vim.cmd("normal! " .. visual_count .. key)
|
vim.cmd("normal! " .. visual_count .. key)
|
||||||
else
|
else
|
||||||
vim.api.nvim_feedkeys(prefix .. key, "n", false)
|
-- vim.keycode: <C-r>/<C-a>/<C-x> must be fed as keys, not text.
|
||||||
|
-- "i" inserts at the FRONT of the typeahead: when the rest of
|
||||||
|
-- the command is already queued (fast typing, `gUU`, `dw`), an
|
||||||
|
-- appended replay would run after it (`gUU` became `U` + `gU`).
|
||||||
|
vim.api.nvim_feedkeys(vim.keycode(prefix .. key), "ni", false)
|
||||||
end
|
end
|
||||||
|
arm_return_to_render(src_buf)
|
||||||
end, {
|
end, {
|
||||||
buffer = ev.buf,
|
buffer = ev.buf,
|
||||||
noremap = true,
|
noremap = true,
|
||||||
@@ -115,29 +207,114 @@ return {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Yanking in the render buffer used to copy the decorated text (icons,
|
||||||
|
-- padding, reflowed paragraphs), which pastes as garbage into markdown.
|
||||||
|
-- yy and Visual y/Y (except a charwise selection within one rendered
|
||||||
|
-- line, which keeps the native yank) copy the SOURCE lines behind the
|
||||||
|
-- rendered rows instead, linewise; the view stays rendered. A rendered
|
||||||
|
-- diagram yanks its whole fenced block. These yanks are set with
|
||||||
|
-- setreg(), so they don't fire TextYankPost / enter yanky's ring.
|
||||||
|
local yank_ns = vim.api.nvim_create_namespace("md_render_source_yank")
|
||||||
|
|
||||||
|
local function render_ctx()
|
||||||
|
local ok, state = pcall(vim.api.nvim_win_get_var, 0, "md_render_state")
|
||||||
|
if not ok or type(state) ~= "table" or state.mode ~= "render" then return nil end
|
||||||
|
local session = require("md-render").preview._toggle_sessions[state.source_buf]
|
||||||
|
if not session or session.buf ~= vim.api.nvim_get_current_buf() then return nil end
|
||||||
|
local map = session.content and session.content.source_line_map
|
||||||
|
if type(map) ~= "table" or #map == 0 or not vim.api.nvim_buf_is_valid(state.source_buf) then return nil end
|
||||||
|
return map, state.source_buf
|
||||||
|
end
|
||||||
|
|
||||||
|
local function source_lines_for(map, src_buf, r1, r2)
|
||||||
|
r1 = math.max(1, math.min(r1, #map))
|
||||||
|
r2 = math.max(r1, math.min(r2, #map))
|
||||||
|
local total = vim.api.nvim_buf_line_count(src_buf)
|
||||||
|
local s1 = math.max(1, math.min(map[r1], total))
|
||||||
|
s1 = diagram_open_fence(src_buf, s1) or s1
|
||||||
|
-- The last row's block ends right before the next row that maps to a
|
||||||
|
-- later source line (covers joined paragraph lines and fences).
|
||||||
|
local s2 = total
|
||||||
|
for r = r2 + 1, #map do
|
||||||
|
if map[r] > map[r2] then
|
||||||
|
s2 = map[r] - 1
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
s2 = math.max(s1, math.min(s2, total))
|
||||||
|
local lines = vim.api.nvim_buf_get_lines(src_buf, s1 - 1, s2, false)
|
||||||
|
while #lines > 1 and lines[#lines]:match("^%s*$") do table.remove(lines) end
|
||||||
|
return lines
|
||||||
|
end
|
||||||
|
|
||||||
|
local function yank_source(buf, r1, r2, reg)
|
||||||
|
local map, src_buf = render_ctx()
|
||||||
|
if not map then return false end
|
||||||
|
vim.fn.setreg(reg, source_lines_for(map, src_buf, r1, r2), "l")
|
||||||
|
pcall(vim.hl.range, buf, yank_ns, "IncSearch", { r1 - 1, 0 }, { r2 - 1, 0 }, { regtype = "V", timeout = 150 })
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
local yank_group = vim.api.nvim_create_augroup("MdRenderSourceYank", { clear = true })
|
||||||
|
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
||||||
|
group = yank_group,
|
||||||
|
desc = "md-render: yank in render view copies markdown source",
|
||||||
|
callback = function(ev)
|
||||||
|
if vim.bo[ev.buf].filetype ~= "md-render" then return end
|
||||||
|
if vim.b[ev.buf].md_render_yank_installed then return end
|
||||||
|
vim.b[ev.buf].md_render_yank_installed = true
|
||||||
|
|
||||||
|
vim.keymap.set("n", "yy", function()
|
||||||
|
local r, count, reg = vim.fn.line("."), vim.v.count1, vim.v.register
|
||||||
|
if not yank_source(ev.buf, r, r + count - 1, reg) then
|
||||||
|
vim.api.nvim_feedkeys('"' .. reg .. count .. "yy", "n", false)
|
||||||
|
end
|
||||||
|
end, { buffer = ev.buf, desc = "md-render: yank markdown source line(s)" })
|
||||||
|
|
||||||
|
local function visual_yank(always_source)
|
||||||
|
return function()
|
||||||
|
if not render_ctx() then return "y" end
|
||||||
|
if not always_source and vim.fn.mode() == "v" and vim.fn.line("v") == vim.fn.line(".") then
|
||||||
|
return "y" -- charwise within one rendered line: native yank
|
||||||
|
end
|
||||||
|
local a, b, reg = vim.fn.line("v"), vim.fn.line("."), vim.v.register
|
||||||
|
local buf = ev.buf
|
||||||
|
vim.schedule(function() yank_source(buf, math.min(a, b), math.max(a, b), reg) end)
|
||||||
|
return "<Esc>"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vim.keymap.set("x", "y", visual_yank(false), {
|
||||||
|
buffer = ev.buf, expr = true, desc = "md-render: yank markdown source of selection",
|
||||||
|
})
|
||||||
|
vim.keymap.set("x", "Y", visual_yank(true), {
|
||||||
|
buffer = ev.buf, expr = true, desc = "md-render: yank markdown source of selected rows",
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
})
|
||||||
end,
|
end,
|
||||||
keys = {
|
keys = {
|
||||||
{
|
{
|
||||||
"<leader>mp",
|
"<leader>mp",
|
||||||
function() require("md-render").preview.show({ max_width = 140 }) end,
|
function() require("md-render").preview.show() end,
|
||||||
ft = "markdown",
|
ft = "markdown",
|
||||||
desc = "Markdown preview (wide float toggle)",
|
desc = "Markdown preview (float toggle)",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<leader>mt",
|
"<leader>mt",
|
||||||
function() require("md-render").preview.show_tab({ max_width = 140 }) end,
|
function() require("md-render").preview.show_tab() end,
|
||||||
ft = "markdown",
|
ft = "markdown",
|
||||||
desc = "Markdown preview (wide tab toggle)",
|
desc = "Markdown preview (tab toggle)",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<leader>ms",
|
"<leader>ms",
|
||||||
function() require("md-render").preview.split({ max_width = 140 }) end,
|
function() require("md-render").preview.split() end,
|
||||||
ft = "markdown",
|
ft = "markdown",
|
||||||
desc = "Markdown source/render split",
|
desc = "Markdown source/render split",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<leader>mr",
|
"<leader>mr",
|
||||||
function() require("md-render").preview.toggle({ max_width = 140 }) end,
|
function() require("md-render").preview.toggle() end,
|
||||||
ft = "markdown",
|
ft = "markdown",
|
||||||
desc = "Markdown render toggle in-place",
|
desc = "Markdown render toggle in-place",
|
||||||
},
|
},
|
||||||
@@ -329,6 +506,116 @@ return {
|
|||||||
|
|
||||||
patch_offscreen_mermaid()
|
patch_offscreen_mermaid()
|
||||||
|
|
||||||
|
-- md-render bug (v3.11.1, content_builder.lua ~2616/~2693): when a
|
||||||
|
-- mermaid/PlantUML block becomes an image, the builder pops the
|
||||||
|
-- already-emitted code lines from self.lines but NOT from
|
||||||
|
-- self.source_line_map, so every rendered line below the diagram maps
|
||||||
|
-- #removed lines too early (render-mode dd/x/p/o edit the wrong line).
|
||||||
|
-- All map writes go through add_line, so re-align there. No-op once
|
||||||
|
-- fixed upstream (the map is then never longer than the lines).
|
||||||
|
local function patch_source_line_map()
|
||||||
|
local ok, mod = pcall(require, "md-render.content_builder")
|
||||||
|
local CB = ok and type(mod) == "table" and mod.ContentBuilder or nil
|
||||||
|
if not CB or CB._thembones_source_map_patch then return end
|
||||||
|
if type(CB.add_line) ~= "function" or type(CB.result) ~= "function" then return end
|
||||||
|
CB._thembones_source_map_patch = true
|
||||||
|
local original_add_line, original_result = CB.add_line, CB.result
|
||||||
|
|
||||||
|
CB.add_line = function(self, ...)
|
||||||
|
original_add_line(self, ...)
|
||||||
|
local map, n = self.source_line_map, #self.lines
|
||||||
|
if type(map) == "table" and #map > n then
|
||||||
|
local newest = map[#map] -- entry just appended for line n
|
||||||
|
for i = #map, n, -1 do map[i] = nil end -- drop the stale tail
|
||||||
|
map[n] = newest
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
CB.result = function(self, ...)
|
||||||
|
local map, n = self.source_line_map, #self.lines
|
||||||
|
if type(map) == "table" then
|
||||||
|
for i = #map, n + 1, -1 do map[i] = nil end
|
||||||
|
end
|
||||||
|
return original_result(self, ...)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
patch_source_line_map()
|
||||||
|
|
||||||
|
-- Session:rendered_to_source() rounds a linear interpolation between
|
||||||
|
-- sync points; across a multi-row image/diagram the lower rows round to
|
||||||
|
-- the NEXT source line (dd on the bottom half of an image deleted the
|
||||||
|
-- blank line after it). Callers of the integer version (toggle cursor
|
||||||
|
-- placement, so every hop key; the float footer) want the exact line,
|
||||||
|
-- so snap to the raw map. Scroll sync uses the *_f variants, untouched.
|
||||||
|
local function patch_exact_rendered_to_source()
|
||||||
|
local ok, preview = pcall(require, "md-render.preview")
|
||||||
|
local S = ok and type(preview) == "table" and preview._Session or nil
|
||||||
|
if not S or S._thembones_exact_source_patch then return end
|
||||||
|
if type(S.rendered_to_source) ~= "function" then return end
|
||||||
|
S._thembones_exact_source_patch = true
|
||||||
|
local original_rendered_to_source = S.rendered_to_source
|
||||||
|
|
||||||
|
S.rendered_to_source = function(self, rendered_line, ...)
|
||||||
|
local map = self.content and self.content.source_line_map
|
||||||
|
if type(map) == "table" and #map > 0 and type(rendered_line) == "number" then
|
||||||
|
local v = map[math.max(1, math.min(math.floor(rendered_line), #map))]
|
||||||
|
if type(v) == "number" and v > 0 then return v end
|
||||||
|
end
|
||||||
|
return original_rendered_to_source(self, rendered_line, ...)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
patch_exact_rendered_to_source()
|
||||||
|
|
||||||
|
-- md-render's auto mode hops i/I/a/A/o/O from the render view to source
|
||||||
|
-- with buffer-local maps that toggle() and then vim.schedule() an
|
||||||
|
-- appended feedkeys (preview.lua install_auto_insert_keymaps). Keys
|
||||||
|
-- typed in the same burst (fast typing, a paste through typeahead) were
|
||||||
|
-- already queued, so they ran first in source Normal mode: `ohi<Esc>`
|
||||||
|
-- turned "# Title" into "o# Title". After auto_on() installs those maps,
|
||||||
|
-- replace them with the same hop fed synchronously at the FRONT of the
|
||||||
|
-- typeahead (as the editing-key hop in `init` does), keeping a count.
|
||||||
|
-- Only maps md-render itself installed (matched by desc) are replaced,
|
||||||
|
-- and auto_off() still removes them.
|
||||||
|
local function patch_auto_insert_hop()
|
||||||
|
local ok, preview = pcall(require, "md-render.preview")
|
||||||
|
if not ok or type(preview) ~= "table" or preview._thembones_insert_hop_patch then return end
|
||||||
|
if type(preview.auto_on) ~= "function" or type(preview._toggle_sessions) ~= "table" then return end
|
||||||
|
preview._thembones_insert_hop_patch = true
|
||||||
|
local original_auto_on = preview.auto_on
|
||||||
|
|
||||||
|
local function install(render_buf)
|
||||||
|
local stock = {}
|
||||||
|
for _, map in ipairs(vim.api.nvim_buf_get_keymap(render_buf, "n")) do
|
||||||
|
stock[map.lhs] = map.desc
|
||||||
|
end
|
||||||
|
for _, key in ipairs({ "i", "I", "a", "A", "o", "O" }) do
|
||||||
|
local desc = "md-render auto: switch to source then " .. key
|
||||||
|
if stock[key] == desc then
|
||||||
|
vim.keymap.set("n", key, function()
|
||||||
|
local count = vim.v.count
|
||||||
|
preview.toggle()
|
||||||
|
if vim.bo.filetype == "md-render" then return end -- toggle refused
|
||||||
|
vim.api.nvim_feedkeys((count > 0 and tostring(count) or "") .. key, "ni", false)
|
||||||
|
end, { buffer = render_buf, noremap = true, silent = true, desc = desc .. " (in order)" })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
preview.auto_on = function(...)
|
||||||
|
original_auto_on(...)
|
||||||
|
for src_buf, session in pairs(preview._toggle_sessions) do
|
||||||
|
if vim.api.nvim_buf_is_valid(src_buf) and vim.b[src_buf].md_render_auto
|
||||||
|
and session.buf and vim.api.nvim_buf_is_valid(session.buf) then
|
||||||
|
install(session.buf)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
patch_auto_insert_hop()
|
||||||
|
|
||||||
-- md-render's Ghostty path intentionally re-transmits images on every
|
-- md-render's Ghostty path intentionally re-transmits images on every
|
||||||
-- placement so redraws stay visible. Its stock transport uses `t=f`,
|
-- placement so redraws stay visible. Its stock transport uses `t=f`,
|
||||||
-- which means "the terminal reads this file path". Over SSH that path is
|
-- which means "the terminal reads this file path". Over SSH that path is
|
||||||
@@ -753,6 +1040,84 @@ return {
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- md-render bug (v3.11.1, display_utils.lua place_images): image
|
||||||
|
-- placements belong to a window, not to the render buffer in it. After
|
||||||
|
-- :e / :b / a picker puts another file in that window, the window's
|
||||||
|
-- WinScrolled/CursorMoved redraw keeps placing the images at the same
|
||||||
|
-- rows over the new file. Only place them while the window still shows
|
||||||
|
-- the buffer they were set up for, clear them when that buffer leaves
|
||||||
|
-- the window, and put them back when it returns.
|
||||||
|
local function patch_image_window_guard()
|
||||||
|
local img = require("md-render.image")
|
||||||
|
local du = require("md-render.display_utils")
|
||||||
|
if img._thembones_win_guard_patch then return end
|
||||||
|
img._thembones_win_guard_patch = true
|
||||||
|
|
||||||
|
local owner_buf = {} -- win -> buffer whose images that window shows
|
||||||
|
local original_setup_images = du.setup_images
|
||||||
|
du.setup_images = function(win, content, ns, opts)
|
||||||
|
if vim.api.nvim_win_is_valid(win) then
|
||||||
|
owner_buf[win] = opts and opts.buf or vim.api.nvim_win_get_buf(win)
|
||||||
|
end
|
||||||
|
return original_setup_images(win, content, ns, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
local original_put_image = img.put_image
|
||||||
|
img.put_image = function(image_id, win, ...)
|
||||||
|
local owner = owner_buf[win]
|
||||||
|
if owner and vim.api.nvim_win_is_valid(win) and vim.api.nvim_win_get_buf(win) ~= owner then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
return original_put_image(image_id, win, ...)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function session_for(buf)
|
||||||
|
for _, session in pairs(require("md-render").preview._toggle_sessions or {}) do
|
||||||
|
if session.buf == buf and session.image_state then return session end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local group = vim.api.nvim_create_augroup("MdRenderImageWindowGuard", { clear = true })
|
||||||
|
vim.api.nvim_create_autocmd("BufWinLeave", {
|
||||||
|
group = group,
|
||||||
|
desc = "md-render: clear images when the render buffer leaves its window",
|
||||||
|
callback = function(ev)
|
||||||
|
local session = session_for(ev.buf)
|
||||||
|
if not session then return end
|
||||||
|
local state = session.image_state
|
||||||
|
img.begin_batch()
|
||||||
|
for _, id in pairs(state.image_ids or {}) do
|
||||||
|
img.clear_placements(id)
|
||||||
|
end
|
||||||
|
for _, anim in pairs(state.anims or {}) do
|
||||||
|
for _, id in ipairs(anim.frame_ids or {}) do
|
||||||
|
img.clear_placements(id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
img.flush_batch()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
vim.api.nvim_create_autocmd("BufWinEnter", {
|
||||||
|
group = group,
|
||||||
|
desc = "md-render: re-place images when the render buffer returns",
|
||||||
|
callback = function(ev)
|
||||||
|
local session = session_for(ev.buf)
|
||||||
|
if not session then return end
|
||||||
|
local win = vim.api.nvim_get_current_win()
|
||||||
|
if session.win == win then
|
||||||
|
session.image_state.schedule_redraw()
|
||||||
|
elseif not (vim.api.nvim_win_is_valid(session.win) and vim.api.nvim_win_get_buf(session.win) == session.buf) then
|
||||||
|
-- Came back in a different window: move the images here, as
|
||||||
|
-- md-render's own toggle does.
|
||||||
|
session:cleanup_images()
|
||||||
|
session:bind_window(win)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
patch_image_window_guard()
|
||||||
|
|
||||||
local function mermaid_sources(buf)
|
local function mermaid_sources(buf)
|
||||||
local sources = {}
|
local sources = {}
|
||||||
local in_mermaid = false
|
local in_mermaid = false
|
||||||
@@ -786,7 +1151,18 @@ return {
|
|||||||
|
|
||||||
for _, source in ipairs(mermaid_sources(buf)) do
|
for _, source in ipairs(mermaid_sources(buf)) do
|
||||||
if not image.get_mermaid_cached(source) then
|
if not image.get_mermaid_cached(source) then
|
||||||
image.render_mermaid(source)
|
-- Async so Esc / :w don't freeze for the mmdc run (~1s, up to 30s
|
||||||
|
-- on the npx fallback). md-render's placement pass
|
||||||
|
-- (display_utils.lua produce()) calls the same patched
|
||||||
|
-- render_mermaid_async, which de-duplicates in-flight jobs per
|
||||||
|
-- cache path (mermaid_inflight above), so it joins this job and
|
||||||
|
-- rebuilds when the PNG lands. Until then the diagram shows
|
||||||
|
-- md-render's "Rendering mermaid diagram..." placeholder.
|
||||||
|
if image.render_mermaid_async then
|
||||||
|
image.render_mermaid_async(source, function() end)
|
||||||
|
else
|
||||||
|
image.render_mermaid(source)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -794,6 +1170,10 @@ return {
|
|||||||
local function ensure_md_render_auto(buf)
|
local function ensure_md_render_auto(buf)
|
||||||
if not vim.api.nvim_buf_is_valid(buf) then return end
|
if not vim.api.nvim_buf_is_valid(buf) then return end
|
||||||
if vim.bo[buf].filetype ~= "markdown" then return end
|
if vim.bo[buf].filetype ~= "markdown" then return end
|
||||||
|
-- Skip scratch markdown buffers (LSP hover, completion docs, noice) and
|
||||||
|
-- buffers that aren't current: auto_on always targets the current buffer.
|
||||||
|
if vim.bo[buf].buftype ~= "" then return end
|
||||||
|
if vim.api.nvim_get_current_buf() ~= buf then return end
|
||||||
|
|
||||||
if not vim.b[buf].md_render_auto then
|
if not vim.b[buf].md_render_auto then
|
||||||
local cache_group = vim.api.nvim_create_augroup("MdRenderMermaidCache" .. buf, { clear = true })
|
local cache_group = vim.api.nvim_create_augroup("MdRenderMermaidCache" .. buf, { clear = true })
|
||||||
@@ -803,7 +1183,7 @@ return {
|
|||||||
callback = function()
|
callback = function()
|
||||||
prime_mermaid_cache(buf)
|
prime_mermaid_cache(buf)
|
||||||
end,
|
end,
|
||||||
desc = "Prime md-render Mermaid cache before redraw",
|
desc = "Prime md-render Mermaid cache before redraw (async)",
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -818,7 +1198,7 @@ return {
|
|||||||
pcall(vim.api.nvim_win_del_var, win, "md_render_state")
|
pcall(vim.api.nvim_win_del_var, win, "md_render_state")
|
||||||
end
|
end
|
||||||
|
|
||||||
pcall(md.preview.auto_on, { max_width = 140 })
|
pcall(md.preview.auto_on)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
-- Override LazyVim's indent-blankline for VS Code-like indent guides
|
-- Override LazyVim's indent-blankline for VS Code-like indent guides
|
||||||
|
-- Disabled: LazyVim now draws indent guides (and the current scope) with
|
||||||
|
-- snacks.indent ("│", toggle <leader>ug), so ibl only drew a second set.
|
||||||
|
-- Delete the `enabled = false` line to bring ibl back.
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"lukas-reineke/indent-blankline.nvim",
|
"lukas-reineke/indent-blankline.nvim",
|
||||||
|
enabled = false,
|
||||||
main = "ibl", -- v3 module name
|
main = "ibl", -- v3 module name
|
||||||
opts = {
|
opts = {
|
||||||
indent = {
|
indent = {
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = function(_, opts)
|
||||||
|
-- LazyVim maps gD unconditionally; tsgo has no textDocument/declaration.
|
||||||
|
-- Gate it so servers without it keep Vim's built-in gD.
|
||||||
|
table.insert(opts.servers["*"].keys, {
|
||||||
|
"gD",
|
||||||
|
vim.lsp.buf.declaration,
|
||||||
|
desc = "Goto Declaration",
|
||||||
|
has = "declaration",
|
||||||
|
})
|
||||||
|
-- Call hierarchy: the tool for understanding a call chain without editing.
|
||||||
|
-- <leader>ci = who calls this (incoming); <leader>co = what this calls (outgoing).
|
||||||
|
-- Uses Telescope's picker when present. Gated on callHierarchy support. Added 2026-10-23.
|
||||||
|
table.insert(opts.servers["*"].keys, {
|
||||||
|
"<leader>ci",
|
||||||
|
function()
|
||||||
|
local ok, tb = pcall(require, "telescope.builtin")
|
||||||
|
if ok then tb.lsp_incoming_calls() else vim.lsp.buf.incoming_calls() end
|
||||||
|
end,
|
||||||
|
desc = "Incoming Calls (callers)",
|
||||||
|
has = "callHierarchy",
|
||||||
|
})
|
||||||
|
table.insert(opts.servers["*"].keys, {
|
||||||
|
"<leader>co",
|
||||||
|
function()
|
||||||
|
local ok, tb = pcall(require, "telescope.builtin")
|
||||||
|
if ok then tb.lsp_outgoing_calls() else vim.lsp.buf.outgoing_calls() end
|
||||||
|
end,
|
||||||
|
desc = "Outgoing Calls (callees)",
|
||||||
|
has = "callHierarchy",
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
return {
|
|
||||||
{
|
|
||||||
"mfussenegger/nvim-lint",
|
|
||||||
optional = true,
|
|
||||||
opts = {
|
|
||||||
linters_by_ft = {
|
|
||||||
markdown = {}, -- no linters for .md
|
|
||||||
["markdown.mdx"] = {}, -- no linters for .mdx
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -21,6 +21,7 @@ return {
|
|||||||
opts = {
|
opts = {
|
||||||
linters_by_ft = {
|
linters_by_ft = {
|
||||||
markdown = {},
|
markdown = {},
|
||||||
|
["markdown.mdx"] = {},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
-- meow.yarn.nvim — interactive, expandable call/type hierarchy TREE (like VS Code's
|
||||||
|
-- Call Hierarchy panel), built on native LSP + nui.nvim. Added 2026-10-23 for reading
|
||||||
|
-- call chains in the TS code-walkthrough prep. Telescope's lsp_*_calls is flat/one-level;
|
||||||
|
-- this one expands recursively, previews code, and lets you drill in / switch direction.
|
||||||
|
--
|
||||||
|
-- Keys (<leader>y = "yarn"): put the cursor on a function, then
|
||||||
|
-- <leader>yc callers (who calls this) <leader>yC callees (what this calls)
|
||||||
|
-- <leader>yt supertypes <leader>yT subtypes
|
||||||
|
-- <leader>yl re-open last hierarchy
|
||||||
|
-- In the tree: <CR> jump, o/za expand, zO/zC expand/collapse all, / filter, <BS> back.
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"retran/meow.yarn.nvim",
|
||||||
|
dependencies = { "MunifTanjim/nui.nvim" },
|
||||||
|
keys = {
|
||||||
|
{ "<leader>y", "", desc = "+yarn (hierarchy)" },
|
||||||
|
{ "<leader>yc", function() require("meow.yarn").open_tree("call_hierarchy", "callers") end, desc = "Yarn: callers (who calls this)" },
|
||||||
|
{ "<leader>yC", function() require("meow.yarn").open_tree("call_hierarchy", "callees") end, desc = "Yarn: callees (what this calls)" },
|
||||||
|
{ "<leader>yt", function() require("meow.yarn").open_tree("type_hierarchy", "supertypes") end, desc = "Yarn: supertypes" },
|
||||||
|
{ "<leader>yT", function() require("meow.yarn").open_tree("type_hierarchy", "subtypes") end, desc = "Yarn: subtypes" },
|
||||||
|
{ "<leader>yl", "<Plug>(MeowYarnLast)", desc = "Yarn: last hierarchy" },
|
||||||
|
},
|
||||||
|
opts = {},
|
||||||
|
config = function(_, opts)
|
||||||
|
require("meow.yarn").setup(opts)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@ return {
|
|||||||
lazy = false,
|
lazy = false,
|
||||||
keys = {
|
keys = {
|
||||||
{ "<leader>um", "<cmd>Neominimap Toggle<cr>", desc = "Toggle minimap" },
|
{ "<leader>um", "<cmd>Neominimap Toggle<cr>", desc = "Toggle minimap" },
|
||||||
{ "<leader>uf", "<cmd>Neominimap Focus<cr>", desc = "Focus minimap" },
|
{ "<leader>uM", "<cmd>Neominimap Focus<cr>", desc = "Focus minimap" },
|
||||||
},
|
},
|
||||||
init = function()
|
init = function()
|
||||||
vim.g.neominimap = {
|
vim.g.neominimap = {
|
||||||
@@ -33,10 +33,14 @@ return {
|
|||||||
enabled = true,
|
enabled = true,
|
||||||
mode = "line", -- Highlight full line
|
mode = "line", -- Highlight full line
|
||||||
},
|
},
|
||||||
|
-- Git changes come from gitsigns (see lua/plugins/git.lua).
|
||||||
git = {
|
git = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
mode = "line", -- Full line highlight for git changes
|
mode = "line", -- Full line highlight for git changes
|
||||||
},
|
},
|
||||||
|
mini_diff = {
|
||||||
|
enabled = false,
|
||||||
|
},
|
||||||
search = {
|
search = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
mode = "line",
|
mode = "line",
|
||||||
|
|||||||
@@ -1,115 +0,0 @@
|
|||||||
-- Inline LLM (ghost-text) completion tuned for writing markdown/prose.
|
|
||||||
-- Reuses ZAI_API_KEY from the environment (same key the :AI command uses).
|
|
||||||
-- Suggestions are virtual text, auto-triggered behind a debounce delay.
|
|
||||||
local PROSE_FT = {
|
|
||||||
markdown = true,
|
|
||||||
["md-render"] = true,
|
|
||||||
text = true,
|
|
||||||
rst = true,
|
|
||||||
tex = true,
|
|
||||||
gitcommit = true,
|
|
||||||
mail = true,
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
"milanglacier/minuet-ai.nvim",
|
|
||||||
dependencies = { "nvim-lua/plenary.nvim" },
|
|
||||||
-- Load eagerly: minuet only sets its buffer-local auto-trigger flag from a
|
|
||||||
-- FileType autocmd registered in setup(). Lazy-loading on InsertEnter would
|
|
||||||
-- register that autocmd *after* the current buffer's FileType already fired,
|
|
||||||
-- so virtualtext would never auto-trigger on the buffer you're editing.
|
|
||||||
lazy = false,
|
|
||||||
opts = {
|
|
||||||
provider = "openai_compatible",
|
|
||||||
-- One natural continuation, not three alternatives — prose has a single
|
|
||||||
-- "next sentence", and fewer candidates means less to read past.
|
|
||||||
n_completions = 1,
|
|
||||||
-- Give the model more of the text *before* the cursor (default 0.75).
|
|
||||||
context_ratio = 0.85,
|
|
||||||
-- Cap how much surrounding text is sent. Smaller = lower, steadier latency
|
|
||||||
-- (the full default of 16000 chars is overkill for prose continuation and
|
|
||||||
-- inflates time-to-first-token). 4000 chars ≈ plenty of preceding context.
|
|
||||||
context_window = 4000,
|
|
||||||
-- Delay knobs: wait for an idle pause, and rate-limit requests. Groq is fast
|
|
||||||
-- and deterministic, so we can afford a snappier debounce than the cloud
|
|
||||||
-- defaults; throttle stays moderate to respect the free-tier rate limit.
|
|
||||||
throttle = 800, -- min ms between requests
|
|
||||||
debounce = 400, -- ms of idle typing before a request fires
|
|
||||||
provider_options = {
|
|
||||||
openai_compatible = {
|
|
||||||
api_key = "GROQ_API_KEY", -- env var NAME; minuet reads it at runtime
|
|
||||||
name = "Groq",
|
|
||||||
-- Groq's LPU inference gives ~80-100ms time-to-first-token with very low
|
|
||||||
-- variance — that consistency is the whole reason for moving off Z.AI's
|
|
||||||
-- hit-or-miss coding endpoint. OpenAI-compatible, so the schema is unchanged.
|
|
||||||
end_point = "https://api.groq.com/openai/v1/chat/completions",
|
|
||||||
-- llama-3.3-70b is Groq's flagship general model: strong prose, still fast
|
|
||||||
-- on their hardware. If you ever want the absolute lowest latency, swap to
|
|
||||||
-- "llama-3.1-8b-instant" (faster, slightly weaker prose).
|
|
||||||
model = "llama-3.3-70b-versatile",
|
|
||||||
-- Swap minuet's "code completion engine" system prompt for a prose one
|
|
||||||
-- in writing filetypes; keep the default (string) for code. Guidelines
|
|
||||||
-- and few-shots are left at defaults so minuet's <endCompletion> parsing
|
|
||||||
-- still works.
|
|
||||||
system = {
|
|
||||||
prompt = function()
|
|
||||||
if PROSE_FT[vim.bo.filetype] then
|
|
||||||
return [[
|
|
||||||
You are a prose writing assistant embedded in a text editor. Continue the
|
|
||||||
author's text at the <cursorPosition> marker naturally and fluently, matching
|
|
||||||
their voice, tone, and sentence rhythm.
|
|
||||||
|
|
||||||
- Output ONLY the continuation text — no preamble, no explanation.
|
|
||||||
- Never wrap the output in markdown code fences or backticks.
|
|
||||||
- Do not add headings, bullets, or numbering unless the surrounding text
|
|
||||||
already uses them.
|
|
||||||
- Keep it to at most 1-3 sentences and stop at a natural boundary.]]
|
|
||||||
end
|
|
||||||
return require("minuet.config").default_system_prefix_first.prompt
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
optional = {
|
|
||||||
-- Short, focused completions. (No `thinking` field here — that was a
|
|
||||||
-- Z.AI-specific param; Groq's Llama models 400 on unknown body fields.)
|
|
||||||
max_tokens = 96,
|
|
||||||
temperature = 0.3,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
virtualtext = {
|
|
||||||
auto_trigger_ft = { "*" },
|
|
||||||
-- Alt keymaps are kept as a secondary path, but the primary accept key is
|
|
||||||
-- <Tab>, wired in config() below (Alt+* doesn't fire in Ghostty without
|
|
||||||
-- macos-option-as-alt, and Tab is the natural "accept" key for prose).
|
|
||||||
keymap = {
|
|
||||||
accept = "<A-y>", -- accept full suggestion
|
|
||||||
accept_line = "<A-l>", -- accept one line
|
|
||||||
prev = "<A-[>",
|
|
||||||
next = "<A-]>",
|
|
||||||
dismiss = "<A-e>",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
config = function(_, opts)
|
|
||||||
require("minuet").setup(opts)
|
|
||||||
|
|
||||||
-- Smart <Tab>: accept a visible minuet ghost-text suggestion; otherwise fall
|
|
||||||
-- back to the exact super-tab behavior we had before (jump an active snippet,
|
|
||||||
-- else insert a literal Tab). Blink's menu navigates with <C-n>/<C-p>, not
|
|
||||||
-- Tab, so this doesn't fight the completion popup.
|
|
||||||
local vt = require("minuet.virtualtext").action
|
|
||||||
vim.keymap.set("i", "<Tab>", function()
|
|
||||||
if vt.is_visible() then
|
|
||||||
vt.accept()
|
|
||||||
elseif vim.snippet.active({ direction = 1 }) then
|
|
||||||
vim.snippet.jump(1)
|
|
||||||
else
|
|
||||||
vim.api.nvim_feedkeys(
|
|
||||||
vim.api.nvim_replace_termcodes("<Tab>", true, false, true),
|
|
||||||
"n",
|
|
||||||
false
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end, { desc = "minuet: accept suggestion, else snippet jump / Tab" })
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
-- Navigation enhancement plugins
|
|
||||||
-- (neoscroll removed due to conflicts with smear-cursor)
|
|
||||||
return {}
|
|
||||||
@@ -10,5 +10,9 @@ return {
|
|||||||
|
|
||||||
opts.filesystem.filtered_items.always_show = opts.filesystem.filtered_items.always_show or {}
|
opts.filesystem.filtered_items.always_show = opts.filesystem.filtered_items.always_show or {}
|
||||||
table.insert(opts.filesystem.filtered_items.always_show, "*.log")
|
table.insert(opts.filesystem.filtered_items.always_show, "*.log")
|
||||||
|
|
||||||
|
-- 60% of neo-tree's default 40-column width
|
||||||
|
opts.window = opts.window or {}
|
||||||
|
opts.window.width = 24
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,9 @@
|
|||||||
|
-- Disabled: neo-tree (LazyVim editor.neo-tree extra, customised in
|
||||||
|
-- neo-tree-extras.lua) is the file explorer. Both specs claimed <leader>e and
|
||||||
|
-- which one won changed from start to start. Delete `enabled = false` to restore.
|
||||||
return {
|
return {
|
||||||
"nvim-tree/nvim-tree.lua",
|
"nvim-tree/nvim-tree.lua",
|
||||||
|
enabled = false,
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"nvim-tree/nvim-web-devicons",
|
"nvim-tree/nvim-web-devicons",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
-- Pin refactoring.nvim (LazyVim editor.refactoring extra) on Neovim < 0.12.5.
|
||||||
|
--
|
||||||
|
-- Since abdcad8 (2026-09-23) refactoring.nvim calls the core vim.pos(buf, row, col) and
|
||||||
|
-- vim.range(buf, start_row, start_col, end_row, end_col). Neovim only takes buf first from
|
||||||
|
-- 0.12.5 on (upstream README: "requires Neovim 0.12.5"); 0.12.0-0.12.4 expect
|
||||||
|
-- vim.range(start_row, start_col, end_row, end_col, { buf = buf }), so every refactor fails
|
||||||
|
-- with "vim/range.lua:98: attempt to index local 'opts' (a number value)".
|
||||||
|
-- 8bcf893 is the parent of abdcad8 and the last upstream commit that ships its own
|
||||||
|
-- refactoring.pos/refactoring.range with the buf-first API; the two commits after it on master
|
||||||
|
-- are CI/docs only. Pinning in the spec (not just lazy-lock.json) keeps :Lazy update from
|
||||||
|
-- moving it back to the broken commit.
|
||||||
|
--
|
||||||
|
-- Remove this file once Neovim is >= 0.12.5 (the guard below already stops pinning there),
|
||||||
|
-- then run :Lazy update refactoring.nvim.
|
||||||
|
if vim.fn.has("nvim-0.12.5") == 1 then
|
||||||
|
return {}
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
{ "ThePrimeagen/refactoring.nvim", commit = "8bcf893eb3871bc87b42adffe2fb9b0b7dc9d328" },
|
||||||
|
}
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
return {
|
|
||||||
{
|
|
||||||
"ThePrimeagen/refactoring.nvim",
|
|
||||||
dependencies = {
|
|
||||||
"nvim-lua/plenary.nvim",
|
|
||||||
"nvim-treesitter/nvim-treesitter",
|
|
||||||
"lewis6991/async.nvim",
|
|
||||||
},
|
|
||||||
ft = { "lua", "python", "javascript", "typescript", "go", "c", "cpp", "java", "php", "ruby" },
|
|
||||||
config = function()
|
|
||||||
require("refactoring").setup()
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -7,8 +7,10 @@ return {
|
|||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
enabled = true, -- Set to false to disable
|
enabled = true, -- Set to false to disable
|
||||||
keys = {
|
keys = {
|
||||||
{ "n", [[<Cmd>execute('normal! ' . v:count1 . 'n')<CR><Cmd>lua require('hlslens').start()<CR>]], desc = "Next search result" },
|
-- n/N keep LazyVim's direction-stable behaviour (n always searches
|
||||||
{ "N", [[<Cmd>execute('normal! ' . v:count1 . 'N')<CR><Cmd>lua require('hlslens').start()<CR>]], desc = "Previous search result" },
|
-- forward, N backward, even after `?`) and open folds (zv).
|
||||||
|
{ "n", [[<Cmd>execute('normal! ' . v:count1 . 'Nn'[v:searchforward] . 'zv')<CR><Cmd>lua require('hlslens').start()<CR>]], desc = "Next Search Result" },
|
||||||
|
{ "N", [[<Cmd>execute('normal! ' . v:count1 . 'nN'[v:searchforward] . 'zv')<CR><Cmd>lua require('hlslens').start()<CR>]], desc = "Prev Search Result" },
|
||||||
{ "*", [[*<Cmd>lua require('hlslens').start()<CR>]], desc = "Search word under cursor" },
|
{ "*", [[*<Cmd>lua require('hlslens').start()<CR>]], desc = "Search word under cursor" },
|
||||||
{ "#", [[#<Cmd>lua require('hlslens').start()<CR>]], desc = "Search word under cursor (backward)" },
|
{ "#", [[#<Cmd>lua require('hlslens').start()<CR>]], desc = "Search word under cursor (backward)" },
|
||||||
{ "g*", [[g*<Cmd>lua require('hlslens').start()<CR>]], desc = "Search word under cursor (no boundary)" },
|
{ "g*", [[g*<Cmd>lua require('hlslens').start()<CR>]], desc = "Search word under cursor (no boundary)" },
|
||||||
@@ -37,22 +39,36 @@ return {
|
|||||||
default_replace_single_buffer_options = "gcI",
|
default_replace_single_buffer_options = "gcI",
|
||||||
default_replace_multi_buffer_options = "egcI",
|
default_replace_multi_buffer_options = "egcI",
|
||||||
},
|
},
|
||||||
|
-- Under <leader>R: <leader>r belongs to LazyVim's refactoring extra
|
||||||
|
-- (<leader>rs and <leader>rf collided). Selection maps use mode "x", not
|
||||||
|
-- "v", so typing a space over a Shift+arrow (Select mode) selection
|
||||||
|
-- doesn't wait for a <leader> mapping.
|
||||||
keys = {
|
keys = {
|
||||||
-- Single buffer replacements
|
-- Single buffer replacements
|
||||||
{ "<leader>rs", "<CMD>SearchReplaceSingleBufferSelections<CR>", desc = "Search/Replace Selections", mode = "v" },
|
{ "<leader>Rs", "<CMD>SearchReplaceSingleBufferSelections<CR>", desc = "Search/Replace Selections", mode = "x" },
|
||||||
{ "<leader>ro", "<CMD>SearchReplaceSingleBufferOpen<CR>", desc = "Search/Replace Open" },
|
{ "<leader>Ro", "<CMD>SearchReplaceSingleBufferOpen<CR>", desc = "Search/Replace Open" },
|
||||||
{ "<leader>rw", "<CMD>SearchReplaceSingleBufferCWord<CR>", desc = "Search/Replace Word" },
|
{ "<leader>Rw", "<CMD>SearchReplaceSingleBufferCWord<CR>", desc = "Search/Replace Word" },
|
||||||
{ "<leader>rW", "<CMD>SearchReplaceSingleBufferCWORD<CR>", desc = "Search/Replace WORD" },
|
{ "<leader>RW", "<CMD>SearchReplaceSingleBufferCWORD<CR>", desc = "Search/Replace WORD" },
|
||||||
{ "<leader>re", "<CMD>SearchReplaceSingleBufferCExpr<CR>", desc = "Search/Replace Expr" },
|
{ "<leader>Re", "<CMD>SearchReplaceSingleBufferCExpr<CR>", desc = "Search/Replace Expr" },
|
||||||
{ "<leader>rf", "<CMD>SearchReplaceSingleBufferCFile<CR>", desc = "Search/Replace File" },
|
{ "<leader>Rf", "<CMD>SearchReplaceSingleBufferCFile<CR>", desc = "Search/Replace File" },
|
||||||
|
|
||||||
-- Multi buffer replacements
|
-- Multi buffer replacements
|
||||||
{ "<leader>rbs", "<CMD>SearchReplaceMultiBufferSelections<CR>", desc = "Search/Replace Selections (Multi)", mode = "v" },
|
{ "<leader>Rbs", "<CMD>SearchReplaceMultiBufferSelections<CR>", desc = "Search/Replace Selections (Multi)", mode = "x" },
|
||||||
{ "<leader>rbo", "<CMD>SearchReplaceMultiBufferOpen<CR>", desc = "Search/Replace Open (Multi)" },
|
{ "<leader>Rbo", "<CMD>SearchReplaceMultiBufferOpen<CR>", desc = "Search/Replace Open (Multi)" },
|
||||||
{ "<leader>rbw", "<CMD>SearchReplaceMultiBufferCWord<CR>", desc = "Search/Replace Word (Multi)" },
|
{ "<leader>Rbw", "<CMD>SearchReplaceMultiBufferCWord<CR>", desc = "Search/Replace Word (Multi)" },
|
||||||
{ "<leader>rbW", "<CMD>SearchReplaceMultiBufferCWORD<CR>", desc = "Search/Replace WORD (Multi)" },
|
{ "<leader>RbW", "<CMD>SearchReplaceMultiBufferCWORD<CR>", desc = "Search/Replace WORD (Multi)" },
|
||||||
{ "<leader>rbe", "<CMD>SearchReplaceMultiBufferCExpr<CR>", desc = "Search/Replace Expr (Multi)" },
|
{ "<leader>Rbe", "<CMD>SearchReplaceMultiBufferCExpr<CR>", desc = "Search/Replace Expr (Multi)" },
|
||||||
{ "<leader>rbf", "<CMD>SearchReplaceMultiBufferCFile<CR>", desc = "Search/Replace File (Multi)" },
|
{ "<leader>Rbf", "<CMD>SearchReplaceMultiBufferCFile<CR>", desc = "Search/Replace File (Multi)" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"folke/which-key.nvim",
|
||||||
|
optional = true,
|
||||||
|
opts = {
|
||||||
|
spec = {
|
||||||
|
{ "<leader>R", group = "search/replace", mode = { "n", "x" } },
|
||||||
|
{ "<leader>Rb", group = "multi-buffer", mode = { "n", "x" } },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
-- TypeScript LSP: LazyVim's lang.typescript.tsc extra runs lspconfig's `tsc`
|
||||||
|
-- server (`tsc --lsp`), which already prefers a project-local
|
||||||
|
-- node_modules/.bin/tsc that supports --lsp (TypeScript >= 7) and disables
|
||||||
|
-- tsgo, so no server override is needed here.
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-neotest/neotest",
|
||||||
|
optional = true,
|
||||||
|
dependencies = { "marilari88/neotest-vitest" },
|
||||||
|
opts = {
|
||||||
|
adapters = {
|
||||||
|
["neotest-vitest"] = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Inlay hints: show inferred TYPES inline while reading code. LazyVim's tsc extra
|
||||||
|
-- turns variableTypes/functionLikeReturnTypes OFF by default (noisy); for reading an
|
||||||
|
-- unfamiliar TS codebase (interview walkthroughs) the inferred types inline are the
|
||||||
|
-- point, so turn them back on. Toggle the whole thing live with <leader>uh.
|
||||||
|
-- Added 2026-10-23.
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = {
|
||||||
|
servers = {
|
||||||
|
tsc = {
|
||||||
|
settings = {
|
||||||
|
["js/ts"] = {
|
||||||
|
inlayHints = {
|
||||||
|
variableTypes = { enabled = true },
|
||||||
|
functionLikeReturnTypes = { enabled = true },
|
||||||
|
parameterNames = { enabled = "all", suppressWhenArgumentMatchesName = true },
|
||||||
|
parameterTypes = { enabled = true },
|
||||||
|
propertyDeclarationTypes = { enabled = true },
|
||||||
|
enumMemberValues = { enabled = true },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Turn inlay hints ON by default, but only for TS/JS buffers, so Go/Python/etc. are
|
||||||
|
-- unaffected. <leader>uh still toggles per buffer.
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = function()
|
||||||
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
|
callback = function(args)
|
||||||
|
local ft = vim.bo[args.buf].filetype
|
||||||
|
if ft:match("^typescript") or ft:match("^javascript") then
|
||||||
|
pcall(vim.lsp.inlay_hint.enable, true, { bufnr = args.buf })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -7,6 +7,11 @@ return {
|
|||||||
enabled = true,
|
enabled = true,
|
||||||
dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-tree/nvim-web-devicons" },
|
dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-tree/nvim-web-devicons" },
|
||||||
opts = {
|
opts = {
|
||||||
|
-- md-render.nvim (lua/plugins/image.lua) owns the rendered view of
|
||||||
|
-- markdown files; the source buffer is what you edit, so keep it
|
||||||
|
-- plain. render-markdown still decorates nofile floats (LSP hover,
|
||||||
|
-- completion docs). Re-enable per buffer with :RenderMarkdown buf_toggle.
|
||||||
|
overrides = { buftype = { [""] = { enabled = false } } },
|
||||||
render_modes = { "n", "i", "c", "t" },
|
render_modes = { "n", "i", "c", "t" },
|
||||||
heading = {
|
heading = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
|
|||||||
Reference in new issue
Block a user