@@ -347,108 +347,52 @@ require('lazy').setup({
347
347
-- Use the `dependencies` key to specify the dependencies of a particular plugin
348
348
349
349
{ -- Fuzzy Finder (files, lsp, etc)
350
- 'nvim-telescope/telescope.nvim',
351
- event = 'VimEnter',
350
+ 'folke/snacks.nvim',
351
+ priority = 1000,
352
+ lazy = false,
352
353
dependencies = {
353
- 'nvim-lua/plenary.nvim',
354
- { -- If encountering errors, see telescope-fzf-native README for installation instructions
355
- 'nvim-telescope/telescope-fzf-native.nvim',
356
-
357
- -- `build` is used to run some command when the plugin is installed/updated.
358
- -- This is only run then, not every time Neovim starts up.
359
- build = 'make',
360
-
361
- -- `cond` is a condition used to determine whether this plugin should be
362
- -- installed and loaded.
363
- cond = function() return vim.fn.executable 'make' == 1 end,
364
- },
365
- { 'nvim-telescope/telescope-ui-select.nvim' },
366
-
367
354
-- Useful for getting pretty icons, but requires a Nerd Font.
368
355
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
369
356
},
370
- config = function()
371
- -- Telescope is a fuzzy finder that comes with a lot of different things that
372
- -- it can fuzzy find! It's more than just a "file finder", it can search
373
- -- many different aspects of Neovim, your workspace, LSP, and more!
374
- --
375
- -- The easiest way to use Telescope, is to start by doing something like:
376
- -- :Telescope help_tags
377
- --
378
- -- After running this command, a window will open up and you're able to
379
- -- type in the prompt window. You'll see a list of `help_tags` options and
380
- -- a corresponding preview of the help.
381
- --
382
- -- Two important keymaps to use while in Telescope are:
383
- -- - Insert mode: <c-/>
384
- -- - Normal mode: ?
385
- --
386
- -- This opens a window that shows you all of the keymaps for the current
387
- -- Telescope picker. This is really useful to discover what Telescope can
388
- -- do as well as how to actually do it!
389
-
390
- -- [[ Configure Telescope ]]
391
- -- See `:help telescope` and `:help telescope.setup()`
392
- require('telescope').setup {
393
- -- You can put your default mappings / updates / etc. in here
394
- -- All the info you're looking for is in `:help telescope.setup()`
395
- --
396
- -- defaults = {
397
- -- mappings = {
398
- -- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
399
- -- },
400
- -- },
401
- -- pickers = {}
402
- extensions = {
403
- ['ui-select'] = {
404
- require('telescope.themes').get_dropdown(),
405
- },
406
- },
407
- }
408
357
409
- -- Enable Telescope extensions if they are installed
410
- pcall(require('telescope').load_extension, 'fzf')
411
- pcall(require('telescope').load_extension, 'ui-select')
412
-
413
- -- See `:help telescope.builtin`
414
- local builtin = require 'telescope.builtin'
415
- vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
416
- vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
417
- vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
418
- vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
419
- vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
420
- vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
421
- vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
422
- vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
423
- vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
424
- vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
425
-
426
- -- Slightly advanced example of overriding default behavior and theme
427
- vim.keymap.set('n', '<leader>/', function()
428
- -- You can pass additional configuration to Telescope to change the theme, layout, etc.
429
- builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
430
- winblend = 10,
431
- previewer = false,
432
- })
433
- end, { desc = '[/] Fuzzily search in current buffer' })
434
-
435
- -- It's also possible to pass additional configuration options.
436
- -- See `:help telescope.builtin.live_grep()` for information about particular keys
437
- vim.keymap.set(
438
- 'n',
439
- '<leader>s/',
440
- function()
441
- builtin.live_grep {
442
- grep_open_files = true,
443
- prompt_title = 'Live Grep in Open Files',
444
- }
445
- end,
446
- { desc = '[S]earch [/] in Open Files' }
447
- )
358
+ -- snacks.nvim is a plugin that contains a collection of QoL improvements.
359
+ -- One of those plugins is called snacks-picker
360
+ -- It is a fuzzy finder, inspired by Telescope, that comes with a lot of different
361
+ -- things that it can fuzzy find! It's more than just a "file finder", it can search
362
+ -- many different aspects of Neovim, your workspace, LSP, and more!
363
+ --
364
+ -- Two important keymaps to use while in a picker are:
365
+ -- - Insert mode: <c-/>
366
+ -- - Normal mode: ?
367
+ --
368
+ -- This opens a window that shows you all of the keymaps for the current
369
+ -- Snacks picker. This is really useful to discover what nacks-picker can
370
+ -- do as well as how to actually do it!
371
+
372
+ -- [[ Configure Snacks Pickers ]]
373
+ -- See `:help snacks-picker` and `:help snacks-picker-setup`
374
+ ---@type snacks.Config
375
+ opts = {
376
+ picker = {},
377
+ },
448
378
379
+ -- See `:help snacks-pickers-sources`
380
+ keys = {
381
+ { '<leader>sh', function() Snacks.picker.help() end, desc = '[S]earch [H]elp' },
382
+ { '<leader>sk', function() Snacks.picker.keymaps() end, desc = '[S]earch [K]eymaps' },
383
+ { '<leader>sf', function() Snacks.picker.smart() end, desc = '[S]earch [F]iles' },
384
+ { '<leader>ss', function() Snacks.picker.pickers() end, desc = '[S]earch [S]elect Snacks' },
385
+ { '<leader>sw', function() Snacks.picker.grep_word() end, desc = '[S]earch current [W]ord', mode = { 'n', 'x' } },
386
+ { '<leader>sg', function() Snacks.picker.grep() end, desc = '[S]earch by [G]rep' },
387
+ { '<leader>sd', function() Snacks.picker.diagnostics() end, desc = '[S]earch [D]iagnostics' },
388
+ { '<leader>sr', function() Snacks.picker.resume() end, desc = '[S]earch [R]esume' },
389
+ { '<leader>s.', function() Snacks.picker.recent() end, desc = '[S]earch Recent Files ("." for repeat)' },
390
+ { '<leader><leader>', function() Snacks.picker.buffers() end, desc = '[ ] Find existing buffers' },
391
+ { '<leader>/', function() Snacks.picker.lines {} end, desc = '[/] Fuzzily search in current buffer' },
392
+ { '<leader>s/', function() Snacks.picker.grep_buffers() end, desc = '[S]earch [/] in Open Files' },
449
393
-- Shortcut for searching your Neovim configuration files
450
- vim.keymap.set('n', '<leader>sn', function() builtin.find_files { cwd = vim.fn.stdpath 'config' } end, { desc = '[S]earch [N]eovim files' })
451
- end ,
394
+ { '<leader>sn', function() Snacks.picker.files { cwd = vim.fn.stdpath 'config' } end, desc = '[S]earch [N]eovim files' },
395
+ } ,
452
396
},
453
397
454
398
-- LSP Plugins
@@ -533,33 +477,32 @@ require('lazy').setup({
533
477
map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' })
534
478
535
479
-- Find references for the word under your cursor.
536
- map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
537
-
480
+ map('grr', require('snacks').picker.lsp_references, '[G]oto [R]eferences')
538
481
-- Jump to the implementation of the word under your cursor.
539
482
-- Useful when your language has ways of declaring types without an actual implementation.
540
- map('gri', require('telescope.builtin') .lsp_implementations, '[G]oto [I]mplementation')
483
+ map('gri', require('snacks').picker .lsp_implementations, '[G]oto [I]mplementation')
541
484
542
485
-- Jump to the definition of the word under your cursor.
543
486
-- This is where a variable was first declared, or where a function is defined, etc.
544
487
-- To jump back, press <C-t>.
545
- map('grd', require('telescope.builtin') .lsp_definitions, '[G]oto [D]efinition')
488
+ map('grd', require('snacks').picker .lsp_definitions, '[G]oto [D]efinition')
546
489
547
490
-- WARN: This is not Goto Definition, this is Goto Declaration.
548
491
-- For example, in C this would take you to the header.
549
492
map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
550
493
551
494
-- Fuzzy find all the symbols in your current document.
552
495
-- Symbols are things like variables, functions, types, etc.
553
- map('gO', require('telescope.builtin ').lsp_document_symbols , 'Open Document Symbols')
496
+ map('gO', require('snacks ').picker.lsp_symbols , 'Open Document Symbols')
554
497
555
498
-- Fuzzy find all the symbols in your current workspace.
556
499
-- Similar to document symbols, except searches over your entire project.
557
- map('gW', require('telescope.builtin ').lsp_dynamic_workspace_symbols , 'Open Workspace Symbols')
500
+ map('gW', require('snacks ').picker.lsp_workspace_symbols , 'Open Workspace Symbols')
558
501
559
502
-- Jump to the type of the word under your cursor.
560
503
-- Useful when you're not sure what type a variable is and you want to see
561
504
-- the definition of its *type*, not where it was *defined*.
562
- map('grt', require('telescope.builtin') .lsp_type_definitions, '[G]oto [T]ype Definition')
505
+ map('grt', require('snacks').picker .lsp_type_definitions, '[G]oto [T]ype Definition')
563
506
564
507
-- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
565
508
---@param client vim.lsp.Client
@@ -865,7 +808,7 @@ require('lazy').setup({
865
808
-- Change the name of the colorscheme plugin below, and then
866
809
-- change the command in the config to whatever the name of that colorscheme is.
867
810
--
868
- -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme `.
811
+ -- If you want to see what colorschemes are already installed, you can use `:lua Snacks.picker.colorschemes() `.
869
812
'folke/tokyonight.nvim',
870
813
priority = 1000, -- Make sure to load this before all the other start plugins.
871
814
config = function()
@@ -970,9 +913,9 @@ require('lazy').setup({
970
913
-- { import = 'custom.plugins' },
971
914
--
972
915
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
973
- -- Or use telescope !
916
+ -- Or use the "help" snacks-picker !
974
917
-- In normal mode type `<space>sh` then write `lazy.nvim-plugin`
975
- -- you can continue same window with `<space>sr` which resumes last telescope search
918
+ -- you can continue same window with `<space>sr` which resumes last snacks-picker search
976
919
}, {
977
920
ui = {
978
921
-- If you are using a Nerd Font: set icons to an empty table which will use the
0 commit comments