# Neovim Cheatsheet What this LazyVim config adds or changes. `` is Space. Everything else is stock LazyVim: `sk` searches all keymaps, `?` shows the current buffer's keymaps. --- ## Markdown (md-render.nvim, `lua/plugins/image.lua`) Opening a `.md` file shows the **rendered view** (a separate read-only buffer, images and mermaid/PlantUML diagrams drawn inline). The source buffer is what you edit. | Key / command | What it does | |---|---| | `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`) | | `dd` `x` `p` `u` `` `.` `J` `>` `gUU` `gq` … | Editing keys jump to the matching source line and run there | | (wait ~200 ms) | After a normal-mode edit, the view returns to rendered once Neovim is idle | | `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, `` or `gv` | | `mr` | Render ⇄ source in place (mapped in the markdown source buffer) | | `mp` / `mt` / `ms` | Preview in a wide float / a tab / a source+render split (source buffer) | | `md` | md-render demo | | `:MdRender toggle\|split\|tab\|float\|auto on\|off` | Same from the command line (works in the rendered view too) | - **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. --- ## Clipboard and selections `clipboard=unnamedplus` everywhere, so `y`/`p` use the system clipboard. | Where nvim runs | Copy (`y`) | Paste (`p`) | |---|---|---| | **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) | | **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 | | **Local macOS** | `pbcopy` | `pbpaste` | - **Mac → nvim over SSH:** paste with the terminal, **Cmd-V** (works in every mode). There is no runtime hint for this. - Over 512 KiB a yank warns that the terminal may drop the OSC 52 payload; over 8 MiB it is not shared with other instances. | Selection | How you get it | Keys | |---|---|---| | **Select mode** | Shift+arrows | Typing replaces the selection at once (Space too). `` copy, `` cut, `` switch to Visual | | **Visual mode** | Mouse drag, `v`, `V`, `` | `y` `d` `p` as usual; `` also copies (`` stays decrement) | - `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. - `cy` / `cY` copy the file's relative / absolute path. --- ## Search and replace (`lua/plugins/search.lua`) | Key | What it does | |---|---| | `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 | | `Rs` (Visual) / `Ro` / `Rw` / `RW` / `Re` / `Rf` | search-replace.nvim, current buffer: selection / prompt / word / WORD / expression / filename | | `Rbs` (Visual) / `Rbo` / `Rbw` / `RbW` / `Rbe` / `Rbf` | Same across all buffers | | `sr` | LazyVim's grug-far search and replace (project-wide) | | `rs` | Refactoring menu (LazyVim refactoring extra; `rf` extract function, `rx` extract variable, `ri` inline variable) | - refactoring.nvim is pinned to `8bcf893` while Neovim is older than 0.12.5 (`lua/plugins/refactoring-fix.lua`). Newer commits call `vim.range`/`vim.pos` with the 0.12.5 signature and every refactor fails with `E5108 … vim/range.lua:98` on 0.12.1. After upgrading Neovim, delete that file and run `:Lazy update refactoring.nvim`. --- ## Completion and AI | Item | State | |---|---| | blink.cmp | On; sources LSP, path, snippets (no buffer words). Markdown: LSP + path only. friendly-snippets' global snippets (dates, lorem) off | | `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) | | nvim_ai_assist (`:AI`) | **Disabled** (see below) | | Claude Code (LazyVim extra) | `ac` toggle, `af` focus, `ar` resume, `aC` continue, `ab` add buffer, `as` send selection (Visual) / add file (neo-tree), `aa` / `ad` accept / deny diff | --- ## Git | Key / command | What it does | |---|---| | git-blame.nvim | Blame as virtual text at column 80; `:GitBlameToggle`, `:GitBlameCopySHA`, `:GitBlameOpenCommitURL` | | `gd` / `gh` / `gH` | Diffview: changes / file history / repo history | | `dv` / `ds` / `dh` / `dH` | Diffview: open / staged / file history / all history | | `go` / `uG` | mini.diff overlay / signs | | `gb` / `gg` | Blame line / lazygit (LazyVim) | In Diffview: `]c` `[c` hunks, `` `` files, `q` close (`:DiffviewClose`). --- ## UI | Key | What it does | |---|---| | `um` / `uM` | Minimap (neominimap, on at start; shows diagnostics, mini.diff changes, search) toggle / focus | | `uf` | LazyVim's auto-format toggle (global) | | `ut` | Twilight (dim inactive code). Hides LazyVim's treesitter-context toggle: use `:TSContext toggle` | | `uT` | Themery theme picker (`:Themery`). Hides LazyVim's treesitter-highlight toggle: use `:lua Snacks.toggle.treesitter():toggle()`. `uC` is LazyVim's colorscheme picker | | `ug` | Indent guides (snacks.indent) | Always on: hlargs (argument colours), smear-cursor, treesitter-context. --- ## Files and navigation | Key | What it does | |---|---| | `e` / `E` | neo-tree (root / cwd); shows dotfiles, gitignored files and `*.log` | | `ff` / `` | Find files (Telescope; includes hidden and gitignored files) | | `/` / `sg` | Grep (includes gitignored files) | | `fg` / `fb` / `fr` | Git files / buffers / recent | | `sh` / `sk` | Help / keymaps | | `H` / `h` / `1`–`9` | Harpoon: add file / menu / jump | | `cs` / `ss` | Aerial outline / symbol search | | `fp` | Projects | | `cv` | CSV/TSV aligned view (in `.csv` / `.tsv` buffers) | | `t…` | Tests (neotest, incl. vitest) | | `sz` | chezmoi files | TypeScript uses the `tsc` LSP from the lang.typescript.tsc extra (project-local TypeScript 7 when present). --- ## Disabled on purpose (and how to undo) | Plugin / feature | Why | Re-enable | |---|---|---| | nvim-tree | neo-tree is the explorer; both fought over `e` | Delete `enabled = false` in `lua/plugins/nvim-tree.lua` | | indent-blankline | snacks.indent already draws guides | Delete `enabled = false` in `lua/plugins/indent.lua` | | nvim_ai_assist (`:AI`) | AI off | Delete `enabled = false` in `lua/plugins/ai_assist.lua` | | noice.nvim | Caused treesitter errors | Delete `lua/plugins/noice-fix.lua` | | 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 | | render-markdown in source buffers | md-render owns the rendered view | Remove the `overrides` line in `ui-enhancements.lua`, or `:RenderMarkdown buf_toggle` | | 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` | --- ## Files ``` ~/.config/nvim/ ├── init.lua # loads config.lazy ├── lazyvim.json # enabled LazyVim extras ├── lazy-lock.json # plugin versions └── lua/ ├── config/ │ ├── options.lua # ai_cmp off, clipboard providers, Select/Visual setup │ ├── keymaps.lua # cy/cY, / 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 (R) ├── git.lua # git-blame, diffview (options + g keys) ├── diffview.lua # diffview d keys ├── minimap.lua # neominimap (um / uM) ├── blink.lua # completion sources, 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) ```