121 lines
4.1 KiB
Lua
Executable File
121 lines
4.1 KiB
Lua
Executable File
return {
|
|
-- fuzzy finder
|
|
"nvim-telescope/telescope.nvim",
|
|
dependencies = {
|
|
"nvim-lua/plenary.nvim",
|
|
{
|
|
"nvim-telescope/telescope-live-grep-args.nvim",
|
|
-- This will not install any breaking changes.
|
|
-- For major updates, this must be adjusted manually.
|
|
version = "^1.0.0",
|
|
},
|
|
},
|
|
config = function()
|
|
local builtin = require("telescope.builtin")
|
|
local actions = require("telescope.actions")
|
|
local opts = { silent = true }
|
|
local telescope = require("telescope")
|
|
local lga_actions = require("telescope-live-grep-args.actions")
|
|
|
|
telescope.setup({
|
|
defaults = {
|
|
mappings = {
|
|
i = {
|
|
["<C-j>"] = actions.move_selection_next,
|
|
["<C-k>"] = actions.move_selection_previous,
|
|
["<C-q>"] = actions.smart_add_to_qflist,
|
|
["<C-A-q>"] = actions.smart_send_to_qflist,
|
|
["<C-Space>"] = lga_actions.quote_prompt(),
|
|
},
|
|
},
|
|
path_display = { "truncate" },
|
|
},
|
|
extensions = {
|
|
frecency = {
|
|
db_safe_mode = false,
|
|
matcher = "fuzzy"
|
|
},
|
|
},
|
|
})
|
|
|
|
telescope.load_extension("live_grep_args")
|
|
|
|
opts.desc = "telescope find files"
|
|
vim.keymap.set("n", "<leader>ff", builtin.find_files, opts)
|
|
|
|
opts.desc = "telescope live grep"
|
|
vim.keymap.set("n", "<leader>flg", builtin.live_grep, opts)
|
|
|
|
opts.desc = "telescope live grep args"
|
|
local function start_live_grep_args()
|
|
telescope.extensions.live_grep_args.live_grep_args()
|
|
end
|
|
vim.keymap.set("n", "<leader>fg", start_live_grep_args, opts)
|
|
|
|
opts.desc = "telescope buffers"
|
|
vim.keymap.set("n", "<leader>fb", builtin.buffers, opts)
|
|
|
|
opts.desc = "Show nvim functions"
|
|
vim.keymap.set("n", "<leader>fh", builtin.help_tags, opts)
|
|
|
|
opts.desc = "Telescope TODOs"
|
|
vim.keymap.set("n", "<leader>ft", ":TodoTelescope<CR>", opts)
|
|
|
|
-- Git
|
|
opts.desc = "Show git diff"
|
|
vim.keymap.set("n", "<leader>fld", builtin.git_status, opts)
|
|
|
|
opts.desc = "Show git commits"
|
|
vim.keymap.set("n", "<leader>flc", builtin.git_commits, opts)
|
|
|
|
opts.desc = "Show git files"
|
|
vim.keymap.set("n", "<leader>flf", builtin.git_files, opts)
|
|
|
|
-- Recent Commands
|
|
opts.desc = "Show recent commands"
|
|
vim.keymap.set("n", "<leader>foc", ":Telescope command_history<CR>", opts)
|
|
|
|
-- Recent Searches
|
|
opts.desc = "Show recent searches"
|
|
vim.keymap.set("n", "<leader>fos", ":Telescope search_history<CR>", opts)
|
|
|
|
-- Old Files
|
|
opts.desc = "Show recent files"
|
|
vim.keymap.set("n", "<leader>fof", builtin.oldfiles, opts)
|
|
|
|
-- Frecency (Old files, but better)
|
|
local function run_frecency()
|
|
require("telescope").extensions.frecency.frecency({
|
|
workspace = "CWD",
|
|
})
|
|
end
|
|
|
|
opts.desc = "Show recent files (Frecency algorithm)"
|
|
vim.keymap.set("n", "<leader>fr", run_frecency, opts)
|
|
|
|
-- Quickfix Items
|
|
opts.desc = "Show quickfix items"
|
|
vim.keymap.set("n", "<leader>fq", ":Telescope quickfix<CR>", opts)
|
|
|
|
-- Spell Suggestions
|
|
opts.desc = "Show spell suggestions"
|
|
vim.keymap.set("n", "<leader>fs", ":Telescope spell_suggest<CR>", opts)
|
|
|
|
-- Diagnostics
|
|
opts.desc = "Show diagnostics"
|
|
vim.keymap.set("n", "<leader>fd", ":Telescope diagnostics<CR>", opts)
|
|
|
|
-- Notifications
|
|
opts.desc = "Show notifications"
|
|
vim.keymap.set("n", "<leader>fn", ":Telescope notify<CR>", opts)
|
|
|
|
-- Implementations
|
|
opts.desc = "Show implementations"
|
|
vim.keymap.set("n", "<leader>fi", ":Telescope lsp_implementations<CR>", opts)
|
|
|
|
-- quickfix
|
|
opts.desc = "Show quickfix list"
|
|
vim.keymap.set("n", "<leader>fq", ":Telescope quickfix<CR>", opts)
|
|
end,
|
|
}
|