How do I add floating scratch buffers, a built-in file picker, and lazygit integration in Neovim using a single plugin?
Answer
folke/snacks.nvim
Explanation
snacks.nvim by folke is a curated collection of small, high-quality Neovim utilities packaged as a single plugin. Unlike mega-plugins, each "snack" can be independently enabled or disabled, so you only pay for what you use.
How it works
Install with lazy.nvim:
{
'folke/snacks.nvim',
priority = 1000,
lazy = false,
opts = {
picker = { enabled = true }, -- fuzzy file picker
terminal = { enabled = true }, -- floating terminal
scratch = { enabled = true }, -- scratch buffer
lazygit = { enabled = true }, -- lazygit integration
notifier = { enabled = true }, -- notification UI
bigfile = { enabled = true }, -- auto-disable for large files
words = { enabled = true }, -- highlight word occurrences
},
}
Key commands once installed:
:lua Snacks.picker.files()— fuzzy file picker (replaces Telescope for common cases):lua Snacks.picker.grep()— live grep across project:lua Snacks.terminal()— floating terminal (toggle with a mapping):lua Snacks.scratch()— open a persistent scratch buffer:lua Snacks.lazygit()— open lazygit in a floating window:lua Snacks.words.jump(1)— jump to next occurrence of word under cursor
Tips
Snacks.pickeris highly competitive with Telescope but has faster startup since it's Lua-native with no Plenary dependencySnacks.bigfileautomatically disables Treesitter, LSP, and other features for files over a configurable size threshold — crucial for opening logs or minified files- Add keymaps via lazy.nvim's
keysarray for zero-overhead lazy loading Snacks.toggleprovides consistent toggle functions fordiagnostics,inlay hints,spell check, and more with LSP-aware behavior