Files
nix-config/home/base/core/editors/neovim
Ryan Yin 74a9106917 security(home): drop all neovim plugins to shrink supply-chain exposure (#259)
* chore(home): drop AstroNvim bundle and centralize editors

Remove the bundled Neovim plugin tree to shrink supply-chain exposure; keep a
minimal programs.neovim backup. Daily editing stays Helix-first with Yazi and
Zellij.

- Add Helix/Neovim docs, glossary, and cheatsheets under core/editors/.
- Default EDITOR/VISUAL to hx; use SUDO_EDITOR nvim --clean for sudoedit and
  other sensitive edits; adjust Nushell buffer_editor accordingly.
- Apply Helix Home Manager settings (keys, editor UI) in core/editors/helix.
- Keep heavy language-server tooling only in home/base/tui/editors/packages.nix;
  wire it via an explicit default.nix import so core stays lightweight.
- Extend modules/base packages.nix where that profile sets global editor env.

* docs: link editors, VS Code, and agents from README

Document tui/editors versus core/editors; add root README pointers to GUI
vscode (Home Manager) and agents/. Cross-link heavy packages README from
core/editors.
2026-04-27 21:31:58 +08:00
..

Neovim (backup) — vim-style usage

Primary day-to-day editing is Helix; this file is the vim/Neovim quick reference and doc pointers for when you reach for Neovim as a backup.

Tips

  1. Many motions already exist in vim — check vim/Neovim docs before adding plugins or reinventing wheels.
  2. For deeper skill, read the official docs:
    1. https://vimhelp.org/ — vim help.
    2. https://neovim.io/doc/user/ — Neovim user manual.
  3. Prefer Zellij for shells and panes; use Helix or Neovim for buffers and text.
  4. Two powerful navigation modes on large codebases:
    1. By path — when you know the tree layout.
    2. By content — when you know what the code says.

Tutorial

Type :tutor (or :Tutor in Neovim) for the built-in vim tutorial.

Vim cheatsheet (common keys)

For a fuller reference: https://vimhelp.org/quickref.txt.html

Emacs Evil, Neovim, and vim share the motions below.

Zellij shortcuts used often:

Action Zellij shortcut
Floating terminal Ctrl + p + w
Horizontal split terminal Ctrl + p + d
Vertical split terminal Ctrl + p + n
Run a shell command !xxx

File management

https://neovim.io/doc/user/usr_22.html
https://vimhelp.org/editing.txt.html

Action Command
Save selection to a file :w filename (shows :'<,'>w filename)
Save and close current buffer :wq
Save all buffers :wa
Save and close all buffers :wqa
Edit a file :e filename (or :e <TAB> for completion)
Browse files :Ex or :e .
Discard changes and reload :e!

Motion

https://vimhelp.org/motion.txt.html

Action Command
Start / end of buffer gg / G
Go to line 5 5gg / 5G
Left / down / up / right h j k l (counts like 5j work)
Jump to matchpairs (), {}, [] %
Start / end of line 0 / $
Sentence forward / backward ( / )
Paragraph forward / backward { / }
Section forward / backward [[ / ]]
Jump to marks ' + mark (Neovim may prompt)

Text objects:

  • Sentence: ends at . ! ? plus line end or space/tab.
  • Paragraph: ends at a blank line.
  • Section: between section headers; [[ / ]] often stop at { in column 1 (handy in C/Go/Java).

Text manipulation

Basics:

Action Command
Delete character under cursor x
Put (paste) p
Delete operator + motion d
Undo word (insert) CTRL-w
Undo line (insert) CTRL-u
Undo change u
Redo Ctrl-r
Repeat previous insert Ctrl-a
Repeat last change .
Toggle case ~
Uppercase (visual) U
Lowercase (visual) u
Align selection :center / :left / :right

Misc:

Action Shortcut
Character-wise visual v
Line-wise visual V
Block visual <Ctrl-v>
Fold close / open zc / zo
Go to definition gd
Go to references gD
Comment line (if mapped) e.g. gcc
Action Command
Sort lines :sort
Join lines :join or J
Join without spaces :join!
Insert at line start / end I / A
Delete to end of line D
Change to end of line (into insert) C

Advanced patterns:

  • Append to many lines: :normal A<text> (often after visual-block Ctrl-v).
  • Neovim may pad short lines with spaces when block-appending past EOL.
  • Delete last character on many lines: :normal $x over a visual selection.
  • Delete last word on many lines: :normal $bD.
Action Command
Search forward / backward / ?
Repeat search same / opposite dir n N

Find and replace

Action Command
In visual selection :s/old/new/g
Current line same
Whole buffer :%s/old/new/g
Regex example :%s@\vhttp://(\w+)@https://\1@gc

Notes:

  • \v — “very magic”, less backslash noise in the pattern.
  • \1 — first capture group.

Specific line ranges

Action Command examples
Lines 10end :10,$s/old/new/g or :10,$s@^@#@g
Lines 1020 :10,20s/old/new/g
Strip trailing spaces :%s/\s\+$//g

Flags: g all matches in range, c confirm each, i ignore case.

Buffers, windows, tabs

https://neovim.io/doc/user/usr_08.html
https://vimhelp.org/windows.txt.html

  • Buffer — in-memory text for a file.
  • Window — viewport on a buffer.
  • Tab page — layout of windows.
Action Command
Horizontal split :sp or :sp filename
Vertical split :vs or :vs filename
Next / prev window Ctrl-w w or Ctrl-w h/j/k/l
List buffers :ls
Next / prev buffer ]b / [b or :bn / :bp
New tab :tabnew
Next / prev tab gt / gT

History

Action Command
Command history q:
Search history q/