diff options
| author | 2026-04-17 10:53:20 +0100 | |
|---|---|---|
| committer | 2026-04-17 10:53:20 +0100 | |
| commit | e01f1d6f5d42fac643facecd9ca2d240d53453bd (patch) | |
| tree | 6684173cbd992e4c0b5fa2002b9a6082f866ca51 | |
| parent | dd2bc0a81d7ca6de60a509d8ff1a669e13785f01 (diff) | |
| download | dotfiles-e01f1d6f5d42fac643facecd9ca2d240d53453bd.tar.gz dotfiles-e01f1d6f5d42fac643facecd9ca2d240d53453bd.tar.bz2 dotfiles-e01f1d6f5d42fac643facecd9ca2d240d53453bd.zip | |
feat: migrate from lazy.nvim to vim.pack
Replace lazy.nvim plugin manager with Neovim 0.12's native vim.pack API.
All plugin config files rewritten from lazy.nvim spec tables to imperative
require/setup format with explicit vim.keymap.set() calls.
Key changes:
- vim.pack.add() with ~53 plugins in init.lua
- blink.cmp/pairs/download pinned to version tags (vim.version.range)
- PackChanged autocmd for markdown-preview build hook
- Ordered requires: colorscheme → ui → treesitter → completion → lsp → rest
- Plugin setup guards (gitsigns, which-key, blink.cmp) handle deferred
plugin/ file loading correctly
Net reduction: ~438 lines across 13 files.
| -rw-r--r-- | home/.config/nvim/init.lua | 147 | ||||
| -rw-r--r-- | home/.config/nvim/lua/plugins/ai.lua | 59 | ||||
| -rw-r--r-- | home/.config/nvim/lua/plugins/completion.lua | 171 | ||||
| -rw-r--r-- | home/.config/nvim/lua/plugins/debug.lua | 160 | ||||
| -rw-r--r-- | home/.config/nvim/lua/plugins/editing.lua | 197 | ||||
| -rw-r--r-- | home/.config/nvim/lua/plugins/git.lua | 272 | ||||
| -rw-r--r-- | home/.config/nvim/lua/plugins/init.lua | 143 | ||||
| -rw-r--r-- | home/.config/nvim/lua/plugins/lsp.lua | 591 | ||||
| -rw-r--r-- | home/.config/nvim/lua/plugins/runner.lua | 222 | ||||
| -rw-r--r-- | home/.config/nvim/lua/plugins/search.lua | 175 | ||||
| -rw-r--r-- | home/.config/nvim/lua/plugins/session.lua | 151 | ||||
| -rw-r--r-- | home/.config/nvim/lua/plugins/treesitter.lua | 236 | ||||
| -rw-r--r-- | home/.config/nvim/lua/plugins/ui.lua | 124 |
13 files changed, 1105 insertions, 1543 deletions
diff --git a/home/.config/nvim/init.lua b/home/.config/nvim/init.lua index 860c876..e3334a7 100644 --- a/home/.config/nvim/init.lua +++ b/home/.config/nvim/init.lua @@ -7,41 +7,122 @@ _G.P = function(v) return v end -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not (vim.uv or vim.loop).fs_stat(lazypath) then - local lazyrepo = "https://github.com/folke/lazy.nvim.git" - local out = vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "--branch=stable", - lazyrepo, - lazypath, - }) - if vim.v.shell_error ~= 0 then - vim.api.nvim_echo({ - { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, - { out, "WarningMsg" }, - { "\nPress any key to exit..." }, - }, true, {}) - vim.fn.getchar() - os.exit(1) - end -end -vim.opt.rtp:prepend(lazypath) +-- Pre-load globals (must be set before plugins load) +vim.g.copilot_nes_debounce = 500 -require("lazy").setup({ import = "plugins" }, { - defaults = { - version = "*", - }, - change_detection = { - notify = false, - }, - rocks = { - enabled = false, - hererocks = false, - }, +-- Build hooks for plugins that need post-install steps +vim.api.nvim_create_autocmd("User", { + pattern = "PackChanged", + callback = function(ev) + if ev.data.kind ~= "install" and ev.data.kind ~= "update" then + return + end + if ev.data.spec.name == "markdown-preview.nvim" then + vim.system({ "yarn", "install" }, { cwd = ev.data.path .. "/app" }) + end + end, }) +local gh = function(x) + return "https://github.com/" .. x +end + +vim.pack.add({ + -- UI + gh("ellisonleao/gruvbox.nvim"), + gh("saghen/blink.indent"), + gh("nvim-lualine/lualine.nvim"), + gh("AndreM222/copilot-lualine"), + + -- Treesitter + { src = gh("nvim-treesitter/nvim-treesitter"), version = "main" }, + gh("RRethy/nvim-treesitter-endwise"), + gh("nvim-treesitter/nvim-treesitter-context"), + gh("JoosepAlviste/nvim-ts-context-commentstring"), + gh("aaronik/treewalker.nvim"), + gh("LiadOz/nvim-dap-repl-highlights"), + + -- Completion + gh("saghen/blink.compat"), + { src = gh("saghen/blink.cmp"), version = vim.version.range("*") }, + gh("rafamadriz/friendly-snippets"), + gh("fang2hou/blink-copilot"), + gh("rcarriga/cmp-dap"), + gh("xzbdmw/colorful-menu.nvim"), + { src = gh("saghen/blink.pairs"), version = vim.version.range("*") }, + { src = gh("saghen/blink.download"), version = vim.version.range("*") }, + + -- Editing + gh("nmac427/guess-indent.nvim"), + gh("kylechui/nvim-surround"), + gh("chrisgrieser/nvim-various-textobjs"), + gh("monaqa/dial.nvim"), + gh("ThePrimeagen/refactoring.nvim"), + gh("nvim-lua/plenary.nvim"), + + -- Git + gh("akinsho/git-conflict.nvim"), + gh("NeogitOrg/neogit"), + gh("ruifm/gitlinker.nvim"), + gh("lewis6991/gitsigns.nvim"), + + -- LSP + gh("folke/lazydev.nvim"), + gh("neovim/nvim-lspconfig"), + gh("j-hui/fidget.nvim"), + gh("williamboman/mason.nvim"), + gh("williamboman/mason-lspconfig.nvim"), + gh("WhoIsSethDaniel/mason-tool-installer.nvim"), + gh("stevearc/conform.nvim"), + gh("mrcjkb/rustaceanvim"), + gh("mfussenegger/nvim-lint"), + gh("rachartier/tiny-inline-diagnostic.nvim"), + + -- Debug + { src = gh("miroshQa/debugmaster.nvim"), version = "dashboard" }, + gh("mfussenegger/nvim-dap"), + gh("theHamsta/nvim-dap-virtual-text"), + gh("jay-babu/mason-nvim-dap.nvim"), + + -- Runner + gh("stevearc/overseer.nvim"), + + -- Search + { src = gh("ibhagwan/fzf-lua"), version = "main" }, + + -- Session + gh("rmagatti/auto-session"), + + -- AI + gh("zbirenbaum/copilot.lua"), + gh("copilotlsp-nvim/copilot-lsp"), + + -- Misc + gh("iamcco/markdown-preview.nvim"), + gh("aserowy/tmux.nvim"), + gh("folke/which-key.nvim"), + gh("stevearc/quicker.nvim"), + gh("stevearc/oil.nvim"), +}, { confirm = false }) + +-- Colorscheme (must be set immediately after plugins are on rtp) +require("gruvbox").setup({}) +vim.o.background = "dark" +vim.cmd.colorscheme("gruvbox") + +-- Plugin configurations (order matters for dependencies) +require("plugins.ui") +require("plugins.treesitter") +require("plugins.completion") +require("plugins.editing") +require("plugins.git") +require("plugins.lsp") +require("plugins.debug") +require("plugins.runner") +require("plugins.search") +require("plugins.session") +require("plugins.ai") +require("plugins.init") + require("config.keymaps") require("config.autocmds") diff --git a/home/.config/nvim/lua/plugins/ai.lua b/home/.config/nvim/lua/plugins/ai.lua index 5936339..d88bc7e 100644 --- a/home/.config/nvim/lua/plugins/ai.lua +++ b/home/.config/nvim/lua/plugins/ai.lua @@ -1,44 +1,23 @@ -return { - { - "zbirenbaum/copilot.lua", - cmd = "Copilot", - build = ":Copilot auth", - event = "InsertEnter", - dependencies = { - { - "copilotlsp-nvim/copilot-lsp", - init = function() - vim.g.copilot_nes_debounce = 500 - end, +require("copilot").setup({ + suggestion = { enabled = false }, + panel = { enabled = false }, + server_opts_overrides = { + settings = { + telemetry = { + telemetryLevel = "off", }, }, - keys = { - { - "<leader>tc", - function() - require("copilot.command").toggle() - end, - desc = "[T]oggle [C]opilot attachment", - }, - }, - opts = { - suggestion = { enabled = false }, - panel = { enabled = false }, - server_opts_overrides = { - settings = { - telemetry = { - telemetryLevel = "off", - }, - }, - }, - nes = { - enabled = true, - keymap = { - accept_and_goto = "<leader>p", - accept = false, - dismiss = "<Esc>", - }, - }, + }, + nes = { + enabled = true, + keymap = { + accept_and_goto = "<leader>p", + accept = false, + dismiss = "<Esc>", }, }, -} +}) + +vim.keymap.set("n", "<leader>tc", function() + require("copilot.command").toggle() +end, { desc = "[T]oggle [C]opilot attachment" }) diff --git a/home/.config/nvim/lua/plugins/completion.lua b/home/.config/nvim/lua/plugins/completion.lua index 0310923..df24a5d 100644 --- a/home/.config/nvim/lua/plugins/completion.lua +++ b/home/.config/nvim/lua/plugins/completion.lua @@ -1,109 +1,86 @@ -return { - { - "saghen/blink.compat", - opts = {}, +require("blink.compat").setup({}) + +require("blink.cmp").setup({ + keymap = { + preset = "cmdline", + ["<CR>"] = { "accept", "fallback" }, }, - { - "saghen/blink.cmp", - dependencies = { - "rafamadriz/friendly-snippets", - "fang2hou/blink-copilot", - "rcarriga/cmp-dap", - "xzbdmw/colorful-menu.nvim", - }, - opts = { - keymap = { - preset = "cmdline", - ["<CR>"] = { "accept", "fallback" }, - }, - appearance = { - use_nvim_cmp_as_default = true, - }, - completion = { - menu = { - draw = { - -- treesitter = { "lsp" }, - -- We don't need label_description now because label and label_description are already - -- combined together in label by colorful-menu.nvim. - columns = { { "kind_icon" }, { "label", gap = 1 } }, - components = { - label = { - text = function(ctx) - return require("colorful-menu").blink_components_text(ctx) - end, - highlight = function(ctx) - return require("colorful-menu").blink_components_highlight( - ctx - ) - end, - }, - }, - }, - }, - list = { - selection = { - preselect = function() - return not require("blink.cmp").snippet_active({ direction = 1 }) + appearance = { + use_nvim_cmp_as_default = true, + }, + completion = { + menu = { + draw = { + columns = { { "kind_icon" }, { "label", gap = 1 } }, + components = { + label = { + text = function(ctx) + return require("colorful-menu").blink_components_text(ctx) + end, + highlight = function(ctx) + return require("colorful-menu").blink_components_highlight(ctx) end, }, }, - 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" }, - }, + }, + list = { + selection = { + preselect = function() + return not require("blink.cmp").snippet_active({ direction = 1 }) + end, }, }, + documentation = { auto_show = true }, }, - { - "saghen/blink.pairs", - version = "*", - dependencies = "saghen/blink.download", - opts = { - mappings = { - disabled_filetypes = {}, - }, - highlights = { - groups = { - "BlinkIndentOrange", - "BlinkIndentViolet", - "BlinkIndentBlue", - "BlinkIndentRed", - "BlinkIndentCyan", - "BlinkIndentYellow", - "BlinkIndentGreen", + 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", + score_offset = 100, + }, + dap = { name = "dap", module = "blink.compat.source" }, + }, + }, +}) + +require("blink.pairs").setup({ + mappings = { + disabled_filetypes = {}, + }, + highlights = { + groups = { + "BlinkIndentOrange", + "BlinkIndentViolet", + "BlinkIndentBlue", + "BlinkIndentRed", + "BlinkIndentCyan", + "BlinkIndentYellow", + "BlinkIndentGreen", }, }, -} +}) diff --git a/home/.config/nvim/lua/plugins/debug.lua b/home/.config/nvim/lua/plugins/debug.lua index b47dd63..bef0d1c 100644 --- a/home/.config/nvim/lua/plugins/debug.lua +++ b/home/.config/nvim/lua/plugins/debug.lua @@ -1,101 +1,75 @@ -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") +vim.keymap.set("n", "<leader>td", function() + require("debugmaster").mode.toggle() +end, { desc = "[T]oggle [D]ebug mode" }) - local function get_env_vars() - local variables = vim.fn.environ() - table.insert(variables, { ASAN_OPTIONS = "detect_leaks=0" }) - return variables - end +local dap = require("dap") - dap.adapters.lldb = { - type = "executable", - 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 get_env_vars() + local variables = vim.fn.environ() + table.insert(variables, { ASAN_OPTIONS = "detect_leaks=0" }) + return variables +end - local function get_program() - 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 +dap.adapters.lldb = { + type = "executable", + 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 get_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 +local function get_program() + 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 - dap.configurations.cpp = { - { - name = "codelldb Launch", - type = "codelldb", - request = "launch", - cwd = "${workspaceFolder}", - program = get_program, - args = get_args, - stopOnEntry = true, - console = "integratedTerminal", - }, - } +local function get_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.c = dap.configurations.cpp - dap.configurations.rust = dap.configurations.cpp - end, - dependencies = { - { - "theHamsta/nvim-dap-virtual-text", - opts = {}, - dependencies = { "nvim-treesitter/nvim-treesitter" }, - }, - "williamboman/mason.nvim", - { - "jay-babu/mason-nvim-dap.nvim", - opts = { - automatic_installation = false, - handlers = {}, - ensure_installed = {}, - }, - }, - }, +dap.configurations.cpp = { + { + name = "codelldb Launch", + type = "codelldb", + request = "launch", + cwd = "${workspaceFolder}", + program = get_program, + args = get_args, + stopOnEntry = true, + console = "integratedTerminal", }, } + +dap.configurations.c = dap.configurations.cpp +dap.configurations.rust = dap.configurations.cpp + +require("nvim-dap-virtual-text").setup({}) +require("mason-nvim-dap").setup({ + automatic_installation = false, + handlers = {}, + ensure_installed = {}, +}) diff --git a/home/.config/nvim/lua/plugins/editing.lua b/home/.config/nvim/lua/plugins/editing.lua index 2d93aeb..bcbfc6f 100644 --- a/home/.config/nvim/lua/plugins/editing.lua +++ b/home/.config/nvim/lua/plugins/editing.lua @@ -1,146 +1,55 @@ -return { - { - "nmac427/guess-indent.nvim", - event = "BufRead", - opts = {}, - }, - { - "kylechui/nvim-surround", - event = "VeryLazy", - opts = {}, - }, - { - "chrisgrieser/nvim-various-textobjs", - event = "VeryLazy", - opts = { - keymaps = { - useDefaults = true, - }, - }, - }, - { - "monaqa/dial.nvim", - 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", - }, - }, - }, - { - "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", - }, +require("guess-indent").setup({}) - { - "<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 = {}, +require("various-textobjs").setup({ + keymaps = { + useDefaults = true, }, -} +}) + +-- dial.nvim keymaps +vim.keymap.set("n", "]i", function() + return require("dial.map").inc_normal() +end, { expr = true, desc = "Increment" }) +vim.keymap.set("n", "[i", function() + return require("dial.map").dec_normal() +end, { expr = true, desc = "Decrement" }) +vim.keymap.set("v", "]i", function() + return require("dial.map").inc_visual() +end, { expr = true, desc = "Increment" }) +vim.keymap.set("v", "[i", function() + return require("dial.map").dec_visual() +end, { expr = true, desc = "Decrement" }) + +-- refactoring.nvim +require("refactoring").setup({}) + +vim.keymap.set("x", "<leader>re", function() + require("refactoring").refactor("Extract Function") +end, { desc = "[R]efactor [E]xtract function" }) +vim.keymap.set("x", "<leader>rf", function() + require("refactoring").refactor("Extract Function To File") +end, { desc = "[R]efactor extract function to [F]ile" }) +vim.keymap.set("x", "<leader>rv", function() + require("refactoring").refactor("Extract Variable") +end, { desc = "[R]efactor extract [V]ariable" }) +vim.keymap.set("n", "<leader>rI", function() + require("refactoring").refactor("Inline Function") +end, { desc = "[R]efactor [I]nline function" }) +vim.keymap.set({ "x", "n" }, "<leader>ri", function() + require("refactoring").refactor("Inline Variable") +end, { desc = "[R]efactor [I]nline variable" }) +vim.keymap.set("n", "<leader>rb", function() + require("refactoring").refactor("Extract Block") +end, { desc = "[R]efactor extract [B]lock" }) +vim.keymap.set("n", "<leader>rB", function() + require("refactoring").refactor("Extract Block To File") +end, { desc = "[R]efactor extract [B]lock to file" }) +vim.keymap.set("n", "<leader>rp", function() + require("refactoring").debug.printf({}) +end, { desc = "[R]efactor [P]rint" }) +vim.keymap.set({ "x", "n" }, "<leader>rV", function() + require("refactoring").debug.print_var({}) +end, { desc = "[R]efactor [P]rint [V]ariable" }) +vim.keymap.set("n", "<leader>rc", function() + require("refactoring").debug.cleanup({}) +end, { desc = "[R]efactor [C]leanup" }) diff --git a/home/.config/nvim/lua/plugins/git.lua b/home/.config/nvim/lua/plugins/git.lua index 9e920e2..b052c33 100644 --- a/home/.config/nvim/lua/plugins/git.lua +++ b/home/.config/nvim/lua/plugins/git.lua @@ -1,159 +1,123 @@ -return { - { - "akinsho/git-conflict.nvim", - event = "BufRead", - opts = { - disable_diagnostics = true, - default_mappings = { - next = "]x", - prev = "[x", - }, - }, +require("git-conflict").setup({ + disable_diagnostics = true, + default_mappings = { + next = "]x", + prev = "[x", }, - { - "NeogitOrg/neogit", - dependencies = { - "nvim-lua/plenary.nvim", - }, - 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") - end, - mode = "v", - }, - }, - dependencies = { - "nvim-lua/plenary.nvim", - }, - 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 - return url - end, - }, - }, +}) + +require("neogit").setup({ + disable_commit_confirmation = true, + kind = "split", + console_timeout = 5000, + auto_show_console = false, +}) + +vim.keymap.set("n", "<leader>go", function() + require("neogit").open() +end, { desc = "neo[G]it [O]pen" }) + +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 + end, }, - { - "lewis6991/gitsigns.nvim", - event = "BufRead", - opts = { - signs = { - change = { show_count = true }, - delete = { show_count = true }, - topdelete = { show_count = true }, - changedelete = { show_count = true }, - }, - numhl = true, - on_attach = function(bufnr) - 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 - nmap("]c", function() - if vim.wo.diff then - vim.cmd.normal({ "]c", bang = true }) - else - gs.nav_hunk("next") - end - end, "Jump to next git [c]hange") +}) - nmap("[c", function() - if vim.wo.diff then - vim.cmd.normal({ "[c", bang = true }) - else - gs.nav_hunk("prev") - end - end, "Jump to previous git [c]hange") +vim.keymap.set("n", "<leader>gy", function() + require("gitlinker").get_buf_range_url("n") +end) +vim.keymap.set("v", "<leader>gy", function() + require("gitlinker").get_buf_range_url("v") +end) - -- Actions - 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( - { "o", "x" }, - "ih", - ":<C-U>Gitsigns select_hunk<CR>", - "git [H]unk text object" - ) - end, - }, - dependencies = { - "nvim-lua/plenary.nvim", - }, +require("gitsigns").setup({ + signs = { + change = { show_count = true }, + delete = { show_count = true }, + topdelete = { show_count = true }, + changedelete = { show_count = true }, }, -} + numhl = true, + on_attach = function(bufnr) + 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 + nmap("]c", function() + if vim.wo.diff then + vim.cmd.normal({ "]c", bang = true }) + else + gs.nav_hunk("next") + end + end, "Jump to next git [c]hange") + + nmap("[c", function() + if vim.wo.diff then + vim.cmd.normal({ "[c", bang = true }) + else + gs.nav_hunk("prev") + end + end, "Jump to previous git [c]hange") + + -- Actions + 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( + { "o", "x" }, + "ih", + ":<C-U>Gitsigns select_hunk<CR>", + "git [H]unk text object" + ) + end, +}) diff --git a/home/.config/nvim/lua/plugins/init.lua b/home/.config/nvim/lua/plugins/init.lua index df8063e..8dce4cd 100644 --- a/home/.config/nvim/lua/plugins/init.lua +++ b/home/.config/nvim/lua/plugins/init.lua @@ -1,94 +1,59 @@ -return { - { - "iamcco/markdown-preview.nvim", - cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, - build = "cd app && yarn install", - ft = "markdown", +require("tmux").setup({ + resize = { + enable_default_keybindings = false, }, - { - "aserowy/tmux.nvim", - event = "VeryLazy", - opts = { - resize = { - enable_default_keybindings = false, - }, - }, +}) + +require("which-key").setup({ + 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>o", group = "[O]verseer" }, + { "<leader>r", group = "[R]efactor" }, + { "<leader>s", group = "[S]earch" }, + { "<leader>w", group = "[W]orkspace" }, + { "<leader>t", group = "[T]oggle" }, }, - { - "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>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)", - }, +}) + +vim.keymap.set("n", "<leader>?", function() + require("which-key").show({ global = false }) +end, { desc = "Buffer Local Keymaps (which-key)" }) + +require("quicker").setup({ + keys = { + { + ">", + function() + require("quicker").expand({ + before = 2, + after = 2, + add_to_existing = true, + }) + end, + desc = "Expand quickfix context", }, - }, - { - "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", - }, + { + "<", + function() + require("quicker").collapse() + end, + desc = "Collapse quickfix context", }, - 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", - }, - }, - }, - }, - { - "stevearc/oil.nvim", - opts = {}, - lazy = false, }, -} +}) + +vim.keymap.set("n", "<leader>tq", function() + require("quicker").toggle() +end, { desc = "[T]oggle [Q]uickfix" }) +vim.keymap.set("n", "<leader>tl", function() + require("quicker").toggle({ loclist = true }) +end, { desc = "[T]oggle [L]oclist" }) + +require("oil").setup({}) diff --git a/home/.config/nvim/lua/plugins/lsp.lua b/home/.config/nvim/lua/plugins/lsp.lua index 5a0cfaa..564028e 100644 --- a/home/.config/nvim/lua/plugins/lsp.lua +++ b/home/.config/nvim/lua/plugins/lsp.lua @@ -1,345 +1,282 @@ -return { - { - "folke/lazydev.nvim", - ft = "lua", - opts = { - library = { - { path = "${3rd}/luv/library", words = { "vim%.uv" } }, - }, - }, +require("lazydev").setup({ + library = { + { path = "${3rd}/luv/library", words = { "vim%.uv" } }, }, - { - "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, - }, - }, - }, - { - "WhoIsSethDaniel/mason-tool-installer.nvim", - opts = { - ensure_installed = { - "actionlint", - "autotools-language-server", - "basedpyright", - "bash-language-server", - "clangd", - "codelldb", - "codespell", - "css-lsp", - "dockerfile-language-server", - "gh", - "gh-actions-language-server", - "groovy-language-server", - "hadolint", - "html-lsp", - "jq", - "json-lsp", - "jsonlint", - "just-lsp", -- "Platform unsupported" - "lua-language-server", - "markdownlint", - "mdformat", - "neocmakelsp", - "nginx-config-formatter", - "nginx-language-server", -- needs python <= 3.12 - "npm-groovy-lint", - "prettier", - "ruff", - "rust-analyzer", - "shellcheck", - "shellharden", - "shfmt", - "stylelint", - "stylua", - "systemd-lsp", - "systemdlint", - "typescript-language-server", - "typos", - "yaml-language-server", - "yamllint", - "yq", - -- "fortls", - }, - }, - }, - }, - config = function() - vim.lsp.enable("just") - vim.lsp.enable("tblgen_lsp_server") +}) - vim.api.nvim_create_autocmd("LspAttach", { - group = vim.api.nvim_create_augroup("lsp-attach", { clear = true }), - callback = function(event) - local bufnr = event.buf +vim.lsp.enable("just") +vim.lsp.enable("tblgen_lsp_server") - local function map(mode, l, r, desc) - vim.keymap.set( - mode, - l, - r, - { buffer = bufnr, desc = "LSP: " .. desc } - ) - end - local function nmap(l, r, desc) - map("n", l, r, desc) - end - nmap("<c-]>", vim.lsp.buf.definition, "Goto definition") - nmap("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration") +require("fidget").setup({}) +require("mason").setup({}) +require("mason-lspconfig").setup({ + ensure_installed = {}, + automatic_installation = false, + handlers = { + function(server_name) + vim.lsp.enable(server_name) + end, + }, +}) +require("mason-tool-installer").setup({ + ensure_installed = { + "actionlint", + "autotools-language-server", + "basedpyright", + "bash-language-server", + "clangd", + "codelldb", + "codespell", + "css-lsp", + "dockerfile-language-server", + "gh", + "gh-actions-language-server", + "groovy-language-server", + "hadolint", + "html-lsp", + "jq", + "json-lsp", + "jsonlint", + "just-lsp", + "lua-language-server", + "markdownlint", + "mdformat", + "neocmakelsp", + "nginx-config-formatter", + "nginx-language-server", + "npm-groovy-lint", + "prettier", + "ruff", + "rust-analyzer", + "shellcheck", + "shellharden", + "shfmt", + "stylelint", + "stylua", + "systemd-lsp", + "systemdlint", + "typescript-language-server", + "typos", + "yaml-language-server", + "yamllint", + "yq", + }, +}) - local fzf = require("fzf-lua") - nmap("gd", fzf.lsp_definitions, "[G]oto [D]efinition") - nmap("gvd", function() - fzf.lsp_definitions({ jump1_action = fzf.actions.file_vsplit }) - end, "[G]oto in a [V]ertical split to [D]efinition") - nmap("gxd", function() - fzf.lsp_definitions({ jump1_action = fzf.actions.file_split }) - end, "[G]oto in a [X]horizontal split to [D]efinition") - nmap("gtd", function() - fzf.lsp_definitions({ jump1_action = fzf.actions.file_tabedit }) - end, "[G]oto in a [T]ab to [D]efinition") - nmap("<leader>D", fzf.lsp_typedefs, "Type [D]efinition") - nmap("<leader>vD", function() - fzf.lsp_typedefs({ jump1_action = fzf.actions.file_vsplit }) - end, "Open in a [V]ertical split Type [D]efinition") - nmap("<leader>xD", function() - fzf.lsp_typedefs({ jump1_action = fzf.actions.file_split }) - end, "Open in a [X]horizontal split Type [D]efinition") - nmap("<leader>tD", function() - fzf.lsp_typedefs({ jump1_action = fzf.actions.file_tabedit }) - end, "Open in a [T]ab Type [D]efinition") - nmap("gri", fzf.lsp_implementations, "[G]oto [I]mplementation") - nmap("grvi", function() - fzf.lsp_implementations({ jump1_action = fzf.actions.file_vsplit }) - end, "[G]oto in a [V]ertical split to [I]mplementation") - nmap("grxi", function() - fzf.lsp_implementations({ jump1_action = fzf.actions.file_split }) - end, "[G]oto in a [X]horizontal split to [I]mplementation") - nmap("grti", function() - fzf.lsp_implementations({ jump1_action = fzf.actions.file_tabedit }) - end, "[G]oto in a [T]ab to [I]mplementation") - nmap("grr", fzf.lsp_references, "[G]oto [R]eferences") - nmap("<leader>ic", fzf.lsp_incoming_calls, "[I]ncoming [C]alls") - nmap("<leader>oc", fzf.lsp_outgoing_calls, "[O]utgoing [C]alls") - nmap("gO", fzf.lsp_document_symbols, "d[O]ocument symbols") - nmap( - "<leader>ws", - fzf.lsp_live_workspace_symbols, - "[W]orkspace [S]ymbols" - ) - nmap( - "<leader>wd", - fzf.diagnostics_workspace, - "[W]orkspace [D]iagnostics" - ) +vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("lsp-attach", { clear = true }), + callback = function(event) + local bufnr = event.buf - local client = vim.lsp.get_client_by_id(event.data.client_id) - if - client - and client:supports_method( - vim.lsp.protocol.Methods.textDocument_documentHighlight, - event.buf - ) - then - local highlight_augroup = - vim.api.nvim_create_augroup("lsp-highlight", { clear = false }) - vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { - buffer = event.buf, - group = highlight_augroup, - callback = vim.lsp.buf.document_highlight, - }) + local function map(mode, l, r, desc) + vim.keymap.set(mode, l, r, { buffer = bufnr, desc = "LSP: " .. desc }) + end + local function nmap(l, r, desc) + map("n", l, r, desc) + end + nmap("<c-]>", vim.lsp.buf.definition, "Goto definition") + nmap("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration") - vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, { - buffer = event.buf, - group = highlight_augroup, - callback = vim.lsp.buf.clear_references, - }) + local fzf = require("fzf-lua") + nmap("gd", fzf.lsp_definitions, "[G]oto [D]efinition") + nmap("gvd", function() + fzf.lsp_definitions({ jump1_action = fzf.actions.file_vsplit }) + end, "[G]oto in a [V]ertical split to [D]efinition") + nmap("gxd", function() + fzf.lsp_definitions({ jump1_action = fzf.actions.file_split }) + end, "[G]oto in a [X]horizontal split to [D]efinition") + nmap("gtd", function() + fzf.lsp_definitions({ jump1_action = fzf.actions.file_tabedit }) + end, "[G]oto in a [T]ab to [D]efinition") + nmap("<leader>D", fzf.lsp_typedefs, "Type [D]efinition") + nmap("<leader>vD", function() + fzf.lsp_typedefs({ jump1_action = fzf.actions.file_vsplit }) + end, "Open in a [V]ertical split Type [D]efinition") + nmap("<leader>xD", function() + fzf.lsp_typedefs({ jump1_action = fzf.actions.file_split }) + end, "Open in a [X]horizontal split Type [D]efinition") + nmap("<leader>tD", function() + fzf.lsp_typedefs({ jump1_action = fzf.actions.file_tabedit }) + end, "Open in a [T]ab Type [D]efinition") + nmap("gri", fzf.lsp_implementations, "[G]oto [I]mplementation") + nmap("grvi", function() + fzf.lsp_implementations({ jump1_action = fzf.actions.file_vsplit }) + end, "[G]oto in a [V]ertical split to [I]mplementation") + nmap("grxi", function() + fzf.lsp_implementations({ jump1_action = fzf.actions.file_split }) + end, "[G]oto in a [X]horizontal split to [I]mplementation") + nmap("grti", function() + fzf.lsp_implementations({ jump1_action = fzf.actions.file_tabedit }) + end, "[G]oto in a [T]ab to [I]mplementation") + nmap("grr", fzf.lsp_references, "[G]oto [R]eferences") + nmap("<leader>ic", fzf.lsp_incoming_calls, "[I]ncoming [C]alls") + nmap("<leader>oc", fzf.lsp_outgoing_calls, "[O]utgoing [C]alls") + nmap("gO", fzf.lsp_document_symbols, "d[O]ocument symbols") + nmap( + "<leader>ws", + fzf.lsp_live_workspace_symbols, + "[W]orkspace [S]ymbols" + ) + nmap( + "<leader>wd", + fzf.diagnostics_workspace, + "[W]orkspace [D]iagnostics" + ) - 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 + local client = vim.lsp.get_client_by_id(event.data.client_id) + if + client + and client:supports_method( + vim.lsp.protocol.Methods.textDocument_documentHighlight, + event.buf + ) + then + local highlight_augroup = + vim.api.nvim_create_augroup("lsp-highlight", { clear = false }) + vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.document_highlight, + }) - if - client - and client:supports_method( - vim.lsp.protocol.Methods.textDocument_codeLens, - event.buf - ) - then - vim.api.nvim_create_autocmd( - { "CursorHold", "CursorHoldI", "InsertLeave" }, - { - buffer = bufnr, - group = vim.api.nvim_create_augroup( - "codelens", - { clear = true } - ), - callback = vim.lsp.codelens.refresh, - } - ) - end + vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.clear_references, + }) - if - client - and client:supports_method( - vim.lsp.protocol.Methods.textDocument_inlayHint, - event.buf - ) - then - nmap("<leader>th", function() - vim.lsp.inlay_hint.enable( - not vim.lsp.inlay_hint.is_enabled({ bufnr = event.buf }) - ) - end, "[T]oggle Inlay [H]ints") - end + 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, + end + + if + client + and client:supports_method( + vim.lsp.protocol.Methods.textDocument_codeLens, + event.buf + ) + then + vim.api.nvim_create_autocmd( + { "CursorHold", "CursorHoldI", "InsertLeave" }, + { + buffer = bufnr, + group = vim.api.nvim_create_augroup( + "codelens", + { clear = true } + ), + callback = vim.lsp.codelens.refresh, + } + ) + end + + if + client + and client:supports_method( + vim.lsp.protocol.Methods.textDocument_inlayHint, + event.buf + ) + then + nmap("<leader>th", function() + vim.lsp.inlay_hint.enable( + not vim.lsp.inlay_hint.is_enabled({ bufnr = event.buf }) + ) + end, "[T]oggle Inlay [H]ints") + end + end, +}) + +require("conform").setup({ + formatters_by_ft = { + awk = { "gawk" }, + bash = { "shfmt" }, + cmake = { "cmake_format" }, + css = { "prettier", "stylelint" }, + groovy = { "npm-groovy-lint" }, + html = { "prettier" }, + javascript = { "prettier" }, + typescript = { "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", "shellcheck", "shellharden" }, + yaml = { "yamllint" }, + zsh = { "shfmt", "shellcheck", "shellharden" }, }, - { - "stevearc/conform.nvim", - event = { "BufWritePre" }, - cmd = { "ConformInfo" }, - keys = { - { - "<leader>f", - function() - require("conform").format({ async = true, lsp_fallback = true }) - end, - mode = "", - desc = "[F]ormat buffer", - }, - }, - config = function() - require("conform").setup({ - formatters_by_ft = { - awk = { "gawk" }, - bash = { "shfmt" }, - cmake = { "cmake_format" }, - css = { "prettier", "stylelint" }, - groovy = { "npm-groovy-lint" }, - html = { "prettier" }, - javascript = { "prettier" }, - typescript = { "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", "shellcheck", "shellharden" }, - yaml = { "yamllint" }, - zsh = { "shfmt", "shellcheck", "shellharden" }, - }, - default_format_opts = { - lsp_format = "fallback", - }, - formatters = { - shfmt = { - prepend_args = { "-i", "2" }, - }, - }, - }) - vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" - end, + default_format_opts = { + lsp_format = "fallback", }, - { - "mrcjkb/rustaceanvim", - ft = "rust", + formatters = { + shfmt = { + prepend_args = { "-i", "2" }, + }, }, - { - "mfussenegger/nvim-lint", - event = { "BufReadPre", "BufNewFile" }, - config = function() - local lint = require("lint") +}) +vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" - 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" }, - } - local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true }) - vim.api.nvim_create_autocmd({ "BufReadPost", "BufWritePost" }, { - group = lint_augroup, - callback = function() - if vim.opt_local.modifiable:get() then - lint.try_lint() - end - end, - }) - end, - }, - { - "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, - }, +vim.keymap.set("", "<leader>f", function() + require("conform").format({ async = true, lsp_fallback = true }) +end, { desc = "[F]ormat buffer" }) - -- 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, - }, - }, +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" }, { + group = vim.api.nvim_create_augroup("lint", { clear = true }), + callback = function() + if vim.opt_local.modifiable:get() then + lint.try_lint() + end + end, +}) + +require("tiny-inline-diagnostic").setup({ + options = { + show_source = { + if_many = true, + }, + set_arrow_to_diag_color = true, + multilines = { + enabled = true, + }, + show_all_diags_on_cursorline = true, + enable_on_select = true, + break_line = { + enabled = true, + }, + severity = { + vim.diagnostic.severity.ERROR, + vim.diagnostic.severity.WARN, + vim.diagnostic.severity.INFO, + vim.diagnostic.severity.HINT, }, }, -} +}) diff --git a/home/.config/nvim/lua/plugins/runner.lua b/home/.config/nvim/lua/plugins/runner.lua index 229d68d..28e4e5f 100644 --- a/home/.config/nvim/lua/plugins/runner.lua +++ b/home/.config/nvim/lua/plugins/runner.lua @@ -1,147 +1,77 @@ -return { - { - "stevearc/overseer.nvim", - keys = { - { - "<leader>to", - function() - require("overseer").toggle() - end, - desc = "[T]oggle [O]verseer", - }, - { - "<leader>ob", - function() - require("overseer").run_task({ - name = "just build", - disallow_prompt = true, - }) - end, - desc = "[O]verseer [B]uild", - }, - { - "<leader>oB", - function() - require("overseer").run_task({ - name = "just build", - }) - end, - desc = "[O]verseer [B]uild", - }, - { - "<leader>ot", - function() - require("overseer").run_task({ - name = "just test", - disallow_prompt = true, - }) - end, - desc = "[O]verseer [J]ust [T]est", - }, - { - "<leader>oT", - function() - require("overseer").run_task({ - name = "just test", - }) - end, - desc = "[O]verseer [J]ust [T]est", - }, - { - "<leader>of", - function() - require("overseer").run_task({ - name = "just test", - disallow_prompt = true, - params = { target = vim.fn.expand("%") }, - }) - end, - desc = "[O]verseer test [F]ile", - }, - { - "<leader>oF", - function() - require("overseer").run_task({ - name = "just test", - params = { target = vim.fn.expand("%") }, - }) - end, - desc = "[O]verseer test [F]ile", - }, - { - "<leader>od", - function() - require("overseer").run_task({ - name = "just debug=true test", - disallow_prompt = true, - params = { target = vim.fn.expand("%") }, - }) - end, - desc = "[O]verseer [d]ebug test file", - }, - { - "<leader>oD", - function() - require("overseer").run_task({ - name = "just debug=true test", - params = { target = vim.fn.expand("%") }, - }) - end, - desc = "[O]verseer [D]ebug test file", - }, - { - "<leader>oa", - function() - require("overseer").run_task({ - name = "just test_autofix", - disallow_prompt = true, - params = { target = vim.fn.expand("%") }, - }) - end, - desc = "[O]verseer [A]utofix", - }, - { - "<leader>or", - function() - require("overseer").run_task() - end, - desc = "[O]verseer [R]un", - }, - { - "<leader>os", - function() - vim.cmd("OverseerShell") - end, - desc = "[O]verseer [S]hell", - }, - { - "<leader>ol", - function() - local tasks = require("overseer").list_tasks({ - sort = function(a, b) - return a.id > b.id - end, - }) - 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", - direction = "vertical", - }) - end) +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", + direction = "vertical", + }) +end) + +vim.keymap.set("n", "<leader>to", function() + overseer.toggle() +end, { desc = "[T]oggle [O]verseer" }) +vim.keymap.set("n", "<leader>ob", function() + overseer.run_task({ name = "just build", disallow_prompt = true }) +end, { desc = "[O]verseer [B]uild" }) +vim.keymap.set("n", "<leader>oB", function() + overseer.run_task({ name = "just build" }) +end, { desc = "[O]verseer [B]uild" }) +vim.keymap.set("n", "<leader>ot", function() + overseer.run_task({ name = "just test", disallow_prompt = true }) +end, { desc = "[O]verseer [J]ust [T]est" }) +vim.keymap.set("n", "<leader>oT", function() + overseer.run_task({ name = "just test" }) +end, { desc = "[O]verseer [J]ust [T]est" }) +vim.keymap.set("n", "<leader>of", function() + overseer.run_task({ + name = "just test", + disallow_prompt = true, + params = { target = vim.fn.expand("%") }, + }) +end, { desc = "[O]verseer test [F]ile" }) +vim.keymap.set("n", "<leader>oF", function() + overseer.run_task({ + name = "just test", + params = { target = vim.fn.expand("%") }, + }) +end, { desc = "[O]verseer test [F]ile" }) +vim.keymap.set("n", "<leader>od", function() + overseer.run_task({ + name = "just debug=true test", + disallow_prompt = true, + params = { target = vim.fn.expand("%") }, + }) +end, { desc = "[O]verseer [d]ebug test file" }) +vim.keymap.set("n", "<leader>oD", function() + overseer.run_task({ + name = "just debug=true test", + params = { target = vim.fn.expand("%") }, + }) +end, { desc = "[O]verseer [D]ebug test file" }) +vim.keymap.set("n", "<leader>oa", function() + overseer.run_task({ + name = "just test_autofix", + disallow_prompt = true, + params = { target = vim.fn.expand("%") }, + }) +end, { desc = "[O]verseer [A]utofix" }) +vim.keymap.set("n", "<leader>or", function() + overseer.run_task() +end, { desc = "[O]verseer [R]un" }) +vim.keymap.set("n", "<leader>os", function() + vim.cmd("OverseerShell") +end, { desc = "[O]verseer [S]hell" }) +vim.keymap.set("n", "<leader>ol", function() + local tasks = overseer.list_tasks({ + sort = function(a, b) + return a.id > b.id end, - }, -} + }) + if vim.tbl_isempty(tasks) then + vim.notify("No tasks found", vim.log.levels.WARN) + else + overseer.run_action(tasks[1], "restart") + end +end, { desc = "[O]verseer run [L]ast" }) diff --git a/home/.config/nvim/lua/plugins/search.lua b/home/.config/nvim/lua/plugins/search.lua index e889c4c..a36cddc 100644 --- a/home/.config/nvim/lua/plugins/search.lua +++ b/home/.config/nvim/lua/plugins/search.lua @@ -1,119 +1,60 @@ -return { - { - "ibhagwan/fzf-lua", - branch = "main", - keys = { - { - "<localleader>b", - function() - require("fzf-lua").buffers() - end, - desc = "fzf-lua [B]uffers", - }, - { - "<localleader>/", - function() - require("fzf-lua").live_grep() - end, - desc = "fzf-lua live grep", - }, - { - "<localleader>f", - function() - require("fzf-lua").files() - end, - desc = "fzf-lua [F]iles", - }, - { - "<leader><leader>", - function() - require("fzf-lua").global() - end, - desc = "fzf-lua global picker", - }, - { - "<localleader>d", - function() - require("fzf-lua").diagnostics() - end, - desc = "fzf-lua [D]iagnostics", - }, - { - "<localleader>r", - function() - require("fzf-lua").resume() - end, - desc = "fzf-lua [R]esume", - }, - { - "<localleader>gc", - function() - require("fzf-lua").git_bcommits() - end, - mode = "n", - desc = "[G]it buffer [C]commits", - }, - { - "<localleader>gc", - function() - require("fzf-lua").git_bcommits_range() - end, - mode = "v", - desc = "[G]it [C]commits for selected range", - }, - { - "<localleader>gC", - function() - require("fzf-lua").git_commits() - end, - desc = "[G]it (all) [C]commits", - }, - { - "<localleader>gb", - function() - require("fzf-lua").git_branches() - end, - desc = "[G]it [B]ranches", - }, - { - "<localleader>gs", - function() - require("fzf-lua").git_status() - end, - desc = "[G]it [S]tatus", - }, - { - "<localleader>gS", - function() - require("fzf-lua").git_stash() - end, - desc = "[G]it [S]tash", - }, +local fzflua = require("fzf-lua") +fzflua.setup({ + keymap = { + builtin = { + true, + ["<M-p>"] = "toggle-preview", }, - config = function() - local fzflua = require("fzf-lua") - fzflua.setup({ - keymap = { - builtin = { - true, - ["<M-p>"] = "toggle-preview", - }, - }, - grep = { - hidden = true, - RIPGREP_CONFIG_PATH = "~/.config/ripgrep/ripgreprc", - }, - lsp = { - includeDeclaration = false, - }, - actions = { - files = { - true, - ["ctrl-x"] = fzflua.actions.file_split, - }, - }, - }) - fzflua.register_ui_select() - end, }, -} + grep = { + hidden = true, + RIPGREP_CONFIG_PATH = "~/.config/ripgrep/ripgreprc", + }, + lsp = { + includeDeclaration = false, + }, + actions = { + files = { + true, + ["ctrl-x"] = fzflua.actions.file_split, + }, + }, +}) +fzflua.register_ui_select() + +vim.keymap.set("n", "<localleader>b", function() + fzflua.buffers() +end, { desc = "fzf-lua [B]uffers" }) +vim.keymap.set("n", "<localleader>/", function() + fzflua.live_grep() +end, { desc = "fzf-lua live grep" }) +vim.keymap.set("n", "<localleader>f", function() + fzflua.files() +end, { desc = "fzf-lua [F]iles" }) +vim.keymap.set("n", "<leader><leader>", function() + fzflua.global() +end, { desc = "fzf-lua global picker" }) +vim.keymap.set("n", "<localleader>d", function() + fzflua.diagnostics() +end, { desc = "fzf-lua [D]iagnostics" }) +vim.keymap.set("n", "<localleader>r", function() + fzflua.resume() +end, { desc = "fzf-lua [R]esume" }) +vim.keymap.set("n", "<localleader>gc", function() + fzflua.git_bcommits() +end, { desc = "[G]it buffer [C]commits" }) +vim.keymap.set("v", "<localleader>gc", function() + fzflua.git_bcommits_range() +end, { desc = "[G]it [C]commits for selected range" }) +vim.keymap.set("n", "<localleader>gC", function() + fzflua.git_commits() +end, { desc = "[G]it (all) [C]commits" }) +vim.keymap.set("n", "<localleader>gb", function() + fzflua.git_branches() +end, { desc = "[G]it [B]ranches" }) +vim.keymap.set("n", "<localleader>gs", function() + fzflua.git_status() +end, { desc = "[G]it [S]tatus" }) +vim.keymap.set("n", "<localleader>gS", function() + fzflua.git_stash() +end, { desc = "[G]it [S]tash" }) diff --git a/home/.config/nvim/lua/plugins/session.lua b/home/.config/nvim/lua/plugins/session.lua index 36759b0..a094727 100644 --- a/home/.config/nvim/lua/plugins/session.lua +++ b/home/.config/nvim/lua/plugins/session.lua @@ -1,84 +1,77 @@ -return { - { - "rmagatti/auto-session", - lazy = false, - opts = function() - local function get_cwd_as_name() - local dir = vim.fn.getcwd(0) - return dir:gsub("[^A-Za-z0-9]", "_") +local function get_cwd_as_name() + local dir = vim.fn.getcwd(0) + return dir:gsub("[^A-Za-z0-9]", "_") +end +local overseer = require("overseer") + +require("auto-session").setup({ + use_git_branch = true, + pre_save_cmds = { + function() + overseer.save_task_bundle( + get_cwd_as_name(), + nil, + { on_conflict = "overwrite" } + ) + end, + }, + pre_restore_cmds = { + function() + for _, task in ipairs(overseer.list_tasks({})) do + task:dispose(true) end - local overseer = require("overseer") - return { - use_git_branch = true, - pre_save_cmds = { - function() - overseer.save_task_bundle( - get_cwd_as_name(), - nil, - { on_conflict = "overwrite" } - ) - end, - }, - 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 + 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, + 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) + 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 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, - }, -} + 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 = { "~/", "/" }, +}) diff --git a/home/.config/nvim/lua/plugins/treesitter.lua b/home/.config/nvim/lua/plugins/treesitter.lua index 99c9688..8355a07 100644 --- a/home/.config/nvim/lua/plugins/treesitter.lua +++ b/home/.config/nvim/lua/plugins/treesitter.lua @@ -1,153 +1,85 @@ -return { - { - "aaronik/treewalker.nvim", - keys = { - { - "<a-k>", - "<cmd>Treewalker Up<cr>", - mode = { "n", "v" }, - silent = true, - desc = "Moves up to the previous neighbor node", - }, - { - "<a-j>", - "<cmd>Treewalker Down<cr>", - mode = { "n", "v" }, - silent = true, - desc = "Moves up to the next neighbor node", - }, - { - "<a-h>", - "<cmd>Treewalker Left<cr>", - mode = { "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>", - mode = { "n", "v" }, - silent = true, - desc = "Moves to the next node down that's indented further than the current node", - }, - { - "<s-a-k>", - "<cmd>Treewalker SwapUp<cr>", - 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 = { - { - "LiadOz/nvim-dap-repl-highlights", - opts = {}, - }, - }, - build = ":TSUpdate", - config = function() - 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", - "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, - }) - local get_option = vim.filetype.get_option +require("treewalker").setup({}) - 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, - }, -} +vim.keymap.set({ "n", "v" }, "<a-k>", "<cmd>Treewalker Up<cr>", { silent = true, desc = "Moves up to the previous neighbor node" }) +vim.keymap.set({ "n", "v" }, "<a-j>", "<cmd>Treewalker Down<cr>", { silent = true, desc = "Moves up to the next neighbor node" }) +vim.keymap.set({ "n", "v" }, "<a-h>", "<cmd>Treewalker Left<cr>", { silent = true, desc = "Moves to the first ancestor node that's on a different line from the current node" }) +vim.keymap.set({ "n", "v" }, "<a-l>", "<cmd>Treewalker Right<cr>", { silent = true, desc = "Moves to the next node down that's indented further than the current node" }) +vim.keymap.set("n", "<s-a-k>", "<cmd>Treewalker SwapUp<cr>", { silent = true, desc = "Swaps the highest node on the line upwards in the document" }) +vim.keymap.set("n", "<s-a-j>", "<cmd>Treewalker SwapDown<cr>", { silent = true, desc = "Swaps the biggest node on the line downward in the document" }) +vim.keymap.set("n", "<s-a-h>", "<cmd>Treewalker SwapLeft<cr>", { silent = true, desc = "Swap the node under the cursor with its previous neighbor" }) +vim.keymap.set("n", "<s-a-l>", "<cmd>Treewalker SwapRight<cr>", { silent = true, desc = "Swap the node under the cursor with its next neighbor" }) + +require("nvim-treesitter").install({ + "awk", + "bash", + "c", + "cmake", + "comment", + "cpp", + "css", + "csv", + "diff", + "dockerfile", + "doxygen", + "editorconfig", + "fortran", + "git_config", + "git_rebase", + "gitattributes", + "gitcommit", + "gitignore", + "groovy", + "gpg", + "hlsplaylist", + "html", + "http", + "ini", + "javascript", + "jq", + "jsdoc", + "json", + "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", +}) + +require("nvim-dap-repl-highlights").setup({}) +require("treesitter-context").setup({}) + +require("ts_context_commentstring").setup({ + enable_autocmd = false, +}) +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 diff --git a/home/.config/nvim/lua/plugins/ui.lua b/home/.config/nvim/lua/plugins/ui.lua index f55ca45..50a2114 100644 --- a/home/.config/nvim/lua/plugins/ui.lua +++ b/home/.config/nvim/lua/plugins/ui.lua @@ -1,78 +1,58 @@ -return { - { - "ellisonleao/gruvbox.nvim", - priority = 1000, - config = function() - require("gruvbox").setup({}) - vim.o.background = "dark" - vim.cmd([[colorscheme gruvbox]]) - end, - }, - { - "saghen/blink.indent", - --- @module 'blink.indent' - --- @type blink.indent.Config - opts = { - scope = { - highlights = { - "BlinkIndentOrange", - "BlinkIndentViolet", - "BlinkIndentBlue", - "BlinkIndentRed", - "BlinkIndentCyan", - "BlinkIndentYellow", - "BlinkIndentGreen", - }, - underline = { - enabled = true, - highlights = { - "BlinkIndentOrangeUnderline", - "BlinkIndentVioletUnderline", - "BlinkIndentBlueUnderline", - "BlinkIndentRedUnderline", - "BlinkIndentCyanUnderline", - "BlinkIndentYellowUnderline", - "BlinkIndentGreenUnderline", - }, - }, +-- blink.indent (gruvbox setup is in init.lua) +require("blink.indent").setup({ + scope = { + highlights = { + "BlinkIndentOrange", + "BlinkIndentViolet", + "BlinkIndentBlue", + "BlinkIndentRed", + "BlinkIndentCyan", + "BlinkIndentYellow", + "BlinkIndentGreen", + }, + underline = { + enabled = true, + highlights = { + "BlinkIndentOrangeUnderline", + "BlinkIndentVioletUnderline", + "BlinkIndentBlueUnderline", + "BlinkIndentRedUnderline", + "BlinkIndentCyanUnderline", + "BlinkIndentYellowUnderline", + "BlinkIndentGreenUnderline", }, }, }, - { - "nvim-lualine/lualine.nvim", - opts = { - options = { - icons_enabled = false, - 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 = { "overseer", "copilot" }, - lualine_z = { "diagnostics" }, - }, - inactive_sections = { - lualine_a = {}, - lualine_b = {}, - lualine_c = { "filename" }, - lualine_x = {}, - lualine_y = {}, - lualine_z = {}, +}) + +require("lualine").setup({ + options = { + icons_enabled = false, + theme = "gruvbox_dark", + component_separators = "", + section_separators = "|", + disabled_filetypes = { + winbar = { + "dap-view", + "dap-repl", + "dap-view-term", }, }, - dependencies = { - "AndreM222/copilot-lualine", - }, }, -} + sections = { + 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_x = {}, + lualine_y = {}, + lualine_z = {}, + }, +}) |
