Skip to content

Instantly share code, notes, and snippets.

@vishalzambre
Created July 3, 2026 05:25
Show Gist options
  • Select an option

  • Save vishalzambre/eaff63428fc182122f409aae286a9428 to your computer and use it in GitHub Desktop.

Select an option

Save vishalzambre/eaff63428fc182122f409aae286a9428 to your computer and use it in GitHub Desktop.
Neovim Cheat Sheet (Ruby on Rails + LazyVim + Claude Code)

Neovim Cheat Sheet (Ruby on Rails + LazyVim + Claude Code)

Save this as NEOVIM_CHEATSHEET.md in a GitHub Gist.

Neovim Cheat Sheet

Optimized for Ruby on Rails + LazyVim + Claude Code


Modes

Key Description
i Insert before cursor
I Insert at beginning of line
a Append after cursor
A Append at end of line
o New line below
O New line above
Esc Return to Normal mode

Save / Quit

Command Description
:w Save
:w filename Save As
:wa Save all files
:q Quit
:q! Quit without saving
:wq Save and Quit
ZZ Save and Quit
:qa Quit all
:qa! Quit all without saving

Movement

Key Description
h Left
j Down
k Up
l Right
w Next word
b Previous word
e End of word
0 Beginning of line
^ First non-space
$ End of line
gg Top of file
G Bottom of file
10G Go to line 10
:25 Go to line 25
% Matching bracket

Editing

Key Description
x Delete character
dd Delete line
dw Delete word
D Delete to end of line
yy Copy line
yw Copy word
p Paste after
P Paste before
u Undo
Ctrl+r Redo
. Repeat last command

Change

Key Description
cw Change word
cc Change line
C Change to end of line
ci" Change inside quotes
ci' Change inside single quotes
ci( Change inside parentheses
ci{ Change inside braces
ci[ Change inside brackets

Visual Mode

Key Description
v Character selection
V Line selection
Ctrl+v Block selection
y Copy selection
d Delete selection
> Indent
< Unindent

Search

Key Description
/text Search forward
?text Search backward
n Next result
N Previous result
* Search current word
# Search backward current word

Window Management

Command Description
:split Horizontal split
:vsplit Vertical split
Ctrl+w h Left window
Ctrl+w j Down window
Ctrl+w k Up window
Ctrl+w l Right window
Ctrl+w q Close window
Ctrl+w = Equal size

Buffers

Command Description
:ls List buffers
:bnext Next buffer
:bprev Previous buffer
:buffer 3 Open buffer 3
:bd Close current buffer
:bd! Force close buffer

LazyVim

Leader key = Space

Shortcut Description
Space ff Find Files
Space fg Live Grep
Space fr Recent Files
Space fb Buffers
Space gg LazyGit
Space e File Explorer (Neo-tree if enabled)
Space xx Diagnostics
Space ca Code Action
Space rn Rename Symbol

LSP

Shortcut Description
gd Go to Definition
gD Go to Declaration
gr References
gi Implementation
gt Type Definition
K Hover Documentation
Space ca Code Action
Space rn Rename Symbol
]d Next Diagnostic
[d Previous Diagnostic

Telescope

Shortcut Description
Space ff Find files
Space fg Search text
Space fb Buffers
Space fr Recent files
Space fh Help
Space fc Commands

Git

Shortcut Description
Space gg LazyGit
]h Next Git change
[h Previous Git change
Space ghp Preview Hunk
Space ghr Reset Hunk
Space ghs Stage Hunk

Tree (Neo-tree)

Shortcut Description
Space e Toggle tree
Enter Open file
a New file
A New directory
d Delete
r Rename
c Copy
m Move
R Refresh

Oil.nvim

Key Description
- Open parent directory
Enter Open file
Ctrl+s Horizontal split
Ctrl+v Vertical split

Claude Code

Open terminal

:terminal

Run

claude

Useful layout

Ctrl+w s Horizontal split Ctrl+w v Vertical split Ctrl+w h Move left Ctrl+w j Move down Ctrl+w k Move up Ctrl+w l Move right

Example workflow

Space ff Open controller gd Go to model Ctrl+o Back :terminal claude


Rails (vim-rails)

Command Description
:A Alternate file
:R Related file
:Emodel User Open model
:Econtroller Users Open controller
:Eview Open view
:Espec Open spec

Useful Commands

:Mason :Lazy :checkhealth :messages :pwd :cd path :terminal :help keyword


Exit Terminal Mode

Ctrl+\ Ctrl+n


Copy/Paste

yy Copy line

p Paste

P Paste before

"+y Copy to system clipboard

"+p Paste from system clipboard


Numbers

Ctrl+a Increment number

Ctrl+x Decrement number


Indent

<<

=%

gg=G


Comment

gcc Toggle comment line

gc Toggle selection


Macros

qa Record macro a

q Stop recording

@a Run macro

@@ Repeat macro


My Daily Workflow

cd ~/Projects/myapp

nvim .

Space ff Find file

Space fg Search text

gd Go definition

gr References

K Documentation

Space gg Git

:terminal

claude

Ctrl+w h/j/k/l Switch panes

:w Save

:q Quit

A couple of notes

  1. If you're using the latest LazyVim, some keybindings may differ slightly from older blog posts (for example, search commands are often under Space s...). You can always press:
Space

and pause for a second—WhichKey will show all available shortcuts.

  1. I also recommend printing this cheat sheet or keeping it on a second monitor for the first week. Most users only need 20–30 commands to become productive, and the rest can be learned gradually.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment