@@ -347,108 +347,50 @@ require('lazy').setup({
347347 -- Use the `dependencies` key to specify the dependencies of a particular plugin
348348
349349 { -- Fuzzy Finder (files, lsp, etc)
350- ' nvim-telescope/telescope.nvim' ,
351- event = ' VimEnter' ,
350+ ' folke/snacks.nvim' ,
352351 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-
367352 -- Useful for getting pretty icons, but requires a Nerd Font.
368353 { ' nvim-tree/nvim-web-devicons' , enabled = vim .g .have_nerd_font },
369354 },
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- }
408355
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- )
356+ -- snacks.nvim is a plugin that contains a collection of QoL improvements.
357+ -- One of those plugins is called snacks-picker
358+ -- It is a fuzzy finder, inspired by Telescope, that comes with a lot of different
359+ -- things that it can fuzzy find! It's more than just a "file finder", it can search
360+ -- many different aspects of Neovim, your workspace, LSP, and more!
361+ --
362+ -- Two important keymaps to use while in a picker are:
363+ -- - Insert mode: <c-/>
364+ -- - Normal mode: ?
365+ --
366+ -- This opens a window that shows you all of the keymaps for the current
367+ -- Snacks picker. This is really useful to discover what nacks-picker can
368+ -- do as well as how to actually do it!
369+
370+ -- [[ Configure Snacks Pickers ]]
371+ -- See `:help snacks-picker` and `:help snacks-picker-setup`
372+ --- @type snacks.Config
373+ opts = {
374+ picker = {},
375+ },
448376
377+ -- See `:help snacks-pickers-sources`
378+ keys = {
379+ { ' <leader>sh' , function () Snacks .picker .help () end , desc = ' [S]earch [H]elp' },
380+ { ' <leader>sk' , function () Snacks .picker .keymaps () end , desc = ' [S]earch [K]eymaps' },
381+ { ' <leader>sf' , function () Snacks .picker .smart () end , desc = ' [S]earch [F]iles' },
382+ { ' <leader>ss' , function () Snacks .picker .pickers () end , desc = ' [S]earch [S]elect Snacks' },
383+ { ' <leader>sw' , function () Snacks .picker .grep_word () end , desc = ' [S]earch current [W]ord' , mode = { ' n' , ' x' } },
384+ { ' <leader>sg' , function () Snacks .picker .grep () end , desc = ' [S]earch by [G]rep' },
385+ { ' <leader>sd' , function () Snacks .picker .diagnostics () end , desc = ' [S]earch [D]iagnostics' },
386+ { ' <leader>sr' , function () Snacks .picker .resume () end , desc = ' [S]earch [R]esume' },
387+ { ' <leader>s.' , function () Snacks .picker .recent () end , desc = ' [S]earch Recent Files ("." for repeat)' },
388+ { ' <leader><leader>' , function () Snacks .picker .buffers () end , desc = ' [ ] Find existing buffers' },
389+ { ' <leader>/' , function () Snacks .picker .lines {} end , desc = ' [/] Fuzzily search in current buffer' },
390+ { ' <leader>s/' , function () Snacks .picker .grep_buffers () end , desc = ' [S]earch [/] in Open Files' },
449391 -- 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 ,
392+ { ' <leader>sn' , function () Snacks . picker . files { cwd = vim .fn .stdpath ' config' } end , desc = ' [S]earch [N]eovim files' },
393+ } ,
452394 },
453395
454396 -- LSP Plugins
@@ -533,33 +475,32 @@ require('lazy').setup({
533475 map (' gra' , vim .lsp .buf .code_action , ' [G]oto Code [A]ction' , { ' n' , ' x' })
534476
535477 -- Find references for the word under your cursor.
536- map (' grr' , require (' telescope.builtin' ).lsp_references , ' [G]oto [R]eferences' )
537-
478+ map (' grr' , require (' snacks' ).picker .lsp_references , ' [G]oto [R]eferences' )
538479 -- Jump to the implementation of the word under your cursor.
539480 -- 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' )
481+ map (' gri' , require (' snacks ' ). picker .lsp_implementations , ' [G]oto [I]mplementation' )
541482
542483 -- Jump to the definition of the word under your cursor.
543484 -- This is where a variable was first declared, or where a function is defined, etc.
544485 -- To jump back, press <C-t>.
545- map (' grd' , require (' telescope.builtin ' ) .lsp_definitions , ' [G]oto [D]efinition' )
486+ map (' grd' , require (' snacks ' ). picker .lsp_definitions , ' [G]oto [D]efinition' )
546487
547488 -- WARN: This is not Goto Definition, this is Goto Declaration.
548489 -- For example, in C this would take you to the header.
549490 map (' grD' , vim .lsp .buf .declaration , ' [G]oto [D]eclaration' )
550491
551492 -- Fuzzy find all the symbols in your current document.
552493 -- Symbols are things like variables, functions, types, etc.
553- map (' gO' , require (' telescope.builtin ' ).lsp_document_symbols , ' Open Document Symbols' )
494+ map (' gO' , require (' snacks ' ).picker . lsp_symbols , ' Open Document Symbols' )
554495
555496 -- Fuzzy find all the symbols in your current workspace.
556497 -- Similar to document symbols, except searches over your entire project.
557- map (' gW' , require (' telescope.builtin ' ).lsp_dynamic_workspace_symbols , ' Open Workspace Symbols' )
498+ map (' gW' , require (' snacks ' ).picker . lsp_workspace_symbols , ' Open Workspace Symbols' )
558499
559500 -- Jump to the type of the word under your cursor.
560501 -- Useful when you're not sure what type a variable is and you want to see
561502 -- the definition of its *type*, not where it was *defined*.
562- map (' grt' , require (' telescope.builtin ' ) .lsp_type_definitions , ' [G]oto [T]ype Definition' )
503+ map (' grt' , require (' snacks ' ). picker .lsp_type_definitions , ' [G]oto [T]ype Definition' )
563504
564505 -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
565506 --- @param client vim.lsp.Client
@@ -970,9 +911,9 @@ require('lazy').setup({
970911 -- { import = 'custom.plugins' },
971912 --
972913 -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
973- -- Or use telescope !
914+ -- Or use the "help" snacks-picker !
974915 -- 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
916+ -- you can continue same window with `<space>sr` which resumes last snacks-picker search
976917}, {
977918 ui = {
978919 -- If you are using a Nerd Font: set icons to an empty table which will use the
0 commit comments