LazyGit Integration
lazygit.nvim embeds the powerful LazyGit terminal UI directly into Neovim, providing a beautiful and efficient way to interact with Git.What is LazyGit?
LazyGit is a simple terminal UI for git commands. It provides:- Visual interface for git operations
- Keyboard-driven workflow
- Staging/unstaging changes
- Interactive commits
- Branch management
- Merge conflict resolution
- Git log visualization
- Stash management
Features
- Full LazyGit Access: Complete LazyGit functionality within Neovim
- Floating Window: Opens in a floating terminal window
- Multiple Commands: Access different LazyGit modes
- Seamless Integration: Stays in your editor workflow
Keybindings
| Keybinding | Action | Description |
|---|---|---|
<leader>ll | LazyGit | Open LazyGit in floating window |
Available Commands
While the primary keybinding is<leader>ll, you can also use these commands:
:LazyGit- Open LazyGit (same as<leader>ll):LazyGitConfig- Open LazyGit configuration:LazyGitCurrentFile- Open LazyGit for current file:LazyGitFilter- Open LazyGit with filter:LazyGitFilterCurrentFile- Filter LazyGit to current file
LazyGit Workflow
Basic Workflow
-
Open LazyGit
-
Navigate Panels
- Use
1,2,3,4,5to switch between panels 1: Status/Files2: Branches3: Commits4: Stash
- Use
-
Stage Changes
-
Commit Changes
-
Push Changes
-
Close LazyGit
Common LazyGit Operations
Staging and Committing
Branch Management
Viewing History
Merge Conflict Resolution
Stashing Changes
LazyGit Keybindings (Inside LazyGit)
Navigation
| Key | Action |
|---|---|
1, 2, 3, 4, 5 | Switch between panels |
j / k | Move down/up |
<C-d> / <C-u> | Scroll down/up |
[ / ] | Previous/next tab |
Files Panel
| Key | Action |
|---|---|
Space | Stage/unstage file |
a | Stage all files |
A | Unstage all files |
d | Discard changes |
e | Edit file |
o | Open file |
i | Ignore file |
r | Refresh files |
c | Commit changes |
C | Commit with editor |
Branches Panel
| Key | Action |
|---|---|
Space | Checkout branch |
n | New branch |
d | Delete branch |
r | Rebase branch |
M | Merge into current |
f | Fast-forward |
P | Push branch |
p | Pull branch |
Commits Panel
| Key | Action |
|---|---|
Enter | View commit details |
c | Checkout commit |
C | Copy commit SHA |
r | Revert commit |
R | Rename commit |
d | Delete commit |
s | Squash commit |
General
| Key | Action |
|---|---|
? | Open help |
q | Quit LazyGit |
P | Push |
p | Pull |
R | Refresh |
+ / - | Increase/decrease context |
Configuration
Location:lua/magictt/plugins/lazygit.lua
Git-Aware Plugins
Several other Magictt plugins integrate with Git:nvim-tree Git Integration
nvim-tree shows git status for files in the file explorer.Git Status Icons
In nvim-tree, files are marked with git status:- ✓ Staged file
- ✗ Deleted file
- ★ Renamed file
- ✚ Untracked file
- ● Modified file
- ◌ Ignored file
Features
- Visual Indicators: See file status at a glance
- Not Ignored: Shows .gitignored files (configurable)
- Folder Status: Folders show aggregated status of contents
Configuration
Fromlua/magictt/plugins/nvim-tree.lua:
Telescope Git Integration
Telescope has built-in git pickers (not configured by default, but available). You can add these git-related Telescope commands:lua/magictt/plugins/telescope.lua:
Lualine Git Integration
lualine automatically shows git information in the statusline:- Current branch name
- Diff stats (added, modified, removed lines)
- Which branch you’re on
- How many changes you have
TODO Comments Git Integration
todo-comments.nvim helps track TODO items that often relate to git workflows:<leader>ft to view all TODOs with Telescope.
Use <leader>xt to view TODOs in Trouble.
Git Workflow Recommendations
Daily Workflow
Morning: Start Work
During Development
Before Pushing
Merge Conflict Resolution
Feature Branch Workflow
Keybindings Summary
Primary Git Keybinding
| Keybinding | Action |
|---|---|
<leader>ll | Open LazyGit |
Git-Related Keybindings
| Keybinding | Action | Plugin |
|---|---|---|
<leader>ll | LazyGit | lazygit.nvim |
<leader>ft | Find TODOs | todo-comments (git-related) |
<leader>xt | Trouble TODOs | trouble.nvim |
<leader>ee | File tree (git status) | nvim-tree |
Optional Telescope Git Keybindings
Add these to your config if desired:| Keybinding | Action |
|---|---|
<leader>gc | Git commits |
<leader>gb | Git branches |
<leader>gs | Git status |
Prerequisites
LazyGit Installation
LazyGit must be installed separately: macOS:Git Configuration
Ensure Git is properly configured:Customization
LazyGit Configuration
LazyGit has its own configuration file at:- macOS/Linux:
~/.config/lazygit/config.yml - Windows:
%APPDATA%\lazygit\config.yml
Change LazyGit Keybinding
Editlua/magictt/plugins/lazygit.lua:
Add Telescope Git Pickers
Editlua/magictt/plugins/telescope.lua to add:
Configure nvim-tree Git Display
Editlua/magictt/plugins/nvim-tree.lua:
Troubleshooting
LazyGit Not Found
If you see “lazygit not found” error:- Install LazyGit (see Prerequisites)
- Ensure it’s in your PATH:
which lazygit - Restart Neovim
LazyGit Won’t Open
- Check LazyGit works standalone:
lazygitin terminal - Check Neovim terminal:
:terminal lazygit - Check plugin is loaded:
:Lazy
Git Status Not Showing in nvim-tree
- Ensure you’re in a git repository:
git status - Refresh tree:
<leader>er - Check git is enabled in config
Tips and Tricks
LazyGit
- Use
?inside LazyGit to see all keybindings - Press
+or-to increase/decrease diff context - Use
:LazyGitCurrentFileto focus on current file’s history - Customize LazyGit colors to match your theme
Git Workflow
- Commit frequently with descriptive messages
- Use TODO comments for work in progress
- Review diffs before committing
- Keep branches up to date with rebase
- Use stash for temporary changes
Integration
- Open LazyGit while file tree is open for full project view
- Use Telescope to search commits:
:Telescope git_commits - Check statusline for branch name and changes
- Use
<leader>xtto see all TODOs before committing
Related Documentation
Plugin Overview
See all installed plugins
Keybindings
Complete keybinding reference
File Navigation
nvim-tree and other navigation tools