@@ -351,107 +351,131 @@ require('lazy').setup({
351
351
-- Use the `dependencies` key to specify the dependencies of a particular plugin
352
352
353
353
{ -- Fuzzy Finder (files, lsp, etc)
354
- ' nvim-telescope/telescope.nvim' ,
355
- event = ' VimEnter' ,
354
+ ' folke/snacks.nvim' ,
355
+ priority = 1000 ,
356
+ lazy = false ,
356
357
dependencies = {
357
- ' nvim-lua/plenary.nvim' ,
358
- { -- If encountering errors, see telescope-fzf-native README for installation instructions
359
- ' nvim-telescope/telescope-fzf-native.nvim' ,
360
-
361
- -- `build` is used to run some command when the plugin is installed/updated.
362
- -- This is only run then, not every time Neovim starts up.
363
- build = ' make' ,
364
-
365
- -- `cond` is a condition used to determine whether this plugin should be
366
- -- installed and loaded.
367
- cond = function ()
368
- return vim .fn .executable ' make' == 1
369
- end ,
370
- },
371
- { ' nvim-telescope/telescope-ui-select.nvim' },
372
-
373
358
-- Useful for getting pretty icons, but requires a Nerd Font.
374
359
{ ' nvim-tree/nvim-web-devicons' , enabled = vim .g .have_nerd_font },
375
360
},
376
- config = function ()
377
- -- Telescope is a fuzzy finder that comes with a lot of different things that
378
- -- it can fuzzy find! It's more than just a "file finder", it can search
379
- -- many different aspects of Neovim, your workspace, LSP, and more!
380
- --
381
- -- The easiest way to use Telescope, is to start by doing something like:
382
- -- :Telescope help_tags
383
- --
384
- -- After running this command, a window will open up and you're able to
385
- -- type in the prompt window. You'll see a list of `help_tags` options and
386
- -- a corresponding preview of the help.
387
- --
388
- -- Two important keymaps to use while in Telescope are:
389
- -- - Insert mode: <c-/>
390
- -- - Normal mode: ?
391
- --
392
- -- This opens a window that shows you all of the keymaps for the current
393
- -- Telescope picker. This is really useful to discover what Telescope can
394
- -- do as well as how to actually do it!
395
-
396
- -- [[ Configure Telescope ]]
397
- -- See `:help telescope` and `:help telescope.setup()`
398
- require (' telescope' ).setup {
399
- -- You can put your default mappings / updates / etc. in here
400
- -- All the info you're looking for is in `:help telescope.setup()`
401
- --
402
- -- defaults = {
403
- -- mappings = {
404
- -- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
405
- -- },
406
- -- },
407
- -- pickers = {}
408
- extensions = {
409
- [' ui-select' ] = {
410
- require (' telescope.themes' ).get_dropdown (),
411
- },
412
- },
413
- }
414
361
415
- -- Enable Telescope extensions if they are installed
416
- pcall (require (' telescope' ).load_extension , ' fzf' )
417
- pcall (require (' telescope' ).load_extension , ' ui-select' )
418
-
419
- -- See `:help telescope.builtin`
420
- local builtin = require ' telescope.builtin'
421
- vim .keymap .set (' n' , ' <leader>sh' , builtin .help_tags , { desc = ' [S]earch [H]elp' })
422
- vim .keymap .set (' n' , ' <leader>sk' , builtin .keymaps , { desc = ' [S]earch [K]eymaps' })
423
- vim .keymap .set (' n' , ' <leader>sf' , builtin .find_files , { desc = ' [S]earch [F]iles' })
424
- vim .keymap .set (' n' , ' <leader>ss' , builtin .builtin , { desc = ' [S]earch [S]elect Telescope' })
425
- vim .keymap .set (' n' , ' <leader>sw' , builtin .grep_string , { desc = ' [S]earch current [W]ord' })
426
- vim .keymap .set (' n' , ' <leader>sg' , builtin .live_grep , { desc = ' [S]earch by [G]rep' })
427
- vim .keymap .set (' n' , ' <leader>sd' , builtin .diagnostics , { desc = ' [S]earch [D]iagnostics' })
428
- vim .keymap .set (' n' , ' <leader>sr' , builtin .resume , { desc = ' [S]earch [R]esume' })
429
- vim .keymap .set (' n' , ' <leader>s.' , builtin .oldfiles , { desc = ' [S]earch Recent Files ("." for repeat)' })
430
- vim .keymap .set (' n' , ' <leader><leader>' , builtin .buffers , { desc = ' [ ] Find existing buffers' })
431
-
432
- -- Slightly advanced example of overriding default behavior and theme
433
- vim .keymap .set (' n' , ' <leader>/' , function ()
434
- -- You can pass additional configuration to Telescope to change the theme, layout, etc.
435
- builtin .current_buffer_fuzzy_find (require (' telescope.themes' ).get_dropdown {
436
- winblend = 10 ,
437
- previewer = false ,
438
- })
439
- end , { desc = ' [/] Fuzzily search in current buffer' })
440
-
441
- -- It's also possible to pass additional configuration options.
442
- -- See `:help telescope.builtin.live_grep()` for information about particular keys
443
- vim .keymap .set (' n' , ' <leader>s/' , function ()
444
- builtin .live_grep {
445
- grep_open_files = true ,
446
- prompt_title = ' Live Grep in Open Files' ,
447
- }
448
- end , { desc = ' [S]earch [/] in Open Files' })
362
+ -- snacks.nvim is a plugin that contains a collection of QoL improvements.
363
+ -- One of those plugins is called snacks-picker
364
+ -- It is a fuzzy finder, inspired by Telescope, that comes with a lot of different
365
+ -- things that it can fuzzy find! It's more than just a "file finder", it can search
366
+ -- many different aspects of Neovim, your workspace, LSP, and more!
367
+ --
368
+ -- Two important keymaps to use while in a picker are:
369
+ -- - Insert mode: <c-/>
370
+ -- - Normal mode: ?
371
+ --
372
+ -- This opens a window that shows you all of the keymaps for the current
373
+ -- Snacks picker. This is really useful to discover what nacks-picker can
374
+ -- do as well as how to actually do it!
449
375
376
+ -- [[ Configure Snacks Pickers ]]
377
+ -- See `:help snacks-picker` and `:help snacks-picker-setup`
378
+ --- @type snacks.Config
379
+ opts = {
380
+ picker = {},
381
+ },
382
+
383
+ -- See `:help snacks-pickers-sources`
384
+ keys = {
385
+ {
386
+ ' <leader>sh' ,
387
+ function ()
388
+ Snacks .picker .help ()
389
+ end ,
390
+ desc = ' [S]earch [H]elp' ,
391
+ },
392
+ {
393
+ ' <leader>sk' ,
394
+ function ()
395
+ Snacks .picker .keymaps ()
396
+ end ,
397
+ desc = ' [S]earch [K]eymaps' ,
398
+ },
399
+ {
400
+ ' <leader>sf' ,
401
+ function ()
402
+ Snacks .picker .smart ()
403
+ end ,
404
+ desc = ' [S]earch [F]iles' ,
405
+ },
406
+ {
407
+ ' <leader>ss' ,
408
+ function ()
409
+ Snacks .picker .pickers ()
410
+ end ,
411
+ desc = ' [S]earch [S]elect Snacks' ,
412
+ },
413
+ {
414
+ ' <leader>sw' ,
415
+ function ()
416
+ Snacks .picker .grep_word ()
417
+ end ,
418
+ desc = ' [S]earch current [W]ord' ,
419
+ mode = { ' n' , ' x' },
420
+ },
421
+ {
422
+ ' <leader>sg' ,
423
+ function ()
424
+ Snacks .picker .grep ()
425
+ end ,
426
+ desc = ' [S]earch by [G]rep' ,
427
+ },
428
+ {
429
+ ' <leader>sd' ,
430
+ function ()
431
+ Snacks .picker .diagnostics ()
432
+ end ,
433
+ desc = ' [S]earch [D]iagnostics' ,
434
+ },
435
+ {
436
+ ' <leader>sr' ,
437
+ function ()
438
+ Snacks .picker .resume ()
439
+ end ,
440
+ desc = ' [S]earch [R]esume' ,
441
+ },
442
+ {
443
+ ' <leader>s.' ,
444
+ function ()
445
+ Snacks .picker .recent ()
446
+ end ,
447
+ desc = ' [S]earch Recent Files ("." for repeat)' ,
448
+ },
449
+ {
450
+ ' <leader><leader>' ,
451
+ function ()
452
+ Snacks .picker .buffers ()
453
+ end ,
454
+ desc = ' [ ] Find existing buffers' ,
455
+ },
456
+ {
457
+ ' <leader>/' ,
458
+ function ()
459
+ Snacks .picker .lines {}
460
+ end ,
461
+ desc = ' [/] Fuzzily search in current buffer' ,
462
+ },
463
+ {
464
+ ' <leader>s/' ,
465
+ function ()
466
+ Snacks .picker .grep_buffers ()
467
+ end ,
468
+ desc = ' [S]earch [/] in Open Files' ,
469
+ },
450
470
-- Shortcut for searching your Neovim configuration files
451
- vim .keymap .set (' n' , ' <leader>sn' , function ()
452
- builtin .find_files { cwd = vim .fn .stdpath ' config' }
453
- end , { desc = ' [S]earch [N]eovim files' })
454
- end ,
471
+ {
472
+ ' <leader>sn' ,
473
+ function ()
474
+ Snacks .picker .files { cwd = vim .fn .stdpath ' config' }
475
+ end ,
476
+ desc = ' [S]earch [N]eovim files' ,
477
+ },
478
+ },
455
479
},
456
480
457
481
-- LSP Plugins
@@ -464,6 +488,7 @@ require('lazy').setup({
464
488
library = {
465
489
-- Load luvit types when the `vim.uv` word is found
466
490
{ path = ' ${3rd}/luv/library' , words = { ' vim%.uv' } },
491
+ { path = ' snacks.nvim' , words = { ' Snacks' } },
467
492
},
468
493
},
469
494
},
@@ -536,33 +561,32 @@ require('lazy').setup({
536
561
map (' gra' , vim .lsp .buf .code_action , ' [G]oto Code [A]ction' , { ' n' , ' x' })
537
562
538
563
-- Find references for the word under your cursor.
539
- map (' grr' , require (' telescope.builtin' ).lsp_references , ' [G]oto [R]eferences' )
540
-
564
+ map (' grr' , require (' snacks' ).picker .lsp_references , ' [G]oto [R]eferences' )
541
565
-- Jump to the implementation of the word under your cursor.
542
566
-- Useful when your language has ways of declaring types without an actual implementation.
543
- map (' gri' , require (' telescope.builtin ' ) .lsp_implementations , ' [G]oto [I]mplementation' )
567
+ map (' gri' , require (' snacks ' ). picker .lsp_implementations , ' [G]oto [I]mplementation' )
544
568
545
569
-- Jump to the definition of the word under your cursor.
546
570
-- This is where a variable was first declared, or where a function is defined, etc.
547
571
-- To jump back, press <C-t>.
548
- map (' grd' , require (' telescope.builtin ' ) .lsp_definitions , ' [G]oto [D]efinition' )
572
+ map (' grd' , require (' snacks ' ). picker .lsp_definitions , ' [G]oto [D]efinition' )
549
573
550
574
-- WARN: This is not Goto Definition, this is Goto Declaration.
551
575
-- For example, in C this would take you to the header.
552
576
map (' grD' , vim .lsp .buf .declaration , ' [G]oto [D]eclaration' )
553
577
554
578
-- Fuzzy find all the symbols in your current document.
555
579
-- Symbols are things like variables, functions, types, etc.
556
- map (' gO' , require (' telescope.builtin ' ).lsp_document_symbols , ' Open Document Symbols' )
580
+ map (' gO' , require (' snacks ' ).picker . lsp_symbols , ' Open Document Symbols' )
557
581
558
582
-- Fuzzy find all the symbols in your current workspace.
559
583
-- Similar to document symbols, except searches over your entire project.
560
- map (' gW' , require (' telescope.builtin ' ).lsp_dynamic_workspace_symbols , ' Open Workspace Symbols' )
584
+ map (' gW' , require (' snacks ' ).picker . lsp_workspace_symbols , ' Open Workspace Symbols' )
561
585
562
586
-- Jump to the type of the word under your cursor.
563
587
-- Useful when you're not sure what type a variable is and you want to see
564
588
-- the definition of its *type*, not where it was *defined*.
565
- map (' grt' , require (' telescope.builtin ' ) .lsp_type_definitions , ' [G]oto [T]ype Definition' )
589
+ map (' grt' , require (' snacks ' ). picker .lsp_type_definitions , ' [G]oto [T]ype Definition' )
566
590
567
591
-- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
568
592
--- @param client vim.lsp.Client
@@ -872,7 +896,7 @@ require('lazy').setup({
872
896
-- Change the name of the colorscheme plugin below, and then
873
897
-- change the command in the config to whatever the name of that colorscheme is.
874
898
--
875
- -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme `.
899
+ -- If you want to see what colorschemes are already installed, you can use `:lua Snacks.picker.colorschemes() `.
876
900
' folke/tokyonight.nvim' ,
877
901
priority = 1000 , -- Make sure to load this before all the other start plugins.
878
902
config = function ()
@@ -979,9 +1003,9 @@ require('lazy').setup({
979
1003
-- { import = 'custom.plugins' },
980
1004
--
981
1005
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
982
- -- Or use telescope !
1006
+ -- Or use the "help" snacks-picker !
983
1007
-- In normal mode type `<space>sh` then write `lazy.nvim-plugin`
984
- -- you can continue same window with `<space>sr` which resumes last telescope search
1008
+ -- you can continue same window with `<space>sr` which resumes last snacks-picker search
985
1009
}, {
986
1010
ui = {
987
1011
-- If you are using a Nerd Font: set icons to an empty table which will use the
0 commit comments