lua/plugins/snacks.lua
Core features
Picker
Fuzzy finder for files, grep, buffers, LSP, and more
Explorer
File explorer with diagnostics and git integration
Notifier
Notification system with history
Dashboard
Startup dashboard with quick actions
Scratch buffers
Temporary note-taking buffers
Zen mode
Distraction-free editing modes
Picker
The picker is the primary way to find and navigate files, code, and git objects.File finding
| Key | Action | Description |
|---|---|---|
<leader>ff | Find files | Search files in current directory |
<leader><leader> | Smart find | Auto-detect git root or use cwd |
<leader>fr | Recent files | Browse recently opened files |
<leader>fp | Projects | Switch between projects |
<leader>nc | Config files | Search Neovim config directory |
lua/plugins/snacks.lua
The picker automatically shows hidden files (dotfiles) by default.
Text searching
| Key | Action | Description |
|---|---|---|
<leader>fa | Grep all | Live grep across all files |
<leader>fv | Grep word | Search for word under cursor or visual selection |
lua/plugins/snacks.lua
Buffer management
lua/plugins/snacks.lua
Press
d on any buffer in the picker to delete it without opening.LSP navigation
Snacks picker powers all LSP navigation:- Definitions
- References
- Symbols
gd - Go to definition with auto-confirm for single resultsGit pickers
| Key | Command | Description |
|---|---|---|
<leader>gl | Git log line | Commits that modified current line |
<leader>gd | Git diff | Browse all changed hunks |
<leader>gS | Git stash | Manage stashes interactively |
<leader>go | Git browse | Open file on GitHub/GitLab |
lua/plugins/snacks.lua
Search utilities
| Key | Action | Description |
|---|---|---|
<leader>sh | Help pages | Search Neovim help documentation |
<leader>sk | Keymaps | Browse all keybindings |
<leader>sC | Commands | Search Neovim commands |
<leader>sd | Diagnostics | Buffer diagnostics |
<leader>sD | Diagnostics | Workspace diagnostics |
<leader>sp | Plugins | Search plugin specs |
<leader>su | Undo history | Browse undo tree |
<leader>sm | Marks | Browse marks |
<leader>sj | Jumps | Browse jump list |
<leader>sr | Resume | Resume last picker |
Picker keybindings
Inside any picker window:| Key | Action | Description |
|---|---|---|
<Esc> | Close | Close picker (normal and insert mode) |
<M-p> | Cycle layouts | Switch between layout presets |
<Tab> | Focus preview | Jump to preview window |
J | Scroll down | Scroll preview down (normal mode) |
K | Scroll up | Scroll preview up (normal mode) |
H | Scroll left | Scroll preview left (normal mode) |
L | Scroll right | Scroll preview right (normal mode) |
lua/plugins/snacks.lua
Picker configuration
lua/plugins/snacks.lua
Explorer
File explorer with git status and diagnostics integration.Opening explorer
lua/plugins/snacks.lua
Configuration
lua/plugins/snacks.lua
Features
Git integration
Shows git status indicators for files
Diagnostics
Auto-opens folders with errors/warnings
Netrw replacement
Replaces default file explorer
Line numbers
Shows absolute line numbers in list
Notifications
Beautiful notification system with history.Usage
Configuration
lua/plugins/snacks.lua
Managing notifications
| Key | Action | Description |
|---|---|---|
<leader>nh | History | Show notification history |
<leader>un | Dismiss | Dismiss all notifications |
lua/plugins/snacks.lua
Scratch buffers
Temporary buffers for notes and experiments.| Key | Action | Description |
|---|---|---|
<leader>. | Scratch | Toggle scratch buffer |
<leader>S | Select | Select from multiple scratch buffers |
lua/plugins/snacks.lua
Scratch buffers are persisted across sessions. Use them for quick notes, calculations, or testing code snippets.
Zen mode
Distraction-free editing with two modes:- Zen mode
- Zoom mode
<leader>z - Full zen mode with hidden UI elementsDashboard
Startup dashboard with quick actions:lua/plugins/snacks.lua
Indent guides
Animated indent guides with scope highlighting:lua/plugins/snacks.lua
Toggle indent guides with
<leader>ug.Utility functions
Buffer operations
| Key | Action | Description |
|---|---|---|
<leader>bd | Delete buffer | Smart buffer deletion |
<leader>cR | Rename file | Rename file and update imports |
lua/plugins/snacks.lua
Word navigation
| Key | Action | Description |
|---|---|---|
<leader>fn | Next reference | Jump to next reference of word under cursor |
<leader>fN | Prev reference | Jump to previous reference |
Toggles
Snacks provides convenient toggles for various options:| Key | Toggle | Description |
|---|---|---|
<leader>us | Spelling | Toggle spell check |
<leader>uw | Wrap | Toggle line wrapping |
<leader>uL | Relative number | Toggle relative line numbers |
<leader>ud | Diagnostics | Toggle diagnostic display |
<leader>ul | Line number | Toggle line numbers |
<leader>uc | Conceal | Toggle conceallevel |
<leader>uT | Treesitter | Toggle treesitter highlighting |
<leader>ub | Background | Toggle light/dark background |
<leader>ug | Indent guides | Toggle indent guides |
<leader>uD | Dim | Toggle dim inactive windows |
lua/plugins/snacks.lua
Input dialogs
Snacks provides improved input dialogs:lua/plugins/snacks.lua
vim.ui.input() calls use Snacks input for better UI.
Advanced configuration
Custom layouts
The configuration uses custom layouts defined inutils/snacks_picker.lua:
lua/plugins/snacks.lua
File exclusions
lua/plugins/snacks.lua
Integration with other plugins
Snacks integrates with:- Neogit: Git operations use Snacks pickers
- Trouble: Send picker results to Trouble with
<c-t> - CodeDiff: Git browsing uses Snacks for stash management
Performance
High priority
Loaded early (priority = 1000) for immediate availability
Not lazy
Always loaded to ensure utilities are ready
Frecency sorting
Intelligent file ranking based on frequency and recency
Efficient rendering
Optimized for large directories and search results