2022-12-30 17:30:52 +01:00
|
|
|
return {
|
|
|
|
|
2023-01-02 17:38:05 +01:00
|
|
|
-- search/replace in multiple files
|
|
|
|
{
|
2024-07-20 21:39:39 +02:00
|
|
|
"MagicDuck/grug-far.nvim",
|
|
|
|
opts = { headerMaxWidth = 80 },
|
|
|
|
cmd = "GrugFar",
|
2023-01-02 17:38:05 +01:00
|
|
|
keys = {
|
2024-07-20 21:39:39 +02:00
|
|
|
{
|
|
|
|
"<leader>sr",
|
|
|
|
function()
|
2024-07-21 17:20:29 +02:00
|
|
|
local grug = require("grug-far")
|
|
|
|
local ext = vim.bo.buftype == "" and vim.fn.expand("%:e")
|
2024-09-16 08:47:31 +02:00
|
|
|
grug.open({
|
2024-07-22 23:26:03 +02:00
|
|
|
transient = true,
|
2024-07-22 08:38:32 +02:00
|
|
|
prefills = {
|
|
|
|
filesFilter = ext and ext ~= "" and "*." .. ext or nil,
|
|
|
|
},
|
2024-07-20 21:39:39 +02:00
|
|
|
})
|
|
|
|
end,
|
|
|
|
mode = { "n", "v" },
|
|
|
|
desc = "Search and Replace",
|
|
|
|
},
|
2023-01-02 17:38:05 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2023-07-19 07:14:07 -04:00
|
|
|
-- Flash enhances the built-in search functionality by showing labels
|
|
|
|
-- at the end of each match, letting you quickly jump to a specific
|
|
|
|
-- location.
|
2023-01-01 09:54:16 +01:00
|
|
|
{
|
2023-07-13 08:17:36 +02:00
|
|
|
"folke/flash.nvim",
|
|
|
|
event = "VeryLazy",
|
|
|
|
vscode = true,
|
|
|
|
---@type Flash.Config
|
|
|
|
opts = {},
|
|
|
|
-- stylua: ignore
|
2023-02-16 14:12:04 +01:00
|
|
|
keys = {
|
2023-07-13 08:17:36 +02:00
|
|
|
{ "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
|
|
|
|
{ "S", mode = { "n", "o", "x" }, 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" },
|
2023-02-16 14:12:04 +01:00
|
|
|
},
|
2023-07-13 08:17:36 +02:00
|
|
|
},
|
|
|
|
|
2023-07-19 07:14:07 -04:00
|
|
|
-- which-key helps you remember key bindings by showing a popup
|
|
|
|
-- with the active keybindings of the command you started typing.
|
2022-12-30 17:30:52 +01:00
|
|
|
{
|
|
|
|
"folke/which-key.nvim",
|
|
|
|
event = "VeryLazy",
|
2024-07-12 22:54:35 +02:00
|
|
|
opts_extend = { "spec" },
|
2023-01-08 15:05:34 +01:00
|
|
|
opts = {
|
2024-12-12 06:59:52 +01:00
|
|
|
preset = "helix",
|
2024-07-12 22:54:35 +02:00
|
|
|
defaults = {},
|
|
|
|
spec = {
|
|
|
|
{
|
|
|
|
mode = { "n", "v" },
|
|
|
|
{ "<leader><tab>", group = "tabs" },
|
|
|
|
{ "<leader>c", group = "code" },
|
2024-12-12 12:29:43 +01:00
|
|
|
{ "<leader>d", group = "debug" },
|
|
|
|
{ "<leader>dp", group = "profiler" },
|
2024-07-12 22:54:35 +02:00
|
|
|
{ "<leader>f", group = "file/find" },
|
|
|
|
{ "<leader>g", group = "git" },
|
|
|
|
{ "<leader>gh", group = "hunks" },
|
|
|
|
{ "<leader>q", group = "quit/session" },
|
|
|
|
{ "<leader>s", group = "search" },
|
2024-07-15 15:47:44 +02:00
|
|
|
{ "<leader>u", group = "ui", icon = { icon = " ", color = "cyan" } },
|
2024-07-20 17:04:01 +02:00
|
|
|
{ "<leader>x", group = "diagnostics/quickfix", icon = { icon = " ", color = "green" } },
|
|
|
|
{ "[", group = "prev" },
|
|
|
|
{ "]", group = "next" },
|
|
|
|
{ "g", group = "goto" },
|
|
|
|
{ "gs", group = "surround" },
|
|
|
|
{ "z", group = "fold" },
|
|
|
|
{
|
|
|
|
"<leader>b",
|
|
|
|
group = "buffer",
|
|
|
|
expand = function()
|
|
|
|
return require("which-key.extras").expand.buf()
|
|
|
|
end,
|
|
|
|
},
|
2024-07-17 12:42:55 +02:00
|
|
|
{
|
|
|
|
"<leader>w",
|
|
|
|
group = "windows",
|
|
|
|
proxy = "<c-w>",
|
|
|
|
expand = function()
|
|
|
|
return require("which-key.extras").expand.win()
|
|
|
|
end,
|
|
|
|
},
|
2024-07-20 17:04:01 +02:00
|
|
|
-- better descriptions
|
|
|
|
{ "gx", desc = "Open with system app" },
|
2024-07-12 22:54:35 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
keys = {
|
|
|
|
{
|
|
|
|
"<leader>?",
|
|
|
|
function()
|
|
|
|
require("which-key").show({ global = false })
|
|
|
|
end,
|
2024-07-15 15:47:44 +02:00
|
|
|
desc = "Buffer Keymaps (which-key)",
|
2023-04-16 21:33:55 +02:00
|
|
|
},
|
2024-07-17 12:42:29 +02:00
|
|
|
{
|
|
|
|
"<c-w><space>",
|
|
|
|
function()
|
|
|
|
require("which-key").show({ keys = "<c-w>", loop = true })
|
|
|
|
end,
|
|
|
|
desc = "Window Hydra Mode (which-key)",
|
|
|
|
},
|
2023-04-16 21:33:55 +02:00
|
|
|
},
|
|
|
|
config = function(_, opts)
|
|
|
|
local wk = require("which-key")
|
|
|
|
wk.setup(opts)
|
2024-07-12 22:54:35 +02:00
|
|
|
if not vim.tbl_isempty(opts.defaults) then
|
|
|
|
LazyVim.warn("which-key: opts.defaults is deprecated. Please use opts.spec instead.")
|
|
|
|
wk.register(opts.defaults)
|
|
|
|
end
|
2022-12-31 18:14:46 +01:00
|
|
|
end,
|
2022-12-30 17:30:52 +01:00
|
|
|
},
|
2022-12-31 17:07:30 +01:00
|
|
|
|
2023-07-19 07:14:07 -04:00
|
|
|
-- git signs highlights text that has changed since the list
|
|
|
|
-- git commit, and also lets you interactively stage & unstage
|
|
|
|
-- hunks in a commit.
|
2022-12-31 17:07:30 +01:00
|
|
|
{
|
|
|
|
"lewis6991/gitsigns.nvim",
|
2023-10-04 10:45:10 +02:00
|
|
|
event = "LazyFile",
|
2023-01-08 15:05:34 +01:00
|
|
|
opts = {
|
2022-12-31 17:07:30 +01:00
|
|
|
signs = {
|
|
|
|
add = { text = "▎" },
|
|
|
|
change = { text = "▎" },
|
2023-02-28 10:01:53 +01:00
|
|
|
delete = { text = "" },
|
|
|
|
topdelete = { text = "" },
|
2022-12-31 17:07:30 +01:00
|
|
|
changedelete = { text = "▎" },
|
|
|
|
untracked = { text = "▎" },
|
|
|
|
},
|
2024-06-28 02:03:08 +08:00
|
|
|
signs_staged = {
|
|
|
|
add = { text = "▎" },
|
|
|
|
change = { text = "▎" },
|
|
|
|
delete = { text = "" },
|
|
|
|
topdelete = { text = "" },
|
|
|
|
changedelete = { text = "▎" },
|
|
|
|
},
|
2023-01-07 00:06:54 +01:00
|
|
|
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
|
2024-06-23 06:13:51 +01:00
|
|
|
map("n", "]h", function()
|
|
|
|
if vim.wo.diff then
|
|
|
|
vim.cmd.normal({ "]c", bang = true })
|
|
|
|
else
|
|
|
|
gs.nav_hunk("next")
|
|
|
|
end
|
|
|
|
end, "Next Hunk")
|
|
|
|
map("n", "[h", function()
|
|
|
|
if vim.wo.diff then
|
|
|
|
vim.cmd.normal({ "[c", bang = true })
|
|
|
|
else
|
|
|
|
gs.nav_hunk("prev")
|
|
|
|
end
|
|
|
|
end, "Prev Hunk")
|
2024-05-15 18:15:11 +04:00
|
|
|
map("n", "]H", function() gs.nav_hunk("last") end, "Last Hunk")
|
|
|
|
map("n", "[H", function() gs.nav_hunk("first") end, "First Hunk")
|
2023-01-07 00:06:54 +01:00
|
|
|
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")
|
2024-01-21 19:49:41 +01:00
|
|
|
map("n", "<leader>ghp", gs.preview_hunk_inline, "Preview Hunk Inline")
|
2023-01-07 00:06:54 +01:00
|
|
|
map("n", "<leader>ghb", function() gs.blame_line({ full = true }) end, "Blame Line")
|
2024-06-21 22:14:48 +03:00
|
|
|
map("n", "<leader>ghB", function() gs.blame() end, "Blame Buffer")
|
2023-01-07 00:06:54 +01:00
|
|
|
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,
|
2022-12-31 17:07:30 +01:00
|
|
|
},
|
|
|
|
},
|
2024-12-07 11:57:21 +01:00
|
|
|
{
|
|
|
|
"gitsigns.nvim",
|
|
|
|
opts = function()
|
|
|
|
Snacks.toggle({
|
|
|
|
name = "Git Signs",
|
|
|
|
get = function()
|
|
|
|
return require("gitsigns.config").config.signcolumn
|
|
|
|
end,
|
|
|
|
set = function(state)
|
|
|
|
require("gitsigns").toggle_signs(state)
|
|
|
|
end,
|
|
|
|
}):map("<leader>uG")
|
|
|
|
end,
|
|
|
|
},
|
2022-12-31 17:07:30 +01:00
|
|
|
|
2023-01-04 13:51:45 +01:00
|
|
|
-- better diagnostics list and others
|
|
|
|
{
|
|
|
|
"folke/trouble.nvim",
|
2024-06-14 16:46:35 +02:00
|
|
|
cmd = { "Trouble" },
|
2024-07-05 02:22:38 -04:00
|
|
|
opts = {
|
|
|
|
modes = {
|
|
|
|
lsp = {
|
|
|
|
win = { position = "right" },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2023-01-04 13:51:45 +01:00
|
|
|
keys = {
|
2024-05-30 14:41:13 +02:00
|
|
|
{ "<leader>xx", "<cmd>Trouble diagnostics toggle<cr>", desc = "Diagnostics (Trouble)" },
|
|
|
|
{ "<leader>xX", "<cmd>Trouble diagnostics toggle filter.buf=0<cr>", desc = "Buffer Diagnostics (Trouble)" },
|
2024-07-05 02:22:38 -04:00
|
|
|
{ "<leader>cs", "<cmd>Trouble symbols toggle<cr>", desc = "Symbols (Trouble)" },
|
|
|
|
{ "<leader>cS", "<cmd>Trouble lsp toggle<cr>", desc = "LSP references/definitions/... (Trouble)" },
|
2024-05-30 14:41:13 +02:00
|
|
|
{ "<leader>xL", "<cmd>Trouble loclist toggle<cr>", desc = "Location List (Trouble)" },
|
|
|
|
{ "<leader>xQ", "<cmd>Trouble qflist toggle<cr>", desc = "Quickfix List (Trouble)" },
|
2023-02-28 10:31:35 +00:00
|
|
|
{
|
|
|
|
"[q",
|
|
|
|
function()
|
|
|
|
if require("trouble").is_open() then
|
2024-05-30 14:41:13 +02:00
|
|
|
require("trouble").prev({ skip_groups = true, jump = true })
|
2023-02-28 10:31:35 +00:00
|
|
|
else
|
2023-06-08 07:53:16 +02:00
|
|
|
local ok, err = pcall(vim.cmd.cprev)
|
|
|
|
if not ok then
|
|
|
|
vim.notify(err, vim.log.levels.ERROR)
|
|
|
|
end
|
2023-02-28 10:31:35 +00:00
|
|
|
end
|
|
|
|
end,
|
2024-03-27 00:56:44 -07:00
|
|
|
desc = "Previous Trouble/Quickfix Item",
|
2023-02-28 10:31:35 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"]q",
|
|
|
|
function()
|
|
|
|
if require("trouble").is_open() then
|
|
|
|
require("trouble").next({ skip_groups = true, jump = true })
|
|
|
|
else
|
2023-06-08 07:53:16 +02:00
|
|
|
local ok, err = pcall(vim.cmd.cnext)
|
|
|
|
if not ok then
|
|
|
|
vim.notify(err, vim.log.levels.ERROR)
|
|
|
|
end
|
2023-02-28 10:31:35 +00:00
|
|
|
end
|
|
|
|
end,
|
2024-03-27 00:56:44 -07:00
|
|
|
desc = "Next Trouble/Quickfix Item",
|
2023-02-28 10:31:35 +00:00
|
|
|
},
|
2023-01-04 13:51:45 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2023-07-19 07:14:07 -04:00
|
|
|
-- Finds and lists all of the TODO, HACK, BUG, etc comment
|
|
|
|
-- in your project and loads them into a browsable list.
|
2023-01-04 13:51:54 +01:00
|
|
|
{
|
|
|
|
"folke/todo-comments.nvim",
|
|
|
|
cmd = { "TodoTrouble", "TodoTelescope" },
|
2023-10-04 10:45:10 +02:00
|
|
|
event = "LazyFile",
|
2024-06-11 00:06:56 +02:00
|
|
|
opts = {},
|
2023-01-04 13:51:54 +01:00
|
|
|
-- stylua: ignore
|
|
|
|
keys = {
|
2024-03-27 00:56:44 -07:00
|
|
|
{ "]t", function() require("todo-comments").jump_next() end, desc = "Next Todo Comment" },
|
|
|
|
{ "[t", function() require("todo-comments").jump_prev() end, desc = "Previous Todo Comment" },
|
2024-06-02 18:23:58 +05:30
|
|
|
{ "<leader>xt", "<cmd>Trouble todo toggle<cr>", desc = "Todo (Trouble)" },
|
|
|
|
{ "<leader>xT", "<cmd>Trouble todo toggle filter = {tag = {TODO,FIX,FIXME}}<cr>", desc = "Todo/Fix/Fixme (Trouble)" },
|
2023-01-17 14:21:39 +01:00
|
|
|
{ "<leader>st", "<cmd>TodoTelescope<cr>", desc = "Todo" },
|
2023-04-16 20:15:34 +08:00
|
|
|
{ "<leader>sT", "<cmd>TodoTelescope keywords=TODO,FIX,FIXME<cr>", desc = "Todo/Fix/Fixme" },
|
2023-01-04 13:51:54 +01:00
|
|
|
},
|
|
|
|
},
|
2022-12-30 17:30:52 +01:00
|
|
|
}
|