|
@ -5,6 +5,7 @@ return { |
|
|
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, |
|
|
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, |
|
|
"nvim-tree/nvim-web-devicons", |
|
|
"nvim-tree/nvim-web-devicons", |
|
|
"debugloop/telescope-undo.nvim", |
|
|
"debugloop/telescope-undo.nvim", |
|
|
|
|
|
"nvim-telescope/telescope-ui-select.nvim", |
|
|
}, |
|
|
}, |
|
|
config = function() |
|
|
config = function() |
|
|
local telescope = require("telescope") |
|
|
local telescope = require("telescope") |
|
@ -62,9 +63,9 @@ return { |
|
|
|
|
|
|
|
|
mappings = { |
|
|
mappings = { |
|
|
i = { |
|
|
i = { |
|
|
["<C-k>"] = actions.move_selection_previous, -- move to prev result |
|
|
|
|
|
["<C-j>"] = actions.move_selection_next, -- move to next result |
|
|
|
|
|
["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist, |
|
|
|
|
|
|
|
|
["<C-k>"] = actions.move_selection_previous, |
|
|
|
|
|
["<C-j>"] = actions.move_selection_next, |
|
|
|
|
|
["<C-q>"] = actions.send_to_qflist + actions.open_qflist, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
@ -83,11 +84,15 @@ return { |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
|
|
|
["ui-select"] = { |
|
|
|
|
|
require("telescope.themes").get_dropdown({}) |
|
|
|
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
telescope.load_extension("fzf") |
|
|
telescope.load_extension("fzf") |
|
|
telescope.load_extension("undo") |
|
|
telescope.load_extension("undo") |
|
|
|
|
|
telescope.load_extension("ui-select") |
|
|
|
|
|
|
|
|
local git_branches = function() |
|
|
local git_branches = function() |
|
|
builtin.git_branches({ |
|
|
builtin.git_branches({ |
|
@ -101,55 +106,62 @@ return { |
|
|
|
|
|
|
|
|
local find_files = function() |
|
|
local find_files = function() |
|
|
local ran, errorMessage = pcall(function() |
|
|
local ran, errorMessage = pcall(function() |
|
|
builtin.git_files({ show_untracked = true }) |
|
|
|
|
|
|
|
|
builtin.git_files({ show_untracked = true, hidden = true }) |
|
|
end) |
|
|
end) |
|
|
if not ran then |
|
|
if not ran then |
|
|
builtin.find_files() |
|
|
|
|
|
|
|
|
builtin.find_files({ hidden = true }) |
|
|
end |
|
|
end |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
-- set keymaps |
|
|
-- set keymaps |
|
|
local keymap = vim.keymap -- for conciseness |
|
|
local keymap = vim.keymap -- for conciseness |
|
|
|
|
|
|
|
|
keymap.set("n", "<C-g>", builtin.live_grep, { desc = "Live grep over project files." }) |
|
|
|
|
|
keymap.set("n", "<C-p>", find_files, { desc = "Fuzzy find files in cwd" }) |
|
|
|
|
|
|
|
|
keymap.set("n", "<C-g>", function () builtin.live_grep({ hidden = true }) end, {}) |
|
|
|
|
|
keymap.set("n", "<C-p>", find_files, {}) |
|
|
|
|
|
|
|
|
keymap.set("n", "<leader>fb", builtin.buffers, { desc = "Fuzzy find open buffers" }) |
|
|
|
|
|
keymap.set("n", "<leader>fo", builtin.oldfiles, { desc = "Fuzzy find recently opened files" }) |
|
|
|
|
|
|
|
|
keymap.set("n", "<leader>fb", builtin.buffers, {}) |
|
|
|
|
|
keymap.set("n", "<leader>fo", builtin.oldfiles, {}) |
|
|
|
|
|
|
|
|
keymap.set("n", "<leader>m", builtin.marks, { desc = "Fuzzy find marks" }) |
|
|
|
|
|
keymap.set("n", "<leader>ch", builtin.command_history, { desc = "Fuzzy find recent commands" }) |
|
|
|
|
|
|
|
|
keymap.set("n", "<leader>m", builtin.marks, {}) |
|
|
|
|
|
keymap.set("n", "<leader>ch", builtin.command_history, {}) |
|
|
|
|
|
|
|
|
keymap.set("n", "<leader>gb", git_branches, { desc = "Fuzzy find git branches" }) |
|
|
|
|
|
|
|
|
keymap.set("n", "<leader>gb", git_branches, {}) |
|
|
|
|
|
|
|
|
keymap.set("n", "<leader>df", function() |
|
|
|
|
|
builtin.find_files({ |
|
|
|
|
|
prompt_title = "< VimRC >", |
|
|
|
|
|
cwd = vim.fn.expand("~/.config/nvim"), |
|
|
|
|
|
hidden = true, |
|
|
|
|
|
}) |
|
|
|
|
|
end, { desc = "Find neovim config files" }) |
|
|
|
|
|
|
|
|
keymap.set("n", "<leader>vh", builtin.help_tags, {}) |
|
|
|
|
|
|
|
|
keymap.set("n", "<leader>vh", builtin.help_tags, { desc = "Fuzzy find help tags" }) |
|
|
|
|
|
|
|
|
keymap.set("n", "<leader>ds", builtin.lsp_document_symbols, {}) |
|
|
|
|
|
keymap.set("n", "<leader>ws", builtin.lsp_workspace_symbols, {}) |
|
|
|
|
|
keymap.set("n", "<leader>dws", builtin.lsp_dynamic_workspace_symbols, {}) |
|
|
|
|
|
|
|
|
keymap.set("n", "<leader>gf", function () |
|
|
keymap.set("n", "<leader>gf", function () |
|
|
builtin.grep_string({ |
|
|
builtin.grep_string({ |
|
|
search = vim.fn.expand("<cword>"), |
|
|
search = vim.fn.expand("<cword>"), |
|
|
}) |
|
|
}) |
|
|
end, { desc = "Find neovim config files with FZF" }) |
|
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
|
keymap.set("n", "<leader>gF", function () |
|
|
keymap.set("n", "<leader>gF", function () |
|
|
builtin.grep_string({ |
|
|
builtin.grep_string({ |
|
|
search = vim.fn.expand("<cWORD>"), |
|
|
search = vim.fn.expand("<cWORD>"), |
|
|
}) |
|
|
}) |
|
|
end, { desc = "Find neovim config files with FZF" }) |
|
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
|
keymap.set("n", "<leader>gD", function () |
|
|
keymap.set("n", "<leader>gD", function () |
|
|
builtin.find_files({ |
|
|
builtin.find_files({ |
|
|
search_file = vim.fn.expand("<cword>"), |
|
|
search_file = vim.fn.expand("<cword>"), |
|
|
}) |
|
|
}) |
|
|
end, { desc = "Find neovim config files with FZF" }) |
|
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
|
vim.keymap.set("n", "<leader>u", "<cmd>Telescope undo<cr>") |
|
|
vim.keymap.set("n", "<leader>u", "<cmd>Telescope undo<cr>") |
|
|
|
|
|
|
|
|
|
|
|
local function telescopeDotfiles() |
|
|
|
|
|
builtin.find_files({ |
|
|
|
|
|
prompt_title = "< VimRC >", |
|
|
|
|
|
cwd = vim.fn.expand("~/dotfiles"), |
|
|
|
|
|
hidden = true, |
|
|
|
|
|
}) |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_user_command('TelescopeDotfiles', telescopeDotfiles, {}) |
|
|
|
|
|
|
|
|
end, |
|
|
end, |
|
|
} |
|
|
} |