2024-02-15 09:53:19 +01:00
|
|
|
return {
|
|
|
|
-- Fuzzy finder.
|
|
|
|
{
|
|
|
|
"nvim-telescope/telescope.nvim",
|
|
|
|
cmd = "Telescope",
|
|
|
|
version = false, -- telescope did only one release, so use HEAD for now
|
|
|
|
dependencies = {
|
|
|
|
"nvim-telescope/telescope-fzf-native.nvim",
|
2024-03-18 20:21:43 +01:00
|
|
|
build = "gmake",
|
|
|
|
config = function()
|
|
|
|
require("telescope").load_extension("fzf")
|
|
|
|
end,
|
2024-02-15 09:53:19 +01:00
|
|
|
},
|
|
|
|
keys = {
|
2024-03-18 20:21:43 +01:00
|
|
|
{ "<leader><space>", "<cmd>Telescope find_files<cr>", desc = "Find Files" },
|
|
|
|
{ "<leader>,", "<cmd>Telescope buffers show_all_buffers=true<cr>", desc = "Switch Buffer" },
|
|
|
|
{ "<leader>/", "<cmd>Telescope live_grep<cr>", desc = "Switch Buffer" },
|
|
|
|
{ "<leader>sh", "<cmd>Telescope help_tags<cr>", desc = "Search help tags" },
|
|
|
|
{ "<leader>sk", "<cmd>Telescope keymaps<cr>", desc = "Key Maps" },
|
|
|
|
{ "z=", "<cmd>Telescope spell_suggest<cr>", desc = "Spell options" },
|
|
|
|
{ "<leader>ss", "<cmd>Telescope lsp_document_symbols<cr>", desc = "Goto Symbol" },
|
2024-02-15 09:53:19 +01:00
|
|
|
},
|
|
|
|
opts = function()
|
|
|
|
local actions = require("telescope.actions")
|
|
|
|
|
|
|
|
local open_with_trouble = function(...)
|
|
|
|
return require("trouble.providers.telescope").open_with_trouble(...)
|
|
|
|
end
|
|
|
|
local open_selected_with_trouble = function(...)
|
|
|
|
return require("trouble.providers.telescope").open_selected_with_trouble(...)
|
|
|
|
end
|
|
|
|
|
|
|
|
return {
|
|
|
|
defaults = {
|
|
|
|
prompt_prefix = " ",
|
|
|
|
selection_caret = " ",
|
|
|
|
layout_config = { horizontal = { preview_width = 0.5 } },
|
|
|
|
file_ignore_patterns = { 'node_modules/.*' },
|
|
|
|
extensions = {
|
|
|
|
fzf = {
|
|
|
|
fuzzy = true, -- false will only do exact matching
|
|
|
|
override_generic_sorter = true, -- override the generic sorter
|
|
|
|
override_file_sorter = true, -- override the file sorter
|
|
|
|
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mappings = {
|
|
|
|
i = {
|
|
|
|
["<c-t>"] = open_with_trouble,
|
|
|
|
["<a-t>"] = open_selected_with_trouble,
|
|
|
|
["<C-Down>"] = actions.cycle_history_next,
|
|
|
|
["<C-Up>"] = actions.cycle_history_prev,
|
|
|
|
["<C-f>"] = actions.preview_scrolling_down,
|
|
|
|
["<C-b>"] = actions.preview_scrolling_up,
|
|
|
|
},
|
|
|
|
n = {
|
|
|
|
["q"] = actions.close,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
end,
|
|
|
|
},
|
2024-04-04 21:27:51 +02:00
|
|
|
{
|
|
|
|
"nvim-telescope/telescope-bibtex.nvim",
|
|
|
|
config = function()
|
|
|
|
require "telescope".load_extension("bibtex")
|
|
|
|
end,
|
|
|
|
},
|
2024-03-18 20:21:43 +01:00
|
|
|
{
|
|
|
|
'numToStr/Comment.nvim',
|
|
|
|
opts = {
|
|
|
|
-- add any options here
|
|
|
|
},
|
|
|
|
lazy = false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"windwp/nvim-autopairs",
|
|
|
|
event = "InsertEnter",
|
|
|
|
opts = {
|
|
|
|
fast_wrap = {},
|
|
|
|
},
|
2024-02-15 09:53:19 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
-- which-key helps you remember key bindings by showing a popup
|
|
|
|
-- with the active keybindings of the command you started typing.
|
|
|
|
{
|
|
|
|
"folke/which-key.nvim",
|
|
|
|
event = "VeryLazy",
|
|
|
|
opts = {
|
|
|
|
plugins = { spelling = true },
|
|
|
|
defaults = {
|
|
|
|
mode = { "n", "v" },
|
|
|
|
["g"] = { name = "+goto" },
|
|
|
|
["gs"] = { name = "+surround" },
|
|
|
|
["]"] = { name = "+next" },
|
|
|
|
["["] = { name = "+prev" },
|
|
|
|
["<leader><tab>"] = { name = "+tabs" },
|
|
|
|
["<leader>b"] = { name = "+buffer" },
|
|
|
|
["<leader>c"] = { name = "+code" },
|
|
|
|
["<leader>f"] = { name = "+file/find" },
|
|
|
|
["<leader>g"] = { name = "+git" },
|
|
|
|
["<leader>gh"] = { name = "+hunks" },
|
|
|
|
["<leader>q"] = { name = "+quit/session" },
|
|
|
|
["<leader>s"] = { name = "+search" },
|
|
|
|
["<leader>u"] = { name = "+ui" },
|
|
|
|
["<leader>w"] = { name = "+windows" },
|
|
|
|
["<leader>x"] = { name = "+diagnostics/quickfix" },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
config = function(_, opts)
|
|
|
|
local wk = require("which-key")
|
|
|
|
wk.setup(opts)
|
|
|
|
wk.register(opts.defaults)
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
|
|
|
|
-- git signs highlights text that has changed since the list
|
|
|
|
-- git commit, and also lets you interactively stage & unstage
|
|
|
|
-- hunks in a commit.
|
|
|
|
{
|
|
|
|
"lewis6991/gitsigns.nvim",
|
|
|
|
opts = {
|
|
|
|
signs = {
|
|
|
|
add = { text = "▎" },
|
|
|
|
change = { text = "▎" },
|
|
|
|
delete = { text = "" },
|
|
|
|
topdelete = { text = "" },
|
|
|
|
changedelete = { text = "▎" },
|
|
|
|
untracked = { text = "▎" },
|
|
|
|
},
|
|
|
|
on_attach = function(buffer)
|
|
|
|
local gs = package.loaded.gitsigns
|
|
|
|
|
|
|
|
local function map(mode, l, r, desc)
|
|
|
|
vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc })
|
|
|
|
end
|
|
|
|
|
|
|
|
-- stylua: ignore start
|
|
|
|
map("n", "]h", gs.next_hunk, "Next Hunk")
|
|
|
|
map("n", "[h", gs.prev_hunk, "Prev Hunk")
|
|
|
|
map({ "n", "v" }, "<leader>ghs", ":Gitsigns stage_hunk<CR>", "Stage Hunk")
|
|
|
|
map({ "n", "v" }, "<leader>ghr", ":Gitsigns reset_hunk<CR>", "Reset Hunk")
|
|
|
|
map("n", "<leader>ghS", gs.stage_buffer, "Stage Buffer")
|
|
|
|
map("n", "<leader>ghu", gs.undo_stage_hunk, "Undo Stage Hunk")
|
|
|
|
map("n", "<leader>ghR", gs.reset_buffer, "Reset Buffer")
|
|
|
|
map("n", "<leader>ghp", gs.preview_hunk, "Preview Hunk")
|
|
|
|
map("n", "<leader>ghb", function() gs.blame_line({ full = true }) end, "Blame Line")
|
|
|
|
map("n", "<leader>ghd", gs.diffthis, "Diff This")
|
|
|
|
map("n", "<leader>ghD", function() gs.diffthis("~") end, "Diff This ~")
|
|
|
|
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>", "GitSigns Select Hunk")
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
-- Automatically highlights other instances of the word under your cursor.
|
|
|
|
-- This works with LSP, Treesitter, and regexp matching to find the other
|
|
|
|
-- instances.
|
|
|
|
{
|
|
|
|
"RRethy/vim-illuminate",
|
|
|
|
opts = {
|
|
|
|
delay = 200,
|
|
|
|
large_file_cutoff = 2000,
|
|
|
|
large_file_overrides = {
|
|
|
|
providers = { "lsp" },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
config = function(_, opts)
|
|
|
|
require("illuminate").configure(opts)
|
|
|
|
|
|
|
|
local function map(key, dir, buffer)
|
|
|
|
vim.keymap.set("n", key, function()
|
|
|
|
require("illuminate")["goto_" .. dir .. "_reference"](false)
|
|
|
|
end, { desc = dir:sub(1, 1):upper() .. dir:sub(2) .. " Reference", buffer = buffer })
|
|
|
|
end
|
|
|
|
|
|
|
|
map("]]", "next")
|
|
|
|
map("[[", "prev")
|
|
|
|
|
|
|
|
-- also set it after loading ftplugins, since a lot overwrite [[ and ]]
|
|
|
|
vim.api.nvim_create_autocmd("FileType", {
|
|
|
|
callback = function()
|
|
|
|
local buffer = vim.api.nvim_get_current_buf()
|
|
|
|
map("]]", "next", buffer)
|
|
|
|
map("[[", "prev", buffer)
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
end,
|
|
|
|
keys = {
|
|
|
|
{ "]]", desc = "Next Reference" },
|
|
|
|
{ "[[", desc = "Prev Reference" },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
-- better diagnostics list and others
|
|
|
|
{
|
|
|
|
"folke/trouble.nvim",
|
|
|
|
cmd = { "TroubleToggle", "Trouble" },
|
|
|
|
opts = { use_diagnostic_signs = true },
|
|
|
|
keys = {
|
|
|
|
{ "<leader>xx", "<cmd>TroubleToggle document_diagnostics<cr>", desc = "Document Diagnostics (Trouble)" },
|
|
|
|
{ "<leader>xX", "<cmd>TroubleToggle workspace_diagnostics<cr>", desc = "Workspace Diagnostics (Trouble)" },
|
|
|
|
{ "<leader>xL", "<cmd>TroubleToggle loclist<cr>", desc = "Location List (Trouble)" },
|
|
|
|
{ "<leader>xQ", "<cmd>TroubleToggle quickfix<cr>", desc = "Quickfix List (Trouble)" },
|
|
|
|
{
|
|
|
|
"[q",
|
|
|
|
function()
|
|
|
|
if require("trouble").is_open() then
|
|
|
|
require("trouble").previous({ skip_groups = true, jump = true })
|
|
|
|
else
|
|
|
|
local ok, err = pcall(vim.cmd.cprev)
|
|
|
|
if not ok then
|
|
|
|
vim.notify(err, vim.log.levels.ERROR)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
desc = "Previous trouble/quickfix item",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"]q",
|
|
|
|
function()
|
|
|
|
if require("trouble").is_open() then
|
|
|
|
require("trouble").next({ skip_groups = true, jump = true })
|
|
|
|
else
|
|
|
|
local ok, err = pcall(vim.cmd.cnext)
|
|
|
|
if not ok then
|
|
|
|
vim.notify(err, vim.log.levels.ERROR)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
desc = "Next trouble/quickfix item",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
-- Finds and lists all of the TODO, HACK, BUG, etc comment
|
|
|
|
-- in your project and loads them into a browsable list.
|
|
|
|
{
|
|
|
|
"folke/todo-comments.nvim",
|
|
|
|
cmd = { "TodoTrouble", "TodoTelescope" },
|
|
|
|
config = true,
|
|
|
|
-- stylua: ignore
|
|
|
|
keys = {
|
|
|
|
{ "]t", function() require("todo-comments").jump_next() end, desc = "Next todo comment" },
|
|
|
|
{ "[t", function() require("todo-comments").jump_prev() end, desc = "Previous todo comment" },
|
|
|
|
{ "<leader>xt", "<cmd>TodoTrouble<cr>", desc = "Todo (Trouble)" },
|
|
|
|
{ "<leader>xT", "<cmd>TodoTrouble keywords=TODO,FIX,FIXME<cr>", desc = "Todo/Fix/Fixme (Trouble)" },
|
|
|
|
{ "<leader>st", "<cmd>TodoTelescope<cr>", desc = "Todo" },
|
|
|
|
{ "<leader>sT", "<cmd>TodoTelescope keywords=TODO,FIX,FIXME<cr>", desc = "Todo/Fix/Fixme" },
|
|
|
|
},
|
|
|
|
},
|
2024-03-18 20:21:43 +01:00
|
|
|
{
|
|
|
|
"folke/flash.nvim",
|
|
|
|
event = "VeryLazy",
|
|
|
|
opts = {},
|
|
|
|
keys = {
|
|
|
|
{ "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
|
|
|
|
{ "S", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" },
|
|
|
|
{ "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" },
|
|
|
|
{ "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
|
|
|
|
{ "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
|
|
|
|
},
|
|
|
|
}
|
2024-02-15 09:53:19 +01:00
|
|
|
}
|