2022-01-13 21:17:15 +00:00
|
|
|
local function load_extensions()
|
|
|
|
local utils = require("utils")
|
|
|
|
require("telescope").load_extension("file_browser")
|
|
|
|
if utils.is_plugin_loaded("nvim-notify") then
|
|
|
|
require("telescope").load_extension("notify")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-08-25 23:21:50 +00:00
|
|
|
local function config_telescope()
|
|
|
|
local actions = require("telescope.actions")
|
2021-12-15 17:37:51 +00:00
|
|
|
require("telescope").setup({
|
2021-08-25 23:21:50 +00:00
|
|
|
defaults = {
|
|
|
|
mappings = {
|
|
|
|
i = {
|
|
|
|
["<esc>"] = actions.close,
|
|
|
|
-- Disable scroll-up to allow clearing prompt
|
|
|
|
["<C-u>"] = false,
|
2021-12-15 17:37:51 +00:00
|
|
|
},
|
2021-08-25 23:21:50 +00:00
|
|
|
},
|
|
|
|
layout_strategy = "flex",
|
2021-12-15 17:37:51 +00:00
|
|
|
},
|
|
|
|
})
|
2023-06-14 00:03:16 +00:00
|
|
|
|
2023-06-09 19:10:55 +00:00
|
|
|
local utils = require("utils")
|
2023-06-14 00:03:16 +00:00
|
|
|
utils.keymap_set("n", "<C-t>", "<cmd>lua require('telescope.builtin').find_files()<CR>", { desc = "Find files" })
|
|
|
|
utils.keymap_set("n", "<leader>b", "<cmd>lua require('telescope.builtin').buffers()<CR>", { desc = "Find buffers" })
|
|
|
|
utils.keymap_set(
|
|
|
|
"n",
|
|
|
|
"<leader>t",
|
|
|
|
"<cmd>lua require('telescope.builtin').current_buffer_tags()<CR>",
|
|
|
|
{ desc = "Find buffer tags" }
|
|
|
|
)
|
|
|
|
utils.keymap_set(
|
|
|
|
"n",
|
|
|
|
"<leader>*",
|
|
|
|
"<cmd>lua require('telescope.builtin').grep_string()<CR>",
|
|
|
|
{ desc = "Find string under cursor" }
|
|
|
|
)
|
|
|
|
-- Better spelling replacement for word under cursor
|
|
|
|
utils.keymap_set(
|
|
|
|
"n",
|
|
|
|
"<leader>s",
|
|
|
|
"<cmd>lua require('telescope.builtin').spell_suggest(require('telescope.themes').get_cursor())<CR>",
|
|
|
|
{ desc = "Spell check" }
|
|
|
|
)
|
2022-01-04 05:27:53 +00:00
|
|
|
|
2023-06-14 00:03:16 +00:00
|
|
|
local finder_keymap = utils.curry_keymap("n", "<leader>f")
|
|
|
|
finder_keymap("b", "<cmd>lua require('telescope.builtin').buffers()<CR>", { desc = "Find buffers" })
|
|
|
|
finder_keymap("f", "<cmd>lua require('telescope.builtin').find_files()<CR>", { desc = "Find file" })
|
|
|
|
finder_keymap("g", "<cmd>lua require('telescope.builtin').live_grep()<CR>", { desc = "Live grep" })
|
|
|
|
finder_keymap("h", "<cmd>lua require('telescope.builtin').help_tags()<CR>", { desc = "Find help tags" })
|
|
|
|
finder_keymap("l", "<cmd>lua require('telescope.builtin').resume()<CR>", { desc = "Resume finding" })
|
|
|
|
finder_keymap("t", "<cmd>lua require('telescope.builtin').current_buffer_tags()<CR>", { desc = "Find buffer tags" })
|
|
|
|
finder_keymap("T", "<cmd>lua require('telescope.builtin').tags()<CR>", { desc = "Find tags" })
|
2022-01-13 20:57:50 +00:00
|
|
|
|
2023-10-20 23:59:32 +00:00
|
|
|
if utils.can_require("sg.telescope") then
|
|
|
|
finder_keymap(
|
|
|
|
"G",
|
|
|
|
"<cmd>lua require('sg.telescope').fuzzy_search_results()<CR>",
|
|
|
|
{ desc = "Search Sourcegraph" }
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2022-01-13 21:17:15 +00:00
|
|
|
load_extensions()
|
2021-08-25 23:21:50 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
config_telescope()
|