aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/home/.config/nvim/lua
diff options
context:
space:
mode:
authorLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2025-09-11 16:38:11 +0100
committerLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2025-09-11 16:38:11 +0100
commitaa62e1f27b0cb3d712d6f2b13071cca0f09379be (patch)
treea6d2a4ba09d66490bc7c1a23f35be707fa0f5c8b /home/.config/nvim/lua
parentc1f310bcc39f6cf4684d938d7be45bb25b427335 (diff)
downloaddotfiles-master.tar.gz
dotfiles-master.tar.bz2
dotfiles-master.zip
Add a lot of changesHEADmaster
Diffstat (limited to 'home/.config/nvim/lua')
-rw-r--r--home/.config/nvim/lua/cfg/options.lua66
-rw-r--r--home/.config/nvim/lua/cfg/utils.lua12
-rw-r--r--home/.config/nvim/lua/custom/plugins/completion.lua188
-rw-r--r--home/.config/nvim/lua/custom/plugins/debug.lua358
-rw-r--r--home/.config/nvim/lua/custom/plugins/ft.lua7
-rw-r--r--home/.config/nvim/lua/custom/plugins/git.lua166
-rw-r--r--home/.config/nvim/lua/custom/plugins/init.lua467
-rw-r--r--home/.config/nvim/lua/custom/plugins/lsp.lua387
-rw-r--r--home/.config/nvim/lua/custom/plugins/telescope.lua397
-rw-r--r--home/.config/nvim/lua/custom/plugins/ts.lua292
-rw-r--r--home/.config/nvim/lua/custom/plugins/ui.lua75
-rw-r--r--home/.config/nvim/lua/mapper.lua84
12 files changed, 1528 insertions, 971 deletions
diff --git a/home/.config/nvim/lua/cfg/options.lua b/home/.config/nvim/lua/cfg/options.lua
index 05f563f..47489f1 100644
--- a/home/.config/nvim/lua/cfg/options.lua
+++ b/home/.config/nvim/lua/cfg/options.lua
@@ -1,4 +1,6 @@
-local opt = vim.opt
+local opt = vim.o
+
+opt.termguicolors = true
opt.undofile = true
opt.swapfile = false
@@ -8,6 +10,7 @@ opt.number = true
opt.cursorline = true
opt.signcolumn = "auto:2"
opt.showmatch = true
+opt.laststatus = 3
opt.expandtab = true
opt.shiftround = true
@@ -15,50 +18,62 @@ opt.shiftwidth = 0
opt.softtabstop = -1
opt.tabstop = 4
+opt.gdefault = true
+opt.ignorecase = true
+opt.smartcase = true
+
opt.splitbelow = true
opt.splitright = true
+opt.splitkeep = "screen"
opt.linebreak = true
opt.breakindent = true
opt.textwidth = 80
opt.colorcolumn = "+1"
-opt.formatoptions:remove("t")
+vim.opt.formatoptions:remove("t")
opt.cmdheight = 2
+-- vim.o.messagesopt = "wait:5000,history:500"
-opt.shortmess:append({ a = true })
+vim.opt.shortmess:append({ a = true })
-opt.gdefault = true
+opt.updatetime = 250
+opt.timeoutlen = 300
opt.synmaxcol = 500
-opt.completeopt = { "menu", "menuone", "noselect" }
+vim.opt.completeopt = { "menuone", "noselect", "popup", "fuzzy" }
opt.scrolloff = 999
opt.sidescrolloff = 5
-opt.clipboard = "unnamedplus"
+vim.schedule(function()
+ opt.clipboard = vim.env.SSH_TTY and "" or "unnamedplus"
+end)
+
+vim.o.mouse = "a"
-opt.wildmode = { "longest", "full" }
+vim.opt.wildmode = { "longest", "full" }
-opt.cpoptions:remove({ "_" })
+vim.opt.cpoptions:remove({ "_" })
-opt.listchars = {
+vim.opt.listchars = {
tab = "> ",
- trail = "·",
+ space = "·",
extends = ">",
precedes = "<",
nbsp = "+",
}
opt.list = true
+opt.confirm = true
+
opt.virtualedit = "block"
opt.spelloptions = "camel"
-vim.g.is_posix = 1
-vim.g.python_host_prog = 0
-vim.g.python3_host_prog = 0
-vim.g.netrw_home = vim.fn.stdpath("data")
+vim.g.loaded_node_provider = 0
+vim.g.loaded_perl_provider = 0
+vim.g.loaded_python3_provider = 0
-opt.diffopt:append({
+vim.opt.diffopt:append({
["indent-heuristic"] = true,
hiddenoff = true,
iblank = true,
@@ -68,22 +83,25 @@ opt.diffopt:append({
if vim.fn.executable("rg") then
opt.grepprg = "rg\\ --vimgrep"
- opt.grepformat:append("f:%l:%c:%m")
+ opt.grepformat = "f:%l:%c:%m"
end
-opt.termguicolors = true
opt.pumblend = 20
-opt.foldmethod = "expr"
-opt.foldexpr = "nvim_treesitter#foldexpr()"
-opt.foldenable = false
+vim.wo.foldmethod = "expr"
+vim.wo.foldenable = false
vim.g.mapleader = " "
vim.g.maplocalleader = ","
vim.diagnostic.config({
- virtual_text = {
- source = "if_many",
- severity = vim.diagnostic.severity.ERROR,
- }
+ virtual_text = false,
+ virtual_lines = false,
})
+
+opt.sessionoptions =
+ "blank,buffers,curdir,help,tabpages,winsize,winpos,terminal,localoptions"
+
+vim.o.exrc = true
+
+
diff --git a/home/.config/nvim/lua/cfg/utils.lua b/home/.config/nvim/lua/cfg/utils.lua
index 7cd172a..300d7a7 100644
--- a/home/.config/nvim/lua/cfg/utils.lua
+++ b/home/.config/nvim/lua/cfg/utils.lua
@@ -12,9 +12,15 @@ function M.format_hunks(options)
local start = hunk.added.start
local last = start + hunk.added.count
-- nvim_buf_get_lines uses zero-based indexing -> subtract from last
- local last_hunk_line = vim.api.nvim_buf_get_lines(0, last - 2, last - 1, true)[1]
- local range = { start = { start, 0 }, ["end"] = { last - 1, last_hunk_line:len() } }
- options = vim.tbl_extend("force", { range = range, lsp_fallback = true, quiet = true }, options or {})
+ local last_hunk_line =
+ vim.api.nvim_buf_get_lines(0, last - 2, last - 1, true)[1]
+ local range =
+ { start = { start, 0 }, ["end"] = { last - 1, last_hunk_line:len() } }
+ options = vim.tbl_extend(
+ "force",
+ { range = range, lsp_fallback = true, quiet = true },
+ options or {}
+ )
conform.format(options)
end
end
diff --git a/home/.config/nvim/lua/custom/plugins/completion.lua b/home/.config/nvim/lua/custom/plugins/completion.lua
index 789a459..70fdba0 100644
--- a/home/.config/nvim/lua/custom/plugins/completion.lua
+++ b/home/.config/nvim/lua/custom/plugins/completion.lua
@@ -1,116 +1,96 @@
return {
{
- "hrsh7th/nvim-cmp",
+ "zbirenbaum/copilot.lua",
+ cmd = "Copilot",
+ build = ":Copilot auth",
event = "InsertEnter",
- config = function()
- local cmp = require("cmp")
-
- local has_words_before = function()
- local line, col = unpack(vim.api.nvim_win_get_cursor(0))
- return col ~= 0
- and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]
- :sub(col, col)
- :match("%s")
- == nil
- end
-
- local luasnip = require("luasnip")
-
- cmp.setup({
- snippet = {
- expand = function(args)
- require("luasnip").lsp_expand(args.body)
- end,
- },
- mapping = {
- ["<Tab>"] = cmp.mapping(function(fallback)
- if cmp.visible() then
- cmp.select_next_item()
- elseif luasnip.expand_or_jumpable() then
- luasnip.expand_or_jump()
- elseif has_words_before() then
- cmp.complete()
- else
- fallback()
- end
- end, {
- "i",
- "s",
- }),
- ["<S-Tab>"] = cmp.mapping(function(fallback)
- if cmp.visible() then
- cmp.select_prev_item()
- elseif luasnip.jumpable(-1) then
- luasnip.jump(-1)
- else
- fallback()
- end
- end, {
- "i",
- "s",
- }),
- ["<CR>"] = cmp.mapping.confirm({
- behavior = cmp.ConfirmBehavior.Replace,
- select = true,
- }),
- },
- formatting = {
- format = function(entry, vim_item)
- -- set a name for each source
- vim_item.menu = ({
- path = "[Path]",
- nvim_lsp = "[LSP]",
- luasnip = "[LuaSnip]",
- dap = "[dap]",
- })[entry.source.name]
- return vim_item
- end,
- },
- sources = {
- { name = "nvim_lsp" },
- { name = "luasnip" },
- { name = "path" },
- { name = "nvim_lsp_signature_help" },
- },
- })
-
- require "cmp".setup.filetype(
- { "dap-repl", "dapui_watches", "dapui_hover" }, {
- sources = {
- { name = "dap" },
- },
- })
-
- local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
- cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
- end,
+ keys = {
+ {
+ "<leader>tc",
+ function()
+ require("copilot.command").toggle()
+ end,
+ desc = "[T]oggle [C]opilot attachment",
+ },
+ },
+ opts = {
+ suggestion = { enabled = false },
+ panel = { enabled = false },
+ },
+ },
+ {
+ "saghen/blink.compat",
+ opts = {},
+ },
+ {
+ "saghen/blink.cmp",
dependencies = {
- "hrsh7th/cmp-nvim-lsp",
- "hrsh7th/cmp-path",
- "hrsh7th/cmp-nvim-lsp-signature-help",
+ "rafamadriz/friendly-snippets",
+ "fang2hou/blink-copilot",
"rcarriga/cmp-dap",
- "windwp/nvim-autopairs",
- {
- "saadparwaiz1/cmp_luasnip",
- dependencies = {
- {
- "L3MON4D3/LuaSnip",
- event = "InsertCharPre",
- keys = {
- { "<c-j>", function() require "luasnip".jump(1) end, mode = "i" },
- { "<c-k>", function() require "luasnip".jump(-1) end, mode = "i" },
- },
- config = function()
- require("luasnip/loaders/from_vscode").lazy_load()
+ },
+ opts = {
+ keymap = {
+ preset = "cmdline",
+ ["<CR>"] = { "accept", "fallback" },
+ },
+ appearance = {
+ use_nvim_cmp_as_default = true,
+ },
+ completion = {
+ list = {
+ selection = {
+ preselect = function()
+ return not require("blink.cmp").snippet_active({ direction = 1 })
end,
- dependencies = {
- "kitagry/vs-snippets",
- "rafamadriz/friendly-snippets",
- "kkonghao/snippet-dog",
+ },
+ },
+ documentation = { auto_show = true },
+ },
+ signature = {
+ enabled = true,
+ trigger = {
+ enabled = true,
+ show_on_keyword = true,
+ show_on_insert = true,
+ },
+ },
+ sources = {
+ default = { "lazydev", "lsp", "copilot", "snippets", "path", "buffer" },
+ per_filetype = {
+ ["dap-repl"] = { "dap" },
+ },
+ providers = {
+ path = {
+ opts = {
+ get_cwd = vim.fn.getcwd,
},
- }
+ },
+ copilot = {
+ name = "copilot",
+ module = "blink-copilot",
+ score_offset = 100,
+ async = true,
+ },
+ lazydev = {
+ name = "LazyDev",
+ module = "lazydev.integrations.blink",
+ -- make lazydev completions top priority (see `:h blink.cmp`)
+ score_offset = 100,
+ },
+ dap = { name = "dap", module = "blink.compat.source" },
},
},
},
},
+ {
+ "saghen/blink.pairs",
+ version = "*",
+ dependencies = "saghen/blink.download",
+ opts = {
+ mappings = {
+ disabled_filetypes = { "TelescopePrompt" },
+ },
+ },
+ },
}
diff --git a/home/.config/nvim/lua/custom/plugins/debug.lua b/home/.config/nvim/lua/custom/plugins/debug.lua
index 82de07d..cec04b1 100644
--- a/home/.config/nvim/lua/custom/plugins/debug.lua
+++ b/home/.config/nvim/lua/custom/plugins/debug.lua
@@ -1,237 +1,209 @@
-local map = require("mapper")
-
return {
{
+ "miroshQa/debugmaster.nvim",
+ branch = "dashboard",
+ dependencies = "mfussenegger/nvim-dap",
+ keys = {
+ {
+ "<leader>td",
+ function()
+ require("debugmaster").mode.toggle()
+ end,
+ desc = "[T]oggle [D]ebug mode",
+ },
+ },
+ },
+ {
"mfussenegger/nvim-dap",
config = function()
local dap = require("dap")
- dap.defaults.fallback.force_external_terminal = true
- dap.defaults.fallback.external_terminal = {
- command = "/usr/bin/st",
- args = { "-e" },
- }
-
- dap.defaults.fallback.terminal_win_cmd = "50vsplit new"
-
local function get_env_vars()
- local variables = {}
- for k, v in pairs(vim.fn.environ()) do
- table.insert(variables, string.format("%s=%s", k, v))
- end
+ local variables = vim.fn.environ()
+ table.insert(variables, { ASAN_OPTIONS = "detect_leaks=0" })
return variables
end
dap.adapters.lldb = {
type = "executable",
- command = "/usr/bin/lldb-vscode",
+ command = "lldb-dap",
name = "lldb",
+ env = get_env_vars,
+ }
+ dap.adapters.gdb = {
+ type = "executable",
+ command = "gdb",
+ args = { "--interpreter=dap" },
+ env = get_env_vars,
+ }
+ dap.adapters.codelldb = {
+ type = "executable",
+ command = "codelldb",
+ env = get_env_vars,
}
-
- local function str_split(inputstr, sep)
- sep = sep or "%s"
- local t = {}
- for str in inputstr:gmatch("([^" .. sep .. "]+)") do
- table.insert(t, str)
- end
- return t
- end
-
- local _cmd = nil
-
- local function get_cmd()
- if _cmd then
- return _cmd
- end
- local clipboard_cmd = vim.fn.getreg("+")
- _cmd = vim.fn.input({
- prompt = "Command to execute: ",
- default = clipboard_cmd
- })
- return _cmd
- end
local function get_program()
- return str_split(get_cmd())[1]
+ local _program
+ vim.ui.input({
+ prompt = "Program: ",
+ complete = "file_in_path",
+ }, function(res)
+ _program = res
+ end)
+ return vim.fn.system("which " .. _program):gsub("\n$", "")
end
local function get_args()
- local argv = str_split(get_cmd())
- local args = {}
-
- if #argv < 2 then
- return {}
- end
-
- for i = 2, #argv do
- args[#args + 1] = argv[i]
- end
-
- return args
+ local _args
+ vim.ui.input({
+ prompt = "Args: ",
+ default = vim.fn.getreg("+"),
+ complete = "file",
+ }, function(res)
+ _args = res
+ end)
+ return require("dap.utils").splitstr(_args)
end
dap.configurations.cpp = {
+ -- {
+ -- name = "GDB Launch",
+ -- type = "gdb",
+ -- request = "launch",
+ -- cwd = "${workspaceFolder}",
+ -- program = get_program,
+ -- args = get_args,
+ -- env = get_env_vars,
+ -- stopAtBeginningOfMainSubprogram = false,
+ -- },
+ -- {
+ -- name = "LLDB Launch",
+ -- type = "lldb",
+ -- request = "launch",
+ -- cwd = "${workspaceFolder}",
+ -- program = get_program,
+ -- args = get_args,
+ -- env = get_env_vars,
+ -- stopOnEntry = true,
+ -- disableASLR = false,
+ -- },
{
- name = "Launch",
- type = "lldb",
+ name = "codelldb Launch",
+ type = "codelldb",
request = "launch",
cwd = "${workspaceFolder}",
program = get_program,
- stopOnEntry = true,
args = get_args,
- env = get_env_vars,
- runInTerminal = true,
- },
- {
- -- If you get an "Operation not permitted" error using this, try disabling YAMA:
- -- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
- name = "Attach to process",
- type = "lldb",
- request = "attach",
- pid = require('dap.utils').pick_process,
+ stopOnEntry = true,
+ console = "integratedTerminal",
},
+ -- {
+ -- name = "GDB Attach to process",
+ -- type = "gdb",
+ -- request = "attach",
+ -- pid = require('dap.utils').pick_process,
+ -- },
+ -- {
+ -- name = "LLDB Attach to process",
+ -- type = "lldb",
+ -- request = "attach",
+ -- pid = require('dap.utils').pick_process,
+ -- },
+ -- {
+ -- name = "codelldb Attach to process",
+ -- type = "codelldb",
+ -- request = "attach",
+ -- pid = require('dap.utils').pick_process,
+ -- },
}
dap.configurations.c = dap.configurations.cpp
dap.configurations.rust = dap.configurations.cpp
- local get_python_path = function()
- local venv_path = os.getenv("VIRTUAL_ENV")
- if venv_path then
- return venv_path .. "/bin/python"
- end
- return "/usr/bin/python"
- end
-
- require("dap-python").setup(get_python_path())
-
- dap.adapters.nlua = function(callback, config)
- callback({ type = "server", host = config.host, port = config.port })
- end
-
- dap.configurations.lua = {
- {
- type = "nlua",
- request = "attach",
- name = "Attach to running Neovim instance",
- host = function()
- local value = vim.fn.input("Host [127.0.0.1]: ")
- if value ~= "" then
- return value
- end
- return "127.0.0.1"
- end,
- port = function()
- local val = tonumber(vim.fn.input("Port: "))
- assert(val, "Please provide a port number")
- return val
- end,
- },
- }
-
- dap.repl.commands = vim.tbl_extend("force", dap.repl.commands, {
- continue = { "continue", "c" },
- next_ = { "next", "n" },
- back = { "back", "b" },
- reverse_continue = { "reverse-continue", "rc" },
- into = { "into" },
- into_target = { "into_target" },
- out = { "out" },
- scopes = { "scopes" },
- threads = { "threads" },
- frames = { "frames" },
- exit = { "exit", "quit", "q" },
- up = { "up" },
- down = { "down" },
- goto_ = { "goto" },
- capabilities = { "capabilities", "cap" },
- -- add your own commands
- custom_commands = {
- ["echo"] = function(text)
- dap.repl.append(text)
- end,
- },
- })
+ -- local dapui = require("dapui")
+ -- dap.listeners.before.attach.dapui_config = dapui.open
+ -- dap.listeners.before.launch.dapui_config = dapui.open
+ -- dap.listeners.before.event_terminated.dapui_config = dapui.close
+ -- dap.listeners.before.event_exited.dapui_config = dapui.close
- map.n("<F4>", dap.close)
- map.n("<F5>", dap.continue)
- map.n("<F10>", dap.step_over)
- map.n("<F11>", dap.step_into)
- map.n("<F12>", dap.step_out)
- map.n("<leader>b", dap.toggle_breakpoint)
- map.n("<leader>B", function()
- dap.set_breakpoint(vim.fn.input("Breakpoint condition: "))
- end)
- map.n("<leader>lp", function()
- dap.set_breakpoint(nil, nil, vim.fn.input("Log point message: "))
- end)
- map.n("<leader>dr", dap.repl.open)
- map.n("<leader>dl", dap.run_last)
- map.n("<F2>", dap.list_breakpoints)
-
- local dapui = require("dapui")
- dap.listeners.after.event_initialized["dapui_config"] = function()
- dapui.open()
- end
- dap.listeners.before.event_terminated["dapui_config"] = function()
- dapui.close()
- end
- dap.listeners.before.event_exited["dapui_config"] = function()
- dapui.close()
- end
- map.n("<leader>du", dapui.toggle)
- map.v("<leader>de", dapui.eval)
+ -- local dv = require("dap-view")
+ -- dap.listeners.before.attach["dap-view-config"] = dv.open
+ -- dap.listeners.before.launch["dap-view-config"] = dv.open
+ -- dap.listeners.before.event_terminated["dap-view-config"] = dv.close
+ -- dap.listeners.before.event_exited["dap-view-config"] = dv.close
end,
dependencies = {
+ -- {
+ -- "igorlfs/nvim-dap-view",
+ -- keys = {
+ -- {
+ -- "<leader>td",
+ -- function()
+ -- require("dap-view").toggle(true)
+ -- end,
+ -- desc = "[T]oggle [D]ebug UI",
+ -- },
+ -- },
+ -- opts = {},
+ -- },
+ -- {
+ -- "rcarriga/nvim-dap-ui",
+ -- dependencies = "nvim-neotest/nvim-nio",
+ -- keys = {
+ -- {
+ -- "<leader>td",
+ -- function()
+ -- require("dapui").toggle()
+ -- end,
+ -- desc = "[T]oggle [D]ebug UI",
+ -- },
+ -- {
+ -- "<leader>de",
+ -- function()
+ -- require("dapui").eval()
+ -- end,
+ -- desc = "[D]ebug [E]valuate",
+ -- },
+ -- },
+ -- opts = {
+ -- icons = { expanded = "-", collapsed = "+", current_frame = "*" },
+ -- controls = { enabled = false },
+ -- layouts = {
+ -- {
+ -- elements = {
+ -- -- Elements can be strings or table with id and size keys.
+ -- "scopes",
+ -- "breakpoints",
+ -- "stacks",
+ -- "watches",
+ -- },
+ -- size = 40,
+ -- position = "left",
+ -- },
+ -- {
+ -- elements = {
+ -- "repl",
+ -- },
+ -- size = 0.25, -- 25% of total lines
+ -- position = "bottom",
+ -- },
+ -- },
+ -- },
+ -- },
{
- "rcarriga/nvim-dap-ui",
- dependencies = "nvim-neotest/nvim-nio",
- opts = {
- icons = { expanded = "-", collapsed = "+", current_frame = "*" },
- controls = { enabled = false },
- layouts = {
- {
- elements = {
- -- Elements can be strings or table with id and size keys.
- "scopes",
- "breakpoints",
- "stacks",
- "watches",
- },
- size = 40,
- position = "left",
- },
- {
- elements = {
- "repl",
- },
- size = 0.25, -- 25% of total lines
- position = "bottom",
- },
- },
- },
+ "theHamsta/nvim-dap-virtual-text",
+ opts = {},
+ dependencies = { "nvim-treesitter/nvim-treesitter" },
},
+ "williamboman/mason.nvim",
{
- "mfussenegger/nvim-dap-python",
- keys = {
- { "gm", function()
- require("dap-python").test_method()
- end },
- {
- "g<cr>",
- function()
- require("dap-python").debug_selection()
- end,
- mode = "v"
- },
+ "jay-babu/mason-nvim-dap.nvim",
+ opts = {
+ automatic_installation = false,
+ handlers = {},
+ ensure_installed = {},
},
},
- "jbyuki/one-small-step-for-vimkind",
- {
- "theHamsta/nvim-dap-virtual-text",
- config = true,
- dependencies = { "nvim-treesitter/nvim-treesitter" }
- }
},
},
}
diff --git a/home/.config/nvim/lua/custom/plugins/ft.lua b/home/.config/nvim/lua/custom/plugins/ft.lua
deleted file mode 100644
index 769db86..0000000
--- a/home/.config/nvim/lua/custom/plugins/ft.lua
+++ /dev/null
@@ -1,7 +0,0 @@
-return {
- "kovetskiy/sxhkd-vim",
- "tmux-plugins/vim-tmux",
- "martinda/Jenkinsfile-vim-syntax",
- "rhysd/vim-llvm",
- "wgwoods/vim-systemd-syntax",
-}
diff --git a/home/.config/nvim/lua/custom/plugins/git.lua b/home/.config/nvim/lua/custom/plugins/git.lua
index 077cfd4..3e41626 100644
--- a/home/.config/nvim/lua/custom/plugins/git.lua
+++ b/home/.config/nvim/lua/custom/plugins/git.lua
@@ -1,8 +1,7 @@
-local map = require("mapper")
-
return {
{
- 'akinsho/git-conflict.nvim',
+ "akinsho/git-conflict.nvim",
+ event = "BufRead",
opts = {
disable_diagnostics = true,
highlights = {
@@ -11,10 +10,10 @@ return {
ancestor = nil,
},
default_mappings = {
- next = ']x',
- prev = '[x',
+ next = "]x",
+ prev = "[x",
},
- }
+ },
},
{
"NeogitOrg/neogit",
@@ -22,46 +21,55 @@ return {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim",
},
- config = function()
- local neogit = require("neogit")
- neogit.setup({
- disable_commit_confirmation = true,
- kind = "split",
- console_timeout = 5000,
- auto_show_console = false,
- })
- map.n("<leader>ng", neogit.open)
- end,
+ keys = {
+ {
+ "<leader>go",
+ function()
+ require("neogit").open()
+ end,
+ desc = "neo[G]it [O]pen",
+ },
+ },
+ cmd = "Neogit",
+ opts = {
+ disable_commit_confirmation = true,
+ kind = "split",
+ console_timeout = 5000,
+ auto_show_console = false,
+ },
},
{
"ruifm/gitlinker.nvim",
keys = {
- { "<leader>gy", function() require 'gitlinker'.get_buf_range_url("n") end },
{
"<leader>gy",
function()
- require 'gitlinker'.get_buf_range_url("v")
+ require("gitlinker").get_buf_range_url("n")
end,
- mode = "v"
+ },
+ {
+ "<leader>gy",
+ function()
+ require("gitlinker").get_buf_range_url("v")
+ end,
+ mode = "v",
},
},
dependencies = {
"nvim-lua/plenary.nvim",
},
- config = function()
- require "gitlinker".setup({
- callbacks = {
- ["git.sommerfeld.dev"] = function(url_data)
- local url = require "gitlinker.hosts".get_base_https_url(url_data)
- url = url .. "/tree/" .. url_data.file .. "?id=" .. url_data.rev
- if url_data.lstart then
- url = url .. "#n" .. url_data.lstart
- end
- return url
+ opts = {
+ callbacks = {
+ ["git.sommerfeld.dev"] = function(url_data)
+ local url = require("gitlinker.hosts").get_base_https_url(url_data)
+ url = url .. "/tree/" .. url_data.file .. "?id=" .. url_data.rev
+ if url_data.lstart then
+ url = url .. "#n" .. url_data.lstart
end
- },
- })
- end,
+ return url
+ end,
+ },
+ },
},
{
"lewis6991/gitsigns.nvim",
@@ -77,48 +85,80 @@ return {
_threaded_diff = true,
_refresh_staged_on_update = true,
on_attach = function(bufnr)
- local gs = require('gitsigns')
-
+ local gs = require("gitsigns")
+ local function map(mode, l, r, desc)
+ vim.keymap.set(mode, l, r, { buffer = bufnr, desc = desc })
+ end
+ local function nmap(l, r, desc)
+ map("n", l, r, desc)
+ end
+ local function vmap(l, r, desc)
+ map("v", l, r, desc)
+ end
-- Navigation
- map.n(']c', function()
+ nmap("]c", function()
if vim.wo.diff then
- vim.cmd.normal({ ']c', bang = true })
+ vim.cmd.normal({ "]c", bang = true })
else
- gs.nav_hunk('next')
+ gs.nav_hunk("next")
end
- end, nil, bufnr)
+ end, "Jump to next git [c]hange")
- map.n('[c', function()
+ nmap("[c", function()
if vim.wo.diff then
- vim.cmd.normal({ '[c', bang = true })
+ vim.cmd.normal({ "[c", bang = true })
else
- gs.nav_hunk('prev')
+ gs.nav_hunk("prev")
end
- end, nil, bufnr)
+ end, "Jump to previous git [c]hange")
-- Actions
- map.n('<leader>hs', gs.stage_hunk, nil, bufnr)
- map.n('<leader>hr', gs.reset_hunk, nil, bufnr)
- map.v('<leader>hs', function() gs.stage_hunk { vim.fn.line('.'), vim.fn.line('v') } end, nil, bufnr)
- map.v('<leader>hr', function() gs.reset_hunk { vim.fn.line('.'), vim.fn.line('v') } end, nil, bufnr)
- map.n('<leader>hS', gs.stage_buffer, nil, bufnr)
- map.n('<leader>hu', gs.undo_stage_hunk, nil, bufnr)
- map.n('<leader>hR', gs.reset_buffer, nil, bufnr)
- map.n('<leader>hp', gs.preview_hunk, nil, bufnr)
- map.n('<leader>hb', function() gs.blame_line { full = true } end, nil,
- bufnr)
- map.n('<leader>tb', gs.toggle_current_line_blame, nil, bufnr)
- map.n('<leader>hd', gs.diffthis, nil, bufnr)
- map.n('<leader>hD', function() gs.diffthis('~') end, nil, bufnr)
- map.n('<leader>hc', gs.change_base, nil, bufnr)
- map.n('<leader>hC', function() gs.change_base('~') end, nil, bufnr)
- map.n('<leader>td', gs.toggle_deleted, nil, bufnr)
- map.n('<leader>tw', gs.toggle_word_diff, nil, bufnr)
- map.n('<leader>tl', gs.toggle_linehl, nil, bufnr)
-
+ nmap("<leader>hs", gs.stage_hunk, "git [s]tage hunk")
+ nmap("<leader>hr", gs.reset_hunk, "git [r]eset hunk")
+ vmap("<leader>hs", function()
+ gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
+ end, "git [s]tage hunk")
+ vmap("<leader>hr", function()
+ gs.reset_hunk({ vim.fn.line("."), vim.fn.line("v") })
+ end, "git [r]eset hunk")
+ nmap("<leader>hS", gs.stage_buffer, "git [S]tage buffer")
+ nmap("<leader>hR", gs.reset_buffer, "git [R]eset buffer")
+ nmap("<leader>hp", gs.preview_hunk, "git [p]review hunk")
+ nmap("<leader>hb", function()
+ gs.blame_line({ full = true })
+ end, "git [b]lame line")
+ nmap(
+ "<leader>tb",
+ gs.toggle_current_line_blame,
+ "[T]oggle git show [b]lame line"
+ )
+ nmap("<leader>hd", gs.diffthis, "git [d]iff against index")
+ nmap("<leader>hD", function()
+ gs.diffthis("~")
+ end, "git [D]iff against last commit")
+ nmap("<leader>hc", gs.change_base, "git [C]hange base to index")
+ nmap("<leader>hC", function()
+ gs.change_base("~")
+ end, "git [C]hange base to HEAD")
+ nmap(
+ "<leader>tgd",
+ gs.preview_hunk_inline,
+ "[T]oggle [G]it show [D]eleted"
+ )
+ nmap("<leader>tgw", gs.toggle_word_diff, "[T]oggle [G]it [W]ord diff")
+ nmap(
+ "<leader>tgl",
+ gs.toggle_linehl,
+ "[T]oggle [G]it [L]ine highlighting"
+ )
-- Text object
- map.map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>', nil, bufnr)
- end
+ map(
+ { "o", "x" },
+ "ih",
+ ":<C-U>Gitsigns select_hunk<CR>",
+ "git [H]unk text object"
+ )
+ end,
},
dependencies = {
"nvim-lua/plenary.nvim",
diff --git a/home/.config/nvim/lua/custom/plugins/init.lua b/home/.config/nvim/lua/custom/plugins/init.lua
index ed597ba..3b7c821 100644
--- a/home/.config/nvim/lua/custom/plugins/init.lua
+++ b/home/.config/nvim/lua/custom/plugins/init.lua
@@ -1,38 +1,463 @@
-local map = require("mapper")
-
return {
- { "nvim-lua/plenary.nvim", lazy = true },
- { "tpope/vim-repeat", event = "VeryLazy" },
- 'tpope/vim-sleuth',
+ { "nvim-lua/plenary.nvim", branch = "master", lazy = true },
{
- 'tummetott/unimpaired.nvim',
- keys = { "]", "[", "yo" },
- opts = {
- -- add options here if you wish to override the default settings
- },
+ "nmac427/guess-indent.nvim",
+ event = "BufRead",
+ opts = {},
},
- { "kylechui/nvim-surround", config = true },
{
- "Julian/vim-textobj-variable-segment",
- dependencies = { "kana/vim-textobj-user" },
+ "kylechui/nvim-surround",
+ event = "VeryLazy",
+ opts = {},
+ },
+ {
+ "chrisgrieser/nvim-various-textobjs",
+ event = "VeryLazy",
+ opts = {
+ keymaps = {
+ useDefaults = true,
+ },
+ },
},
{
"monaqa/dial.nvim",
- config = function()
- map.n("]i", require("dial.map").inc_normal())
- map.n("[i", require("dial.map").dec_normal())
- map.v("]i", require("dial.map").inc_visual())
- map.v("[i", require("dial.map").dec_visual())
- end
+ keys = {
+ {
+ "]i",
+ function()
+ require("dial.map").inc_normal()
+ end,
+ expr = true,
+ desc = "Increment",
+ },
+ {
+ "[i",
+ function()
+ require("dial.map").dec_normal()
+ end,
+ expr = true,
+ desc = "Decrement",
+ },
+ {
+ "]i",
+ function()
+ require("dial.map").inc_visual()
+ end,
+ expr = true,
+ mode = "v",
+ desc = "Increment",
+ },
+ {
+ "[i",
+ function()
+ require("dial.map").dec_visual()
+ end,
+ expr = true,
+ mode = "v",
+ desc = "Decrement",
+ },
+ },
+ config = function() end,
},
{
"iamcco/markdown-preview.nvim",
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
build = "cd app && yarn install",
- ft = { "markdown" },
+ ft = "markdown",
},
{
"kwkarlwang/bufresize.nvim",
- config = true
+ event = "VeryLazy",
+ opts = {},
+ },
+ {
+ "rmagatti/auto-session",
+ lazy = false,
+ opts = function()
+ -- Convert the cwd to a simple file name
+ local function get_cwd_as_name()
+ local dir = vim.fn.getcwd(0)
+ return dir:gsub("[^A-Za-z0-9]", "_")
+ end
+ local overseer = require("overseer")
+ return {
+ use_git_branch = true,
+ pre_save_cmds = {
+ function()
+ overseer.save_task_bundle(
+ get_cwd_as_name(),
+ -- Passing nil will use config.opts.save_task_opts. You can call list_tasks() explicitly and
+ -- pass in the results if you want to save specific tasks.
+ nil,
+ { on_conflict = "overwrite" } -- Overwrite existing bundle, if any
+ )
+ end,
+ },
+ -- Optionally get rid of all previous tasks when restoring a session
+ pre_restore_cmds = {
+ function()
+ for _, task in ipairs(overseer.list_tasks({})) do
+ task:dispose(true)
+ end
+ end,
+ },
+ post_restore_cmds = {
+ function()
+ overseer.load_task_bundle(
+ get_cwd_as_name(),
+ { ignore_missing = true, autostart = false }
+ )
+ end,
+ },
+ save_extra_data = function(_)
+ local ok, breakpoints = pcall(require, "dap.breakpoints")
+ if not ok or not breakpoints then
+ return
+ end
+
+ local bps = {}
+ local breakpoints_by_buf = breakpoints.get()
+ for buf, buf_bps in pairs(breakpoints_by_buf) do
+ bps[vim.api.nvim_buf_get_name(buf)] = buf_bps
+ end
+ if vim.tbl_isempty(bps) then
+ return
+ end
+ local extra_data = {
+ breakpoints = bps,
+ }
+ return vim.fn.json_encode(extra_data)
+ end,
+
+ restore_extra_data = function(_, extra_data)
+ local json = vim.fn.json_decode(extra_data)
+
+ if json.breakpoints then
+ local ok, breakpoints = pcall(require, "dap.breakpoints")
+
+ if not ok or not breakpoints then
+ return
+ end
+ vim.notify("restoring breakpoints")
+ for buf_name, buf_bps in pairs(json.breakpoints) do
+ for _, bp in pairs(buf_bps) do
+ local line = bp.line
+ local opts = {
+ condition = bp.condition,
+ log_message = bp.logMessage,
+ hit_condition = bp.hitCondition,
+ }
+ breakpoints.set(opts, vim.fn.bufnr(buf_name), line)
+ end
+ end
+ end
+ end,
+ suppressed_dirs = { "~/", "/" },
+ }
+ end,
+ },
+ {
+ "aserowy/tmux.nvim",
+ event = "VeryLazy",
+ opts = {
+ resize = {
+ enable_default_keybindings = false,
+ },
+ },
+ },
+ {
+ "stevearc/overseer.nvim",
+ keys = {
+ {
+ "<leader>to",
+ function()
+ require("overseer").toggle()
+ end,
+ desc = "[T]oggle [O]verseer",
+ },
+ {
+ "<leader>ob",
+ function()
+ require("overseer").run_template({
+ name = "just build",
+ prompt = "never",
+ })
+ end,
+ desc = "[O]verseer [B]uild",
+ },
+ {
+ "<leader>ot",
+ function()
+ require("overseer").run_template({
+ name = "just test",
+ prompt = "never",
+ })
+ end,
+ desc = "[O]verseer [J]ust [T]est",
+ },
+ {
+ "<leader>of",
+ function()
+ require("overseer").run_template({
+ name = "just test",
+ prompt = "never",
+ params = { target = vim.fn.expand("%") },
+ })
+ end,
+ desc = "[O]verseer test [F]ile",
+ },
+ {
+ "<leader>oa",
+ function()
+ require("overseer").run_template({
+ name = "just test_autofix",
+ prompt = "never",
+ params = { target = vim.fn.expand("%") },
+ })
+ end,
+ desc = "[O]verseer [A]utofix",
+ },
+ {
+ "<leader>or",
+ function()
+ require("overseer").run_template()
+ end,
+ desc = "[O]verseer [R]un",
+ },
+ {
+ "<leader>os",
+ function()
+ require("overseer").run_template({ name = "shell" })
+ end,
+ desc = "[O]verseer [S]hell",
+ },
+ {
+ "<leader>ol",
+ function()
+ local tasks = require("overseer").list_tasks({ recent_first = true })
+ if vim.tbl_isempty(tasks) then
+ vim.notify("No tasks found", vim.log.levels.WARN)
+ else
+ require("overseer").run_action(tasks[1], "restart")
+ end
+ end,
+ desc = "[O]verseer run [L]ast",
+ },
+ },
+ config = function()
+ local overseer = require("overseer")
+ overseer.setup({})
+ overseer.add_template_hook({ name = ".*" }, function(task_defn, util)
+ util.add_component(
+ task_defn,
+ { "open_output", on_start = "never", on_complete = "failure" }
+ )
+ end)
+ end,
+ },
+ {
+ "ThePrimeagen/refactoring.nvim",
+ dependencies = {
+ "nvim-lua/plenary.nvim",
+ "nvim-treesitter/nvim-treesitter",
+ },
+ keys = {
+ {
+ "<leader>re",
+ function()
+ require("refactoring").refactor("Extract Function")
+ end,
+ mode = "x",
+ desc = "[R]efactor [E]xtract function",
+ },
+ {
+ "<leader>rf",
+ function()
+ require("refactoring").refactor("Extract Function To File")
+ end,
+ mode = "x",
+ desc = "[R]efactor extract function to [F]ile",
+ },
+ {
+ "<leader>rv",
+ function()
+ require("refactoring").refactor("Extract Variable")
+ end,
+ mode = "x",
+ desc = "[R]efactor extract [V]ariable",
+ },
+ {
+ "<leader>rI",
+ function()
+ require("refactoring").refactor("Inline Function")
+ end,
+ desc = "[R]efactor [I]nline function",
+ },
+ {
+ "<leader>ri",
+ function()
+ require("refactoring").refactor("Inline Variable")
+ end,
+ mode = { "x", "n" },
+ desc = "[R]efactor [I]nline variable",
+ },
+ {
+ "<leader>rb",
+ function()
+ require("refactoring").refactor("Extract Block")
+ end,
+ desc = "[R]efactor extract [B]lock",
+ },
+ {
+ "<leader>rB",
+ function()
+ require("refactoring").refactor("Extract Block To File")
+ end,
+ desc = "[R]efactor extract [B]lock to file",
+ },
+ {
+ "<leader>rp",
+ function()
+ require("refactoring").debug.printf({})
+ end,
+ desc = "[R]efactor [P]rint",
+ },
+
+ {
+ "<leader>rv",
+ function()
+ require("refactoring").debug.print_var({})
+ end,
+ mode = { "x", "n" },
+ desc = "[R]efactor [P]rint [V]ariable",
+ },
+ {
+ "<leader>rc",
+ function()
+ require("refactoring").debug.cleanup({})
+ end,
+ desc = "[R]efactor [C]leanup",
+ },
+ },
+ opts = {},
+ config = function()
+ local refactoring = require("refactoring")
+ refactoring.setup({})
+ end,
+ },
+ {
+ "folke/which-key.nvim",
+ event = "VeryLazy",
+ opts = {
+ spec = {
+ { "g", group = "[G]oto" },
+ { "yo", group = "Toggle options" },
+ { "]", group = "Navigate to next" },
+ { "[", group = "Navigate to previous" },
+ { "<leader>c", group = "[C]ode", mode = { "n", "x" } },
+ { "<leader>d", group = "[D]ocument" },
+ { "<leader>g", group = "[G]it" },
+ { "<leader>h", group = "Git [H]unk", mode = { "n", "v" } },
+ { "<leader>n", group = "[N]eotest" },
+ { "<leader>o", group = "[O]verseer" },
+ { "<leader>r", group = "[R]efactor" },
+ { "<leader>s", group = "[S]earch" },
+ { "<leader>w", group = "[W]orkspace" },
+ { "<leader>t", group = "[T]oggle" },
+ },
+ },
+ keys = {
+ {
+ "<leader>?",
+ function()
+ require("which-key").show({ global = false })
+ end,
+ desc = "Buffer Local Keymaps (which-key)",
+ },
+ },
+ },
+ {
+ "stevearc/quicker.nvim",
+ event = "FileType qf",
+ keys = {
+ {
+ "<leader>tq",
+ function()
+ require("quicker").toggle()
+ end,
+ desc = "[T]oggle [Q]uickfix",
+ },
+ {
+ "<leader>tl",
+ function()
+ require("quicker").toggle({ loclist = true })
+ end,
+ desc = "[T]oggle [L]oclist",
+ },
+ },
+ opts = {
+ keys = {
+ {
+ ">",
+ function()
+ require("quicker").expand({
+ before = 2,
+ after = 2,
+ add_to_existing = true,
+ })
+ end,
+ desc = "Expand quickfix context",
+ },
+ {
+ "<",
+ function()
+ require("quicker").collapse()
+ end,
+ desc = "Collapse quickfix context",
+ },
+ },
+ },
+ },
+ {
+ "olimorris/codecompanion.nvim",
+ dependencies = {
+ "nvim-lua/plenary.nvim",
+ "nvim-treesitter/nvim-treesitter",
+ },
+ keys = {
+ {
+ "<leader>aa",
+ "<cmd>CodeCompanionActions<cr>",
+ { "n", "v" },
+ { noremap = true, silent = true, desc = "[A]I [A]ctions" },
+ },
+ {
+ "<leader>ta",
+ "<cmd>CodeCompanionChat Toggle<cr>",
+ { "n", "v" },
+ { noremap = true, silent = true, desc = "[T]oggle [A]I chat" },
+ },
+ {
+ "<leader>ac",
+ "<cmd>CodeCompanionChat Add<cr>",
+ "v",
+ { noremap = true, silent = true, desc = "[A]I [C]chat add" },
+ },
+ },
+ opts = {
+ strategies = {
+ chat = {
+ adapter = "copilot",
+ },
+ inline = {
+ adapter = "copilot",
+ },
+ },
+ },
+ },
+ {
+ "stevearc/oil.nvim",
+ opts = {},
+ lazy = false,
},
}
diff --git a/home/.config/nvim/lua/custom/plugins/lsp.lua b/home/.config/nvim/lua/custom/plugins/lsp.lua
index b351e10..8ddbbac 100644
--- a/home/.config/nvim/lua/custom/plugins/lsp.lua
+++ b/home/.config/nvim/lua/custom/plugins/lsp.lua
@@ -1,198 +1,117 @@
-local map = require("mapper")
-
-local function handler_splitcmd(_, uri, splitcmd)
- if not uri or uri == "" then
- vim.api.nvim_echo({ { "Corresponding file cannot be determined" } }, false, {})
- return
- end
- local file_name = vim.uri_to_fname(uri)
- vim.api.nvim_cmd({
- cmd = splitcmd,
- args = { file_name },
- }, {})
-end
-
-local function switch_source_header_splitcmd(bufnr, splitcmd)
- bufnr = bufnr or 0
- vim.lsp.buf_request(bufnr, "textDocument/switchSourceHeader", {
- uri = vim.uri_from_bufnr(bufnr),
- }, function(err, uri) return handler_splitcmd(err, uri, splitcmd) end)
-end
-
-local function edit_source_header(bufnr)
- switch_source_header_splitcmd(bufnr, "edit")
-end
-
-local function split_source_header(bufnr)
- switch_source_header_splitcmd(bufnr, "split")
-end
-
-local function vsplit_source_header(bufnr)
- switch_source_header_splitcmd(bufnr, "vsplit")
-end
-
-local function tabedit_source_header(bufnr)
- switch_source_header_splitcmd(bufnr, "tabedit")
-end
-
return {
{
+ "folke/lazydev.nvim",
+ ft = "lua",
+ opts = {
+ library = {
+ { path = "${3rd}/luv/library", words = { "vim%.uv" } },
+ },
+ },
+ },
+ {
"lewis6991/hover.nvim",
- config = function()
- require("hover").setup {
- init = function()
- require("hover.providers.lsp")
- require('hover.providers.gh')
- require('hover.providers.man')
- -- require('hover.providers.dictionary')
+ keys = {
+ {
+ "K",
+ function()
+ require("hover").hover({})
end,
- }
-
- vim.keymap.set("n", "K", require("hover").hover, { desc = "hover.nvim" })
- vim.keymap.set("n", "gh", require("hover").hover, { desc = "hover.nvim" })
- vim.keymap.set("n", "gK", require("hover").hover_select,
- { desc = "hover.nvim (select)" })
- end
+ desc = "Hover",
+ },
+ {
+ "gK",
+ function()
+ require("hover").hover_select({})
+ end,
+ desc = "Hover Select",
+ },
+ {
+ "gh",
+ function()
+ require("hover").hover({})
+ end,
+ desc = "[H]over",
+ },
+ },
+ opts = {
+ init = function()
+ require("hover.providers.lsp")
+ require("hover.providers.man")
+ require("hover.providers.dap")
+ -- require("hover.providers.gh")
+ require("hover.providers.dictionary")
+ end,
+ },
},
{
- 'neovim/nvim-lspconfig',
- config = function()
- local lspconfig = require("lspconfig")
- -- Enable (broadcasting) snippet capability for completion
- local capabilities = vim.lsp.protocol.make_client_capabilities()
- capabilities.textDocument.completion.completionItem.snippetSupport = true
- capabilities.workspace.didChangeWatchedFiles.dynamicRegistration = true
- if pcall(require, "cmp_nvim_lsp") then
- capabilities = require("cmp_nvim_lsp").default_capabilities()
- end
-
- lspconfig.util.default_config = vim.tbl_extend(
- "force",
- lspconfig.util.default_config,
- {
- capabilities = capabilities,
- }
- )
-
- local servers = {
- bashls = {},
- dockerls = {},
- fortls = {},
- lua_ls = {},
- ruff = {},
- ts_ls = {},
- pyright = {},
- clangd = {
- on_attach = function(_, bufnr)
- map.n("gH", edit_source_header, { buffer = bufnr })
- map.n("gvH", vsplit_source_header, { buffer = bufnr })
- map.n("gxH", split_source_header, { buffer = bufnr })
- map.n("gtH", tabedit_source_header, { buffer = bufnr })
- end,
- init_options = {
- clangdFileStatus = true,
+ "neovim/nvim-lspconfig",
+ version = false,
+ dependencies = {
+ { "j-hui/fidget.nvim", opts = {} },
+ "saghen/blink.cmp",
+ { "williamboman/mason.nvim", opts = {} },
+ {
+ "williamboman/mason-lspconfig.nvim",
+ opts = {
+ ensure_installed = {},
+ automatic_installation = false,
+ handlers = {
+ function(server_name)
+ vim.lsp.enable(server_name)
+ end,
},
},
- }
-
- for server, config in pairs(servers) do
- local cmd = config.cmd
- local config_def = lspconfig[server].config_def
- if not cmd and config_def then
- local default_config = config_def.default_config
- if default_config then
- cmd = default_config.cmd
- end
- end
- if cmd then
- if vim.fn.executable(cmd[1]) == 1 then
- lspconfig[server].setup(config)
- end
- end
- end
-
- vim.api.nvim_create_autocmd("LspAttach", {
- callback = function(args)
- local bufnr = args.buf
- local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
-
- if client.supports_method("textDocument/codeLens") then
- vim.api.nvim_create_autocmd(
- { "CursorHold", "CursorHoldI", "InsertLeave" },
- { buffer = bufnr, callback = vim.lsp.codelens.refresh }
- )
- map.n("gl", vim.lsp.codelens.run, { buffer = bufnr })
- end
-
- map.n("<c-]>", vim.lsp.buf.definition, { buffer = bufnr })
- map.n("gD", vim.lsp.buf.declaration, { buffer = bufnr })
- map.n("gR", vim.lsp.buf.rename, { buffer = bufnr })
- map.n("ga", vim.lsp.buf.code_action, { buffer = bufnr })
- map.v("ga", vim.lsp.buf.code_action, { buffer = bufnr })
-
- -- The following two autocommands are used to highlight references of the
- -- word under your cursor when your cursor rests there for a little while.
- -- See `:help CursorHold` for information about when this is executed
- --
- -- When you move your cursor, the highlights will be cleared (the second autocommand).
- if client.server_capabilities.documentHighlightProvider then
- local highlight_augroup = vim.api.nvim_create_augroup('lsp-highlight', { clear = false })
- vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
- buffer = bufnr,
- group = highlight_augroup,
- callback = vim.lsp.buf.document_highlight,
- })
-
- vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
- buffer = bufnr,
- group = highlight_augroup,
- callback = vim.lsp.buf.clear_references,
- })
-
- vim.api.nvim_create_autocmd('LspDetach', {
- group = vim.api.nvim_create_augroup('lsp-detach', { clear = true }),
- callback = function(event2)
- vim.lsp.buf.clear_references()
- vim.api.nvim_clear_autocmds { group = 'lsp-highlight', buffer = event2.buf }
- end,
- })
- end
-
- -- The following autocommand is used to enable inlay hints in your
- -- code, if the language server you are using supports them
- --
- -- This may be unwanted, since they displace some of your code
- if client.server_capabilities.inlayHintProvider and vim.lsp.inlay_hint then
- map.n('<leader>th', function()
- vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({}))
- vim.lsp.inlay_hint.enable()
- end, { buffer = bufnr })
- end
- end,
- })
- end,
- dependencies = {
- { 'folke/neodev.nvim', opts = {} },
+ },
+ {
+ "WhoIsSethDaniel/mason-tool-installer.nvim",
+ opts = {
+ ensure_installed = {
+ -- "nginx-language-server", -- needs python <= 3.12
+ -- "just-lsp", -- "Platform unsupported"
+ "actionlint",
+ "autotools-language-server",
+ "bash-language-server",
+ "clangd",
+ "codelldb",
+ "codespell",
+ "css-lsp",
+ "dockerfile-language-server",
+ "fortls",
+ "gh",
+ "gh-actions-language-server",
+ "groovy-language-server",
+ "hadolint",
+ "html-lsp",
+ "jq",
+ "jsonlint",
+ "lua-language-server",
+ "markdownlint",
+ "mdformat",
+ "neocmakelsp",
+ "nginx-config-formatter",
+ "npm-groovy-lint",
+ "prettier",
+ "ruff",
+ "rust-analyzer",
+ "shellcheck",
+ -- "shellharden",
+ "shfmt",
+ "stylelint",
+ "stylua",
+ "systemd-language-server",
+ "systemdlint",
+ "typescript-language-server",
+ "typos",
+ "yamllint",
+ "yq",
+ },
+ },
+ },
},
- },
- {
- "ray-x/lsp_signature.nvim",
- event = "VeryLazy",
config = function()
- local lsp_signature = require "lsp_signature"
- lsp_signature.setup({})
-
- vim.api.nvim_create_autocmd("LspAttach", {
- callback = function(args)
- local bufnr = args.buf
- local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
- if client.supports_method("textDocument/signatureHelp") then
- require("lsp_signature").on_attach({}, bufnr)
- map.n("gs", vim.lsp.buf.signature_help, { buffer = bufnr })
- end
- end,
- })
- end
+ vim.lsp.enable("just")
+ vim.lsp.enable("tblgen_lsp_server")
+ end,
},
{
"stevearc/conform.nvim",
@@ -205,19 +124,32 @@ return {
require("conform").format({ async = true, lsp_fallback = true })
end,
mode = "",
- desc = "Format buffer",
+ desc = "[F]ormat buffer",
},
},
config = function()
require("conform").setup({
formatters_by_ft = {
- python = { "ruff_format" },
+ awk = { "gawk" },
+ bash = { "shfmt" },
cmake = { "cmake_format" },
- json = { "jq" },
+ css = { "prettier", "stylelint" },
+ groovy = { "npm-groovy-lint" },
+ html = { "prettier" },
+ javascript = { "prettier" },
+ typecript = { "prettier" },
+ jenkins = { "npm-groovy-lint" },
+ json = { "jq", "jsonlint" },
+ jsonc = { "prettier" },
+ just = { "just" },
+ markdown = { "mdformat" },
+ nginx = { "nginxfmt" },
+ lua = { "stylua" },
+ python = { "ruff_format", "ruff_fix", "ruff_organize_imports" },
rust = { "rustfmt" },
- sh = { "shfmt" },
- bash = { "shfmt" },
- zsh = { "shfmt" },
+ sh = { "shfmt", "shellcheck", "shellharden" },
+ yaml = { "yamllint" },
+ zsh = { "shfmt", "shellcheck", "shellharden" },
},
default_format_opts = {
lsp_format = "fallback",
@@ -229,29 +161,80 @@ return {
},
})
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
- vim.api.nvim_create_autocmd("BufWritePre", {
- callback = require "cfg.utils".format_hunks,
- })
end,
},
{
- 'mrcjkb/rustaceanvim',
- lazy = false,
+ "mrcjkb/rustaceanvim",
+ ft = "rust",
},
{
"mfussenegger/nvim-lint",
- event = { 'BufReadPre', 'BufNewFile' },
+ event = { "BufReadPre", "BufNewFile" },
config = function()
- local lint = require('lint')
+ local lint = require("lint")
+
lint.linters_by_ft = {
+ css = { "stylelint" },
dockerfile = { "hadolint" },
+ groovy = { "npm-groovy-lint" },
+ jenkins = { "npm-groovy-lint" },
+ json = { "jsonlint" },
+ markdown = { "markdownlint" },
+ makefile = { "checkmake" },
+ systemd = { "systemdlint" },
+ yaml = { "yamllint", "yq" },
+ ghaction = { "actionlint" },
+ zsh = { "zsh" },
+ ["*"] = { "codespell", "typos" },
}
- vim.api.nvim_create_autocmd({ "BufReadPost", "BufWritePost", "InsertLeave" }, {
+ local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
+ vim.api.nvim_create_autocmd({ "BufReadPost", "BufWritePost" }, {
+ group = lint_augroup,
callback = function()
- lint.try_lint()
- end
+ if vim.opt_local.modifiable:get() then
+ lint.try_lint()
+ end
+ end,
})
- end
+ end,
},
{ "j-hui/fidget.nvim", opts = {} },
+ {
+ "rachartier/tiny-inline-diagnostic.nvim",
+ event = "VeryLazy",
+ priority = 1000,
+ opts = {
+ options = {
+ show_source = {
+ if_many = true,
+ },
+ -- Set the arrow icon to the same color as the first diagnostic severity
+ set_arrow_to_diag_color = true,
+ -- Configuration for multiline diagnostics
+ -- Can be a boolean or a table with detailed options
+ multilines = {
+ -- Enable multiline diagnostic messages
+ enabled = true,
+ },
+
+ -- Display all diagnostic messages on the cursor line, not just those under cursor
+ show_all_diags_on_cursorline = true,
+ -- Enable diagnostics in Select mode (e.g., when auto-completing with Blink)
+ enable_on_select = true,
+ -- Configuration for breaking long messages into separate lines
+ break_line = {
+ -- Enable breaking messages after a specific length
+ enabled = true,
+ },
+ -- Filter diagnostics by severity levels
+ -- Available severities: vim.diagnostic.severity.ERROR, WARN, INFO, HINT
+ severity = {
+ vim.diagnostic.severity.ERROR,
+ vim.diagnostic.severity.WARN,
+ vim.diagnostic.severity.INFO,
+ vim.diagnostic.severity.HINT,
+ },
+ },
+ },
+ },
}
diff --git a/home/.config/nvim/lua/custom/plugins/telescope.lua b/home/.config/nvim/lua/custom/plugins/telescope.lua
index d2e97d7..ed88754 100644
--- a/home/.config/nvim/lua/custom/plugins/telescope.lua
+++ b/home/.config/nvim/lua/custom/plugins/telescope.lua
@@ -1,129 +1,341 @@
-local map = require("mapper")
-
return {
{
"nvim-telescope/telescope.nvim",
+ branch = "master",
+ keys = {
+ {
+ "<leader>sg",
+ function()
+ require("telescope.builtin").live_grep()
+ end,
+ desc = "[S]earch by [G]rep",
+ },
+ {
+ "<leader>sw",
+ function()
+ require("telescope.builtin").grep_string()
+ end,
+ desc = "[S]earch current [W]ord",
+ },
+ {
+ "<leader>sf",
+ function()
+ require("telescope.builtin").find_files()
+ end,
+ desc = "[S]earch [F]iles",
+ },
+ {
+ "<leader><leader>",
+ function()
+ require("telescope.builtin").buffers()
+ end,
+ desc = "[ ] Find existing buffers",
+ },
+ {
+ "<leader>/",
+ function()
+ require("telescope.builtin").current_buffer_fuzzy_find()
+ end,
+ desc = "[/] Fuzzily search in current buffer",
+ },
+ {
+ "<leader>s/",
+ function()
+ require("telescope.builtin").live_grep({
+ grep_open_files = true,
+ prompt_title = "Live Grep in Open Files",
+ })
+ end,
+ desc = "[S]earch [/] in Open Files",
+ },
+ {
+ "<leader>st",
+ function()
+ require("telescope.builtin").treesitter()
+ end,
+ desc = "[S]earch [T]reesitter",
+ },
+ {
+ "<leader>ss",
+ function()
+ require("telescope.builtin").builtin()
+ end,
+ desc = "[S]earch [S]elect Telescope",
+ },
+ {
+ "<leader>sc",
+ function()
+ require("telescope.builtin").commands()
+ end,
+ desc = "[S]earch [C]ommands",
+ },
+ {
+ "<leader>sh",
+ function()
+ require("telescope.builtin").help_tags()
+ end,
+ desc = "[S]earch [H]elp",
+ },
+ {
+ "<leader>sm",
+ function()
+ require("telescope.builtin").man_pages()
+ end,
+ desc = "[S]earch [M]an pages",
+ },
+ {
+ "<leader>sk",
+ function()
+ require("telescope.builtin").keymaps()
+ end,
+ desc = "[S]earch [K]eymaps",
+ },
+ {
+ "<leader>sd",
+ function()
+ require("telescope.builtin").diagnostics()
+ end,
+ desc = "[S]earch [D]iagnostics",
+ },
+ -- {"<leader>sr", function() require("telescope.builtin").resume() end, desc = '[S]earch [R]esume' },
+ {
+ "<leader>s.",
+ function()
+ require("telescope.builtin").oldfiles()
+ end,
+ desc = '[S]earch Recent Files ("." for repeat)',
+ },
+ {
+ "<leader>sq",
+ function()
+ require("telescope.builtin").quickfix()
+ end,
+ desc = "[S]earch [Q]uickfixlist",
+ },
+ {
+ "<leader>sl",
+ function()
+ require("telescope.builtin").loclist()
+ end,
+ desc = "[S]earch [L]ocationlist",
+ },
+ {
+ "<leader>sR",
+ function()
+ require("telescope.builtin").registers()
+ end,
+ desc = "[S]earch [R]egisters",
+ },
+ {
+ "<leader>sa",
+ function()
+ require("telescope.builtin").autocommands()
+ end,
+ desc = "[S]earch [A]utocommands",
+ },
+
+ {
+ "<leader>gc",
+ function()
+ require("telescope.builtin").git_bcommits()
+ end,
+ desc = "[G]it buffer [C]commits",
+ },
+ {
+ "<leader>gc",
+ function()
+ require("telescope.builtin").git_bcommits_range()
+ end,
+ desc = "[G]it [C]commits for selected range",
+ },
+ {
+ "<leader>gC",
+ function()
+ require("telescope.builtin").git_commits()
+ end,
+ desc = "[G]it (all) [C]commits",
+ },
+ {
+ "<leader>gb",
+ function()
+ require("telescope.builtin").git_branches()
+ end,
+ desc = "[G]it [B]ranches",
+ },
+ {
+ "<leader>gs",
+ function()
+ require("telescope.builtin").git_status()
+ end,
+ desc = "[G]it [S]tatus",
+ },
+ {
+ "<leader>gS",
+ function()
+ require("telescope.builtin").git_stash()
+ end,
+ desc = "[G]it [S]tash",
+ },
+ {
+ "<leader>sr",
+ function()
+ require("telescope").extensions.refactoring.refactors()
+ end,
+ mode = { "n", "x" },
+ desc = "[S]earch [R]efactor",
+ },
+ },
config = function()
local actions = require("telescope.actions")
+ local actions_layout = require("telescope.actions.layout")
require("telescope").setup({
defaults = {
sorting_strategy = "ascending",
layout_config = {
prompt_position = "top",
+ height = 0.95,
+ width = 0.95,
+ flip_columns = 200,
+ vertical = { mirror = true },
+ },
+ layout_strategy = "flex",
+ preview = {
+ filesize_limit = 0.1, -- MB
},
scroll_strategy = "cycle",
selection_strategy = "follow",
color_devicons = false,
mappings = {
+ n = {
+ ["<M-p>"] = actions_layout.toggle_preview,
+ ["d"] = actions.delete_buffer + actions.move_to_top,
+ ["a"] = actions.add_to_qflist,
+ ["s"] = actions.select_all,
+ },
i = {
+ ["jj"] = { "<esc>", type = "command" },
["<c-j>"] = actions.move_selection_next,
["<c-k>"] = actions.move_selection_previous,
+ ["<C-u>"] = false,
+ ["<M-p>"] = actions_layout.toggle_preview,
+ ["<c-d>"] = actions.delete_buffer + actions.move_to_top,
},
},
- 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"
+ },
+ pickers = {
+ find_files = {
+ follow = true,
+ hidden = true,
+ find_command = {
+ "fd",
+ "--type",
+ "f",
+ "--color",
+ "never",
},
- ["ui-select"] = {
- require("telescope.themes").get_dropdown({
- -- even more opts
- }),
+ },
+ live_grep = {
+ additional_args = {
+ "--hidden",
+ "--fixed-strings",
},
},
+ buffers = {
+ initial_mode = "normal",
+ sort_lastused = true,
+ },
+ current_buffer_fuzzy_find = {
+ require("telescope.themes").get_dropdown({
+ winblend = 10,
+ previewer = false,
+ }),
+ },
+ quickfix = {
+ initial_mode = "normal",
+ },
+ loclist = {
+ initial_mode = "normal",
+ },
+ registers = {
+ initial_mode = "normal",
+ },
+ lsp_definitions = {
+ initial_mode = "normal",
+ },
+ lsp_type_definitions = {
+ initial_mode = "normal",
+ },
+ lsp_implementations = {
+ initial_mode = "normal",
+ },
+ lsp_references = {
+ initial_mode = "normal",
+ },
+ lsp_incoming_calls = {
+ initial_mode = "normal",
+ },
+ lsp_outgoing_calls = {
+ initial_mode = "normal",
+ },
+ },
+ 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"
+ },
},
})
require("telescope").load_extension("fzf")
require("telescope").load_extension("ui-select")
-
- local b = require("telescope.builtin")
-
- map.n("<localleader>B", b.builtin)
- map.n("<localleader>/", b.live_grep)
- map.n("<localleader>?", b.grep_string)
- map.n("<localleader>f", function()
- b.find_files({
- find_command = {
- "fd",
- "--type",
- "file",
- "--follow",
- "--hidden",
- "--exclude",
- ".git",
- },
- })
- end)
- map.n("<localleader>b", function()
- b.buffers({ sort_lastused = true, initial_mode = "normal" })
- end)
-
- map.n("<localleader>t", b.treesitter)
-
- map.n("<localleader>c", b.commands)
- map.n("<localleader>h", b.help_tags)
- map.n("<localleader>m", b.man_pages)
- map.n("<localleader>k", b.keymaps)
- map.n("<localleader>Q", function()
- b.quickfix({ initial_mode = "normal" })
- end)
- map.n("<localleader>L", function()
- b.loclist({ initial_mode = "normal" })
- end)
- map.n("<localleader>R", function()
- b.registers({ initial_mode = "normal" })
- end)
- map.n("<localleader>A", b.autocommands)
-
+ require("telescope").load_extension("refactoring")
vim.api.nvim_create_autocmd("LspAttach", {
callback = function(event)
- local bnmap = function(keys, func)
- map.n(keys, func, { buffer = event.buf })
+ local b = require("telescope.builtin")
+ local bnmap = function(keys, func, desc)
+ vim.keymap.set("n", keys, func, { buffer = event.buf, desc = "LSP: " .. desc })
end
- bnmap("gd", function()
- b.lsp_definitions({ initial_mode = "normal" })
- end)
+ bnmap("gd", b.lsp_definitions, "[G]oto [D]efinition")
bnmap("gvd", function()
- b.lsp_definitions({ initial_mode = "normal", jump_type = "vsplit" })
- end)
+ b.lsp_definitions({ jump_type = "vsplit" })
+ end, "[G]oto in a [V]ertical split to [D]efinition")
bnmap("gxd", function()
- b.lsp_definitions({ initial_mode = "normal", jump_type = "split" })
- end)
+ b.lsp_definitions({ jump_type = "split" })
+ end, "[G]oto in a [X]horizontal split to [D]efinition")
bnmap("gtd", function()
- b.lsp_definitions({ initial_mode = "normal", jump_type = "tab" })
- end)
- bnmap("gi", function()
- b.lsp_implementations({ initial_mode = "normal" })
- end)
- bnmap("gvi", function()
- b.lsp_implementations({ initial_mode = "normal", jump_type = "vsplit" })
- end)
- bnmap("gxi", function()
- b.lsp_implementations({ initial_mode = "normal", jump_type = "split" })
- end)
- bnmap("gti", function()
- b.lsp_implementations({ initial_mode = "normal", jump_type = "tab" })
- end)
- bnmap("go", b.lsp_document_symbols)
- bnmap("gS", b.lsp_dynamic_workspace_symbols)
- bnmap("ge", function()
- b.lsp_document_diagnostics({ initial_mode = "normal" })
- end)
- bnmap("gE", function()
- b.lsp_workspace_diagnostics({ initial_mode = "normal" })
- end)
- bnmap("gr", function()
- b.lsp_references({ initial_mode = "normal" })
- end)
- bnmap("gic", function()
- b.lsp_incoming_calls({ initial_mode = "normal" })
- end)
- bnmap("goc", function()
- b.lsp_outgoing_calls({ initial_mode = "normal" })
- end)
+ b.lsp_definitions({ jump_type = "tab" })
+ end, "[G]oto in a [T]ab to [D]efinition")
+ bnmap("<leader>D", b.lsp_type_definitions, "Type [D]efinition")
+ bnmap("<leader>vD", function()
+ b.lsp_type_definitions({ jump_type = "vsplit" })
+ end, "Open in a [V]ertical split Type [D]efinition")
+ bnmap("<leader>xD", function()
+ b.lsp_type_definitions({ jump_type = "split" })
+ end, "Open in a [X]horizontal split Type [D]efinition")
+ bnmap("<leader>tD", function()
+ b.lsp_type_definitions({ jump_type = "tab" })
+ end, "Open in a [T]ab Type [D]efinition")
+ bnmap("gri", b.lsp_implementations, "[G]oto [I]mplementation")
+ bnmap("grvi", function()
+ b.lsp_implementations({ jump_type = "vsplit" })
+ end, "[G]oto in a [V]ertical split to [I]mplementation")
+ bnmap("grxi", function()
+ b.lsp_implementations({ jump_type = "split" })
+ end, "[G]oto in a [X]horizontal split to [I]mplementation")
+ bnmap("grti", function()
+ b.lsp_implementations({ jump_type = "tab" })
+ end, "[G]oto in a [T]ab to [I]mplementation")
+ bnmap("grr", b.lsp_references, "[G]oto [R]eferences")
+ bnmap("<leader>ic", b.lsp_incoming_calls, "[I]ncoming [C]alls")
+ bnmap("<leader>oc", b.lsp_outgoing_calls, "[O]utgoing [C]alls")
+ bnmap("gO", b.lsp_document_symbols, "d[O]ocument symbols")
+ bnmap(
+ "<leader>ws",
+ b.lsp_dynamic_workspace_symbols,
+ "[W]orkspace [S]ymbols"
+ )
end,
})
end,
@@ -134,6 +346,7 @@ return {
build = "make",
},
"nvim-telescope/telescope-ui-select.nvim",
+ "ThePrimeagen/refactoring.nvim",
},
},
}
diff --git a/home/.config/nvim/lua/custom/plugins/ts.lua b/home/.config/nvim/lua/custom/plugins/ts.lua
index c2741e5..40b1209 100644
--- a/home/.config/nvim/lua/custom/plugins/ts.lua
+++ b/home/.config/nvim/lua/custom/plugins/ts.lua
@@ -1,155 +1,155 @@
return {
{
- 'nvim-treesitter/nvim-treesitter',
+ "aaronik/treewalker.nvim",
+ keys = {
+ {
+ "<a-k>",
+ "<cmd>Treewalker Up<cr>",
+ { "n", "v" },
+ silent = true,
+ desc = "Moves up to the previous neighbor node",
+ },
+ {
+ "<a-j>",
+ "<cmd>Treewalker Down<cr>",
+ { "n", "v" },
+ silent = true,
+ desc = "Moves up to the next neighbor node",
+ },
+ {
+ "<a-h>",
+ "<cmd>Treewalker Left<cr>",
+ { "n", "v" },
+ silent = true,
+ desc = "Moves to the first ancestor node that's on a different line from the current node",
+ },
+ {
+ "<a-l>",
+ "<cmd>Treewalker Right<cr>",
+ { "n", "v" },
+ silent = true,
+ desc = "Moves to the next node down that's indented further than the current node",
+ },
+ {
+ "<cmd>Treewalker SwapUp<cr>",
+ "<s-a-k>",
+ silent = true,
+ desc = "Swaps the highest node on the line upwards in the document",
+ },
+ {
+ "<s-a-j>",
+ "<cmd>Treewalker SwapDown<cr>",
+ silent = true,
+ desc = "Swaps the biggest node on the line downward in the document",
+ },
+ {
+ "<s-a-h>",
+ "<cmd>Treewalker SwapLeft<cr>",
+ silent = true,
+ desc = "Swap the node under the cursor with its previous neighbor",
+ },
+ {
+ "<s-a-l>",
+ "<cmd>Treewalker SwapRight<cr>",
+ silent = true,
+ desc = "Swap the node under the cursor with its next neighbor",
+ },
+ },
+ opts = {},
+ },
+ {
+ "nvim-treesitter/nvim-treesitter",
+ branch = "main",
+ lazy = false,
dependencies = {
- 'nvim-treesitter/nvim-treesitter-textobjects',
- "nvim-treesitter/nvim-treesitter-refactor",
- "theHamsta/crazy-node-movement",
- "theHamsta/nvim-treesitter-pairs",
- "RRethy/nvim-treesitter-endwise",
+ -- "theHamsta/nvim-treesitter-pairs", -- Reneable once main branch is supported
+ {
+ "LiadOz/nvim-dap-repl-highlights",
+ opts = {},
+ },
},
build = ":TSUpdate",
config = function()
- require("nvim-treesitter.configs").setup({
- ensure_installed = {
- "bash",
- "c",
- "cmake",
- "comment",
- "cpp",
- "css",
- "diff",
- "dockerfile",
- "doxygen",
- "fortran",
- "git_config",
- "git_rebase",
- "gitattributes",
- "gitcommit",
- "gitignore",
- "gpg",
- "html",
- "http",
- "ini",
- "javascript",
- "jsdoc",
- "json",
- "jsonc",
- "llvm",
- "lua",
- "luadoc",
- "luap",
- "make",
- "markdown",
- "markdown_inline",
- "python",
- "regex",
- "rust",
- "sql",
- "tablegen",
- "todotxt",
- "toml",
- "typescript",
- "vim",
- "vimdoc",
- "xml",
- "yaml",
- },
- highlight = {
- enable = true,
- additional_vim_regex_highlighting = false,
- },
- incremental_selection = {
- enable = true,
- keymaps = {
- init_selection = "gnn",
- node_incremental = "grn",
- scope_incremental = "grc",
- node_decremental = "grm",
- },
- },
- indent = { enable = true },
- refactor = {
- highlight_definitions = { enable = true },
- highlight_current_scope = { enable = true },
- },
- textobjects = {
- select = {
- enable = true,
- -- Automatically jump forward to textobj, similar to targets.vim
- lookahead = true,
- keymaps = {
- -- You can use the capture groups defined in textobjects.scm
- ["af"] = "@function.outer",
- ["if"] = "@function.inner",
- ["ac"] = "@class.outer",
- ["ic"] = "@class.inner",
- },
- },
- swap = {
- enable = true,
- swap_next = { ["<leader>a"] = "@parameter.inner" },
- swap_previous = { ["<leader>A"] = "@parameter.inner" },
- },
- move = {
- enable = true,
- set_jumps = true, -- whether to set jumps in the jumplist
- goto_next_start = {
- ["]m"] = "@function.outer",
- ["]]"] = "@class.outer",
- },
- goto_next_end = {
- ["]M"] = "@function.outer",
- ["]["] = "@class.outer",
- },
- goto_previous_start = {
- ["[m"] = "@function.outer",
- ["[["] = "@class.outer",
- },
- goto_previous_end = {
- ["[M"] = "@function.outer",
- ["[]"] = "@class.outer",
- },
- },
- lsp_interop = {
- enable = true,
- peek_definition_code = {
- ["df"] = "@function.outer",
- ["dF"] = "@class.outer",
- },
- },
- },
- matchup = {
- enable = true,
- },
- pairs = {
- enable = true,
- goto_right_end = false,
- keymaps = { goto_partner = "%" },
- },
- node_movement = {
- enable = true,
- keymaps = {
- move_up = "<a-k>",
- move_down = "<a-j>",
- move_left = "<a-h>",
- move_right = "<a-l>",
- swap_left = "<s-a-h>", -- will only swap when one of "swappable_textobjects" is selected
- swap_right = "<s-a-l>",
- select_current_node = "<leader><Cr>",
- },
- swappable_textobjects = { '@function.outer', '@parameter.inner', '@statement.outer' },
- allow_switch_parents = true, -- more craziness by switching parents while staying on the same level, false prevents you from accidentally jumping out of a function
- allow_next_parent = true, -- more craziness by going up one level if next node does not have children
- },
- tree_docs = {
- enable = true,
- },
- endwise = {
- enable = true,
- },
+ require("nvim-treesitter").install({
+ "awk",
+ "bash",
+ "c",
+ "cmake",
+ "comment",
+ "cpp",
+ "css",
+ "csv",
+ "diff",
+ "dockerfile",
+ "dap_repl",
+ "doxygen",
+ "editorconfig",
+ "fortran",
+ "git_config",
+ "git_rebase",
+ "gitattributes",
+ "gitcommit",
+ "gitignore",
+ "groovy",
+ "gpg",
+ "hlsplaylist",
+ "html",
+ "http",
+ "ini",
+ "javascript",
+ "jq",
+ "jsdoc",
+ "json",
+ "jsonc",
+ "just",
+ "llvm",
+ "lua",
+ "luadoc",
+ "luap",
+ "make",
+ "markdown",
+ "markdown_inline",
+ "query",
+ "passwd",
+ "printf",
+ "python",
+ "regex",
+ "readline",
+ "requirements",
+ "rust",
+ "sql",
+ "ssh_config",
+ "strace",
+ "sxhkdrc",
+ "tablegen",
+ "tmux",
+ "todotxt",
+ "toml",
+ "typescript",
+ "vim",
+ "vimdoc",
+ "xcompose",
+ "xml",
+ "xresources",
+ "yaml",
+ })
+ end,
+ },
+ "RRethy/nvim-treesitter-endwise",
+ { "nvim-treesitter/nvim-treesitter-context", opts = {} },
+ {
+ "JoosepAlviste/nvim-ts-context-commentstring",
+ config = function()
+ require("ts_context_commentstring").setup({
+ enable_autocmd = false,
})
- end
+ local get_option = vim.filetype.get_option
+
+ vim.filetype.get_option = function(filetype, option)
+ return option == "commentstring"
+ and require("ts_context_commentstring.internal").calculate_commentstring()
+ or get_option(filetype, option)
+ end
+ end,
},
- "nvim-treesitter/nvim-treesitter-context",
}
diff --git a/home/.config/nvim/lua/custom/plugins/ui.lua b/home/.config/nvim/lua/custom/plugins/ui.lua
index ba9d4ac..a07eda8 100644
--- a/home/.config/nvim/lua/custom/plugins/ui.lua
+++ b/home/.config/nvim/lua/custom/plugins/ui.lua
@@ -1,24 +1,16 @@
return {
{
- "sainnhe/gruvbox-material",
+ "ellisonleao/gruvbox.nvim",
priority = 1000,
config = function()
- vim.g.gruvbox_material_background = "hard"
- vim.g.gruvbox_material_enable_bold = 1
- vim.g.gruvbox_material_enable_italic = 1
- vim.g.gruvbox_material_better_performance = 1
- vim.g.gruvbox_material_palette = "original"
-
- vim.cmd([[ colorscheme gruvbox-material]])
- end
- },
- {
- "norcalli/nvim-colorizer.lua",
- event = "BufRead",
- config = true
+ require("gruvbox").setup({})
+ vim.o.background = "dark"
+ vim.cmd([[colorscheme gruvbox]])
+ end,
},
{
"lukas-reineke/indent-blankline.nvim",
+ event = "BufRead",
config = function()
local highlight = {
"RainbowRed",
@@ -29,7 +21,7 @@ return {
"RainbowViolet",
"RainbowCyan",
}
- local hooks = require "ibl.hooks"
+ local hooks = require("ibl.hooks")
-- create the highlight groups in the highlight setup hook, so they are reset
-- every time the colorscheme changes
hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
@@ -43,38 +35,57 @@ return {
end)
vim.g.rainbow_delimiters = { highlight = highlight }
- require("ibl").setup { scope = { highlight = highlight } }
+ require("ibl").setup({
+ scope = { highlight = highlight },
+ })
- hooks.register(hooks.type.SCOPE_HIGHLIGHT,
- hooks.builtin.scope_highlight_from_extmark)
- end
+ hooks.register(
+ hooks.type.SCOPE_HIGHLIGHT,
+ hooks.builtin.scope_highlight_from_extmark
+ )
+ end,
},
{
- 'nvim-lualine/lualine.nvim',
+ "nvim-lualine/lualine.nvim",
opts = {
options = {
icons_enabled = false,
- theme = 'gruvbox_dark',
- component_separators = '',
- section_separators = '|',
+ theme = "gruvbox_dark",
+ component_separators = "",
+ section_separators = "|",
+ disabled_filetypes = {
+ winbar = {
+ "dap-view",
+ "dap-repl",
+ "dap-view-term",
+ },
+ },
},
sections = {
- lualine_a = { 'filetype', { 'filename', path = 1 } },
- lualine_b = { '%l/%L:%c:%o' },
- lualine_c = { 'diff' },
- lualine_x = { 'searchcount, selectioncount' },
- lualine_y = {},
- lualine_z = { 'diagnostics' }
+ lualine_a = { "filetype", { "filename", path = 1 } },
+ lualine_b = { "%l/%L:%c:%o" },
+ lualine_c = { "diff" },
+ lualine_x = { "searchcount, selectioncount" },
+ lualine_y = { "overseer", "copilot" },
+ lualine_z = { "diagnostics" },
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
- lualine_c = { 'filename' },
+ lualine_c = { "filename" },
lualine_x = {},
lualine_y = {},
- lualine_z = {}
+ lualine_z = {},
},
},
+ dependencies = {
+ "AndreM222/copilot-lualine",
+ },
+ },
+ {
+ "jake-stewart/auto-cmdheight.nvim",
+ lazy = false,
+ opts = {},
},
- "https://gitlab.com/HiPhish/rainbow-delimiters.nvim",
+ -- "https://gitlab.com/HiPhish/rainbow-delimiters.nvim",
}
diff --git a/home/.config/nvim/lua/mapper.lua b/home/.config/nvim/lua/mapper.lua
deleted file mode 100644
index c31aeca..0000000
--- a/home/.config/nvim/lua/mapper.lua
+++ /dev/null
@@ -1,84 +0,0 @@
-local M = {}
-
-M.map = function(mode, keys, action, opts, bufnr)
- opts = vim.tbl_extend("force", { silent = true, buffer = bufnr }, opts or {})
- vim.keymap.set(mode, keys, action, opts)
-end
-
-M.cmdi = function(mode, keys, action, opts, bufnr)
- opts = vim.tbl_extend("force", { silent = false }, opts or {})
- M.map(mode, keys, ":" .. action, opts, bufnr)
-end
-
-M.cmd = function(mode, keys, action, opts, bufnr)
- M.map(mode, keys, "<cmd>" .. action .. "<cr>", opts, bufnr)
-end
-
-M.plug = function(mode, keys, action, opts, bufnr)
- M.map(mode, keys, "<Plug>" .. action, opts, bufnr)
-end
-
-M.n = function(keys, action, opts, bufnr)
- M.map("n", keys, action, opts, bufnr)
-end
-M.ncmdi = function(keys, action, opts, bufnr)
- M.cmdi("n", keys, action, opts, bufnr)
-end
-M.ncmd = function(keys, action, opts, bufnr)
- M.cmd("n", keys, action, opts, bufnr)
-end
-M.nplug = function(keys, action, opts, bufnr)
- M.plug("n", keys, "(" .. action .. ")", opts, bufnr)
-end
-
-M.v = function(keys, action, opts, bufnr)
- M.map("v", keys, action, opts, bufnr)
-end
-M.vcmdi = function(keys, action, opts, bufnr)
- opts = vim.tbl_extend("force", { silent = false }, opts or {})
- M.v(keys, ":" .. action, opts, bufnr)
-end
-M.vcmd = function(keys, action, opts, bufnr)
- M.vcmdi(keys, action .. "<cr>", opts, bufnr)
-end
-M.vplug = function(keys, action, opts, bufnr)
- M.plug("v", keys, "(" .. action .. ")", opts, bufnr)
-end
-
-M.nv = function(keys, action, opts, bufnr)
- M.map({ "n", "v" }, keys, action, opts, bufnr)
-end
-M.nvcmdi = function(keys, action, opts, bufnr)
- M.ncmdi(keys, action, opts, bufnr)
- M.vcmdi(keys, action, opts, bufnr)
-end
-M.nvcmd = function(keys, action, opts, bufnr)
- M.ncmd(keys, action, opts, bufnr)
- M.vcmd(keys, action, opts, bufnr)
-end
-M.nvplug = function(keys, action, opts, bufnr)
- M.plug({ "n", "v" }, keys, "(" .. action .. ")", opts, bufnr)
-end
-
-M.i = function(keys, action, opts, bufnr)
- M.map("i", keys, action, opts, bufnr)
-end
-M.iplug = function(keys, action, opts, bufnr)
- opts = vim.tbl_extend("force", { silent = false }, opts or {})
- M.plug("i", keys, action, opts, bufnr)
-end
-
-M.t = function(keys, action, opts, bufnr)
- M.map("t", keys, action, opts, bufnr)
-end
-M.tcmdi = function(keys, action, opts, bufnr)
- M.cmdi("t", keys, action, opts, bufnr)
-end
-M.tcmd = function(keys, action, opts, bufnr)
- M.cmd("t", keys, action, opts, bufnr)
-end
-M.tplug = function(keys, action, opts, bufnr)
- M.plug("t", keys, action, opts, bufnr)
-end
-
-return M