Show Menu
Cheatography

Personal Neovim Cheatsheet Cheat Sheet by

This are my personal cheatsheet for Neovim

Basic

-
open netrw file explorer
leader + w
fast saving
leader + ba
close all the buffers

Tab Management

leader + nt
open new tab
leader + tc
close actual tab
leader + tl
toggle between this and the last accessed tab
leader + tn
switch to next tab
leader + to
close other tabs
leader + tp
switch to previous tab

Telescope

;
Lists open buffers in current neovim instance
control + g
Fuzzy search through the output of git ls-files command
control + p
Lists files in your current working directory
leader + fg
Search for a string in your current working directory and get results live as you type
leader + g
Searches for the string under your cursor in your current working directory

Packer Commands

:PackerClean
Remove any disabled or unused plugins
:PackerCompile
Regenerate compiled loader file
:PackerInstall
Clean, then install missing plugins
:PackerSync
Perform Packer­Update and then Packer­Compile
:PackerUpdate
Clean, then update and install plugins

LSP Typescript Utils

leader + gi
Rename TypeScript file and update imports
leader + go
Import all missing imports in TS Files
leader + gs
Organize imports in TypeScript Files

Trouble

leader + xd
switch to document diagno­stics from the builtin LSP client
leader + xr
refresh the active list
leader + xw
switch to workspace diagno­stics from the builtin LSP client
leader + xx
toggle Trouble window

Git

:Git
run git command in terminal, Eg: :Git checkout -b test
leader + gR
Revert the current file to the specific commit
leader + gb
Open blame window
leader + gd
Opens a new diff that compares against the current index
leader + gn
Create a pull request with the target branch is set in the target­_branch option
leader + go
Open file/f­older in git repository
leader + gp
Open pull request of the current branch
leader + gr
Revert to the specific commit

Git conflict

:GitConflictListQf
Show all conflicted files in quickfix window
c0 or :GitConflictChooseNone
Select both none of the changes
cb or :GitConflictChooseBoth
Select both changes
co or :GitConflictChooseOurs
Select the current changes
ct or :GitConflictChooseTheirs
Select the incoming changes

Spectre

leader + s
open search panel
leader + sp
search in current file
leader + sw
search for selected word
When the search panel is opend we can use the following shortcuts:
enter
goto current file
dd
toggle current item
leader + R
replace all
leader + c
input replace vim command
leader + o
show option
leader + q
send all item to quickfix
leader + rc
replace current line
leader + v
change result view mode
th
toggle search hidden
ti
toggle ignore case
tu
update change when vim write file

Sorting

leader + so
sort visual selection
 

Search

space
search
control + space
backward search
leader + space
remove search highlights

Split Management

control + h
Move to existing or create a new split to the left of your current window + open file or custom command
control + j
Move to existing or create a new split to the top of your current window + open file or custom command
control + k
Move to existing or create a new split to the bottom of your current window + open file or custom command
control + l
Move to existing or create a new split to the right of your current window + open file or custom command

Session Management

:SessionDelete
Delete the current session
:SessionLoad
Load the session for the current directory and current branch if git_us­e_b­ranch = true
:SessionLoadLast
Load the last session
:SessionSave
Save the current session
:SessionStart
Start recording a session. Useful if autosave = false
:SessionStop
Stop recording a session
:SessionToggle
Determines whether to load, start or stop a session
leader + sm
open saved session list

LSP Installer Commands

:LspInstall [--sync] [server]
instal­ls/­rei­nstalls language servers. Runs in a blocking fashion if the --sync argument is passed (only recomm­ended for scripting purposes).
:LspInstallInfo
opens a graphical overview of your language servers
:LspInstallLog
opens the log file in a new tab window
:LspPrintInstalled
prints all installed language servers
:LspUninstall [--sync]
uninstalls language servers. Runs in a blocking fashion if the --sync argument is passed (only recomm­ended for scripting purposes).
:LspUninstallAll [--no-confirm]
uninstalls all language servers

LSP Comman­ds/­Sho­rtcuts

K
Displays hover inform­ation about the symbol under the cursor in a floating window.
[ + d
Move to the previous diagnostic in the current buffer.
] + d
Move to the next diagno­stic.
control + k
Displays signature inform­ation about the symbol under the cursor in a floating window
gD
Jumps to the declar­ation of the symbol under the cursor.
gd
Jumps to the definition of the symbol under the cursor.
gi
Lists all the implem­ent­ations for the symbol under the cursor in the quickfix window.
gr
Lists all the references to the symbol under the cursor in the quickfix window.
space + ca
Selects a code action available at the current cursor position.
space + d
Jumps to the definition of the type of the symbol under the cursor.
space + e
Show diagno­stics in a floating window.
space + f
Add buffer diagno­stics to the location list.
space + rn
Renames all references to the symbol under the cursor.

Gitlinker

leader + gy
generate shareable file permalinks (with line ranges)

Diffview

:DiffviewClose
generate shareable file permalinks (with line ranges)
:DiffviewFileHistory
Opens a new file history view that lists all commits that affected the given paths.
:DiffviewOpen
Open Git Diffview Tab
:DiffviewRefresh
Update stats and entries in the file list of the current Diffview

Git Worktree

leader + gw
To bring up the telescope window listing your workspaces
leader + gwn
To bring up the telescope window to create a new worktree

Comment

gb
Toggles the region using blockwise comment in visual mode
gbc
Toggles the current line using blockwise comment in normal mode
gc
Toggles the region using linewise comment in visual mode
gcc
Toggles the current line using linewise comment in normal mode
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          NeoVim Cheat Sheet
          My neovim Keyboard Shortcuts
          nvim cheat sheets Cheat Sheet