Skip to content

Keybindings

Leader Key: Space


Quick Navigation Guide

Multiple Ways to Navigate

Neovim offers several complementary navigation approaches. Use the right tool for the task:

  • Vim motions (hjkl, w/b, {}/(), gg/G): Fast character and line movement
  • LSP jumps (grd, grr, gri): Code exploration (go to definition, find references)
  • Neo-tree (<leader>n): Browse project structure visually
  • Telescope (<leader>sf, <leader>sg): Fuzzy find files and search text
  • Jump back (Ctrl-t, Ctrl-o): Return to previous positions
  • Window splits (Ctrl-w s/v): View multiple files simultaneously

Common Workflows:

  • Exploring new code: grd → read definition → Ctrl-t to return → grr to see all usages
  • Finding a file: <leader>sf (Telescope) or <leader>n (Neo-tree)
  • Searching across project: <leader>sg (live grep) or <leader>sw (search word under cursor)
  • Navigating a file: gg/G (top/bottom), {/} (paragraphs), Ctrl-d/Ctrl-u (scroll), relative numbers (5j)

tmux

Prefix Key: Ctrl+A (press before all tmux commands)

Window Management

Keybinding Action
Ctrl+A C Create new window
Ctrl+A N Next window
Ctrl+A P Previous window
Ctrl+A 1 to Ctrl+A 9 Switch to window 1-9

Pane Management

Keybinding Action
Ctrl+A \ Horizontal split (creates side-by-side panes)
Ctrl+A - Vertical split (creates top/bottom panes)
Ctrl+A H Navigate to left pane
Ctrl+A J Navigate to pane below
Ctrl+A K Navigate to pane above
Ctrl+A L Navigate to right pane
Ctrl+A Shift+H Resize pane left (5 cells)
Ctrl+A Shift+J Resize pane down (5 cells)
Ctrl+A Shift+K Resize pane up (5 cells)
Ctrl+A Shift+L Resize pane right (5 cells)
Ctrl+A M Maximize/zoom current pane (toggle)

Vim-Tmux-Navigator Integration

When using Neovim inside tmux with the vim-tmux-navigator plugin, you can navigate seamlessly between Neovim windows and tmux panes using Ctrl+H, Ctrl+J, Ctrl+K, Ctrl+L without the prefix key.

Copy Mode

Keybinding Action
Ctrl+A [ Enter copy/scrollback mode (Q to exit)
V Start visual selection (in copy mode)
Y Yank/copy selection (in copy mode)

Vi-Style Copy Mode

Copy mode uses vi keybindings. Enter copy mode with Ctrl+A [, use V to start selecting, navigate with H+J+K+L, and press Y to copy. The tmux-yank plugin integrates with system clipboard.

Session Management

Keybinding Action
Ctrl+A D Detach from session
Ctrl+A R Reload tmux config

Session Persistence

Sessions are auto-saved every 1 minute and automatically restored after system reboots thanks to tmux-resurrect and tmux-continuum plugins.

Plugin Management

Keybinding Action
Ctrl+A Shift+I Install new plugins
Ctrl+A Shift+U Update all plugins
Ctrl+A Alt+U Uninstall plugins not in config

General Navigation

Key Mode Action
Esc Normal Clear search highlights
Space+Q Normal Open diagnostic quickfix list

Vim Motions with Relative Line Numbers

Efficient Navigation with Relative Line Numbers

Relative line numbers are enabled, making it easy to jump to any visible line by combining a number with a motion command.

Basic Line Jumps

Keys Vim Action
5+J 5j Jump down 5 lines
1+0+K 10k Jump up 10 lines
3+J 3j Jump down 3 lines

How it works: Look at the relative number next to the target line, then type that number + J (down) or K (up).

With Operators

Combine relative line numbers with vim operators for powerful editing:

Keys Vim Action
D+8+J d8j Delete from current line down 8 lines
Y+5+K y5k Yank (copy) from current line up 5 lines
>+3+J >3j Indent current line and 3 lines below
C+4+K c4k Change from current line up 4 lines

Visual Selection

Keys Vim Action
Shift+V+7+J V7j Visually select down 7 lines
Shift+V+3+K V3k Visually select up 3 lines

Line Number Display

The current line shows the absolute line number (yellow), while lines above and below show relative distance. You can still jump to absolute line numbers with :42 (jumps to line 42).

Practice Vim Motions

Run :VimBeGood to practice vim motions, including relative line number jumps, with interactive exercises.


Window Management

Window Navigation

Standard Vim window commands (Normal mode):

Key Action
Ctrl+W H Move to left window
Ctrl+W L Move to right window
Ctrl+W J Move to lower window
Ctrl+W K Move to upper window
Ctrl+W W Cycle through windows

Alternative navigation (vim-tmux-navigator):

Key Action
Ctrl+H Move to left window (or tmux pane)
Ctrl+L Move to right window (or tmux pane)
Ctrl+J Move to lower window (or tmux pane)
Ctrl+K Move to upper window (or tmux pane)

Seamless Vim-Tmux Navigation

The vim-tmux-navigator plugin allows Ctrl-h/j/k/l to navigate both Neovim windows and tmux panes seamlessly. If you're in Neovim and press Ctrl-h, it will move to the left window. If there's no window to the left in Neovim, it will move to the left tmux pane instead.

Window Splits

Key Action
Ctrl+W S Split window horizontally (new window below)
Ctrl+W V Split window vertically (new window to right)
Ctrl+W C Close current window
Ctrl+W O Close all windows except current
Ctrl+W = Make all windows equal size
Ctrl+W + Increase window height
Ctrl+W - Decrease window height
Ctrl+W > Increase window width
Ctrl+W < Decrease window width

Terminal Mode Navigation

Terminal mode (Claude Code, integrated terminals):

Key Action
Esc Esc Exit terminal mode
Ctrl+W Exit terminal mode and start window command

Terminal Mode Navigation

In terminal mode, Ctrl+W exits terminal and starts a window command sequence, so Ctrl+W H will exit terminal and move left.

Claude CLI Keybinding Conflict

In standalone claude CLI (not claudecode.nvim), Ctrl+W is bound to clear screen. This conflicts with the Neovim terminal binding. When using Claude CLI in a Neovim terminal, the Neovim binding takes precedence. Use /clear command instead to clear the Claude CLI screen.


Basic Vim Motions

Essential Movement Commands

These basic motions are the foundation of efficient Vim navigation. Combine them with counts (e.g., 3w to move forward 3 words) for faster movement.

Horizontal Movement

Keys Vim Action
H h Move left one character
L l Move right one character
W w Move forward to start of next word
B b Move backward to start of previous word
E e Move forward to end of word
0 0 Move to start of line
++dollar++ $ Move to end of line
Shift+6 ^ Move to first non-blank character of line

Vertical Movement

Keys Vim Action
J j Move down one line
K k Move up one line
G+G gg Jump to first line of file
Shift+G G Jump to last line of file
Shift+5 % Jump to matching bracket/parenthesis
Shift+7 { Jump to previous paragraph/block
Shift+0 } Jump to next paragraph/block

Screen Navigation

Keys Vim Action
Ctrl+D Ctrl-d Scroll down half page
Ctrl+U Ctrl-u Scroll up half page
Ctrl+F Ctrl-f Scroll down full page
Ctrl+B Ctrl-b Scroll up full page
Shift+H H Move to top of screen
Shift+M M Move to middle of screen
Shift+L L Move to bottom of screen
Z+Z zz Center screen on cursor

LSP Keybindings

Code Exploration Workflow

The LSP keybindings enable powerful code exploration, especially in Go projects. Use grd to jump to definitions (even across module boundaries), grr to find all references, and Ctrl-t or Ctrl-o to jump back. This workflow makes exploring large codebases intuitive and fast.

Jump to Symbol

Keys Vim Action
G+R+D grd Go to definition
G+R+Shift+D grD Go to declaration
G+R+I gri Go to implementation
G+R+T grt Go to type definition
G+R+R grr Go to references (find all usages)
Keys Vim Action
Ctrl+T Ctrl-t Jump back from definition (tag stack)
Ctrl+O Ctrl-o Jump to older cursor position
Ctrl+I Ctrl-i Jump to newer cursor position

Understanding Jump Back Navigation

  • Ctrl-t: Specifically pops the tag stack (jumps back from grd, gri, etc.)
  • Ctrl-o: Goes to the previous position in the jump list (broader than just definition jumps)
  • Ctrl-i: Goes forward in the jump list (opposite of Ctrl-o)

Example workflow: Press grd to jump to a function definition, explore the code, then press Ctrl-t to return to where you were.

Keys Vim Action
G+Shift+O gO Open document symbols (outline of current file)
G+Shift+W gW Open workspace symbols (search across project)

Code Actions

Keys Vim Action
G+R+N grn Rename symbol across workspace
G+R+A gra Code action (fix imports, quick fixes)
Space+T+H <leader>th Toggle inlay hints

Go Module Imports

In Go projects, imports like github.com/user/repo/package are resolved to local files in your go/pkg/mod directory or project workspace. LSP (gopls) handles this resolution automatically, allowing you to jump to definitions in external packages with grd.


File Navigation

Neo-tree File Browser

Neo-tree Overview

Neo-tree is a file explorer plugin that provides a tree view of your project structure. Toggle it with <leader>n (Space+n by default).

Key Action
Space+N Toggle Neo-tree file browser

Inside Neo-tree window:

Key Action
Enter Open file or expand/collapse directory
Tab Preview file (without opening)
Esc Close Neo-tree
A Add file or directory (ends with / for directory)
D Delete file or directory
R Rename file or directory
C Copy file or directory
X Cut file or directory
P Paste file or directory
Y Copy filename to clipboard
Shift+Y Copy relative path to clipboard
G+Y Copy absolute path to clipboard
Shift+H Toggle hidden files
Shift+R Refresh tree
Z Collapse all nodes (close all directories)
Shift+O Expand all nodes (open all directories)
? Show help

Quick File Navigation

Use Neo-tree (<leader>n) for browsing project structure and Telescope (<leader>sf) for fuzzy finding files by name.

Directory Expansion Shortcuts

Use O (Shift+o, capital O for "Open all") to expand all directories for a complete project overview, or z to collapse everything when you want to focus on a specific area. These shortcuts are especially useful in large projects to quickly see the full structure or reset your view.

Telescope (Fuzzy Finder)

Telescope Overview

Telescope is a fuzzy finder that lets you quickly search files, text, buffers, and more. All searches support fuzzy matching and preview.

Key Action
Space+S+F Search files (fuzzy find by filename)
Space+S+G Live grep (search file contents)
Space+S+W Search current word under cursor
Space+Space Find open buffers
Space+S+R Search recent files
Space+/ Fuzzy find in current buffer
Space+S+/ Live grep in open files only
Space+S+N Search Neovim config files
Space+S+D Search diagnostics (errors/warnings)
Space+S+H Search help documentation
Space+S+K Search keymaps
Space+S+S Search Telescope builtins
Space+S+. Resume last search

Inside Telescope window:

Key Action
Ctrl+N / Ctrl+J Move to next result
Ctrl+P / Ctrl+K Move to previous result
Enter Open selected file
Ctrl+X Open in horizontal split
Ctrl+V Open in vertical split
Ctrl+T Open in new tab
Esc Close Telescope

Claude Code Integration

Key Action
Space+A+C Toggle Claude Code terminal
Space+A+F Focus Claude Code terminal

Commands:

  • :ClaudeCode - Toggle Claude Code terminal
  • :ClaudeCodeFocus - Focus Claude Code terminal

Formatting

Key Action
Space+F Format current buffer

Auto-Format on Save

Auto-formats on save for all configured file types (Go, TypeScript, React, Lua)