feat: new setup using fewer plugins, more reliant on snacks, better completions #1
@@ -14,10 +14,10 @@ vim.opt.rtp:prepend(lazypath)
|
|||||||
require("lazy").setup({
|
require("lazy").setup({
|
||||||
spec = {
|
spec = {
|
||||||
{ import = "plugins.nav" },
|
{ import = "plugins.nav" },
|
||||||
|
{ import = "plugins.snacks" },
|
||||||
{ import = "plugins.lsp" },
|
{ import = "plugins.lsp" },
|
||||||
{ import = "plugins.style" },
|
{ import = "plugins.style" },
|
||||||
{ import = "plugins.util" },
|
{ import = "plugins.util" },
|
||||||
{ import = "plugins.util.diff" },
|
|
||||||
{ import = "plugins.testing" },
|
{ import = "plugins.testing" },
|
||||||
},
|
},
|
||||||
change_detection = {
|
change_detection = {
|
||||||
|
|||||||
@@ -8,21 +8,6 @@ M.on_attach = function(client, bufnr)
|
|||||||
opts.buffer = bufnr
|
opts.buffer = bufnr
|
||||||
|
|
||||||
-- set keybinds
|
-- set keybinds
|
||||||
opts.desc = "Show LSP references"
|
|
||||||
keymap.set("n", "gR", "<cmd>Telescope lsp_references<CR>", opts)
|
|
||||||
|
|
||||||
opts.desc = "Go to declaration"
|
|
||||||
keymap.set("n", "gD", ":lua vim.lsp.buf.declaration", opts)
|
|
||||||
|
|
||||||
opts.desc = "Show LSP definitions"
|
|
||||||
keymap.set("n", "gd", "<cmd>Telescope lsp_definitions<CR>", opts)
|
|
||||||
|
|
||||||
opts.desc = "Show LSP implementations"
|
|
||||||
keymap.set("n", "gi", "<cmd>Telescope lsp_implementations<CR>", opts)
|
|
||||||
|
|
||||||
opts.desc = "Show LSP type definitions"
|
|
||||||
keymap.set("n", "gt", "<cmd>Telescope lsp_type_definitions<CR>", opts)
|
|
||||||
|
|
||||||
opts.desc = "See available code actions"
|
opts.desc = "See available code actions"
|
||||||
keymap.set({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, opts)
|
keymap.set({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, opts)
|
||||||
|
|
||||||
@@ -32,12 +17,6 @@ M.on_attach = function(client, bufnr)
|
|||||||
opts.desc = "Smart rename"
|
opts.desc = "Smart rename"
|
||||||
keymap.set("n", "<leader>n", vim.lsp.buf.rename, opts)
|
keymap.set("n", "<leader>n", vim.lsp.buf.rename, opts)
|
||||||
|
|
||||||
opts.desc = "Show buffer diagnostics"
|
|
||||||
keymap.set("n", "ga", "<cmd>Telescope diagnostics bufnr=0<CR>", opts)
|
|
||||||
|
|
||||||
opts.desc = "Show line diagnostics"
|
|
||||||
keymap.set("n", "gA", ":lua vim.diagnostic.open_float()<CR>", opts)
|
|
||||||
|
|
||||||
opts.desc = "Go to previous diagnostic"
|
opts.desc = "Go to previous diagnostic"
|
||||||
keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
|
keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
|
||||||
|
|
||||||
|
|||||||
@@ -28,5 +28,5 @@ return {
|
|||||||
statuscolumn = { enabled = true },
|
statuscolumn = { enabled = true },
|
||||||
scope = { enabled = true },
|
scope = { enabled = true },
|
||||||
},
|
},
|
||||||
keys = require("plugins.snacks.keys"),
|
keys = require("plugins.snacks.keys.keys"),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ return {
|
|||||||
Snacks.picker.icons()
|
Snacks.picker.icons()
|
||||||
end,
|
end,
|
||||||
desc = "Show icons",
|
desc = "Show icons",
|
||||||
mode = "n"
|
mode = "n",
|
||||||
},
|
},
|
||||||
-- Terminal
|
-- Terminal
|
||||||
{
|
{
|
||||||
@@ -56,7 +56,7 @@ return {
|
|||||||
Snacks.explorer()
|
Snacks.explorer()
|
||||||
end,
|
end,
|
||||||
desc = "Open File Tree",
|
desc = "Open File Tree",
|
||||||
mode = "n"
|
mode = "n",
|
||||||
},
|
},
|
||||||
-- Pickers
|
-- Pickers
|
||||||
{
|
{
|
||||||
@@ -65,7 +65,7 @@ return {
|
|||||||
Snacks.picker.files()
|
Snacks.picker.files()
|
||||||
end,
|
end,
|
||||||
desc = "Find file",
|
desc = "Find file",
|
||||||
mode = "n"
|
mode = "n",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<leader>fg",
|
"<leader>fg",
|
||||||
@@ -73,7 +73,7 @@ return {
|
|||||||
Snacks.picker.grep()
|
Snacks.picker.grep()
|
||||||
end,
|
end,
|
||||||
desc = "Find file content using grep",
|
desc = "Find file content using grep",
|
||||||
mode = "n"
|
mode = "n",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<leader>fb",
|
"<leader>fb",
|
||||||
@@ -81,7 +81,7 @@ return {
|
|||||||
Snacks.picker.buffers()
|
Snacks.picker.buffers()
|
||||||
end,
|
end,
|
||||||
desc = "Show all buffers",
|
desc = "Show all buffers",
|
||||||
mode = "n"
|
mode = "n",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<leader>fch",
|
"<leader>fch",
|
||||||
@@ -89,7 +89,7 @@ return {
|
|||||||
Snacks.picker.command_history()
|
Snacks.picker.command_history()
|
||||||
end,
|
end,
|
||||||
desc = "Show command history",
|
desc = "Show command history",
|
||||||
mode = "n"
|
mode = "n",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<leader>fd",
|
"<leader>fd",
|
||||||
@@ -97,7 +97,7 @@ return {
|
|||||||
Snacks.picker.diagnostics()
|
Snacks.picker.diagnostics()
|
||||||
end,
|
end,
|
||||||
desc = "Show diagnostics",
|
desc = "Show diagnostics",
|
||||||
mode = "n"
|
mode = "n",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<leader>fm",
|
"<leader>fm",
|
||||||
@@ -105,7 +105,7 @@ return {
|
|||||||
Snacks.picker.git_diff()
|
Snacks.picker.git_diff()
|
||||||
end,
|
end,
|
||||||
desc = "Show uncommitted diffs",
|
desc = "Show uncommitted diffs",
|
||||||
mode = "n"
|
mode = "n",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<leader>fh",
|
"<leader>fh",
|
||||||
@@ -113,7 +113,7 @@ return {
|
|||||||
Snacks.picker.help()
|
Snacks.picker.help()
|
||||||
end,
|
end,
|
||||||
desc = "Show nvim help pages",
|
desc = "Show nvim help pages",
|
||||||
mode = "n"
|
mode = "n",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<leader>fj",
|
"<leader>fj",
|
||||||
@@ -121,7 +121,7 @@ return {
|
|||||||
Snacks.picker.jumps()
|
Snacks.picker.jumps()
|
||||||
end,
|
end,
|
||||||
desc = "Show available jumps",
|
desc = "Show available jumps",
|
||||||
mode = "n"
|
mode = "n",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<leader>fk",
|
"<leader>fk",
|
||||||
@@ -129,7 +129,7 @@ return {
|
|||||||
Snacks.picker.keymaps()
|
Snacks.picker.keymaps()
|
||||||
end,
|
end,
|
||||||
desc = "Show keymaps",
|
desc = "Show keymaps",
|
||||||
mode = "n"
|
mode = "n",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<leader>flc",
|
"<leader>flc",
|
||||||
@@ -137,47 +137,68 @@ return {
|
|||||||
Snacks.picker.lsp_config()
|
Snacks.picker.lsp_config()
|
||||||
end,
|
end,
|
||||||
desc = "Show LSP configs",
|
desc = "Show LSP configs",
|
||||||
mode = "n"
|
mode = "n",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<leader>fld",
|
"gd",
|
||||||
function()
|
function()
|
||||||
Snacks.picker.lsp_definitions()
|
Snacks.picker.lsp_definitions()
|
||||||
end,
|
end,
|
||||||
desc = "Show LSP definitions (alias for gd)",
|
desc = "Goto definitions",
|
||||||
mode = "n"
|
mode = "n",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<leader>fli",
|
"gi",
|
||||||
function()
|
function()
|
||||||
Snacks.picker.lsp_implementations()
|
Snacks.picker.lsp_implementations()
|
||||||
end,
|
end,
|
||||||
desc = "Show LSP implementations (alias for gi)",
|
desc = "Goto implementations",
|
||||||
mode = "n"
|
mode = "n",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<leader>flr",
|
"<leader>gR",
|
||||||
function()
|
function()
|
||||||
Snacks.picker.lsp_references()
|
Snacks.picker.lsp_references()
|
||||||
end,
|
end,
|
||||||
desc = "Show LSP references (alias for gR)",
|
desc = "Goto references",
|
||||||
mode = "n"
|
mode = "n",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<leader>fls",
|
"<leader>gD",
|
||||||
|
function()
|
||||||
|
Snacks.picker.lsp_declarations()
|
||||||
|
end,
|
||||||
|
desc = "Goto declaration",
|
||||||
|
mode = "n",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"gy",
|
||||||
|
function()
|
||||||
|
Snacks.picker.lsp_type_definitions()
|
||||||
|
end,
|
||||||
|
desc = "Goto T[y]pe Definition",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"gai",
|
||||||
|
function()
|
||||||
|
Snacks.picker.lsp_incoming_calls()
|
||||||
|
end,
|
||||||
|
desc = "C[a]lls Incoming",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"gao",
|
||||||
|
function()
|
||||||
|
Snacks.picker.lsp_outgoing_calls()
|
||||||
|
end,
|
||||||
|
desc = "C[a]lls Outgoing",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"gs",
|
||||||
function()
|
function()
|
||||||
Snacks.picker.lsp_symbols()
|
Snacks.picker.lsp_symbols()
|
||||||
end,
|
end,
|
||||||
desc = "Show LSP symbols",
|
desc = "Show LSP symbols",
|
||||||
mode = "n"
|
mode = "n",
|
||||||
},
|
|
||||||
{
|
|
||||||
"<leader>flt",
|
|
||||||
function()
|
|
||||||
Snacks.picker.lsp_type_definitions()
|
|
||||||
end,
|
|
||||||
desc = "Show LSP type definitions",
|
|
||||||
mode = "n"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<leader>fn",
|
"<leader>fn",
|
||||||
@@ -185,7 +206,7 @@ return {
|
|||||||
Snacks.picker.notifications()
|
Snacks.picker.notifications()
|
||||||
end,
|
end,
|
||||||
desc = "Show notifications",
|
desc = "Show notifications",
|
||||||
mode = "n"
|
mode = "n",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<leader>fp",
|
"<leader>fp",
|
||||||
@@ -193,7 +214,7 @@ return {
|
|||||||
Snacks.picker.projects()
|
Snacks.picker.projects()
|
||||||
end,
|
end,
|
||||||
desc = "Show recent projects",
|
desc = "Show recent projects",
|
||||||
mode = "n"
|
mode = "n",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<leader>fr",
|
"<leader>fr",
|
||||||
@@ -201,7 +222,7 @@ return {
|
|||||||
Snacks.picker.recent()
|
Snacks.picker.recent()
|
||||||
end,
|
end,
|
||||||
desc = "Show recent files",
|
desc = "Show recent files",
|
||||||
mode = "n"
|
mode = "n",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<leader>fs",
|
"<leader>fs",
|
||||||
@@ -209,7 +230,7 @@ return {
|
|||||||
Snacks.picker.spelling()
|
Snacks.picker.spelling()
|
||||||
end,
|
end,
|
||||||
desc = "Show spelling suggestions",
|
desc = "Show spelling suggestions",
|
||||||
mode = "n"
|
mode = "n",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"<leader>fo",
|
"<leader>fo",
|
||||||
@@ -217,7 +238,7 @@ return {
|
|||||||
Snacks.picker.treesitter()
|
Snacks.picker.treesitter()
|
||||||
end,
|
end,
|
||||||
desc = "Show treesitter details",
|
desc = "Show treesitter details",
|
||||||
mode = "n"
|
mode = "n",
|
||||||
},
|
},
|
||||||
-- Close buffer
|
-- Close buffer
|
||||||
{
|
{
|
||||||
@@ -1,71 +1,87 @@
|
|||||||
return {
|
return {
|
||||||
"folke/todo-comments.nvim",
|
"folke/todo-comments.nvim",
|
||||||
dependencies = { "nvim-lua/plenary.nvim" },
|
dependencies = { "nvim-lua/plenary.nvim" },
|
||||||
event = "BufRead",
|
event = "BufRead",
|
||||||
opts = {
|
opts = {
|
||||||
{
|
{
|
||||||
signs = true, -- show icons in the signs column
|
signs = true, -- show icons in the signs column
|
||||||
sign_priority = 8, -- sign priority
|
sign_priority = 8, -- sign priority
|
||||||
-- keywords recognized as todo comments
|
-- keywords recognized as todo comments
|
||||||
keywords = {
|
keywords = {
|
||||||
FIX = {
|
FIX = {
|
||||||
icon = " ", -- icon used for the sign, and in search results
|
icon = " ", -- icon used for the sign, and in search results
|
||||||
color = "error", -- can be a hex color, or a named color (see below)
|
color = "error", -- can be a hex color, or a named color (see below)
|
||||||
alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords
|
alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords
|
||||||
-- signs = false, -- configure signs for some keywords individually
|
-- signs = false, -- configure signs for some keywords individually
|
||||||
},
|
},
|
||||||
TODO = { icon = " ", color = "todo" },
|
TODO = { icon = " ", color = "todo" },
|
||||||
HACK = { icon = " ", color = "warning" },
|
HACK = { icon = " ", color = "warning" },
|
||||||
WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } },
|
WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } },
|
||||||
PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
|
PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
|
||||||
NOTE = { icon = " ", color = "hint", alt = { "INFO" } },
|
NOTE = { icon = " ", color = "hint", alt = { "INFO" } },
|
||||||
TEST = { icon = "⏲ ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } },
|
TEST = { icon = "⏲ ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } },
|
||||||
},
|
},
|
||||||
gui_style = {
|
gui_style = {
|
||||||
fg = "NONE", -- The gui style to use for the fg highlight group.
|
fg = "NONE", -- The gui style to use for the fg highlight group.
|
||||||
bg = "BOLD", -- The gui style to use for the bg highlight group.
|
bg = "BOLD", -- The gui style to use for the bg highlight group.
|
||||||
},
|
},
|
||||||
merge_keywords = true, -- when true, custom keywords will be merged with the defaults
|
merge_keywords = true, -- when true, custom keywords will be merged with the defaults
|
||||||
-- highlighting of the line containing the todo comment
|
-- highlighting of the line containing the todo comment
|
||||||
-- * before: highlights before the keyword (typically comment characters)
|
-- * before: highlights before the keyword (typically comment characters)
|
||||||
-- * keyword: highlights of the keyword
|
-- * keyword: highlights of the keyword
|
||||||
-- * after: highlights after the keyword (todo text)
|
-- * after: highlights after the keyword (todo text)
|
||||||
highlight = {
|
highlight = {
|
||||||
multiline = true, -- enable multine todo comments
|
multiline = true, -- enable multine todo comments
|
||||||
multiline_pattern = "^.", -- lua pattern to match the next multiline from the start of the matched keyword
|
multiline_pattern = "^.", -- lua pattern to match the next multiline from the start of the matched keyword
|
||||||
multiline_context = 10, -- extra lines that will be re-evaluated when changing a line
|
multiline_context = 10, -- extra lines that will be re-evaluated when changing a line
|
||||||
before = "", -- "fg" or "bg" or empty
|
before = "", -- "fg" or "bg" or empty
|
||||||
keyword = "wide", -- "fg", "bg", "wide", "wide_bg", "wide_fg" or empty. (wide and wide_bg is the same as bg, but will also highlight surrounding characters, wide_fg acts accordingly but with fg)
|
keyword = "wide", -- "fg", "bg", "wide", "wide_bg", "wide_fg" or empty. (wide and wide_bg is the same as bg, but will also highlight surrounding characters, wide_fg acts accordingly but with fg)
|
||||||
after = "fg", -- "fg" or "bg" or empty
|
after = "fg", -- "fg" or "bg" or empty
|
||||||
pattern = [[.*<(KEYWORDS)\s*:]], -- pattern or table of patterns, used for highlighting (vim regex)
|
pattern = [[.*<(KEYWORDS)\s*:]], -- pattern or table of patterns, used for highlighting (vim regex)
|
||||||
comments_only = true, -- uses treesitter to match keywords in comments only
|
comments_only = true, -- uses treesitter to match keywords in comments only
|
||||||
max_line_len = 400, -- ignore lines longer than this
|
max_line_len = 400, -- ignore lines longer than this
|
||||||
exclude = {}, -- list of file types to exclude highlighting
|
exclude = {}, -- list of file types to exclude highlighting
|
||||||
},
|
},
|
||||||
-- list of named colors where we try to extract the guifg from the
|
-- list of named colors where we try to extract the guifg from the
|
||||||
-- list of highlight groups or use the hex color if hl not found as a fallback
|
-- list of highlight groups or use the hex color if hl not found as a fallback
|
||||||
colors = {
|
colors = {
|
||||||
error = { "DiagnosticError", "ErrorMsg", "#DC2626" },
|
error = { "DiagnosticError", "ErrorMsg", "#DC2626" },
|
||||||
warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" },
|
warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" },
|
||||||
todo = { "DiagnosticInfo", "#2563EB" },
|
todo = { "DiagnosticInfo", "#2563EB" },
|
||||||
hint = { "DiagnosticHint", "#10B981" },
|
hint = { "DiagnosticHint", "#10B981" },
|
||||||
default = { "Identifier", "#7C3AED" },
|
default = { "Identifier", "#7C3AED" },
|
||||||
test = { "Identifier", "#FF00FF" },
|
test = { "Identifier", "#FF00FF" },
|
||||||
},
|
},
|
||||||
search = {
|
search = {
|
||||||
command = "rg",
|
command = "rg",
|
||||||
args = {
|
args = {
|
||||||
"--color=never",
|
"--color=never",
|
||||||
"--no-heading",
|
"--no-heading",
|
||||||
"--with-filename",
|
"--with-filename",
|
||||||
"--line-number",
|
"--line-number",
|
||||||
"--column",
|
"--column",
|
||||||
},
|
},
|
||||||
-- regex that will be used to match keywords.
|
-- regex that will be used to match keywords.
|
||||||
-- don't replace the (KEYWORDS) placeholder
|
-- don't replace the (KEYWORDS) placeholder
|
||||||
pattern = [[\b(KEYWORDS):]], -- ripgrep regex
|
pattern = [[\b(KEYWORDS):]], -- ripgrep regex
|
||||||
-- pattern = [[\b(KEYWORDS)\b]], -- match without the extra colon. You'll likely get false positives
|
-- pattern = [[\b(KEYWORDS)\b]], -- match without the extra colon. You'll likely get false positives
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>ft",
|
||||||
|
function()
|
||||||
|
Snacks.picker.todo_comments()
|
||||||
|
end,
|
||||||
|
desc = "Todo",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>fT",
|
||||||
|
function()
|
||||||
|
Snacks.picker.todo_comments({ keywords = { "TODO", "FIX", "FIXME" } })
|
||||||
|
end,
|
||||||
|
desc = "Todo/Fix/Fixme",
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user