LazyVim + Lazygit Basics: Navigate, Edit and Commit Without Leaving Your Editor
LazyVim turns Neovim into a full IDE with sensible defaults, and lazygit gives you a complete git interface in the terminal. In this guide you'll learn how to get around LazyVim, copy and move text...
LazyVim turns Neovim into a full IDE with sensible defaults, and lazygit gives you a complete git interface in the terminal. In this guide you'll learn how to get around LazyVim, copy and move text, find anything in a file or project, and run a normal git workflow with lazygit, all without leaving the editor.
You don't need deep Vim knowledge. If you know i to start typing, Esc to stop, and :w to save, you're ready.
Before you start
You'll need:
- Neovim 0.11.2 or newer and LazyVim installed (installation guide)
- lazygit installed and on your PATH, otherwise
Space g gwon't open it (lazygit on GitHub) - ripgrep and fd for fast project-wide search
- A Nerd Font in your terminal so the icons display properly
All keybindings below are LazyVim defaults. You can check the full list on the LazyVim keymaps page.
1. The dashboard, leader key and which-key
When you open nvim without a file, you land on the LazyVim dashboard. From here you can find files, open recent files, jump into your config or open the plugin manager. Each option has a one-letter shortcut.
The most important thing to learn is the leader key, which is the Space bar. Almost every LazyVim command starts with it.
Press Space and wait a moment. A popup called which-key appears, listing every command you can run next, grouped by letter:
| Group | Purpose |
|---|---|
f | Files |
s | Search |
g | Git |
b | Buffers |
c | Code |
x | Diagnostics and lists |
u | UI toggles |
q | Quit and sessions |
Press a letter to drill into that group. You don't need to memorise anything on day one: press Space and read.
Useful extras:
Space s ksearches every keymap by name. Lost? Start here.Space lopens Lazy, the plugin manager. PressUto update everything andqto close it.
2. Files, buffers and windows
Opening files
Space Spaceopens the fuzzy file finder. Type a few letters of the name, move with the arrow keys orCtrl+j/Ctrl+k, and pressEnter.Space etoggles the file explorer. Move withjandk, pressEnterto open, andato create a new file.Space f rshows recently opened files.
Buffers
Every open file is a buffer, shown along the top like tabs.
Shift+h/Shift+lmove to the previous / next bufferSpace ,lists open buffers in a searchable pickerSpace b dcloses the current buffer
Splits
Space |splits the window to the rightSpace -splits the window belowCtrl+h,Ctrl+j,Ctrl+k,Ctrl+lmove between splitsSpace w dcloses the current split
Saving and quitting
Ctrl+ssaves the file, in any modeSpace q qquits everything
3. Copying, cutting and moving text
Vim calls copying yanking and pasting putting. Deleting text also cuts it, so you can paste whatever you just deleted. LazyVim connects yanks to your system clipboard by default, so you can paste into other apps too.
The basics (Normal mode)
| Keys | What it does |
|---|---|
yy | Copy the current line |
yiw | Copy the word under the cursor |
y$ | Copy from the cursor to the end of the line |
dd | Cut the current line |
diw | Cut the word under the cursor |
x | Cut the character under the cursor |
p | Paste after the cursor (or below the line) |
P | Paste before the cursor (or above the line) |
u | Undo |
Ctrl+r | Redo |
Add a number to repeat: 3yy copies three lines, 5dd cuts five.
Selecting with Visual mode
When you'd rather select first and then act:
- Press
vto select characters,Vto select whole lines, orCtrl+vto select a block (columns). - Move the cursor to grow the selection.
- Press
yto copy,dto cut, orpto replace the selection with what you copied.
Moving lines up and down
LazyVim adds a handy shortcut for moving lines without cutting and pasting:
Alt+jmoves the current line (or selected lines) downAlt+kmoves it up
This works in Normal, Insert and Visual mode. Select a few lines with V and press Alt+j to move the whole block.
Indenting a selection
Select lines with V, then press > to indent or < to un-indent. LazyVim keeps the selection active, so you can press it repeatedly.
Moving text between files
- Copy or cut the text (
yy,ddor a Visual selection). - Open the other file with
Space Space, or switch buffer withShift+l. - Move to where you want it and press
p.
Clipboard history
Vim stores your recent copies and deletes in registers. Press Space s " to browse them and paste an older one.
4. Finding text in a file
Searching with /
- Press
/, type what you're looking for, and pressEnter. - Press
nto jump to the next match andNfor the previous one. - Press
Escto clear the highlighting.
Use ? instead of / to search backwards.
Searching for the word under your cursor
Put the cursor on a word and press * to jump to its next occurrence, or # to jump to the previous one.
Searching with a picker
Space s b searches the lines of the current file in a picker with a preview, which is easier when there are lots of matches.
Jumping to anything on screen with flash
Press s, then type two characters. LazyVim labels every match on screen. Press a label and your cursor jumps straight there. This is often faster than searching when the target is already visible.
Find and replace in the current file
Type this in Normal mode and press Enter:
:%s/old/new/g
%means the whole filegreplaces every match on each line- Add
cat the end (/gc) to confirm each replacement one at a time
5. Finding text anywhere in the project
| Keys | What it does |
|---|---|
Space / | Live search (grep) across the whole project |
Space s w | Search the project for the word under the cursor, or the selected text |
Space s G | Search from the current working directory instead of the project root |
Space s r | Search and replace across the project |
Space s R | Reopen your last search |
Space / updates results as you type, with a preview on the right. Press Enter to jump to a result.
Search and replace across files
Space s r opens a search-and-replace panel:
- Type the text to find in the Search field.
- Type the new text in the Replace field.
- Optionally narrow it down with the Files filter, for example
*.lua. - Review the preview, then apply the changes using the key shown at the top of the panel.
Always review the preview before replacing across a whole project, and commit first so you can undo it in lazygit if needed.
6. Navigating code
LazyVim sets up language servers so you can move through code like in an IDE.
| Keys | What it does |
|---|---|
gd | Go to definition |
gr | List references |
K | Show documentation for the symbol under the cursor |
Ctrl+o | Jump back to where you were |
Space c r | Rename a symbol everywhere |
Space c a | Code actions and quick fixes |
]d / [d | Next / previous problem |
Space x x | Full diagnostics list |
Space c f | Format the file |
Space c m | Open Mason to install language servers and formatters |
7. Using lazygit inside LazyVim
Opening lazygit
Press Space g g and lazygit opens in a floating window over your editor. Space g G does the same from your current working directory rather than the project root.
The layout
On the left are five panels: Status, Files, Branches, Commits and Stash. Press 1 to 5 to jump to one, or move between them with h / l or the arrow keys. The right side shows the diff for whatever you've selected.
Staging changes
In the Files panel (2):
Spacestages or unstages the selected fileastages everythingEnteropens the file's diff, whereSpacestages just the line or hunk under the cursor.Esctakes you back.
Committing, pushing and pulling
copens the commit message box. Type your message and pressEnter.P(capital) pushesp(lowercase) pulls
Branches
In the Branches panel (3):
ncreates a new branch and switches to itSpacechecks out the selected branch
Undo and help
zundoes your last git action, andZredoes it. Be careful with anything you've already pushed.?shows every shortcut for the panel you're inqcloses lazygit and returns you to your code
Quick git shortcuts without lazygit
| Keys | What it does |
|---|---|
Space g b | Blame for the current line |
Space g f | History of the current file |
Space g s | Git status picker |
Space g l | Git log |
Cheat sheet
LazyVim
| Keys | What it does |
|---|---|
Space (wait) | which-key menu of all commands |
Space Space | Find files |
Space e | Toggle file explorer |
Space , | List open buffers |
Shift+h / Shift+l | Previous / next buffer |
Space b d | Close buffer |
Space | / Space - | Split right / below |
Ctrl+h/j/k/l | Move between splits |
Ctrl+s | Save |
Space q q | Quit all |
Copy, cut and move
| Keys | What it does |
|---|---|
yy / dd | Copy / cut line |
yiw / diw | Copy / cut word |
p / P | Paste after / before |
v / V / Ctrl+v | Select characters / lines / block |
Alt+j / Alt+k | Move line or selection down / up |
u / Ctrl+r | Undo / redo |
Space s " | Browse clipboard history (registers) |
Find
| Keys | What it does |
|---|---|
/text then n / N | Search in file, next / previous |
* | Search for word under cursor |
s + 2 letters | Flash jump on screen |
Space s b | Search lines in current file |
:%s/old/new/g | Replace in current file |
Space / | Search the whole project |
Space s w | Search project for word under cursor |
Space s r | Search and replace across project |
Lazygit
| Keys | What it does |
|---|---|
Space g g | Open lazygit |
1–5 | Jump to panel |
Space | Stage / unstage (file, or line in diff view) |
a | Stage all |
c | Commit |
P / p | Push / pull |
n (Branches) | New branch |
z / Z | Undo / redo |
? | All keybindings |
q | Quit lazygit |
Final tip
Don't try to learn everything at once. Use LazyVim for a week, and every time you reach for the mouse, press Space and see whether which-key has an answer.
Want more? Check out the GrimStormZA channels on YouTube, Twitch and TikTok, and let me know what you'd like covered next: customising LazyVim, or a deeper lazygit guide with rebasing and cherry-picking.
Links
- #vim
- #linux
- #git
- #terminal