init.lua/lua/plugins/telescope.lua(view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
return {
"nvim-telescope/telescope.nvim",
event = "VeryLazy",
dependencies = {
"nvim-telescope/telescope-ui-select.nvim",
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
},
keys = function()
local builtin = require "telescope.builtin"
local function grep_string()
vim.ui.input({ prompt = "Grep: " }, function(input)
builtin.grep_string { search = input }
end)
end
return {
{ "<leader>f", builtin.find_files },
{ "<leader>b", builtin.buffers },
{ "<leader>sr", builtin.oldfiles },
{ "<leader>sg", builtin.live_grep },
{ "<leader>st", grep_string },
{ "<leader>sd", builtin.diagnostics },
{ "<leader>sh", builtin.help_tags },
}
end,
config = function()
local telescope = require "telescope"
local actions = require "telescope.actions"
telescope.setup {
defaults = {
prompt_prefix = " ",
selection_caret = " ",
file_ignore_patterns = {
"^\\.git$",
"^\\.bin$",
"^\\tmp$",
"node_modules",
"__pycache__",
"target",
"vendor",
},
mappings = {
i = {
["<esc>"] = actions.close,
["<C-d>"] = actions.delete_buffer,
},
n = {
["<C-d>"] = actions.delete_buffer,
},
},
},
pickers = {
find_files = { theme = "ivy" },
live_grep = { theme = "ivy" },
grep_string = { theme = "ivy" },
filetypes = { theme = "ivy" },
buffers = { theme = "ivy" },
oldfiles = { theme = "ivy" },
keymaps = { theme = "ivy" },
help_tags = { theme = "ivy" },
diagnostics = { theme = "ivy" },
git_branches = { theme = "ivy" },
git_commits = { theme = "ivy" },
git_status = { theme = "ivy" },
lsp_definitions = { theme = "ivy" },
lsp_references = { theme = "ivy" },
lsp_implementations = { theme = "ivy" },
lsp_document_symbols = {
theme = "ivy",
fname_width = 0.1,
symbol_width = 0.8,
symbol_type_width = 0.1,
},
},
extensions = {
["ui-select"] = { require("telescope.themes").get_ivy {} },
},
}
telescope.load_extension "projects"
telescope.load_extension "ui-select"
telescope.load_extension "fzf"
end,
}
|