modify: experimenting with moving away from telescope
This is still an experiment. I'm trying to move away from telescope, but I still use extensions like `telescope-undo.lua`, which makes me unsure entirely of the switch. That's why I'm commenting out the config part, while also lazy-loading it.
This commit is contained in:
parent
eb0b60a2ad
commit
d13bb6d168
|
|
@ -58,3 +58,8 @@ vim.keymap.set('n', '<leader>c', '<cmd>bdelete<CR>', { desc = '[c]lose file' })
|
||||||
-- Add a keymap for delete while on insert-mode
|
-- Add a keymap for delete while on insert-mode
|
||||||
-- this works well with <C-h>, <C-w>, <C-u>
|
-- this works well with <C-h>, <C-w>, <C-u>
|
||||||
vim.keymap.set('i', '<C-f>', '<Del>')
|
vim.keymap.set('i', '<C-f>', '<Del>')
|
||||||
|
|
||||||
|
-- [[ Keymap Deletion ]]
|
||||||
|
|
||||||
|
-- this would be remapped to `grs` so I don't want to keep it.
|
||||||
|
vim.keymap.del('n', 'gO')
|
||||||
|
|
|
||||||
|
|
@ -56,16 +56,56 @@ return {
|
||||||
vim.keymap.set('n', '<leader>Gw', fl.git_worktrees, { desc = 'Git: worktrees' })
|
vim.keymap.set('n', '<leader>Gw', fl.git_worktrees, { desc = 'Git: worktrees' })
|
||||||
|
|
||||||
-- LSP specific
|
-- LSP specific
|
||||||
vim.keymap.set({ 'n', 'v' }, '<leader>la', fl.lsp_code_actions, { desc = 'LSP: code actions' })
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
vim.keymap.set({ 'n', 'v' }, '<leader>lD', fl.lsp_declarations, { desc = 'LSP: declaration' })
|
group = vim.api.nvim_create_augroup('fzflua-lsp-attach', { clear = true }),
|
||||||
vim.keymap.set({ 'n', 'v' }, '<leader>ld', fl.lsp_definitions, { desc = 'LSP: definition' })
|
callback = function(event)
|
||||||
vim.keymap.set({ 'n', 'v' }, '<leader>li', fl.lsp_implementations, { desc = 'LSP: implementations' })
|
local buf = event.buf
|
||||||
vim.keymap.set({ 'n', 'v' }, '<leader>lI', fl.lsp_incoming_calls, { desc = 'LSP: incoming calls' })
|
|
||||||
vim.keymap.set({ 'n', 'v' }, '<leader>lO', fl.lsp_outgoing_calls, { desc = 'LSP: outgoing calls' })
|
-- `gr` keymap style
|
||||||
vim.keymap.set({ 'n', 'v' }, '<leader>lr', fl.lsp_references, { desc = 'LSP: references' })
|
vim.keymap.set({ 'n', 'v' }, 'gra', fl.lsp_code_actions, { buffer = buf, desc = 'LSP: code actions' })
|
||||||
vim.keymap.set('n', '<leader>ls', fl.lsp_document_symbols, { desc = 'LSP: symbols - current buf' })
|
vim.keymap.set({ 'n', 'v' }, 'grD', fl.lsp_declarations, { buffer = buf, desc = 'LSP: declaration' })
|
||||||
vim.keymap.set('n', '<leader>lw', fl.lsp_workspace_symbols, { desc = 'LSP: symbols - workspace' })
|
vim.keymap.set({ 'n', 'v' }, 'grd', fl.lsp_definitions, { buffer = buf, desc = 'LSP: definition' })
|
||||||
vim.keymap.set({ 'n', 'v' }, '<leader>lt', fl.lsp_typedefs, { desc = 'LSP: type definition' })
|
vim.keymap.set({ 'n', 'v' }, 'gri', fl.lsp_implementations, { buffer = buf, desc = 'LSP: implementations' })
|
||||||
|
vim.keymap.set({ 'n', 'v' }, 'grI', fl.lsp_incoming_calls, { buffer = buf, desc = 'LSP: incoming calls' })
|
||||||
|
vim.keymap.set({ 'n', 'v' }, 'grO', fl.lsp_outgoing_calls, { buffer = buf, desc = 'LSP: outgoing calls' })
|
||||||
|
vim.keymap.set({ 'n', 'v' }, 'grr', fl.lsp_references, { buffer = buf, desc = 'LSP: references' })
|
||||||
|
vim.keymap.set('n', 'grs', fl.lsp_document_symbols, { buffer = buf, desc = 'LSP: symbols - current buf' })
|
||||||
|
vim.keymap.set('n', 'grw', fl.lsp_workspace_symbols, { buffer = buf, desc = 'LSP: symbols - workspace' })
|
||||||
|
vim.keymap.set({ 'n', 'v' }, 'grt', fl.lsp_typedefs, { buffer = buf, desc = 'LSP: type definition' })
|
||||||
|
|
||||||
|
-- my style
|
||||||
|
vim.keymap.set({ 'n', 'v' }, '<leader>la', fl.lsp_code_actions, { buffer = buf, desc = 'LSP: code actions' })
|
||||||
|
vim.keymap.set({ 'n', 'v' }, '<leader>lD', fl.lsp_declarations, { buffer = buf, desc = 'LSP: declaration' })
|
||||||
|
vim.keymap.set({ 'n', 'v' }, '<leader>ld', fl.lsp_definitions, { buffer = buf, desc = 'LSP: definition' })
|
||||||
|
vim.keymap.set(
|
||||||
|
{ 'n', 'v' },
|
||||||
|
'<leader>li',
|
||||||
|
fl.lsp_implementations,
|
||||||
|
{ buffer = buf, desc = 'LSP: implementations' }
|
||||||
|
)
|
||||||
|
vim.keymap.set(
|
||||||
|
{ 'n', 'v' },
|
||||||
|
'<leader>lI',
|
||||||
|
fl.lsp_incoming_calls,
|
||||||
|
{ buffer = buf, desc = 'LSP: incoming calls' }
|
||||||
|
)
|
||||||
|
vim.keymap.set(
|
||||||
|
{ 'n', 'v' },
|
||||||
|
'<leader>lO',
|
||||||
|
fl.lsp_outgoing_calls,
|
||||||
|
{ buffer = buf, desc = 'LSP: outgoing calls' }
|
||||||
|
)
|
||||||
|
vim.keymap.set({ 'n', 'v' }, '<leader>lr', fl.lsp_references, { buffer = buf, desc = 'LSP: references' })
|
||||||
|
vim.keymap.set(
|
||||||
|
'n',
|
||||||
|
'<leader>ls',
|
||||||
|
fl.lsp_document_symbols,
|
||||||
|
{ buffer = buf, desc = 'LSP: symbols - current buf' }
|
||||||
|
)
|
||||||
|
vim.keymap.set('n', '<leader>lw', fl.lsp_workspace_symbols, { buffer = buf, desc = 'LSP: symbols - workspace' })
|
||||||
|
vim.keymap.set({ 'n', 'v' }, '<leader>lt', fl.lsp_typedefs, { buffer = buf, desc = 'LSP: type definition' })
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
-- Diagnostic specific
|
-- Diagnostic specific
|
||||||
vim.keymap.set('n', '<leader>dd', fl.diagnostics_document, { desc = 'List diagnostics - current buf' })
|
vim.keymap.set('n', '<leader>dd', fl.diagnostics_document, { desc = 'List diagnostics - current buf' })
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,11 @@ return {
|
||||||
-- lazy = true,
|
-- lazy = true,
|
||||||
keys = {
|
keys = {
|
||||||
{ -- lazy style key map
|
{ -- lazy style key map
|
||||||
'<leader>su',
|
'<leader>fu',
|
||||||
function()
|
function()
|
||||||
require('telescope').extensions.undo.undo()
|
require('telescope').extensions.undo.undo()
|
||||||
end,
|
end,
|
||||||
desc = '[S]earch [U]ndo history',
|
desc = 'Undo history',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
opts = {
|
opts = {
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,8 @@ return {
|
||||||
-- it’s best to remove the Telescope plugin config entirely
|
-- it’s best to remove the Telescope plugin config entirely
|
||||||
-- instead of just disabling it here, to keep your config clean.
|
-- instead of just disabling it here, to keep your config clean.
|
||||||
enabled = true,
|
enabled = true,
|
||||||
event = 'VimEnter',
|
-- event = 'VimEnter',
|
||||||
|
lazy = true,
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'nvim-lua/plenary.nvim',
|
'nvim-lua/plenary.nvim',
|
||||||
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
|
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
|
||||||
|
|
@ -100,79 +101,79 @@ return {
|
||||||
pcall(require('telescope').load_extension, 'ui-select')
|
pcall(require('telescope').load_extension, 'ui-select')
|
||||||
|
|
||||||
-- See `:help telescope.builtin`
|
-- See `:help telescope.builtin`
|
||||||
local builtin = require 'telescope.builtin'
|
-- local builtin = require 'telescope.builtin'
|
||||||
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
|
-- vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
|
||||||
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
|
-- vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
|
||||||
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
|
-- vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
|
||||||
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
|
-- vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
|
||||||
vim.keymap.set({ 'n', 'v' }, '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
|
-- vim.keymap.set({ 'n', 'v' }, '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
|
||||||
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
|
-- vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
|
||||||
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
|
-- vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||||
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
|
-- vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
|
||||||
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
-- vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
||||||
vim.keymap.set('n', '<leader>sc', builtin.commands, { desc = '[S]earch [C]ommands' })
|
-- vim.keymap.set('n', '<leader>sc', builtin.commands, { desc = '[S]earch [C]ommands' })
|
||||||
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
-- vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
||||||
|
|
||||||
-- This runs on LSP attach per buffer (see main LSP attach function in 'neovim/nvim-lspconfig' config for more info,
|
-- -- This runs on LSP attach per buffer (see main LSP attach function in 'neovim/nvim-lspconfig' config for more info,
|
||||||
-- it is better explained there). This allows easily switching between pickers if you prefer using something else!
|
-- -- it is better explained there). This allows easily switching between pickers if you prefer using something else!
|
||||||
vim.api.nvim_create_autocmd('LspAttach', {
|
-- vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
group = vim.api.nvim_create_augroup('telescope-lsp-attach', { clear = true }),
|
-- group = vim.api.nvim_create_augroup('telescope-lsp-attach', { clear = true }),
|
||||||
callback = function(event)
|
-- callback = function(event)
|
||||||
local buf = event.buf
|
-- local buf = event.buf
|
||||||
|
|
||||||
-- Find references for the word under your cursor.
|
-- -- Find references for the word under your cursor.
|
||||||
vim.keymap.set('n', 'grr', builtin.lsp_references, { buffer = buf, desc = '[G]oto [R]eferences' })
|
-- vim.keymap.set('n', 'grr', builtin.lsp_references, { buffer = buf, desc = '[G]oto [R]eferences' })
|
||||||
|
|
||||||
-- Jump to the implementation of the word under your cursor.
|
-- -- Jump to the implementation of the word under your cursor.
|
||||||
-- Useful when your language has ways of declaring types without an actual implementation.
|
-- -- Useful when your language has ways of declaring types without an actual implementation.
|
||||||
vim.keymap.set('n', 'gri', builtin.lsp_implementations, { buffer = buf, desc = '[G]oto [I]mplementation' })
|
-- vim.keymap.set('n', 'gri', builtin.lsp_implementations, { buffer = buf, desc = '[G]oto [I]mplementation' })
|
||||||
|
|
||||||
-- Jump to the definition of the word under your cursor.
|
-- -- Jump to the definition of the word under your cursor.
|
||||||
-- This is where a variable was first declared, or where a function is defined, etc.
|
-- -- This is where a variable was first declared, or where a function is defined, etc.
|
||||||
-- To jump back, press <C-t>.
|
-- -- To jump back, press <C-t>.
|
||||||
vim.keymap.set('n', 'grd', builtin.lsp_definitions, { buffer = buf, desc = '[G]oto [D]efinition' })
|
-- vim.keymap.set('n', 'grd', builtin.lsp_definitions, { buffer = buf, desc = '[G]oto [D]efinition' })
|
||||||
|
|
||||||
-- Fuzzy find all the symbols in your current document.
|
-- -- Fuzzy find all the symbols in your current document.
|
||||||
-- Symbols are things like variables, functions, types, etc.
|
-- -- Symbols are things like variables, functions, types, etc.
|
||||||
vim.keymap.set('n', 'gO', builtin.lsp_document_symbols, { buffer = buf, desc = 'Open Document Symbols' })
|
-- vim.keymap.set('n', 'gO', builtin.lsp_document_symbols, { buffer = buf, desc = 'Open Document Symbols' })
|
||||||
|
|
||||||
-- Fuzzy find all the symbols in your current workspace.
|
-- -- Fuzzy find all the symbols in your current workspace.
|
||||||
-- Similar to document symbols, except searches over your entire project.
|
-- -- Similar to document symbols, except searches over your entire project.
|
||||||
vim.keymap.set(
|
-- vim.keymap.set(
|
||||||
'n',
|
-- 'n',
|
||||||
'gW',
|
-- 'gW',
|
||||||
builtin.lsp_dynamic_workspace_symbols,
|
-- builtin.lsp_dynamic_workspace_symbols,
|
||||||
{ buffer = buf, desc = 'Open Workspace Symbols' }
|
-- { buffer = buf, desc = 'Open Workspace Symbols' }
|
||||||
)
|
-- )
|
||||||
|
|
||||||
-- Jump to the type of the word under your cursor.
|
-- -- Jump to the type of the word under your cursor.
|
||||||
-- Useful when you're not sure what type a variable is and you want to see
|
-- -- Useful when you're not sure what type a variable is and you want to see
|
||||||
-- the definition of its *type*, not where it was *defined*.
|
-- -- the definition of its *type*, not where it was *defined*.
|
||||||
vim.keymap.set('n', 'grt', builtin.lsp_type_definitions, { buffer = buf, desc = '[G]oto [T]ype Definition' })
|
-- vim.keymap.set('n', 'grt', builtin.lsp_type_definitions, { buffer = buf, desc = '[G]oto [T]ype Definition' })
|
||||||
end,
|
-- end,
|
||||||
})
|
-- })
|
||||||
|
|
||||||
-- Override default behavior and theme when searching
|
-- -- Override default behavior and theme when searching
|
||||||
vim.keymap.set('n', '<leader>/', function()
|
-- vim.keymap.set('n', '<leader>/', function()
|
||||||
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
|
-- -- You can pass additional configuration to Telescope to change the theme, layout, etc.
|
||||||
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
-- builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||||
winblend = 10,
|
-- winblend = 10,
|
||||||
previewer = false,
|
-- previewer = false,
|
||||||
})
|
-- })
|
||||||
end, { desc = '[/] Fuzzily search in current buffer' })
|
-- end, { desc = '[/] Fuzzily search in current buffer' })
|
||||||
|
|
||||||
-- It's also possible to pass additional configuration options.
|
-- -- It's also possible to pass additional configuration options.
|
||||||
-- See `:help telescope.builtin.live_grep()` for information about particular keys
|
-- -- See `:help telescope.builtin.live_grep()` for information about particular keys
|
||||||
vim.keymap.set('n', '<leader>s/', function()
|
-- vim.keymap.set('n', '<leader>s/', function()
|
||||||
builtin.live_grep {
|
-- builtin.live_grep {
|
||||||
grep_open_files = true,
|
-- grep_open_files = true,
|
||||||
prompt_title = 'Live Grep in Open Files',
|
-- prompt_title = 'Live Grep in Open Files',
|
||||||
}
|
-- }
|
||||||
end, { desc = '[S]earch [/] in Open Files' })
|
-- end, { desc = '[S]earch [/] in Open Files' })
|
||||||
|
|
||||||
-- Shortcut for searching your Neovim configuration files
|
-- -- Shortcut for searching your Neovim configuration files
|
||||||
vim.keymap.set('n', '<leader>sn', function()
|
-- vim.keymap.set('n', '<leader>sn', function()
|
||||||
builtin.find_files { cwd = vim.fn.stdpath 'config' }
|
-- builtin.find_files { cwd = vim.fn.stdpath 'config' }
|
||||||
end, { desc = '[S]earch [N]eovim files' })
|
-- end, { desc = '[S]earch [N]eovim files' })
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue