From 922369a51d107ddd2e2150bcc1062b1b84756277 Mon Sep 17 00:00:00 2001 From: sgoudham Date: Mon, 5 Feb 2024 00:21:54 +0000 Subject: [PATCH] refactor(nvim): revamp entire setup --- home/apps/nvim/after/ftplugin/java.lua | 1 + home/apps/nvim/after/ftplugin/markdown.lua | 2 + home/apps/nvim/lazy-lock.json | 123 ++++++------ home/apps/nvim/lua/config/keymaps.lua | 96 ++++++--- home/apps/nvim/lua/config/lazy.lua | 28 ++- home/apps/nvim/lua/config/options.lua | 3 +- home/apps/nvim/lua/plugins/colourscheme.lua | 35 ++-- home/apps/nvim/lua/plugins/disabled.lua | 54 ++--- home/apps/nvim/lua/plugins/editor.lua | 106 +++------- home/apps/nvim/lua/plugins/git.lua | 22 ++ home/apps/nvim/lua/plugins/java.lua | 210 ++++++++++++++++++++ home/apps/nvim/lua/plugins/lsp.lua | 107 +++++----- home/apps/nvim/lua/plugins/mini.lua | 56 ++++++ home/apps/nvim/stylua.toml | 2 +- 14 files changed, 548 insertions(+), 297 deletions(-) create mode 100644 home/apps/nvim/after/ftplugin/java.lua create mode 100644 home/apps/nvim/after/ftplugin/markdown.lua create mode 100644 home/apps/nvim/lua/plugins/git.lua create mode 100644 home/apps/nvim/lua/plugins/java.lua create mode 100644 home/apps/nvim/lua/plugins/mini.lua diff --git a/home/apps/nvim/after/ftplugin/java.lua b/home/apps/nvim/after/ftplugin/java.lua new file mode 100644 index 0000000..dd709c2 --- /dev/null +++ b/home/apps/nvim/after/ftplugin/java.lua @@ -0,0 +1 @@ +vim.opt.shiftwidth = 4 diff --git a/home/apps/nvim/after/ftplugin/markdown.lua b/home/apps/nvim/after/ftplugin/markdown.lua new file mode 100644 index 0000000..848b2d1 --- /dev/null +++ b/home/apps/nvim/after/ftplugin/markdown.lua @@ -0,0 +1,2 @@ +vim.opt.textwidth = 80 +vim.opt.wrap = true diff --git a/home/apps/nvim/lazy-lock.json b/home/apps/nvim/lazy-lock.json index c675b80..8058939 100644 --- a/home/apps/nvim/lazy-lock.json +++ b/home/apps/nvim/lazy-lock.json @@ -1,69 +1,66 @@ { - "LazyVim": { "branch": "main", "commit": "aa1cccf230a01bd85d5173f7d87f782fd83caa88" }, - "LuaSnip": { "branch": "master", "commit": "99a94cc35ec99bf06263d0346128e908a204575c" }, - "SchemaStore.nvim": { "branch": "main", "commit": "129914a81535b2c7296c05587c07ac8876fbd3e6" }, - "alpha-nvim": { "branch": "main", "commit": "e4fc5e29b731bdf55d204c5c6a11dc3be70f3b65" }, - "catppuccin": { "branch": "main", "commit": "490078b1593c6609e6a50ad5001e7902ea601824" }, + "LazyVim": { "branch": "main", "commit": "c433ea7aa842c446edc2b1570998bf5440c68188" }, + "LuaSnip": { "branch": "master", "commit": "2dbef19461198630b3d7c39f414d09fb07d1fdd2" }, + "SchemaStore.nvim": { "branch": "main", "commit": "be4d1084397c9b9d3d5a41bda871e6b20415bf48" }, + "catppuccin": { "branch": "main", "commit": "c2034f7b549152e5cc757820426341ea5000bc7a" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, - "cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, - "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, - "copilot-cmp": { "branch": "master", "commit": "d631b3afbf26bb17d6cf2b3cd8f3d79e7d5eeca1" }, - "copilot.lua": { "branch": "master", "commit": "50ca36fd766db4d444094de81f5e131b6628f48f" }, - "crates.nvim": { "branch": "main", "commit": "d5caf28aba49e81ac4099426231f3cf3c151013a" }, - "dressing.nvim": { "branch": "master", "commit": "169877dbcae54b23b464b219e053e92854bbb37f" }, - "friendly-snippets": { "branch": "main", "commit": "bc38057e513458cb2486b6cd82d365fa294ee398" }, - "gitsigns.nvim": { "branch": "main", "commit": "bae45ef449d8811061cc940459e70e883a3aa83a" }, - "harpoon": { "branch": "harpoon2", "commit": "95c04787c450357ec738b3d8da4b395c808a7a1e" }, - "indent-blankline.nvim": { "branch": "master", "commit": "4541d690816cb99a7fc248f1486aa87f3abce91c" }, - "lazy.nvim": { "branch": "main", "commit": "3ad55ae678876516156cca2f361c51f7952a924b" }, - "ltex_extra.nvim": { "branch": "master", "commit": "9bed99b2b8488cc2daf66c76d2e0cf051ee80d13" }, - "lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" }, - "markdown-preview.nvim": { "branch": "master", "commit": "02cc3874738bc0f86e4b91f09b8a0ac88aef8e96" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "e86a4c84ff35240639643ffed56ee1c4d55f538e" }, - "mason-nvim-dap.nvim": { "branch": "main", "commit": "e4d56b400e9757b1dc77d620fd3069396e92d5fc" }, - "mason.nvim": { "branch": "main", "commit": "74eac861b013786bf231b204b4ba9a7d380f4bd9" }, - "mini.ai": { "branch": "main", "commit": "5218ea75e635df78a807bc9d5a7162594fb76d02" }, - "mini.comment": { "branch": "main", "commit": "877acea5b2a32ff55f808fc0ebe9aa898648318c" }, - "mini.indentscope": { "branch": "main", "commit": "f60e9b51a6214c73a170ffc5445ce91560981031" }, - "mini.surround": { "branch": "main", "commit": "9d1956b576d7051da3a483b251dfc778121c60db" }, - "neo-tree.nvim": { "branch": "v3.x", "commit": "7951701fd21291ac473ea92d3fd57ec5c8bf10bb" }, - "neoconf.nvim": { "branch": "main", "commit": "08f146d53e075055500dca35e93281faff95716b" }, - "neodev.nvim": { "branch": "main", "commit": "81a893eb94d502b2cbb08ed3871eeaadfd240131" }, - "neogit": { "branch": "master", "commit": "5aa0880ef6fdbe3f6ca958c06ab9f1a927358922" }, - "noice.nvim": { "branch": "main", "commit": "894db25ec726d32047799d4d0a982b701bec453b" }, - "nui.nvim": { "branch": "main", "commit": "9e3916e784660f55f47daa6f26053ad044db5d6a" }, - "null-ls.nvim": { "branch": "main", "commit": "db09b6c691def0038c456551e4e2772186449f35" }, - "nvim-autopairs": { "branch": "master", "commit": "ae5b41ce880a6d850055e262d6dfebd362bb276e" }, - "nvim-cmp": { "branch": "main", "commit": "3b9f28061a67b19cadc13946de981426a6425e4a" }, - "nvim-dap": { "branch": "master", "commit": "1c63f37f95cd4fb54512898168138d9a75d1516a" }, - "nvim-dap-go": { "branch": "main", "commit": "208f0e685b48a98bec2cdd8648559c4274b84ca2" }, - "nvim-dap-python": { "branch": "master", "commit": "37b4cba02e337a95cb62ad1609b3d1dccb2e5d42" }, - "nvim-dap-ui": { "branch": "master", "commit": "85b16ac2309d85c88577cd8ee1733ce52be8227e" }, - "nvim-dap-virtual-text": { "branch": "master", "commit": "57f1dbd0458dd84a286b27768c142e1567f3ce3b" }, - "nvim-lspconfig": { "branch": "master", "commit": "a981d4447b92c54a4d464eb1a76b799bc3f9a771" }, - "nvim-navic": { "branch": "master", "commit": "9c89730da6a05acfeb6a197e212dfadf5aa60ca0" }, - "nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" }, - "nvim-spectre": { "branch": "master", "commit": "5b39919a2947b1266b3aa34d0b0b14c35523bc69" }, - "nvim-treesitter": { "branch": "master", "commit": "15129f6d70a4d7adc380abe57a64af93478f72e5" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "9e519b6146512c8e2e702faf8ac48420f4f5deec" }, - "nvim-ts-context-commentstring": { "branch": "main", "commit": "e9062e2dfb9854e6a927370f2d720de354c88524" }, - "nvim-web-devicons": { "branch": "master", "commit": "ab899311f8ae00a47eae8e0879506cead8eb1561" }, - "persistence.nvim": { "branch": "main", "commit": "4b8051c01f696d8849a5cb8afa9767be8db16e40" }, - "plenary.nvim": { "branch": "master", "commit": "267282a9ce242bbb0c5dc31445b6d353bed978bb" }, + "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, + "conform.nvim": { "branch": "master", "commit": "c0e0e80f0c233cb3a249f719a44324c660163a3f" }, + "copilot-cmp": { "branch": "master", "commit": "72fbaa03695779f8349be3ac54fa8bd77eed3ee3" }, + "copilot.lua": { "branch": "master", "commit": "71382c2efec76647287d46a4fbe0ec8c9809e2ee" }, + "crates.nvim": { "branch": "main", "commit": "2bd990871f0aef159933bd5fe6da421690a832b9" }, + "dashboard-nvim": { "branch": "master", "commit": "c045eb24334324fb39ad5ede0b5d15a74a5d229e" }, + "dressing.nvim": { "branch": "master", "commit": "6f212262061a2120e42da0d1e87326e8a41c0478" }, + "friendly-snippets": { "branch": "main", "commit": "b8fae73a479ae0a1c54f5c98fa687ae8a0addc53" }, + "gitsigns.nvim": { "branch": "main", "commit": "2c2463dbd82eddd7dbab881c3a62cfbfbe3c67ae" }, + "headlines.nvim": { "branch": "master", "commit": "e3d7bfdf40e41a020d966d35f8b48d75b90367d2" }, + "indent-blankline.nvim": { "branch": "master", "commit": "12e92044d313c54c438bd786d11684c88f6f78cd" }, + "lazy.nvim": { "branch": "main", "commit": "28126922c9b54e35a192ac415788f202c3944c9f" }, + "ltex_extra.nvim": { "branch": "master", "commit": "42dd3572cb09b52a137e91e515f2dff5eb631b1e" }, + "lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" }, + "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "2b3d247fce06f53934174f5dfe0362c42d65c00c" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "3614a39aae98ccd34124b072939d6283853b3dd2" }, + "mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" }, + "mini.ai": { "branch": "main", "commit": "3ad9d455a91b8bf3c24d4e50518d9a6b9dddb42c" }, + "mini.comment": { "branch": "main", "commit": "b0b359ada4293cdcea7ab4072dfd5b031aac3f8e" }, + "mini.indentscope": { "branch": "main", "commit": "ca129b71edb672d30b8d7ec3138106db1b1f6a8b" }, + "mini.nvim": { "branch": "main", "commit": "d1413e1cacaacd29e420b9482754e762076e64ac" }, + "mini.pairs": { "branch": "main", "commit": "552062017ff207e1f35f7028bfb3f27c7421d22d" }, + "mini.surround": { "branch": "main", "commit": "5ceb6a12d3761bc719fbdad5432c89333deb1498" }, + "neoconf.nvim": { "branch": "main", "commit": "435d70c1bc5a5bd21ecb98163baa8262480c4019" }, + "neodev.nvim": { "branch": "main", "commit": "2793ba3127c2c93ee486b9072a3ef129eeb950cc" }, + "neogit": { "branch": "master", "commit": "a3f23af6f1b12938745092c4b427c732c79effe7" }, + "noice.nvim": { "branch": "main", "commit": "bf67d70bd7265d075191e7812d8eb42b9791f737" }, + "nui.nvim": { "branch": "main", "commit": "35da9ca1de0fc4dda96c2e214d93d363c145f418" }, + "nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" }, + "nvim-dap": { "branch": "master", "commit": "9adbfdca13afbe646d09a8d7a86d5d031fb9c5a5" }, + "nvim-dap-go": { "branch": "main", "commit": "a5cc8dcad43f0732585d4793deb02a25c4afb766" }, + "nvim-dap-python": { "branch": "master", "commit": "f5b6f3a90aae0284b61fb3565e575267c19a16e6" }, + "nvim-dap-ui": { "branch": "master", "commit": "d845ebd798ad1cf30aa4abd4c4eff795cdcfdd4f" }, + "nvim-dap-virtual-text": { "branch": "master", "commit": "d4542ac257d3c7ee4131350db6179ae6340ce40b" }, + "nvim-jdtls": { "branch": "master", "commit": "4f4de4d80e1df43d58e5e21677fca4c63676664d" }, + "nvim-lint": { "branch": "master", "commit": "76af3422e3c82ea40adf9ade1ccf1dc1eb361789" }, + "nvim-lspconfig": { "branch": "master", "commit": "9a6279953c82d01b58825a46ede032ab246a5983" }, + "nvim-notify": { "branch": "master", "commit": "80b67b265530632505193553d05127ae7fe09ddd" }, + "nvim-spectre": { "branch": "master", "commit": "d1ce28b6dc287a6f673461218f3326f0266d75f7" }, + "nvim-treesitter": { "branch": "master", "commit": "4fbf150a1621d52f17b099506e1a32f107079210" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "8edd5a6d96936bdff23333d3bc177481388839e5" }, + "nvim-ts-autotag": { "branch": "main", "commit": "a65b202cfd08e0e69e531eab737205ff5bc082a4" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "7ab799a9792f7cf3883cf28c6a00ad431f3d382a" }, + "nvim-web-devicons": { "branch": "master", "commit": "aaec87dbdaa776bfa0a13c8694bec9bcb7454719" }, + "plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" }, "presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" }, - "project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" }, - "rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" }, - "telescope.nvim": { "branch": "master", "commit": "2d92125620417fbea82ec30303823e3cd69e90e8" }, - "todo-comments.nvim": { "branch": "main", "commit": "3094ead8edfa9040de2421deddec55d3762f64d1" }, - "toggleterm.nvim": { "branch": "main", "commit": "12cba0a1967b4f3f31903484dec72a6100dcf515" }, - "trouble.nvim": { "branch": "main", "commit": "40aad004f53ae1d1ba91bcc5c29d59f07c5f01d3" }, - "typescript.nvim": { "branch": "main", "commit": "de304087e6e49981fde01af8ccc5b21e8519306f" }, - "venv-selector.nvim": { "branch": "main", "commit": "cc312074371aff5b0d8d481b80c9c4de2a5287d7" }, - "vim-illuminate": { "branch": "master", "commit": "5ed17582a8e97bf0a0c617c3cf762e98f87b9859" }, - "vim-just": { "branch": "main", "commit": "ee884dc7d45251d92f5972c4556c12fc101419c0" }, + "rust-tools.nvim": { "branch": "master", "commit": "676187908a1ce35ffcd727c654ed68d851299d3e" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, + "telescope.nvim": { "branch": "master", "commit": "7b5c5f56a21e82fdcfe5b250278b8dfc4b1cbab4" }, + "todo-comments.nvim": { "branch": "main", "commit": "833d8dd8b07eeda37a09e99460f72a02616935cb" }, + "toggleterm.nvim": { "branch": "main", "commit": "b49df5cdce67a8964d1b027dae94bde212092b51" }, + "tokyonight.nvim": { "branch": "main", "commit": "610179f7f12db3d08540b6cc61434db2eaecbcff" }, + "trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" }, + "venv-selector.nvim": { "branch": "main", "commit": "fcb30164f2c4f8a34a305ead3247954a1fd8634f" }, "vim-startuptime": { "branch": "master", "commit": "454b3de856b7bd298700de33d79774ca9b9e3875" }, - "vimtex": { "branch": "master", "commit": "877de3ba5de5f766e5bfa1c3fb0d2ecfcd18f868" }, - "which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" } + "vimtex": { "branch": "master", "commit": "f36e5856d85ff97aced152020ac92e3e3a10096b" } } \ No newline at end of file diff --git a/home/apps/nvim/lua/config/keymaps.lua b/home/apps/nvim/lua/config/keymaps.lua index 02e6e2d..a6eaddc 100644 --- a/home/apps/nvim/lua/config/keymaps.lua +++ b/home/apps/nvim/lua/config/keymaps.lua @@ -1,25 +1,25 @@ --- Keymaps are automatically loaded on the VeryLazy event --- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua +local function map(modes, lhs, rhs, opts) + -- NOTE: Use ``, ``, `` casing (instead of ``, ``, + -- ``) to match the `lhs` of keymap info. Otherwise it will say that + -- Otherwise it will just say that + -- mapping doesn't exist when in fact it does. + if type(modes) == "string" then + modes = { modes } + end + + for _, mode in ipairs(modes) do + opts = vim.tbl_deep_extend("force", { silent = true }, opts or {}) + vim.keymap.set(mode, lhs, rhs, opts) + end +end local function unmap(mode, key) vim.keymap.del(mode, key, {}) end -local function map(mode, lhs, rhs, opts) - local keys = require("lazy.core.handler").handlers.keys - ---@cast keys LazyKeysHandler - -- do not create the keymap if a lazy keys handler exists - if not keys.active[keys.parse({ lhs, mode = mode }).id] then - opts = opts or {} - opts.silent = opts.silent ~= false - if opts.remap and not vim.g.vscode then - opts.remap = nil - end - vim.keymap.set(mode, lhs, rhs, opts) - end -end +local Util = require("lazyvim.util") --- Unbind "entering normal mode" when in terminal +-- Unbind stuff relating to terminal unmap("t", "") -- Unbind stuff relating to splitting windows unmap("n", "ww") @@ -27,31 +27,61 @@ unmap("n", "w-") unmap("n", "w|") unmap("n", "wd") unmap("n", "bb") -require("which-key").register({ - ["w"] = "which_key_ignore", -}) -- Restore "H" & "L" from neovim unmap("n", "H") unmap("n", "L") -- Unbind moving lines with ALT in INSERT/VISUAL mode -unmap({"i", "v"}, "") -unmap({"i", "v"}, "") --- Move ":Lazy" from "l" to "cm" +unmap({ "i", "v" }, "") +unmap({ "i", "v" }, "") +-- Unbind Telescope stuff +unmap("n", "fn") +-- Idk what this does "Keywordprg" +unmap("n", "K") +-- Remove the default quit +unmap("n", "qq") +-- I can just type :Lazy unmap("n", "l") -map("n", "cl", "Lazy", { desc = "Lazy" }) -map("n", "0", "0^", { desc = "which_key_ignore " }) -map("n", "", "o", { desc = "which_key_ignore " }) -map("n", "", "zz", { desc = "which_key_ignore " }) -map("n", "", "zz", { desc = "which_key_ignore " }) +-- Rebind format from cf to lf +unmap({ "n", "v" }, "cf") +map({ "n", "v" }, "lf", function() + Util.format({ force = true }) +end, { desc = "Format" }) + +-- Copy/paste with system clipboard +map({ "n", "x" }, "gy", '"+y', { desc = "Copy to system clipboard" }) +map("n", "gp", '"+p', { desc = "Paste from system clipboard" }) +-- - Paste in Visual with `P` to not copy selected text (`:h v_P`) +map("x", "gp", '"+P', { desc = "Paste from system clipboard" }) + +-- I use gl for this +unmap("n", "cd") +map("n", "gl", vim.diagnostic.open_float, { desc = "Line Diagnostics" }) + +-- Configure diagnostics with borders +local diagnostic_goto = function(next, severity) + local go = next and vim.diagnostic.goto_next or vim.diagnostic.goto_prev + severity = severity and vim.diagnostic.severity[severity] or nil + return function() + go({ severity = severity, float = { border = "rounded" } }) + end +end +map("n", "]d", diagnostic_goto(true), { desc = "Next Diagnostic" }) +map("n", "[d", diagnostic_goto(false), { desc = "Prev Diagnostic" }) +map("n", "]e", diagnostic_goto(true, "ERROR"), { desc = "Next Error" }) +map("n", "[e", diagnostic_goto(false, "ERROR"), { desc = "Prev Error" }) +map("n", "]w", diagnostic_goto(true, "WARN"), { desc = "Next Warning" }) +map("n", "[w", diagnostic_goto(false, "WARN"), { desc = "Prev Warning" }) -map("n", "w", "w", { desc = "which_key_ignore", nowait = true }) -map("n", "Q", "qa", { desc = "which_key_ignore" }) -map("n", "q", "q", { desc = "which_key_ignore", nowait = true }) +map("n", "0", "0^", { desc = "which_key_ignore" }) +map("n", "", "o", { desc = "which_key_ignore" }) +map("n", "", "o", { desc = "which_key_ignore" }) +map("n", "", "zz", { desc = "which_key_ignore" }) +map("n", "", "zz", { desc = "which_key_ignore" }) --- Clipboard -map("n", "y", [["+y]], { desc = "which_key_ignore" }) -map("n", "p", [["+p]], { desc = "which_key_ignore" }) +map("n", "w", "w", { desc = "Write", nowait = true }) +map("n", "Q", "qa", { desc = "Quit All" }) +map("n", "q", "q", { desc = "Quit", nowait = true }) map("n", "", "h", { desc = "Go to left window", remap = true }) map("n", "", "j", { desc = "Go to lower window", remap = true }) diff --git a/home/apps/nvim/lua/config/lazy.lua b/home/apps/nvim/lua/config/lazy.lua index e194d72..fe65849 100644 --- a/home/apps/nvim/lua/config/lazy.lua +++ b/home/apps/nvim/lua/config/lazy.lua @@ -1,24 +1,34 @@ local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then -- bootstrap lazy.nvim - -- stylua: ignore - vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath }) + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", + lazypath, + }) end vim.opt.rtp:prepend(vim.env.LAZY or lazypath) require("lazy").setup({ spec = { + -- LazyVim plugins { "LazyVim/LazyVim", import = "lazyvim.plugins" }, + -- My Plugins + { import = "plugins" }, + -- LazyVim Extras + { import = "lazyvim.plugins.extras.lang.json" }, + { import = "lazyvim.plugins.extras.lang.yaml" }, { import = "lazyvim.plugins.extras.lang.rust" }, { import = "lazyvim.plugins.extras.lang.go" }, - { import = "lazyvim.plugins.extras.util.project" }, - { import = "lazyvim.plugins.extras.dap.core" }, { import = "lazyvim.plugins.extras.lang.typescript" }, - { import = "lazyvim.plugins.extras.lang.elixir" }, - { import = "lazyvim.plugins.extras.lang.json" }, - { import = "lazyvim.plugins.extras.coding.copilot" }, { import = "lazyvim.plugins.extras.lang.python" }, - { import = "plugins" }, + { import = "lazyvim.plugins.extras.lang.markdown" }, + { import = "lazyvim.plugins.extras.dap.core" }, + -- Can't figure out how to force reordering of the completions so just gonna disable it for now + -- { import = "lazyvim.plugins.extras.coding.copilot" }, }, defaults = { lazy = false, @@ -39,3 +49,5 @@ require("lazy").setup({ }, }, }) + +vim.cmd.colorscheme("catppuccin") diff --git a/home/apps/nvim/lua/config/options.lua b/home/apps/nvim/lua/config/options.lua index a883077..61aeaaf 100644 --- a/home/apps/nvim/lua/config/options.lua +++ b/home/apps/nvim/lua/config/options.lua @@ -7,4 +7,5 @@ vim.opt.laststatus = 3 vim.opt.cmdheight = 0 vim.opt.updatetime = 100 vim.opt.list = false -vim.opt.foldlevel = 3 +vim.opt.foldlevel = 999 +vim.g.autoformat = false diff --git a/home/apps/nvim/lua/plugins/colourscheme.lua b/home/apps/nvim/lua/plugins/colourscheme.lua index d9205e0..befb18c 100644 --- a/home/apps/nvim/lua/plugins/colourscheme.lua +++ b/home/apps/nvim/lua/plugins/colourscheme.lua @@ -2,31 +2,32 @@ return { { "catppuccin/nvim", name = "catppuccin", - no_italic = true, priority = 10000, opts = { flavour = "latte", - -- styles = { - -- comments = { "italic" }, - -- }, - integrations = { - telescope = { - style = "nvchad", - }, - }, custom_highlights = function(c) local u = require("catppuccin.utils.colors") return { - -- ["@parameter"] = { style = {} }, - -- Parameter = { style = {} }, - -- ["@conditional"] = { style = {} }, - -- Conditional = { style = {} }, - -- ["@namespace"] = { style = {} }, - MiniIndentscopeSymbol = { fg = c.pink }, NoiceCmdLinePopupTitle = { fg = c.base, bg = c.blue }, - NoiceCmdlinePopup = { bg = c.mantle }, - NoiceCmdlinePopupBorder = { bg = c.mantle, fg = c.mantle }, + NoiceCmdlinePopup = { bg = c.base }, + NoiceCmdlinePopupBorder = { fg = c.blue }, + + -- Making the background of mini.files lighter + MiniFilesNormal = { bg = c.base }, + -- Make the indentline nicer on the eyes + MiniIndentscopeSymbol = { fg = c.pink }, + + -- Setting the borders and background of the completion/documentation menu + BorderBG = { fg = c.blue }, + PmenuSel = { bg = c.mantle }, + -- Setting the background of the lsp.buf.hover() and other floats + NormalFloat = { bg = c.base }, + -- Setting the background of the lsp diagnostics - stuff like [d, [w + TroubleNormal = { bg = c.base }, + + -- Markdown headlines + Headline1 = { bg = c.transparent }, -- Neogit -- NeogitUnstagedchanges = { bg = c.base }, diff --git a/home/apps/nvim/lua/plugins/disabled.lua b/home/apps/nvim/lua/plugins/disabled.lua index 01b679d..7739941 100644 --- a/home/apps/nvim/lua/plugins/disabled.lua +++ b/home/apps/nvim/lua/plugins/disabled.lua @@ -1,44 +1,14 @@ return { - { - "ggandor/leap.nvim", - enabled = false, - keys = false, - config = function() end, - }, - { - "folke/flash.nvim", - enabled = false, - keys = false, - config = function() end, - }, - { - "folke/tokyonight.nvim", - enabled = false, - keys = false, - config = function() end, - }, - { - "ggandor/flit.nvim", - enabled = false, - keys = false, - config = function() end, - }, - { - "akinsho/bufferline.nvim", - enabled = false, - keys = false, - config = function() end, - }, - { - "echasnovski/mini.bufremove", - enabled = false, - keys = false, - config = function() end, - }, - { - "echasnovski/mini.pairs", - enabled = false, - keys = false, - config = function() end, - }, + { "ggandor/leap.nvim", enabled = false, keys = false, config = function() end }, + { "folke/flash.nvim", enabled = false, keys = false, config = function() end }, + { "ggandor/flit.nvim", enabled = false, keys = false, config = function() end }, + { "akinsho/bufferline.nvim", enabled = false, keys = false, config = function() end }, + { "echasnovski/mini.bufremove", enabled = false, keys = false, config = function() end }, + { "nvim-treesitter/nvim-treesitter-context", enabled = false, keys = false, config = function() end }, + { "nvim-neo-tree/neo-tree.nvim", enabled = false, keys = false, config = function() end }, + { "RRethy/vim-illuminate", enabled = false, keys = false, config = function() end }, + { "folke/persistence.nvim", enabled = false, keys = false, config = function() end }, + { "folke/which-key.nvim", enabled = false, keys = false, config = function() end }, + { "nvimdev/dashboard-nvim", enabled = false, keys = false, config = function() end }, + { "lukas-reineke/headlines.nvim", enabled = false, keys = false, config = function() end }, } diff --git a/home/apps/nvim/lua/plugins/editor.lua b/home/apps/nvim/lua/plugins/editor.lua index 686d14c..d30f0d3 100644 --- a/home/apps/nvim/lua/plugins/editor.lua +++ b/home/apps/nvim/lua/plugins/editor.lua @@ -1,12 +1,33 @@ return { + { -- do not lazyload + -- and don't use default section operators! + "nvim-lualine/lualine.nvim", + lazy = false, + event = function() + return {} + end, + opts = function(_, opts) + opts.options.section_separators = "" + end, + }, { "LazyVim/LazyVim", + init = function() + -- "I" keeps the startup message, which I've grown to like over time + vim.opt.shortmess:append({ W = true, I = false, c = true, C = true }) + end, + }, + { + "stevearc/conform.nvim", opts = { - colorscheme = "catppuccin", + formatters_by_ft = { + markdown = { "mdformat" }, + }, }, }, { "folke/noice.nvim", + lazy = false, opts = function(_, opts) table.insert(opts.routes, { filter = { @@ -27,52 +48,9 @@ return { }, opts = { skip = true }, }) - opts.presets.lsp_doc_border = false - end, - }, - { - "folke/persistence.nvim", - keys = function() - -- stylua: ignore - return { - { "as", function() require("persistence").load() end, desc = "Restore Session", }, - { "al", function() require("persistence").load({ last = true }) end, desc = "Restore Last Session", }, - { "ad", function() require("persistence").stop() end, desc = "Don't Save Current Session", }, - } + opts.presets.lsp_doc_border = true end, }, - { - "nvim-neo-tree/neo-tree.nvim", - opts = { - enable_normal_mode_for_inputs = true, - window = { mappings = { ["o"] = "open" } }, - }, - }, - { - "NeogitOrg/neogit", - dependencies = "nvim-lua/plenary.nvim", - opts = { - disable_commit_confirmation = true, - }, - keys = { - { "gg", "Neogit kind=replace", desc = "Open Neogit" }, - { "gG", "Neogit cwd=%:p:h", desc = "Open Neogit (cwd)" }, - }, - }, - { - "ahmedkhalf/project.nvim", - opts = { - detection_methods = { "pattern" }, - }, - event = "VeryLazy", - config = function(_, opts) - require("project_nvim").setup(opts) - require("telescope").load_extension("projects") - end, - keys = { - { "fp", "Telescope projects", desc = "Projects" }, - }, - }, { "stevearc/dressing.nvim", opts = { @@ -100,42 +78,4 @@ return { shell = "fish", }, }, - { - "jose-elias-alvarez/null-ls.nvim", - opts = function(_, opts) - local nls = require("null-ls") - opts.sources = vim.list_extend(opts.sources, { - nls.builtins.formatting.black, - -- nls.builtins.diagnostics.ruff, - }) - end, - }, - { - "ThePrimeagen/harpoon", - branch = "harpoon2", - dependencies = "nvim-lua/plenary.nvim", - keys = function() - local harpoon = require("harpoon") - harpoon:setup() - -- stylua: ignore - return { - { "bm", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end, desc = "Open Harpoon Menu", }, - { "bb", function() harpoon:list():append() end, desc = "Add To Harpoon", }, - { "1", function() harpoon:list():select(1) end }, - { "2", function() harpoon:list():select(2) end }, - { "3", function() harpoon:list():select(3) end }, - { "4", function() harpoon:list():select(4) end }, - } - end, - }, - { - "windwp/nvim-autopairs", - event = "InsertEnter", - opts = {}, -- this is equivalent to setup({}) function - }, - { - "NoahTheDuke/vim-just", - event = { "BufReadPre", "BufNewFile" }, - ft = { "\\cjustfile", "*.just", ".justfile" }, - }, } diff --git a/home/apps/nvim/lua/plugins/git.lua b/home/apps/nvim/lua/plugins/git.lua new file mode 100644 index 0000000..b96a6e5 --- /dev/null +++ b/home/apps/nvim/lua/plugins/git.lua @@ -0,0 +1,22 @@ +return { + { + "NeogitOrg/neogit", + dependencies = "nvim-lua/plenary.nvim", + opts = { + disable_commit_confirmation = true, + }, + keys = { + { "gg", "Neogit kind=replace", desc = "Open Neogit" }, + { "gG", "Neogit cwd=%:p:h", desc = "Open Neogit (cwd)" }, + }, + }, + { + "lewis6991/gitsigns.nvim", + event = "LazyFile", + keys = { + { "]h", "Gitsigns next_hunkzz", desc = "Next Hunk" }, + { "[h", "Gitsigns prev_hunkzz", desc = "Prev Hunk" }, + { "ghP", "Gitsigns preview_hunkzz", desc = "Preview Hunk" }, + }, + }, +} diff --git a/home/apps/nvim/lua/plugins/java.lua b/home/apps/nvim/lua/plugins/java.lua new file mode 100644 index 0000000..0bf497e --- /dev/null +++ b/home/apps/nvim/lua/plugins/java.lua @@ -0,0 +1,210 @@ +local Util = require("lazyvim.util") + +-- This is the same as in lspconfig.server_configurations.jdtls, but avoids +-- needing to require that when this module loads. +local java_filetypes = { "java" } + +-- Utility function to extend or override a config table, similar to the way +-- that Plugin.opts works. +---@param config table +---@param custom function | table | nil +local function extend_or_override(config, custom, ...) + if type(custom) == "function" then + config = custom(config, ...) or config + elseif custom then + config = vim.tbl_deep_extend("force", config, custom) --[[@as table]] + end + return config +end + +return { + -- Ensure java debugger and test packages are installed. + { + "mfussenegger/nvim-dap", + optional = true, + dependencies = { + { + "williamboman/mason.nvim", + opts = function(_, opts) + opts.ensure_installed = opts.ensure_installed or {} + vim.list_extend(opts.ensure_installed, { "java-test", "java-debug-adapter" }) + end, + }, + }, + }, + + -- Configure nvim-lspconfig to install the server automatically via mason, but + -- defer actually starting it to our configuration of nvim-jtdls below. + { + "neovim/nvim-lspconfig", + opts = { + -- make sure mason installs the server + servers = { + jdtls = {}, + }, + setup = { + jdtls = function() + return true -- avoid duplicate servers + end, + }, + }, + }, + + -- Set up nvim-jdtls to attach to java files. + { + "mfussenegger/nvim-jdtls", + ft = java_filetypes, + opts = function() + return { + -- How to find the root dir for a given filename. The default comes from + -- lspconfig which provides a function specifically for java projects. + root_dir = require("lspconfig.server_configurations.jdtls").default_config.root_dir, + + -- How to find the project name for a given root dir. + project_name = function(root_dir) + return root_dir and vim.fs.basename(root_dir) + end, + + -- Where are the config and workspace dirs for a project? + jdtls_config_dir = function(project_name) + return vim.fn.stdpath("cache") .. "/jdtls/" .. project_name .. "/config" + end, + jdtls_workspace_dir = function(project_name) + return vim.fn.stdpath("cache") .. "/jdtls/" .. project_name .. "/workspace" + end, + + -- How to run jdtls. This can be overridden to a full java command-line + -- if the Python wrapper script doesn't suffice. + cmd = { vim.fn.exepath("jdtls") }, + full_cmd = function(opts) + local fname = vim.api.nvim_buf_get_name(0) + local root_dir = opts.root_dir(fname) + local project_name = opts.project_name(root_dir) + local cmd = vim.deepcopy(opts.cmd) + if project_name then + vim.list_extend(cmd, { + "-configuration", + opts.jdtls_config_dir(project_name), + "-data", + opts.jdtls_workspace_dir(project_name), + }) + end + return cmd + end, + + -- These depend on nvim-dap, but can additionally be disabled by setting false here. + dap = { hotcodereplace = "auto", config_overrides = {} }, + test = true, + } + end, + config = function() + local opts = Util.opts("nvim-jdtls") or {} + + -- Find the extra bundles that should be passed on the jdtls command-line + -- if nvim-dap is enabled with java debug/test. + local mason_registry = require("mason-registry") + local bundles = {} ---@type string[] + if opts.dap and Util.has("nvim-dap") and mason_registry.is_installed("java-debug-adapter") then + local java_dbg_pkg = mason_registry.get_package("java-debug-adapter") + local java_dbg_path = java_dbg_pkg:get_install_path() + local jar_patterns = { + java_dbg_path .. "/extension/server/com.microsoft.java.debug.plugin-*.jar", + } + -- java-test also depends on java-debug-adapter. + if opts.test and mason_registry.is_installed("java-test") then + local java_test_pkg = mason_registry.get_package("java-test") + local java_test_path = java_test_pkg:get_install_path() + vim.list_extend(jar_patterns, { + java_test_path .. "/extension/server/*.jar", + }) + end + for _, jar_pattern in ipairs(jar_patterns) do + for _, bundle in ipairs(vim.split(vim.fn.glob(jar_pattern), "\n")) do + table.insert(bundles, bundle) + end + end + end + + local function attach_jdtls() + local fname = vim.api.nvim_buf_get_name(0) + + -- Configuration can be augmented and overridden by opts.jdtls + local config = extend_or_override({ + cmd = opts.full_cmd(opts), + root_dir = opts.root_dir(fname), + init_options = { + bundles = bundles, + }, + -- enable CMP capabilities + capabilities = require("cmp_nvim_lsp").default_capabilities(), + }, opts.jdtls) + + -- Existing server will be reused if the root_dir matches. + require("jdtls").start_or_attach(config) + -- not need to require("jdtls.setup").add_commands(), start automatically adds commands + end + + -- Attach the jdtls for each java buffer. HOWEVER, this plugin loads + -- depending on filetype, so this autocmd doesn't run for the first file. + -- For that, we call directly below. + vim.api.nvim_create_autocmd("FileType", { + pattern = java_filetypes, + callback = attach_jdtls, + }) + + -- Setup keymap and dap after the lsp is fully attached. + -- https://github.com/mfussenegger/nvim-jdtls#nvim-dap-configuration + -- https://neovim.io/doc/user/lsp.html#LspAttach + vim.api.nvim_create_autocmd("LspAttach", { + callback = function(args) + local client = vim.lsp.get_client_by_id(args.data.client_id) + if client and client.name == "jdtls" then + -- ["cx"] = { name = "+extract" }, + -- ["cxv"] = { require("jdtls").extract_variable_all, "Extract Variable" }, + -- ["cxc"] = { require("jdtls").extract_constant, "Extract Constant" }, + -- ["gs"] = { require("jdtls").super_implementation, "Goto Super" }, + -- ["gS"] = { require("jdtls.tests").goto_subjects, "Goto Subjects" }, + -- ["co"] = { require("jdtls").organize_imports, "Organize Imports" }, + -- ["c"] = { name = "+code" }, + -- ["cx"] = { name = "+extract" }, + -- ["cxm"] = { + -- [[lua require('jdtls').extract_method(true)]], + -- "Extract Method", + -- }, + -- ["cxv"] = { + -- [[lua require('jdtls').extract_variable_all(true)]], + -- "Extract Variable", + -- }, + -- ["cxc"] = { + -- [[lua require('jdtls').extract_constant(true)]], + -- "Extract Constant", + -- }, + + if opts.dap and Util.has("nvim-dap") and mason_registry.is_installed("java-debug-adapter") then + -- custom init for Java debugger + require("jdtls").setup_dap(opts.dap) + require("jdtls.dap").setup_dap_main_class_configs() + + -- Java Test require Java debugger to work + if opts.test and mason_registry.is_installed("java-test") then + -- custom keymaps for Java test runner (not yet compatible with neotest) + -- ["t"] = { name = "+test" }, + -- ["tt"] = { require("jdtls.dap").test_class, "Run All Test" }, + -- ["tr"] = { require("jdtls.dap").test_nearest_method, "Run Nearest Test" }, + -- ["tT"] = { require("jdtls.dap").pick_test, "Run Test" }, + end + end + + -- User can set additional keymaps in opts.on_attach + if opts.on_attach then + opts.on_attach(args) + end + end + end, + }) + + -- Avoid race condition by calling attach the first time, since the autocmd won't fire. + attach_jdtls() + end, + }, +} diff --git a/home/apps/nvim/lua/plugins/lsp.lua b/home/apps/nvim/lua/plugins/lsp.lua index bbe9530..8caa3c0 100644 --- a/home/apps/nvim/lua/plugins/lsp.lua +++ b/home/apps/nvim/lua/plugins/lsp.lua @@ -5,6 +5,7 @@ return { if type(opts.ensure_installed) == "table" then vim.list_extend(opts.ensure_installed, { "nix", + "java", }) end opts.indent = { @@ -15,6 +16,13 @@ return { }, { "neovim/nvim-lspconfig", + dependencies = { + { + "barreiroleo/ltex_extra.nvim", + ft = { "markdown", "tex" }, + dependencies = { "neovim/nvim-lspconfig" }, + }, + }, ---@class PluginLspOpts init = function() local keys = require("lazyvim.plugins.lsp.keymaps").get() @@ -30,17 +38,12 @@ return { local leader_c = "c" local leader_l = "l" swap_prefix(leader_c, leader_l) - require("which-key").register({ - [leader_c] = "pkgs", - [leader_l] = "code", - }) - keys[#keys + 1] = { "gl", vim.diagnostic.open_float, "Line Diagnostics" } + keys[#keys + 1] = { "gy", false } end, opts = { diagnostics = { underline = false, update_in_insert = true }, inlay_hints = { enabled = true }, - autoformat = false, ---@type lspconfig.options servers = { lua_ls = { @@ -51,13 +54,13 @@ return { }, }, setup = { - ltex = function(_, opts) + ltex = function(_, _) vim.api.nvim_create_autocmd("LspAttach", { callback = function(args) local client = vim.lsp.get_client_by_id(args.data.client_id) if client.name == "ltex" then require("ltex_extra").setup({ - load_langs = { "en-GB" }, -- languages for witch dictionaries will be loaded + load_langs = { "en-GB" }, -- languages for which dictionaries will be loaded init_check = true, -- whether to load dictionaries on startup path = vim.fn.stdpath("data") .. "/spell", -- path to store dictionaries. }) @@ -67,6 +70,9 @@ return { end, }, }, + config = function() + require("lspconfig.ui.windows").default_options.border = "rounded" + end, }, { "williamboman/mason.nvim", @@ -86,13 +92,18 @@ return { }) end end, + keys = { + { "cm", false }, + }, }, - { - "hrsh7th/nvim-cmp", - dependencies = { - "hrsh7th/cmp-emoji", + "stevearc/conform.nvim", + keys = { + { "cF", false }, }, + }, + { + "hrsh7th/nvim-cmp", ---@param opts cmp.ConfigSchema opts = function(_, opts) local has_words_before = function() @@ -104,18 +115,30 @@ return { local luasnip = require("luasnip") local cmp = require("cmp") + opts.window = { + completion = cmp.config.window.bordered({ + winhighlight = "Normal:Normal,FloatBorder:BorderBG,CursorLine:PmenuSel,Search:None", + }), + documentation = cmp.config.window.bordered({ + winhighlight = "Normal:Normal,FloatBorder:BorderBG,CursorLine:PmenuSel,Search:None", + }), + } opts.experimental.ghost_text = false - opts.mapping = vim.tbl_extend("force", opts.mapping, { + opts.mapping = { + [""] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), + [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), [""] = cmp.mapping(function(fallback) if cmp.visible() then -- You could replace select_next_item() with confirm({ select = true }) to get VS Code autocompletion behavior - cmp.select_next_item() - -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() - -- this way you will only jump inside the snippet region + cmp.confirm({ select = true }) + -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() + -- this way you will only jump inside the snippet region elseif luasnip.expand_or_jumpable() then luasnip.expand_or_jump() elseif has_words_before() then @@ -133,23 +156,25 @@ return { fallback() end end, { "i", "s" }), - }) + [""] = cmp.mapping({ + i = function(fallback) + if cmp.visible() and cmp.get_active_entry() then + cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false }) + else + fallback() + end + end, + s = cmp.mapping.confirm({ select = true }), + c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }), + }), + } + opts.sources = { + { name = "nvim_lsp", priority = 200 }, + { name = "path", priority = 150 }, + { name = "buffer", priority = 125 }, + } end, }, - { - "echasnovski/mini.surround", - opts = { - mappings = { - add = "gsa", - delete = "gsd", - find = "gsf", - find_left = "gsF", - highlight = "gsh", - replace = "gsr", - update_n_lines = "gsn", - }, - }, - }, { "simrat39/rust-tools.nvim", opts = { @@ -162,20 +187,4 @@ return { vim.g.vimtex_mappings_enabled = 0 end, }, - { - "barreiroleo/ltex_extra.nvim", - dependencies = { "neovim/nvim-lspconfig" }, - -- opts = { - -- load_langs = { "en-GB" }, - -- path = vim.fn.stdpath("data") .. "/dictionary", - -- }, - }, - { - "iamcco/markdown-preview.nvim", - build = "cd app && npm install", - setup = function() - vim.g.mkdp_filetypes = { "markdown" } - end, - ft = { "markdown" }, - }, } diff --git a/home/apps/nvim/lua/plugins/mini.lua b/home/apps/nvim/lua/plugins/mini.lua new file mode 100644 index 0000000..cc653e7 --- /dev/null +++ b/home/apps/nvim/lua/plugins/mini.lua @@ -0,0 +1,56 @@ +return { + "echasnovski/mini.nvim", + lazy = false, + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + config = function() + require("mini.clue").setup({ + triggers = { + -- Leader triggers + { mode = "n", keys = "" }, + { mode = "x", keys = "" }, + -- `g` key + { mode = "n", keys = "g" }, + { mode = "x", keys = "g" }, + }, + window = { + delay = 800, + }, + }) + require("mini.cursorword").setup({ + delay = 0, + }) + require("mini.extra").setup() + require("mini.files").setup() + local hipatterns = require("mini.hipatterns") + hipatterns.setup({ + highlighters = { + -- Highlight standalone 'FIXME', 'HACK', 'TODO', 'NOTE' + fixme = { pattern = "%f[%w]()FIXME()%f[%W]", group = "MiniHipatternsFixme" }, + hack = { pattern = "%f[%w]()HACK()%f[%W]", group = "MiniHipatternsHack" }, + todo = { pattern = "%f[%w]()TODO()%f[%W]", group = "MiniHipatternsTodo" }, + note = { pattern = "%f[%w]()NOTE()%f[%W]", group = "MiniHipatternsNote" }, + -- Highlight hex color strings (`#rrggbb`) using that color + hex_color = hipatterns.gen_highlighter.hex_color(), + }, + }) + require("mini.pick").setup() + end, + keys = { + { + "-", + function() + require("mini.files").open(vim.api.nvim_buf_get_name(0), true) + end, + desc = "File Navigation (file)", + }, + { + "_", + function() + require("mini.files").open(vim.loop.cwd(), true) + end, + desc = "File Navigation (cwd)", + }, + }, +} diff --git a/home/apps/nvim/stylua.toml b/home/apps/nvim/stylua.toml index 5d6c50d..0f90030 100644 --- a/home/apps/nvim/stylua.toml +++ b/home/apps/nvim/stylua.toml @@ -1,3 +1,3 @@ indent_type = "Spaces" indent_width = 2 -column_width = 120 \ No newline at end of file +column_width = 120