From 67a4bc03ac81be48911de51337e1065cfe96425b Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Thu, 24 Apr 2025 20:34:48 +0300 Subject: Replaced telescope and trouble with snacks picker --- .config/nvim/lua/dap-keymaps.lua | 2 +- .config/nvim/lua/lsp-keymaps.lua | 5 -- .config/nvim/lua/plugins/snacks.lua | 116 ++++++++++++++++++++++++++++- .config/nvim/lua/plugins/telescope.lua | 22 ------ .config/nvim/lua/plugins/todo-comments.lua | 19 ++++- .config/nvim/lua/plugins/trouble.lua | 40 ---------- .config/nvim/lua/telescope_helper.lua | 41 ---------- 7 files changed, 132 insertions(+), 113 deletions(-) delete mode 100644 .config/nvim/lua/plugins/telescope.lua delete mode 100644 .config/nvim/lua/plugins/trouble.lua delete mode 100644 .config/nvim/lua/telescope_helper.lua diff --git a/.config/nvim/lua/dap-keymaps.lua b/.config/nvim/lua/dap-keymaps.lua index 8c3d540..dd97f85 100644 --- a/.config/nvim/lua/dap-keymaps.lua +++ b/.config/nvim/lua/dap-keymaps.lua @@ -4,7 +4,7 @@ local keymaps = { { 'n', 'dt', 'DapRestartFrame', { desc = '[D]ebug [R]estart' } }, { 'n', 'dp', 'DapToggleBreakpoint', { desc = '[D]ebug Break[p]oint' } }, { 'n', 'dh', 'lua require("dap.ui.widgets").hover()', { desc = '[D]ebug [H]over' } }, - { 'n', 'si', 'DapStepInto', { desc = '[S]tep [I]nto' } }, + -- { 'n', 'si', 'DapStepInto', { desc = '[S]tep [I]nto' } }, { 'n', 'so', 'DapStepOver', { desc = '[S]tep [O]ver' } }, { 'n', 'sO', 'DapStepOut', { desc = '[S]tep [O]ut' } }, } diff --git a/.config/nvim/lua/lsp-keymaps.lua b/.config/nvim/lua/lsp-keymaps.lua index 7bbc2e8..1721881 100644 --- a/.config/nvim/lua/lsp-keymaps.lua +++ b/.config/nvim/lua/lsp-keymaps.lua @@ -18,12 +18,7 @@ end local keymaps = { { 'n', 'gd', 'Lspsaga goto_definition', { desc = '[G]oto [D]efinition' } }, - -- { 'n', 'gu', 'Telescope lsp_references', { desc = '[G]oto [U]sages' } }, { 'n', 'gu', 'Lspsaga finder', { desc = '[G]oto [U]sages' } }, - { 'n', 'gi', 'Telescope lsp_implementations', { desc = '[G]oto [I]mplementations' } }, - { 'n', 'gt', 'Telescope lsp_type_definitions', { desc = '[G]oto [T]ype Definitions' } }, - { 'n', 'ds', 'Telescope lsp_document_symbols', { desc = '[D]ocument [S]symbols' } }, - { 'n', 'ps', 'Telescope lsp_workspace_symbols', { desc = '[P]roject [S]ymbols' } }, { { 'n', 'i' }, '', vim.lsp.buf.signature_help, { desc = 'Show [P]arameters' } }, { 'n', 'K', 'Lspsaga hover_doc', { desc = 'Documentation' } }, { 'n', 'R', 'Lspsaga rename', { desc = '[R]ename' } }, diff --git a/.config/nvim/lua/plugins/snacks.lua b/.config/nvim/lua/plugins/snacks.lua index 5e00a23..02c5e35 100644 --- a/.config/nvim/lua/plugins/snacks.lua +++ b/.config/nvim/lua/plugins/snacks.lua @@ -23,6 +23,7 @@ return { return true end, }, + picker = {}, }, keys = { { @@ -45,11 +46,11 @@ return { }, { - 'si', + 'ri', function() Snacks.image.hover() end, - desc = '[S]how [I]mage', + desc = '[R]ender [I]mage', }, { @@ -66,5 +67,116 @@ return { end, desc = '[N]otification [H]istory', }, + + { + 'sp', + function() + Snacks.picker.pickers({ layout = 'telescope' }) + end, + desc = '[S]how [P]ickers', + }, + { + 'fs', + function() + Snacks.picker.files({ + layout = 'telescope', + hidden = true, + follow = true, + }) + end, + desc = '[F]ile [S]ystem', + }, + { + 'lv', + function() + Snacks.picker.grep({ + layout = 'telescope', + hidden = true, + follow = true, + }) + end, + desc = '[L]ive [G]rep', + }, + { + 'gi', + function() + Snacks.picker.lsp_implementations() + end, + { desc = '[G]oto [I]mplementations' }, + }, + { + 'gt', + function() + Snacks.picker.lsp_type_definitions() + end, + { desc = '[G]oto [T]ype Definitions' }, + }, + { + 'ds', + function() + Snacks.picker.lsp_symbols({ layout = 'telescope' }) + end, + desc = '[D]ocument [S]ymbols', + }, + { + 'ps', + function() + Snacks.picker.lsp_workspace_symbols({ layout = 'telescope' }) + end, + desc = '[P]roject [S]ymbols', + }, + { + 'di', + function() + Snacks.picker.diagnostics({ layout = 'telescope' }) + end, + desc = '[Di]agnostics', + }, + { + 'dl', + function() + Snacks.picker.diagnostics_buffer({ layout = 'telescope' }) + end, + desc = '[D]iagnostics [L]ocal', + }, + { + 'fh', + function() + Snacks.picker.help({ layout = 'telescope' }) + end, + desc = '[F]ind [H]elp', + }, + { + 'hi', + function() + Snacks.picker.highlights({ + layout = 'telescope', + hidden = true, + follow = true, + }) + end, + desc = '[Hi]light Groups', + }, + { + 'si', + function() + Snacks.picker.icons({ layout = 'select' }) + end, + desc = '[S]earch [I]cons', + }, + { + 'sk', + function() + Snacks.picker.keymaps({ layout = 'dropdown' }) + end, + desc = '[S]earch [K]eymaps', + }, + { + 'th', + function() + Snacks.picker.colorschemes({ layout = 'dropdown' }) + end, + desc = '[T]hemes [P]icker', + }, }, } diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua deleted file mode 100644 index b3e09af..0000000 --- a/.config/nvim/lua/plugins/telescope.lua +++ /dev/null @@ -1,22 +0,0 @@ -return { - 'nvim-telescope/telescope.nvim', - tag = '0.1.5', - dependencies = { - 'nvim-lua/plenary.nvim', - { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }, - 'nvim-telescope/telescope-ui-select.nvim', - }, - cmd = 'Telescope', - config = function() - require('telescope_helper') - end, - keys = { - 'fs', - 'fa', - 'fh', - 'fm', - 'lv', - 'f.', - 'th', - }, -} diff --git a/.config/nvim/lua/plugins/todo-comments.lua b/.config/nvim/lua/plugins/todo-comments.lua index 799afd8..b19ad05 100644 --- a/.config/nvim/lua/plugins/todo-comments.lua +++ b/.config/nvim/lua/plugins/todo-comments.lua @@ -13,8 +13,23 @@ return { dependencies = { 'nvim-lua/plenary.nvim' }, event = 'VeryLazy', keys = { - { 'st', 'TodoTelescope keywords=TODO,FIX', desc = '[S]earch [T]odos' }, - { 'lt', 'TodoTrouble', desc = '[L]ist [T]odos' }, + { + 'st', + function() + Snacks.picker.todo_comments({ + layout = 'telescope', + keywords = { 'TODO', 'FIX', 'FIXME', 'BUG', 'ISSUE', 'OPTIMIZE' }, + }) + end, + desc = '[S]earch [T]odos', + }, + { + 'sn', + function() + Snacks.picker.todo_comments({ layout = 'telescope' }) + end, + desc = '[S]earch [N]otes', + }, }, config = function() require('todo-comments').setup({ diff --git a/.config/nvim/lua/plugins/trouble.lua b/.config/nvim/lua/plugins/trouble.lua deleted file mode 100644 index 3239aa7..0000000 --- a/.config/nvim/lua/plugins/trouble.lua +++ /dev/null @@ -1,40 +0,0 @@ -return { - 'folke/trouble.nvim', - opts = {}, - cmd = 'Trouble', - -- TODO: Consider maybe using this for outlines (code structure) - -- and also configuring some of the keys to better fit me - -- and probably removing most of them in the process - keys = { - { - 'xx', - 'Trouble diagnostics toggle', - desc = 'Diagnostics (Trouble)', - }, - { - 'xX', - 'Trouble diagnostics toggle filter.buf=0', - desc = 'Buffer Diagnostics (Trouble)', - }, - { - 'cs', - 'Trouble symbols toggle focus=false', - desc = 'Symbols (Trouble)', - }, - { - 'cl', - 'Trouble lsp toggle focus=false win.position=right', - desc = 'LSP Definitions / references / ... (Trouble)', - }, - { - 'xL', - 'Trouble loclist toggle', - desc = 'Location List (Trouble)', - }, - { - 'xQ', - 'Trouble qflist toggle', - desc = 'Quickfix List (Trouble)', - }, - }, -} diff --git a/.config/nvim/lua/telescope_helper.lua b/.config/nvim/lua/telescope_helper.lua deleted file mode 100644 index 5a84121..0000000 --- a/.config/nvim/lua/telescope_helper.lua +++ /dev/null @@ -1,41 +0,0 @@ -local telescope = require('telescope') -telescope.setup({ - pickers = { - find_files = { follow = true, hidden = true }, - grep_string = { additional_args = '--follow' }, - live_grep = { additional_args = '--follow' }, - }, - extensions = { - fzf = { - fuzzy = true, -- false will only do exact matching - override_generic_sorter = true, - override_file_sorter = true, - case_mode = 'smart_case', -- default "smart_case" or "ignore_case" or "respect_case" - }, - ['ui-select'] = { - require('telescope.themes').get_dropdown({}), - }, - }, -}) - -pcall(telescope.load_extension('ui-select')) -pcall(telescope.load_extension('fzf')) - -local builtin = require('telescope.builtin') -local function find_all() - builtin.find_files({ - cwd = '~', - hidden = true, - no_ignore = true, - no_ignore_parent = true, - }) -end - -vim.keymap.set('n', 'fs', builtin.find_files, { desc = '[F]ile [S]ystem' }) -vim.keymap.set('n', 'fa', find_all, { desc = '[F]ind [A]ll files' }) -vim.keymap.set('n', 'fh', builtin.help_tags, { desc = '[F]ind [H]elp' }) -vim.keymap.set('n', 'fm', builtin.man_pages, { desc = '[F]ind [M]an Pages' }) -vim.keymap.set('n', 'lv', builtin.live_grep, { desc = '[L]ive [G]rep' }) -vim.keymap.set('n', 'f.', builtin.oldfiles, { desc = '[F]ind Recent Files' }) -vim.keymap.set('n', 'th', builtin.colorscheme, { desc = 'List [Th]eme' }) -vim.keymap.set('n', 'hi', builtin.highlights, { desc = '[Hi]light Groups' }) -- cgit v1.3.1