Skip to content
shyun3 edited this page Oct 14, 2025 · 6 revisions

Useful Neovim stuff I keep forgetting about.

Events

At startup

Listed in order of occurrence.

  • BufNewFile: only triggered if file given as argument doesn't exist
  • BufReadPre: only triggered if file was specified as argument
  • FileType: only triggered if the opened file has a type
  • BufWinEnter
  • BufEnter
  • VimEnter
  • UIEnter
  • VeryLazy
  • LspAttach

Unless otherwise pointed out above, it does not seem worth lazily loading plugins based on events that occur earlier than UIEnter since those will be always be triggered.

User controlled

  • CmdlineEnter: also triggered with searches or input() calls
  • ModeChanged: useful for lazily loading text object plugins

LSP

LSP client configurations can be specified in dedicated Lua files, see docs.

An example is available here.

Mappings

Normal mode

Miscellaneous

  • g<C-g>: Display word count (among other info)

Registers

  • Q: Repeats the last recorded register (not necessarily the last executed register)

Windows

  • <C-w><C-v>: Split current window vertically

Terminal mode

  • <C-\><C-n>: Return to normal mode

Visual mode

  • g<C-a>: Add to numbers in highlighted text, creating an incrementing sequence if several lines are highlighted

Search

Patterns

  • \C: Force match case

Clone this wiki locally