dotfiles/.config/nvim/lua/plugins/telescope.lua

36 lines
1.2 KiB
Lua
Raw Normal View History

2023-01-04 07:28:57 -05:00
local ok, telescope = pcall(require, "telescope")
if not ok then
2023-04-03 09:19:12 -04:00
vim.notify("Failed to load telescope")
return
2023-01-04 07:28:57 -05:00
end
local actions = require'telescope.actions'
local builtin = require'telescope.builtin'
telescope.setup{
2023-04-03 09:19:12 -04:00
defaults = {
mappings = {
i = {
["<c-j>"] = actions.move_selection_next,
["<c-k>"] = actions.move_selection_previous,
},
n = {
["q"] = actions.close,
}
},
}
2023-01-04 07:28:57 -05:00
}
local keymap = vim.keymap.set
2023-08-14 19:28:08 -04:00
keymap("n","<leader>sf",builtin.find_files, {desc = "[S]earch [F]iles"})
keymap("n","<leader>sg",builtin.live_grep, {desc = "[S]earch by [G]rep"})
keymap("n","<leader>sw",builtin.grep_string, {desc = "[S]earch current [W]ord"})
keymap("n","<leader>ff",builtin.current_buffer_fuzzy_find, {desc = "[F]uzzy [F]ind in current [B]uffer"})
2023-01-04 07:28:57 -05:00
2023-08-14 19:28:08 -04:00
keymap("n","<leader>fb",builtin.buffers, {desc = "[F]ind existing [B]uffers"})
2023-01-04 07:28:57 -05:00
2023-08-14 19:28:08 -04:00
keymap("n","<leader>sd",builtin.diagnostics, {desc = "[S]earch [D]iagnostics"})
keymap("n","<leader>sdc",function() builtin.diagnostics{bufnr = 0} end, {desc = "[S]earch [D]iagnostics in current [B]uffer"})
keymap("n","<leader>sk",builtin.keymaps, {desc = "[S]earch existing [K]eymaps"})