Neovim

NAME

neovim - the editor and its keymaps

DESCRIPTION

Neovim 0.12 with one plugin, nvim-treesitter, and the built-in language server client. This page assumes:

Contents

Open a file

The config searches subdirectories for :find and skips node_modules, .git, bin, and obj. Type part of a name and press Tab to complete it.

Do this Press From
Open a file by name, anywhere under the current folder :find name Neovim
Browse the current file’s folder - dotfiles

Search across files

:grep runs ripgrep, which searches the current folder and everything under it. Case is ignored unless the pattern has a capital letter. Matches go to the quickfix list.

Do this Press From
Search for a pattern :grep pattern Neovim
Search for the phrase you type next, and list the matches Space s dotfiles
Go to the next or previous match ]q or [q Neovim
Show every match in a list :copen Neovim
Close the list :cclose Neovim

Jump to a definition and back

With a language server, these ask the server. Without one, CTRL-] falls back to a tags file. Opening the first C# file in a project builds one if none exists.

Do this Press From
Go to the definition gd dotfiles
Go to the declaration gD dotfiles
Go to the definition, through the server or the tags file CTRL-] Neovim
Pick from several definitions with the same name g CTRL-] Neovim
Jump back CTRL-T or CTRL-O Neovim
List the references grr Neovim
Go to the implementation gri Neovim
Go to the type definition grt Neovim
List the symbols in this file gO Neovim
Show the documentation K Neovim
Rebuild the tags file Space c t dotfiles

Rename a symbol or apply a fix

Do this Press From
Rename the symbol everywhere grn Neovim
Choose a fix or refactoring gra Neovim

Read errors and warnings

The config keeps error text out of the code, so a problem shows only as a letter in the left column: E, W, I, or H.

Do this Press From
Read the message under the cursor CTRL-W d Neovim
Go to the next or previous problem ]d or [d Neovim
Go to the first or last problem [D or ]D Neovim

Complete code

Suggestions appear as you type wherever a language server is running.

Do this Press From
Move through suggestions CTRL-N or CTRL-P Neovim
Accept the selected suggestion CTRL-Y Neovim
Close the menu CTRL-E Neovim
Show the function’s parameters while typing CTRL-S Neovim

Format or rewrap

Space c f does what fits the file. It formats through the language server, formats a .feature file with prettier, and rewraps the paragraph under the cursor in Markdown. Markdown also wraps at 100 columns as you type.

Do this Press From
Format the file, or rewrap the paragraph in Markdown Space c f dotfiles
Rewrap the text a motion covers, such as gqap for a paragraph gq Neovim

Comment lines out

Do this Press From
Toggle a comment on this line gcc Neovim
Toggle comments over a motion, such as gcap for a paragraph gc Neovim

Build C# and step through errors

In a C# file, :make runs dotnet msbuild and loads the errors into the quickfix list.

Do this Press From
Build :make Neovim
Go to the next or previous error ]q or [q Neovim

Copy to the system clipboard

A yank goes straight to the system clipboard, so yy copies a line you can paste anywhere, and p pastes from it.

In WSL or over SSH, the copy travels through the terminal instead, which works without a clipboard tool installed. There, p pastes only what you last yanked in Neovim. To paste text copied elsewhere, use the terminal’s paste key, CTRL+SHIFT+V in Alacritty.

Keys the dotfiles add

Key Does Where
Space s Search the project Everywhere
- Explore parent dir Everywhere
Space c t Regenerate tags Everywhere
Space c f Rewrap paragraph Markdown
Space c f Format Gherkin (.feature)
gd Goto definition Buffers with a language server
gD Goto declaration Buffers with a language server
Space c f Format Buffers with a language server

SEE ALSO

The man pages index.