File Navigation in LazyVim
File Navigation in LazyVim
Fast file navigation is the foundation of efficient coding. LazyVim provides multiple tools for finding and opening filesβlearn when to use each one.
The Three Ways to Navigate
- Telescope - Fuzzy finding (most common)
- Neo-tree - File explorer (visual browsing)
- Buffer navigation - Switch between open files
Telescope - Fuzzy Finding
Telescope is your primary navigation tool. It's a fuzzy finder that searches files, text, symbols, and more.
Find Files
Space + f + f
How it works:
- Type partial filename (fuzzy match)
- No need for exact matches or paths
- Instant results as you type
Examples:
# Project structure:
src/components/UserProfile.tsx
src/utils/formatDate.ts
tests/components/UserProfile.test.tsx
# Find "UserProfile.tsx":
Space + f + f
Type: "upro" β Matches UserProfile.tsx
Type: "userpro" β Also matches
Type: "cmp/user" β Also matches (path aware)
Pro tips:
- Use
Ctrl+j/Ctrl+kto move down/up in results Enterto open fileCtrl+xto open in horizontal splitCtrl+vto open in vertical splitCtrl+tto open in new tab
Search Text in Files (Grep)
Space + s + g
Find any text across your entire project:
Space + s + g
Type: "function handleClick"
β Shows all files containing that text
β Shows line number and preview
Use cases:
- Find where a function is defined
- Find all TODOs
- Find API endpoint usage
- Find error messages
Pro tip: Use regex:
Space + s + g
Type: "const.*=.*useState"
β Finds all useState declarations
Find Recent Files
Space + f + r
Shows files you recently opened:
- Faster than fuzzy finding when you just edited a file
- Great for switching between 2-3 files repeatedly
Find Buffers (Open Files)
Space + f + b
Lists currently open files:
- Use this instead of cycling with
:bn/:bp - Type partial filename to filter
Example workflow:
# You have 10 files open
Space + f + b
Type: "user"
β Shows only UserProfile.tsx, UserSettings.tsx
Enter β Opens selected file
Find Symbols (Go to Symbol)
Space + s + s
Shows all functions, classes, variables in current file:
javascript// Your file has: function handleSubmit() {} function validateForm() {} const API_URL = "..." class UserService {} Space + s + s Type: "valid" β Jump directly to validateForm()
Great for navigating large files without scrolling.
Find Git Files
Space + f + g
Only shows files tracked by git:
- Ignores node_modules, build artifacts, etc.
- Faster than
Space + f + fin large repos
Neo-tree - File Explorer
Visual file browser for when you need to see directory structure.
Toggle Explorer
Space + e
Navigation:
j/k- Move up/downEnter- Open file or expand foldera- Create new file/folderd- Deleter- Renamec- Copyx- Cutp- Pasteq- Close explorer
Keybindings in Neo-tree:
| Key | Action |
|---|---|
a | Add (create file/folder) |
d | Delete |
r | Rename |
c | Copy |
x | Cut |
p | Paste |
y | Copy filename |
Y | Copy relative path |
gy | Copy absolute path |
o | Open file |
s | Open in split |
t | Open in tab |
When to Use Neo-tree
Use Neo-tree when:
- β Exploring unfamiliar codebase
- β Need to see folder structure
- β Creating/deleting/renaming multiple files
- β Visual context helps you think
Use Telescope when:
- β You know the filename
- β Quick file switching
- β Searching for text
- β You're already in flow state
Buffer Navigation
Buffers are open files in memory.
Switch Between Buffers
]b # Next buffer
[b # Previous buffer
Or use Telescope:
Space + f + b
Close Buffer
Space + b + d # Close current buffer
List All Buffers
Space + f + b # Telescope buffer search
Or see buffer list:
:buffers # Show numbered list
:b <number> # Jump to buffer number
:b <partial> # Jump to buffer by partial name
Window (Split) Navigation
Windows are the visible panes on screen.
Navigate Between Windows
Ctrl + h # Left window
Ctrl + j # Down window
Ctrl + k # Up window
Ctrl + l # Right window
Create Splits
Ctrl + w + s # Horizontal split
Ctrl + w + v # Vertical split
Close Window
Ctrl + w + c # Close current window
Ctrl + w + o # Close all other windows (keep current)
Resize Windows
Ctrl + w + = # Equal size
Ctrl + w + > # Wider
Ctrl + w + < # Narrower
Ctrl + w + + # Taller
Ctrl + w + - # Shorter
Tab Navigation
Tabs are collections of windows.
Tab Management
Space + <tab> + l # List tabs
Space + <tab> + n # New tab
Space + <tab> + d # Close tab
gt # Next tab
gT # Previous tab
Tabs are useful when:
- Working on two separate features simultaneously
- Keeping different contexts (e.g., code vs config files)
Most people don't need tabsβbuffers + splits are enough.
Real-World Workflows
Scenario 1: "I need to edit UserProfile.tsx"
Method 1: Telescope (fastest)
Space + f + f
Type: "upro"
Enter
Method 2: Neo-tree (visual)
Space + e
Navigate to src/components/
Enter on UserProfile.tsx
Scenario 2: "Where is the login function defined?"
Space + s + g
Type: "function login"
Enter on result
Scenario 3: "Switch between 3 files I'm actively editing"
# First time: Open via Telescope
Space + f + f β Open File1
Space + f + f β Open File2
Space + f + f β Open File3
# Then: Quick switch via buffers
Space + f + b
Type partial filename
Enter
Scenario 4: "Navigate large file"
# Inside the file:
Space + s + s # Symbol search
Type function name
Enter β Jump there
Scenario 5: "Explore new codebase"
Space + e # Open file explorer
Navigate folders
j/k to move
Enter to open files
Advanced Techniques
Jump to Definition (LSP)
gd # Go to definition
This is NOT file navigationβit's code intelligence:
- Cursor on a function name
- Press
gd - Jumps to where it's defined (even in another file)
Go back:
Ctrl + o # Jump back
Ctrl + i # Jump forward
Jump List
Neovim tracks everywhere you've been:
Ctrl + o # Jump to older position
Ctrl + i # Jump to newer position
Example:
1. You're in File A
2. Press gd β Jump to File B
3. Press gd β Jump to File C
4. Press Ctrl+o β Back to File B
5. Press Ctrl+o β Back to File A
Marks
Set marks to bookmark locations:
m + a # Set mark 'a' at cursor
`a # Jump to mark 'a'
:marks # List all marks
Use marks for:
- Temporary bookmarks within a file
- Quick navigation between important spots
Search and Replace in Multiple Files
# 1. Find all occurrences
Space + s + g
Type: "oldFunction"
# 2. Send results to quickfix list
Ctrl + q
# 3. Search and replace
:cdo s/oldFunction/newFunction/g
# 4. Save all changes
:wa
Keyboard Shortcut Summary
| Action | Keybinding | When to Use |
|---|---|---|
| Find files | Space f f | Know filename, quick navigation |
| Find text | Space s g | Search across all files |
| Recent files | Space f r | Recently edited files |
| File explorer | Space e | Visual browsing, creating files |
| Buffers | Space f b | Switch between open files |
| Symbols | Space s s | Navigate within file |
| Next buffer | ]b | Cycle through open files |
| Go to def | gd | Jump to function definition |
| Jump back | Ctrl o | Undo jump |
| Jump forward | Ctrl i | Redo jump |
Pro Tips
- Default to Telescope - It's fast and works for 90% of navigation
- Learn fuzzy matching - Type "upr" instead of "UserProfile", it's faster
- Use Neo-tree sparingly - Only when you need visual context
- Master jump list (Ctrl+o / Ctrl+i) - Navigate your code history
- Don't overuse tabs - Buffers are usually enough
- Memorize
gd- Jump to definition is the most used LSP feature
Common Mistakes
β Using arrow keys in Telescope β Use Ctrl+j / Ctrl+k instead (faster)
β Scrolling through file explorer β Use Telescope fuzzy find instead
β Opening too many splits β Keep it simple: 2-3 splits max
β Not learning jump list β Ctrl+o is how you navigate code efficiently
Related:
- LazyVim Setup - Initial configuration
- Code Editing Workflows - Once you've found the file
- LSP and Code Intelligence - Using gd, gr, and other LSP features
- Neovim - The Vim Ecosystem - Understanding the bigger picture