From 565fa8a2a6382b2d8710fce57f1dd6ffdeebf68e Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Mon, 14 Aug 2023 18:10:05 -0500 Subject: [PATCH] refactor(nvim)!: improve plugin organization This also is MUCH better at lazy loading the plugins as well --- dots/.config/nvim/lazy-lock.json | 19 +- dots/.config/nvim/lua/core/lsp.lua | 1 + dots/.config/nvim/lua/core/mappings.lua | 11 +- dots/.config/nvim/lua/core/options.lua | 20 +- .../.config/nvim/lua/plugins/configs/_cmp.lua | 208 ----- .../.config/nvim/lua/plugins/configs/_dap.lua | 141 --- .../nvim/lua/plugins/configs/_stabilize.lua | 20 - .../nvim/lua/plugins/configs/alpha.lua | 360 ++++---- .../nvim/lua/plugins/configs/autolist.lua | 93 ++ .../nvim/lua/plugins/configs/autopairs.lua | 7 + .../nvim/lua/plugins/configs/bufdelete.lua | 8 + dots/.config/nvim/lua/plugins/configs/ccc.lua | 98 +- dots/.config/nvim/lua/plugins/configs/cmp.lua | 257 ++++++ .../nvim/lua/plugins/configs/comment.lua | 13 + .../nvim/lua/plugins/configs/dap-ui.lua | 9 - dots/.config/nvim/lua/plugins/configs/dap.lua | 278 ++++++ dots/.config/nvim/lua/plugins/configs/git.lua | 74 ++ .../nvim/lua/plugins/configs/github.lua | 13 + dots/.config/nvim/lua/plugins/configs/hop.lua | 23 + .../nvim/lua/plugins/configs/hydra.lua | 516 ++++++----- .../lua/plugins/configs/indent-blankline.lua | 72 +- .../nvim/lua/plugins/configs/kanagawa.lua | 403 ++++---- .../nvim/lua/plugins/configs/lastplace.lua | 11 + dots/.config/nvim/lua/plugins/configs/lib.lua | 19 + .../nvim/lua/plugins/configs/live-command.lua | 26 + dots/.config/nvim/lua/plugins/configs/log.lua | 6 + dots/.config/nvim/lua/plugins/configs/lsp.lua | 855 ++++++++++------- .../nvim/lua/plugins/configs/lualine.lua | 232 +++++ .../nvim/lua/plugins/configs/markdown.lua | 7 + .../.config/nvim/lua/plugins/configs/mini.lua | 10 + .../nvim/lua/plugins/configs/mkdir.lua | 6 + .../.config/nvim/lua/plugins/configs/move.lua | 12 + .../nvim/lua/plugins/configs/neo-tree.lua | 32 + .../nvim/lua/plugins/configs/neoclip.lua | 13 + .../nvim/lua/plugins/configs/neoformat.lua | 22 +- .../nvim/lua/plugins/configs/neogit.lua | 17 - .../nvim/lua/plugins/configs/neoscroll.lua | 9 + .../nvim/lua/plugins/configs/neotree.lua | 17 - .../nvim/lua/plugins/configs/nftables.lua | 6 + .../nvim/lua/plugins/configs/nibbler.lua | 17 + .../nvim/lua/plugins/configs/noice.lua | 95 +- .../nvim/lua/plugins/configs/null_ls.lua | 11 - .../nvim/lua/plugins/configs/nvim-notify.lua | 35 - .../nvim/lua/plugins/configs/nvim-ufo.lua | 91 +- .../nvim/lua/plugins/configs/overseer.lua | 26 + .../nvim/lua/plugins/configs/python-dap.lua | 3 - .../nvim/lua/plugins/configs/statuscol.lua | 50 + .../nvim/lua/plugins/configs/statusline.lua | 224 ----- .../nvim/lua/plugins/configs/surround.lua | 7 + .../lua/plugins/configs/telescope-nvim.lua | 150 --- .../nvim/lua/plugins/configs/telescope.lua | 214 +++++ .../.config/nvim/lua/plugins/configs/tint.lua | 28 + .../nvim/lua/plugins/configs/toggleterm.lua | 27 + .../nvim/lua/plugins/configs/treesitter.lua | 293 ++++-- .../nvim/lua/plugins/configs/trouble.lua | 53 ++ .../lua/plugins/configs/vim-visual-multi.lua | 9 + .../nvim/lua/plugins/configs/vimtex.lua | 10 + .../nvim/lua/plugins/configs/which-key.lua | 11 + dots/.config/nvim/lua/plugins/init.lua | 51 +- dots/.config/nvim/lua/plugins/mappings.lua | 339 ------- dots/.config/nvim/lua/plugins/plugins.lua | 858 ------------------ dots/.config/nvim/lua/plugins/postload.lua | 4 - 62 files changed, 3245 insertions(+), 3305 deletions(-) delete mode 100755 dots/.config/nvim/lua/plugins/configs/_cmp.lua delete mode 100755 dots/.config/nvim/lua/plugins/configs/_dap.lua delete mode 100755 dots/.config/nvim/lua/plugins/configs/_stabilize.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/autolist.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/autopairs.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/bufdelete.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/cmp.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/comment.lua delete mode 100755 dots/.config/nvim/lua/plugins/configs/dap-ui.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/dap.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/git.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/github.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/hop.lua mode change 100755 => 100644 dots/.config/nvim/lua/plugins/configs/indent-blankline.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/lastplace.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/lib.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/live-command.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/log.lua mode change 100755 => 100644 dots/.config/nvim/lua/plugins/configs/lsp.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/lualine.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/markdown.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/mini.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/mkdir.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/move.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/neo-tree.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/neoclip.lua mode change 100755 => 100644 dots/.config/nvim/lua/plugins/configs/neoformat.lua delete mode 100644 dots/.config/nvim/lua/plugins/configs/neogit.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/neoscroll.lua delete mode 100644 dots/.config/nvim/lua/plugins/configs/neotree.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/nftables.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/nibbler.lua delete mode 100755 dots/.config/nvim/lua/plugins/configs/null_ls.lua delete mode 100755 dots/.config/nvim/lua/plugins/configs/nvim-notify.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/overseer.lua delete mode 100755 dots/.config/nvim/lua/plugins/configs/python-dap.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/statuscol.lua delete mode 100755 dots/.config/nvim/lua/plugins/configs/statusline.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/surround.lua delete mode 100755 dots/.config/nvim/lua/plugins/configs/telescope-nvim.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/telescope.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/tint.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/toggleterm.lua mode change 100755 => 100644 dots/.config/nvim/lua/plugins/configs/treesitter.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/trouble.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/vim-visual-multi.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/vimtex.lua create mode 100644 dots/.config/nvim/lua/plugins/configs/which-key.lua delete mode 100755 dots/.config/nvim/lua/plugins/mappings.lua delete mode 100755 dots/.config/nvim/lua/plugins/plugins.lua mode change 100755 => 100644 dots/.config/nvim/lua/plugins/postload.lua diff --git a/dots/.config/nvim/lazy-lock.json b/dots/.config/nvim/lazy-lock.json index 58c83c4a..f50685d2 100644 --- a/dots/.config/nvim/lazy-lock.json +++ b/dots/.config/nvim/lazy-lock.json @@ -1,8 +1,8 @@ { "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, - "LuaSnip": { "branch": "master", "commit": "99a94cc35ec99bf06263d0346128e908a204575c" }, + "LuaSnip": { "branch": "master", "commit": "409535b8fc54c650eb845b0c35e0cc7f08810284" }, "SmoothCursor.nvim": { "branch": "main", "commit": "b61173fb107455f18099715b88d86002579f2736" }, - "alpha-nvim": { "branch": "main", "commit": "e4fc5e29b731bdf55d204c5c6a11dc3be70f3b65" }, + "alpha-nvim": { "branch": "main", "commit": "8e05626e073a5a60ffeb8139076520c1eda41d59" }, "autolist.nvim": { "branch": "main", "commit": "5f70a5f99e96c8fe3069de042abd2a8ed2deb855" }, "bufdelete.nvim": { "branch": "master", "commit": "07d1f8ba79dec59d42b975a4df1c732b2e4e37b4" }, "ccc.nvim": { "branch": "main", "commit": "4a0ddaf787cc82796e84ab8a7f70d086f250aeb6" }, @@ -25,7 +25,7 @@ "csharpls-extended-lsp.nvim": { "branch": "master", "commit": "865ace7f8f4069b4965e86005392dc78eec0858f" }, "diffview.nvim": { "branch": "main", "commit": "500d8b2013812e05ab87db83a8d22319986519f2" }, "dressing.nvim": { "branch": "master", "commit": "6bde51adabba06f7fd4a469885a85f36d78a5f52" }, - "friendly-snippets": { "branch": "main", "commit": "bc38057e513458cb2486b6cd82d365fa294ee398" }, + "friendly-snippets": { "branch": "main", "commit": "377d45475b49e37460a902d6d569d2093d4037d0" }, "fuzzy.nvim": { "branch": "master", "commit": "67a42ad2fa6d5ff41f0ef3cf69bb247410da5d7a" }, "gh.nvim": { "branch": "main", "commit": "2b5551656c1b896bf4ae06546eaaab00311f9a18" }, "gitsigns.nvim": { "branch": "main", "commit": "bae45ef449d8811061cc940459e70e883a3aa83a" }, @@ -63,7 +63,6 @@ "nvim-dap-python": { "branch": "master", "commit": "37b4cba02e337a95cb62ad1609b3d1dccb2e5d42" }, "nvim-dap-ui": { "branch": "master", "commit": "85b16ac2309d85c88577cd8ee1733ce52be8227e" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "57f1dbd0458dd84a286b27768c142e1567f3ce3b" }, - "nvim-hlslens": { "branch": "main", "commit": "f0281591a59e95400babf61a96e59ba20e5c9533" }, "nvim-hurl": { "branch": "main", "commit": "5b7c61364e1872ab1cbaf0ff1da941f0ec94a04a" }, "nvim-lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" }, "nvim-lightbulb": { "branch": "master", "commit": "8f00b89dd1b1dbde16872bee5fbcee2e58c9b8e9" }, @@ -71,23 +70,19 @@ "nvim-neoclip.lua": { "branch": "main", "commit": "4e406ae0f759262518731538f2585abb9d269bac" }, "nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" }, "nvim-surround": { "branch": "main", "commit": "0d6882635817a2677749a330127d12ac30a4f3c8" }, - "nvim-treesitter": { "branch": "master", "commit": "bc52938ddde0ff6b3d51ff215d2c66f2e39b7099" }, - "nvim-treesitter-context": { "branch": "master", "commit": "3d4ab25056dcaf6dd11ebacf1da8525c8df6550f" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "9e519b6146512c8e2e702faf8ac48420f4f5deec" }, + "nvim-treesitter": { "branch": "master", "commit": "93ee00cd9daf8d2e3fbaa2a18b8b9adcb4471b16" }, + "nvim-treesitter-context": { "branch": "master", "commit": "d8fd71428e02190d8f75ff915b6cca9e3063992c" }, "nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" }, - "nvim-ufo": { "branch": "main", "commit": "5be5b800b4f3512bca128f345e9c98574b5637c0" }, + "nvim-ufo": { "branch": "main", "commit": "aebd36bf5447862671356fcd5d4a8708ce6c9470" }, "nvim-web-devicons": { "branch": "master", "commit": "ab899311f8ae00a47eae8e0879506cead8eb1561" }, "omnisharp-extended-lsp.nvim": { "branch": "main", "commit": "53edfb413a54c9e55dcddc9e9fa4977a897e4425" }, - "overseer.nvim": { "branch": "master", "commit": "cdee07c73d257e7aaa8d2bb4cac238c4c1b103c9" }, + "overseer.nvim": { "branch": "master", "commit": "667dc5f0048d299fc41c13c8c3b5ef2cb2909a4d" }, "playground": { "branch": "master", "commit": "2b81a018a49f8e476341dfcb228b7b808baba68b" }, "plenary.nvim": { "branch": "master", "commit": "267282a9ce242bbb0c5dc31445b6d353bed978bb" }, "promise-async": { "branch": "main", "commit": "e94f35161b8c5d4a4ca3b6ff93dd073eb9214c0e" }, "rainbow-delimiters.nvim": { "branch": "master", "commit": "b5bb251e057d099ee8186d2521f865cd98c51ead" }, - "refactoring.nvim": { "branch": "master", "commit": "5359e74291164fcaeaaecdea9ba753ad54eb53d0" }, - "rest.nvim": { "branch": "main", "commit": "22673c848768ff25517154a5aebfebc0c77d0b4f" }, "rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" }, "schemastore.nvim": { "branch": "main", "commit": "540b70d60f33a486eb62f06a0db2723ad8fbe8d3" }, - "silicon.nvim": { "branch": "main", "commit": "e0b7d78545470ef72ca6c0cef3980b8a779f4385" }, "sqlite.lua": { "branch": "master", "commit": "b7e28c8463254c46a8e61c52d27d6a2040492fc3" }, "statuscol.nvim": { "branch": "main", "commit": "9f1ff2dcf614544c5022e876d83b4894c1944e87" }, "telescope-file-browser.nvim": { "branch": "master", "commit": "ad7b637c72549713b9aaed7c4f9c79c62bcbdff0" }, diff --git a/dots/.config/nvim/lua/core/lsp.lua b/dots/.config/nvim/lua/core/lsp.lua index 2b995c0d..b05f6c8b 100644 --- a/dots/.config/nvim/lua/core/lsp.lua +++ b/dots/.config/nvim/lua/core/lsp.lua @@ -31,6 +31,7 @@ M.setup = function() vim.diagnostic.config({ virtual_text = false, + virtual_lines = true, severity_sort = true, underline = true, update_in_insert = false, diff --git a/dots/.config/nvim/lua/core/mappings.lua b/dots/.config/nvim/lua/core/mappings.lua index 947e8ca5..c200a860 100755 --- a/dots/.config/nvim/lua/core/mappings.lua +++ b/dots/.config/nvim/lua/core/mappings.lua @@ -23,16 +23,13 @@ M.setup = function() -- Set current focused file as cwd vim.keymap.set("n", "cd", ":cd %:p:h", { silent = true, desc = "Change CWD to Current File" }) - -- Toggle showing diagnostics - local diagnostics_active = true vim.keymap.set("n", "lh", function() - diagnostics_active = not diagnostics_active - if diagnostics_active then + if vim.diagnostic.is_disabled() then vim.diagnostic.enable() else vim.diagnostic.disable() end - end, { silent = true, desc = "Toggle Diagnostics" }) + end, { silent = true, desc = "LSP: Toggle Diagnostics" }) -- Toggle showing command bar vim.keymap.set("n", "sc", function() @@ -61,6 +58,10 @@ M.setup = function() -- Tabclose binding vim.keymap.set("n", "t", "tabclose", { silent = true, desc = "Close Tab" }) + + -- Buffer bindings + vim.keymap.set("n", "", ":bprevious", { silent = true, desc = "Go to Previous Buffer" }) + vim.keymap.set("n", "", ":bnext", { silent = true, desc = "Go to Next Buffer" }) end return M diff --git a/dots/.config/nvim/lua/core/options.lua b/dots/.config/nvim/lua/core/options.lua index 788470ac..c8cf8acd 100755 --- a/dots/.config/nvim/lua/core/options.lua +++ b/dots/.config/nvim/lua/core/options.lua @@ -52,6 +52,7 @@ M.setup = function() opt.ruler = true -- Set timeouts + opt.timeout = true opt.ttimeoutlen = 20 opt.timeoutlen = 1000 opt.updatetime = 250 @@ -65,7 +66,10 @@ M.setup = function() opt.foldexpr = "nvim_treesitter#foldexpr()" opt.foldmethod = "expr" opt.fillchars = { eob = " ", fold = " ", foldopen = "", foldsep = " ", foldclose = "" } - opt.foldlevel = 20 + vim.o.foldcolumn = "1" + vim.o.foldlevel = 99 + vim.o.foldlevelstart = 99 + vim.o.foldenable = true vim.wo.foldexpr = "nvim_treesitter#foldexpr()" vim.wo.foldmethod = "expr" @@ -102,13 +106,13 @@ M.setup = function() -- Set fillchars vim.opt.fillchars:append({ - horiz = "━", - horizup = "┻", - horizdown = "┳", - vert = "┃", - vertleft = "┨", - vertright = "┣", - verthoriz = "╋", + horiz = "─", + horizup = "┴", + horizdown = "┬", + vert = "│", + vertleft = "┤", + vertright = "├", + verthoriz = "┼", }) -- Remove end of boundry '~' diff --git a/dots/.config/nvim/lua/plugins/configs/_cmp.lua b/dots/.config/nvim/lua/plugins/configs/_cmp.lua deleted file mode 100755 index 323397e9..00000000 --- a/dots/.config/nvim/lua/plugins/configs/_cmp.lua +++ /dev/null @@ -1,208 +0,0 @@ -local cmp = require("cmp") -local types = require("cmp.types") -local str = require("cmp.utils.str") -local compare = cmp.config.compare -local luasnip = require("luasnip") - --- Load Snippets -require("luasnip.loaders.from_vscode").lazy_load() - -cmp.setup({ - formatting = { - fields = { cmp.ItemField.Kind, cmp.ItemField.Abbr, cmp.ItemField.Menu }, - format = function(entry, vim_item) - local selections = { - fuzzy_buffer = { symbol = "󰱼 ", name = "Buffer", hl_group = "Buffer" }, - calc = { symbol = " ", name = "Calculator", hl_group = "Calculator" }, - neorg = { symbol = "󱍤 ", name = "Neorg", hl_group = "Neorg" }, - emoji = { symbol = "󰞅 ", name = "Emoji", hl_group = "Emoji" }, - zsh = { symbol = " ", name = "Zsh", hl_group = "Zsh" }, - crates = { symbol = " ", name = "Crates", hl_group = "Crates" }, - cmdline_history = { symbol = " ", name = "Cmd History", hl_group = "CmdHistory" }, - rg = { symbol = " ", name = "Ripgrep", hl_group = "Ripgrep" }, - npm = { symbol = " ", name = "Npm,", hl_group = "Npm," }, - conventionalcommits = { symbol = " ", name = "Commit", hl_group = "Commit" }, - spell = { symbol = "󰏪 ", name = "Spell", hl_group = "Spell" }, - git = { symbol = "󰊢 ", name = "Git", hl_group = "Git" }, - } - - local extra_kind_icons = { - TypeParameter = "", - } - - local selection = selections[entry.source.name] - if not selection then - local kind = require("lspkind").cmp_format({ - mode = "symbol_text", - maxwidth = 50, - })(entry, vim_item) - local strings = vim.split(kind.kind, "%s", { trimempty = true }) - if not strings[2] then - strings[2] = strings[1] - strings[1] = extra_kind_icons[strings[1]] or "" - end - kind.kind = " " .. strings[1] .. " " - vim_item.menu = (strings[1] or "") .. " " .. (strings[2] or "") - return kind - else - local word = entry:get_insert_text() - if entry.completion_item.insertTextFormat == types.lsp.InsertTextFormat.Snippet then - word = vim.lsp.util.parse_snippet(word) - end - word = str.oneline(word) - - -- concatenates the string - local max = 50 - if string.len(word) >= max then - local before = string.sub(word, 1, math.floor((max - 3) / 2)) - word = before .. "..." - end - vim_item.kind = " " .. selection.symbol - vim_item.menu = selection.symbol .. selection.name - vim_item.kind_hl_group = "CmpCustomSelection" .. selection.hl_group - vim_item.abbr = word - return vim_item - end - end, - }, - view = { - entries = { - name = "custom", - selection_order = "near_cursor", - }, - }, - window = { - documentation = { - side_padding = 0, - }, - completion = { - winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:Visual,Search:None", - col_offset = -3, - side_padding = 0, - }, - }, - experimental = { ghost_text = "Comment", native_menu = false }, - snippet = { - -- REQUIRED - you must specify a snippet engine - expand = function(args) - require("luasnip").lsp_expand(args.body) -- For `luasnip` users. - end, - }, - mapping = { - [""] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }), - [""] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }), - [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), - [""] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `` mapping. - [""] = cmp.mapping({ - i = cmp.mapping.abort(), - c = cmp.mapping.close(), - }), - [""] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - [""] = cmp.mapping(function(fallback) - if luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) - if luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - else - fallback() - end - end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { "i", "s" }), - }, - sources = cmp.config.sources({ - { name = "nvim_lsp", priority = 11 }, - { name = "luasnip", priority = 10 }, -- For luasnip users. - { name = "fuzzy_buffer", priority = 9, keyword_length = 3, max_item_count = 10 }, - { - name = "rg", - priority = 7, - keyword_length = 3, - max_item_count = 10, - }, - { name = "async_path", priority = 6 }, - { name = "zsh", priority = 5 }, - { name = "git", priority = 4 }, - { name = "emoji", keyword_length = 2 }, - { name = "neorg" }, - { name = "calc" }, - { name = "npm", keyword_length = 2 }, - { name = "spell", keyword_length = 2 }, - }), - sorting = { - comparators = { - compare.score, - compare.offset, - compare.recently_used, - compare.exact, - require("cmp_fuzzy_buffer.compare"), - compare.kind, - compare.sort_text, - compare.length, - compare.order, - }, - }, -}) - --- Git Commit Completions -cmp.setup.filetype("gitcommit", { - sources = cmp.config.sources({ - { name = "conventionalcommits", priority = 3 }, - { name = " git", priority = 2 }, - { name = "emoji", keyword_length = 2, priority = 1 }, - }), -}) - -cmp.setup.filetype("toml", { sources = cmp.config.sources({ { name = "crates" } }) }) - --- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore). -cmp.setup.cmdline("/", { - mapping = cmp.mapping.preset.cmdline(), - sources = cmp.config.sources({ { name = "fuzzy_buffer" } }), -}) - -cmp.setup.cmdline("?", { - mapping = cmp.mapping.preset.cmdline(), - sources = cmp.config.sources({ { name = "fuzzy_buffer" } }), -}) - -cmp.setup.cmdline("@", { - mapping = cmp.mapping.preset.cmdline(), - sources = cmp.config.sources({ - { name = "fuzzy_buffer" }, - { name = "cmdline_history" }, - }), -}) - --- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). -cmp.setup.cmdline(":", { - mapping = cmp.mapping.preset.cmdline(), - sources = cmp.config.sources({ - { - name = "cmdline", - option = { - ignore_cmds = { "!" }, - }, - }, - { name = "cmdline_history" }, - }), -}) diff --git a/dots/.config/nvim/lua/plugins/configs/_dap.lua b/dots/.config/nvim/lua/plugins/configs/_dap.lua deleted file mode 100755 index 151ec093..00000000 --- a/dots/.config/nvim/lua/plugins/configs/_dap.lua +++ /dev/null @@ -1,141 +0,0 @@ -local dap = require("dap") -local async = require("plenary.async") - ---- Gets a path for a given program in the environment ----@param program @The string of a program in the PATH ----@return @The full path to the program if found, or nil if not -local function get_program_path(program) - local program_path = vim.fn.stdpath("data") .. "/mason/packages/" .. program .. "/" .. program - return program_path -end - -local lldb_path = get_program_path("codelldb") --- Adapaters -dap.adapters.lldb = { - type = "server", - port = "${port}", - executable = { - command = lldb_path, - args = { "--port", "${port}" }, - }, - name = "lldb", -} - -dap.adapters.coreclr = { - type = "executable", - command = get_program_path("netcoredbg"), - args = { "--interpreter=vscode" }, -} - -dap.adapters.bashdb = { - type = "executable", - command = vim.fn.stdpath("data") .. "/mason/packages/bash-debug-adapter/bash-debug-adapter", - name = "bashdb", -} - --- configurations -dap.configurations.cpp = { - { - name = "Launch", - type = "lldb", - request = "launch", - program = function() - return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") - end, - cwd = "${workspaceFolder}", - stopOnEntry = false, - args = {}, - - -- if you change `runInTerminal` to true, you might need to change the yama/ptrace_scope setting: - -- - -- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope - -- - -- Otherwise you might get the following error: - -- - -- Error on launch: Failed to attach to the target process - -- - -- But you should be aware of the implications: - -- https://www.kernel.org/doc/html/latest/admin-guide/LSM/Yama.html - runInTerminal = false, - }, -} - -dap.configurations.c = dap.configurations.cpp -dap.configurations.asm = dap.configurations.cpp -dap.configurations.rust = dap.configurations.cpp - -vim.g.dotnet_build_project = function() - local default_path = vim.fn.getcwd() .. "/" - if vim.g["dotnet_last_proj_path"] ~= nil then - default_path = vim.g["dotnet_last_proj_path"] - end - local path = vim.fn.input("Path to your *proj file", default_path, "file") - vim.g["dotnet_last_proj_path"] = path - local cmd = "dotnet build -c Debug " .. path .. " > /dev/null" - print("") - print("Cmd to execute: " .. cmd) - local f = os.execute(cmd) - if f == 0 then - print("\nBuild: ✔️ ") - else - print("\nBuild: ❌ (code: " .. f .. ")") - end -end - -vim.g.dotnet_get_dll_path = function() - local request = function() - return vim.fn.input("Path to dll", vim.fn.getcwd() .. "/bin/Debug/", "file") - end - - if vim.g["dotnet_last_dll_path"] == nil then - vim.g["dotnet_last_dll_path"] = request() - else - if - vim.fn.confirm("Do you want to change the path to dll?\n" .. vim.g["dotnet_last_dll_path"], "&yes\n&no", 2) - == 1 - then - vim.g["dotnet_last_dll_path"] = request() - end - end - - return vim.g["dotnet_last_dll_path"] -end - -local config = { - { - type = "coreclr", - name = "launch - netcoredbg", - request = "launch", - program = function() - if vim.fn.confirm("Should I recompile first?", "&yes\n&no", 2) == 1 then - vim.g.dotnet_build_project() - end - return vim.g.dotnet_get_dll_path() - end, - }, -} - -dap.configurations.cs = config -dap.configurations.fsharp = config - -dap.configurations.sh = { - { - type = "bashdb", - request = "launch", - name = "Launch file", - showDebugOutput = true, - pathBashdb = vim.fn.stdpath("data") .. "/mason/packages/bash-debug-adapter/extension/bashdb_dir/bashdb", - pathBashdbLib = vim.fn.stdpath("data") .. "/mason/packages/bash-debug-adapter/extension/bashdb_dir", - trace = true, - file = "${file}", - program = "${file}", - cwd = "${workspaceFolder}", - pathCat = "cat", - pathBash = "/bin/bash", - pathMkfifo = "mkfifo", - pathPkill = "pkill", - args = {}, - env = {}, - terminalKind = "integrated", - }, -} diff --git a/dots/.config/nvim/lua/plugins/configs/_stabilize.lua b/dots/.config/nvim/lua/plugins/configs/_stabilize.lua deleted file mode 100755 index 73b6616a..00000000 --- a/dots/.config/nvim/lua/plugins/configs/_stabilize.lua +++ /dev/null @@ -1,20 +0,0 @@ -require("stabilize").setup({ - -- stabilize window even when current cursor position will be hidden behind new window - force = true, - -- set context mark to register on force event which can be jumped to with ' - forcemark = nil, - -- do not manage windows matching these file/buftypes - ignore = { - filetype = { "packer", "Dashboard", "Trouble", "TelescopePrompt" }, - buftype = { - "packer", - "Dashboard", - "terminal", - "quickfix", - "loclist", - "LspInstall", - }, - }, - -- comma-separated list of autocmds that wil trigger the plugins window restore function - nested = nil, -}) diff --git a/dots/.config/nvim/lua/plugins/configs/alpha.lua b/dots/.config/nvim/lua/plugins/configs/alpha.lua index fa65856d..ef882d4d 100644 --- a/dots/.config/nvim/lua/plugins/configs/alpha.lua +++ b/dots/.config/nvim/lua/plugins/configs/alpha.lua @@ -1,186 +1,200 @@ -local alpha = require("alpha") +return { + { + "goolord/alpha-nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + opts = function() + -- Set header + local header = { + type = "text", + val = { + " ", + " ", + " ", + " ", + " ", + " -╲ '- ", + " -' :╲ │ '- ", + " -' : ╲ │ '- ", + " -'· : ╲ │ '- ", + " '.-.· : ╲ │ │ ", + " │. .-· : ╲ │ │ ", + " │ . .-· : ╲ │ │ ", + " │. . .-·; ╲ │ │ ", + " │ . . .-│ ╲ │ │ ", + " │. . . .│╲ ╲│ │ ", + " │ . . . │ ╲ ;- │ ", + " │. . . .│ ╲ :·- │ ", + " │ . . . │ ╲ : .- │ ", + " │. . . .│ ╲ :. .- │ ", + " `- . . .│ ╲ : . .- -' ", + " `- . .│ ╲ :. ..-' ", + " `-. │ ╲ :..-' ", + " `│ ╲;-' ", + " ", + " ", + }, + opts = { position = "center", hl = "@boolean" }, + } --- Set header -local header = { - type = "text", - val = { - " ", - " ", - " ", - " ", - " ", - " -╲ '- ", - " -' :╲ │ '- ", - " -' : ╲ │ '- ", - " -'· : ╲ │ '- ", - " '.-.· : ╲ │ │ ", - " │. .-· : ╲ │ │ ", - " │ . .-· : ╲ │ │ ", - " │. . .-·; ╲ │ │ ", - " │ . . .-│ ╲ │ │ ", - " │. . . .│╲ ╲│ │ ", - " │ . . . │ ╲ ;- │ ", - " │. . . .│ ╲ :·- │ ", - " │ . . . │ ╲ : .- │ ", - " │. . . .│ ╲ :. .- │ ", - " `- . . .│ ╲ : . .- -' ", - " `- . .│ ╲ :. ..-' ", - " `-. │ ╲ :..-' ", - " `│ ╲;-' ", - " ", - " ", - }, - opts = { position = "center", hl = "@boolean" }, -} + local vim_version = { + type = "text", + val = function() + local version = vim.version() + return ("─────── v%s.%s.%s+%s ───────"):format( + version.major, + version.minor, + version.patch, + version.build + ) + end, + opts = { position = "center", hl = "@boolean" }, + } -local vim_version = { - type = "text", - val = function() - local version = vim.version() - return ("─────── v%s.%s.%s ───────"):format( - version.major, - version.minor, - version.patch - ) - end, - opts = { position = "center", hl = "@boolean" }, -} + local plugins_loaded = { + type = "text", + val = function() + local lazy_stats = require("lazy").stats() + local plugin_count = lazy_stats.count + local loaded_plugins = lazy_stats.loaded + local plugin_load_time = string.format("%.2f", lazy_stats.startuptime) + return " " + .. loaded_plugins + .. "/" + .. plugin_count + .. " plugins loaded in " + .. plugin_load_time + .. "ms" + end, -local plugins_loaded = { - type = "text", - val = function() - local lazy_stats = require("lazy").stats() - local plugin_count = lazy_stats.count - local loaded_plugins = lazy_stats.loaded - return "" .. loaded_plugins .. "/" .. plugin_count .. " plugins  loaded!" - end, + opts = { hl = "@conditional", position = "center" }, + } - opts = { hl = "@conditional", position = "center" }, -} - -vim.api.nvim_set_hl(0, "AlphaPluginUpdate", { link = "@string" }) -local plugin_info = { - type = "text", - val = function() - if require("lazy.status").has_updates() then - vim.api.nvim_set_hl(0, "AlphaPluginUpdate", { link = "@exception" }) - return "Plugin updates available!" - else vim.api.nvim_set_hl(0, "AlphaPluginUpdate", { link = "@string" }) - return "All plugins up to date" - end - end, + local plugin_info = { + type = "text", + val = function() + if require("lazy.status").has_updates() then + vim.api.nvim_set_hl(0, "AlphaPluginUpdate", { link = "@exception" }) + return "Plugin updates available!" + else + vim.api.nvim_set_hl(0, "AlphaPluginUpdate", { link = "@string" }) + return "All plugins up to date" + end + end, - opts = { - hl = "AlphaPluginUpdate", - position = "center", - }, -} + opts = { + hl = "AlphaPluginUpdate", + position = "center", + }, + } -local datetime = { - type = "text", - val = function() - return vim.fn.strftime("%c") - end, - opts = { hl = "@field", position = "center" }, -} + local datetime = { + type = "text", + val = function() + return vim.fn.strftime("%c") + end, + opts = { hl = "@field", position = "center" }, + } --- Menu -local button = function(sc, txt, keybind) - local sc_ = sc:gsub("%s", ""):gsub("SPC", "") + -- Menu + local button = function(sc, txt, keybind) + local sc_ = sc:gsub("%s", ""):gsub("SPC", "") - local opts = { - position = "center", - text = txt, - shortcut = sc, - cursor = 4, - width = 30, - align_shortcut = "right", - hl_shortcut = "Number", - hl = "Function", - } - if keybind then - opts.keymap = { "n", sc_, keybind, { noremap = true, silent = true } } - end + local opts = { + position = "center", + text = txt, + shortcut = sc, + cursor = 4, + width = 30, + align_shortcut = "right", + hl_shortcut = "Number", + hl = "Function", + } + if keybind then + opts.keymap = { "n", sc_, keybind, { noremap = true, silent = true } } + end - return { - type = "button", - val = txt, - on_press = function() - local key = vim.api.nvim_replace_termcodes(sc_, true, false, true) - vim.api.nvim_feedkeys(key, "normal", false) + return { + type = "button", + val = txt, + on_press = function() + local key = vim.api.nvim_replace_termcodes(sc_, true, false, true) + vim.api.nvim_feedkeys(key, "normal", false) + end, + opts = opts, + } + end + + -- Set menu + local buttons = { + type = "group", + val = { + button("e", " New File", ":ene startinsert "), + button("f", "󰈞 Find File", ":Telescope find_files"), + button("r", " Recent", ":Telescope oldfiles"), + button("s", " Settings", "e ~/.config/nvim/"), + button("u", " Update Plugins", ":Lazy sync"), + button("q", "󰅚 Quit", ":qa"), + }, + opts = { spacing = 0 }, + } + + -- Footer 2, fortune + local fortune = { + type = "text", + val = require("alpha.fortune")(), + opts = { position = "center", hl = "Comment" }, + } + + local padding = function(pad_amount) + return { type = "padding", val = pad_amount } + end + local opts = { + layout = { + padding(8), + header, + vim_version, + padding(2), + datetime, + padding(1), + plugin_info, + padding(1), + plugins_loaded, + padding(2), + buttons, + padding(2), + fortune, + }, + opts = { margin = 5 }, + } + vim.api.nvim_create_autocmd("FileType", { + pattern = "alpha", + desc = "Alpha Main Handler", + callback = function() + vim.opt_local.cursorline = false + + local alpha_timer = vim.loop.new_timer() + ---@diagnostic disable-next-line: need-check-nil + alpha_timer:start( + 50, + 1000, + vim.schedule_wrap(function() + vim.cmd("AlphaRedraw") + end) + ) + + vim.api.nvim_create_autocmd("BufUnload", { + buffer = 0, + desc = "Shut down alpha timer", + callback = function() + ---@diagnostic disable-next-line: need-check-nil + alpha_timer:close() + end, + }) + end, + }) + + return opts end, - opts = opts, - } -end - --- Set menu -local buttons = { - type = "group", - val = { - button("e", " New File", ":ene startinsert "), - button("f", "󰈞 Find File", ":Telescope find_files"), - button("r", " Recent", ":Telescope oldfiles"), - button("s", " Settings", "e ~/.config/nvim/"), - button("u", " Update Plugins", ":Lazy sync"), - button("q", "󰅚 Quit", ":qa"), }, - opts = { spacing = 0 }, } - --- Footer 2, fortune -local fortune = { - type = "text", - val = require("alpha.fortune")(), - opts = { position = "center", hl = "Comment" }, -} - -local padding = function(pad_amount) - return { type = "padding", val = pad_amount } -end -local opts = { - layout = { - padding(4), - header, - vim_version, - padding(4), - datetime, - padding(1), - plugin_info, - padding(1), - plugins_loaded, - padding(4), - buttons, - padding(4), - fortune, - }, - opts = { margin = 5 }, -} --- Send config to alpha -alpha.setup(opts) - -vim.api.nvim_create_autocmd("FileType", { - pattern = "alpha", - desc = "Alpha Main Handler", - callback = function() - vim.opt_local.cursorline = false - - local alpha_timer = vim.loop.new_timer() - alpha_timer:start( - 50, - 1000, - vim.schedule_wrap(function() - pcall(vim.cmd, "AlphaRedraw") - vim.opt_local.statuscolumn = " " - end) - ) - - vim.api.nvim_create_autocmd("BufUnload", { - buffer = 0, - desc = "Shut down alpha timer", - callback = function(input) - alpha_timer:close() - end, - }) - end, -}) diff --git a/dots/.config/nvim/lua/plugins/configs/autolist.lua b/dots/.config/nvim/lua/plugins/configs/autolist.lua new file mode 100644 index 00000000..2fbe79e3 --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/autolist.lua @@ -0,0 +1,93 @@ +return { + { + "gaoDean/autolist.nvim", + event = { "BufReadPre", "BufNewFile" }, + ft = { + "markdown", + "text", + "tex", + "plaintex", + "norg", + }, + config = function() + require("autolist").setup({}) + local autolist_group = vim.api.nvim_create_augroup("Autolist", {}) + vim.api.nvim_create_autocmd("filetype", { + group = autolist_group, + pattern = { + "markdown", + "text", + "tex", + "plaintex", + "norg", + }, + callback = function() + if pcall(require, "autolist") then + vim.keymap.set( + "i", + "", + "AutolistTab", + { silent = true, desc = "Autolist: Tab", buffer = true } + ) + vim.keymap.set( + "i", + "", + "AutolistShiftTab", + { silent = true, desc = "Autolist: Shift Tab", buffer = true } + ) + vim.keymap.set( + "i", + "", + "AutolistNewBullet", + { silent = true, desc = "Autolist: New Bullet", buffer = true } + ) + vim.keymap.set( + "n", + "o", + "oAutolistNewBullet", + { silent = true, desc = "Autolist: New Bullet", buffer = true } + ) + vim.keymap.set( + "n", + "O", + "OAutolistNewBulletBefore", + { silent = true, desc = "Autolist: New Bullet Before", buffer = true } + ) + vim.keymap.set( + "n", + "", + "AutolistToggleCheckbox", + { silent = true, desc = "Autolist: Toggle Checkbox", buffer = true } + ) + + -- functions to recalculate list on edit + vim.keymap.set( + "n", + ">>", + ">>AutolistRecalculate", + { silent = true, desc = "Autolist: Indent", buffer = true } + ) + vim.keymap.set( + "n", + "<<", + "<<AutolistRecalculate", + { silent = true, desc = "Autolist: Dedent", buffer = true } + ) + vim.keymap.set( + "n", + "dd", + "ddAutolistRecalculate", + { silent = true, desc = "Autolist: Delete", buffer = true } + ) + vim.keymap.set( + "v", + "d", + "dAutolistRecalculate", + { silent = true, desc = "Autolist: Delete", buffer = true } + ) + end + end, + }) + end, + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/autopairs.lua b/dots/.config/nvim/lua/plugins/configs/autopairs.lua new file mode 100644 index 00000000..3c35cb09 --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/autopairs.lua @@ -0,0 +1,7 @@ +return { + { + "windwp/nvim-autopairs", + event = "InsertEnter", + config = true, + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/bufdelete.lua b/dots/.config/nvim/lua/plugins/configs/bufdelete.lua new file mode 100644 index 00000000..95cace1a --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/bufdelete.lua @@ -0,0 +1,8 @@ +return { + { + "famiu/bufdelete.nvim", + keys = { + { "", "Bdelete", desc = "Close Buffer" }, + }, + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/ccc.lua b/dots/.config/nvim/lua/plugins/configs/ccc.lua index fa88baab..18656a28 100644 --- a/dots/.config/nvim/lua/plugins/configs/ccc.lua +++ b/dots/.config/nvim/lua/plugins/configs/ccc.lua @@ -1,91 +1,9 @@ -local ColorInput = require("ccc.input") -local convert = require("ccc.utils.convert") - -local RgbHslCmykInput = setmetatable({ - name = "RGB/HSL/CMYK", - max = { 1, 1, 1, 360, 1, 1, 1, 1, 1, 1 }, - min = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - delta = { 1 / 255, 1 / 255, 1 / 255, 1, 0.01, 0.01, 0.005, 0.005, 0.005, 0.005 }, - bar_name = { "R", "G", "B", "H", "S", "L", "C", "M", "Y", "K" }, -}, { __index = ColorInput }) - -function RgbHslCmykInput.format(n, i) - if i <= 3 then - -- RGB - n = n * 255 - elseif i == 5 or i == 6 then - -- S or L of HSL - n = n * 100 - elseif i >= 7 then - -- CMYK - return ("%5.1f%%"):format(math.floor(n * 200) / 2) - end - return ("%6d"):format(n) -end - -function RgbHslCmykInput.from_rgb(RGB) - local HSL = convert.rgb2hsl(RGB) - local CMYK = convert.rgb2cmyk(RGB) - local R, G, B = unpack(RGB) - local H, S, L = unpack(HSL) - local C, M, Y, K = unpack(CMYK) - return { R, G, B, H, S, L, C, M, Y, K } -end - -function RgbHslCmykInput.to_rgb(value) - return { value[1], value[2], value[3] } -end - -function RgbHslCmykInput:_set_rgb(RGB) - self.value[1] = RGB[1] - self.value[2] = RGB[2] - self.value[3] = RGB[3] -end - -function RgbHslCmykInput:_set_hsl(HSL) - self.value[4] = HSL[1] - self.value[5] = HSL[2] - self.value[6] = HSL[3] -end - -function RgbHslCmykInput:_set_cmyk(CMYK) - self.value[7] = CMYK[1] - self.value[8] = CMYK[2] - self.value[9] = CMYK[3] - self.value[10] = CMYK[4] -end - -function RgbHslCmykInput:callback(index, new_value) - self.value[index] = new_value - local v = self.value - if index <= 3 then - local RGB = { v[1], v[2], v[3] } - local HSL = convert.rgb2hsl(RGB) - local CMYK = convert.rgb2cmyk(RGB) - self:_set_hsl(HSL) - self:_set_cmyk(CMYK) - elseif index <= 6 then - local HSL = { v[4], v[5], v[6] } - local RGB = convert.hsl2rgb(HSL) - local CMYK = convert.rgb2cmyk(RGB) - self:_set_rgb(RGB) - self:_set_cmyk(CMYK) - else - local CMYK = { v[7], v[8], v[9], v[10] } - local RGB = convert.cmyk2rgb(CMYK) - local HSL = convert.rgb2hsl(RGB) - self:_set_rgb(RGB) - self:_set_hsl(HSL) - end -end - -local ccc = require("ccc") -ccc.setup({ - inputs = { - RgbHslCmykInput, +return { + { + "uga-rosa/ccc.nvim", + event = { "BufReadPre", "BufNewFile" }, + config = function() + require("plugins.configs.ccc") + end, }, - highlighter = { - auto_enable = true, - lsp = true, - }, -}) +} diff --git a/dots/.config/nvim/lua/plugins/configs/cmp.lua b/dots/.config/nvim/lua/plugins/configs/cmp.lua new file mode 100644 index 00000000..e371c95e --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/cmp.lua @@ -0,0 +1,257 @@ +---@diagnostic disable: missing-fields +return { + { + "hrsh7th/nvim-cmp", + event = { "BufRead", "BufNewFile", "InsertEnter", "ModeChanged", "WinNew" }, + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-cmdline", + "hrsh7th/cmp-emoji", + "hrsh7th/cmp-nvim-lsp-document-symbol", + "hrsh7th/cmp-calc", + "davidsierradz/cmp-conventionalcommits", + "tamago324/cmp-zsh", + "dmitmel/cmp-cmdline-history", + "David-Kunz/cmp-npm", + "lukas-reineke/cmp-rg", + "onsails/lspkind.nvim", + "f3fora/cmp-spell", + "FelipeLema/cmp-async-path", + { + "petertriho/cmp-git", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = { filetypes = { "*" } }, + }, + -- Snippets + { + "L3MON4D3/LuaSnip", + build = "make install_jsregexp", + dependencies = { + "rafamadriz/friendly-snippets", + "saadparwaiz1/cmp_luasnip", + }, + }, + { + "saecki/crates.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + ft = "toml", + config = true, + }, + { + "tzachar/cmp-fuzzy-buffer", + dependencies = { "hrsh7th/nvim-cmp", "tzachar/fuzzy.nvim" }, + }, + }, + config = function() + local cmp = require("cmp") + local types = require("cmp.types") + local str = require("cmp.utils.str") + local compare = cmp.config.compare + local luasnip = require("luasnip") + + -- Load Snippets + require("luasnip.loaders.from_vscode").lazy_load() + + cmp.setup({ + formatting = { + fields = { cmp.ItemField.Kind, cmp.ItemField.Abbr, cmp.ItemField.Menu }, + format = function(entry, vim_item) + local selections = { + fuzzy_buffer = { symbol = "󰱼 ", name = "Buffer", hl_group = "Buffer" }, + calc = { symbol = " ", name = "Calculator", hl_group = "Calculator" }, + neorg = { symbol = "󱍤 ", name = "Neorg", hl_group = "Neorg" }, + emoji = { symbol = "󰞅 ", name = "Emoji", hl_group = "Emoji" }, + zsh = { symbol = " ", name = "Zsh", hl_group = "Zsh" }, + crates = { symbol = " ", name = "Crates", hl_group = "Crates" }, + cmdline_history = { symbol = " ", name = "Cmd History", hl_group = "CmdHistory" }, + rg = { symbol = " ", name = "Ripgrep", hl_group = "Ripgrep" }, + npm = { symbol = " ", name = "Npm,", hl_group = "Npm," }, + conventionalcommits = { symbol = " ", name = "Commit", hl_group = "Commit" }, + spell = { symbol = "󰏪 ", name = "Spell", hl_group = "Spell" }, + git = { symbol = "󰊢 ", name = "Git", hl_group = "Git" }, + } + + local extra_kind_icons = { + TypeParameter = "", + } + + local selection = selections[entry.source.name] + if not selection then + local kind = require("lspkind").cmp_format({ + mode = "symbol_text", + maxwidth = 50, + })(entry, vim_item) + local strings = vim.split(kind.kind, "%s", { trimempty = true }) + if not strings[2] then + strings[2] = strings[1] + strings[1] = extra_kind_icons[strings[1]] or "" + end + kind.kind = " " .. strings[1] .. " " + vim_item.menu = (strings[1] or "") .. " " .. (strings[2] or "") + return kind + else + local word = entry:get_insert_text() + if entry.completion_item.insertTextFormat == types.lsp.InsertTextFormat.Snippet then + word = vim.lsp.util.parse_snippet(word) + end + word = str.oneline(word) + + -- concatenates the string + local max = 50 + if string.len(word) >= max then + local before = string.sub(word, 1, math.floor((max - 3) / 2)) + word = before .. "..." + end + vim_item.kind = " " .. selection.symbol + vim_item.menu = selection.symbol .. selection.name + vim_item.kind_hl_group = "CmpCustomSelection" .. selection.hl_group + vim_item.abbr = word + return vim_item + end + end, + }, + view = { + entries = { + name = "custom", + selection_order = "near_cursor", + }, + }, + window = { + documentation = { + side_padding = 0, + }, + completion = { + winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:Visual,Search:None", + col_offset = -3, + side_padding = 0, + }, + }, + experimental = { ghost_text = "Comment", native_menu = false }, + snippet = { + -- REQUIRED - you must specify a snippet engine + expand = function(args) + require("luasnip").lsp_expand(args.body) -- For `luasnip` users. + end, + }, + mapping = { + [""] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }), + [""] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }), + [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), + [""] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `` mapping. + [""] = cmp.mapping({ + i = cmp.mapping.abort(), + c = cmp.mapping.close(), + }), + [""] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [""] = cmp.mapping(function(fallback) + if luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }, + sources = cmp.config.sources({ + { name = "nvim_lsp", priority = 11 }, + { name = "luasnip", priority = 10 }, -- For luasnip users. + { name = "fuzzy_buffer", priority = 9, keyword_length = 3, max_item_count = 10 }, + { + name = "rg", + priority = 7, + keyword_length = 3, + max_item_count = 10, + }, + { name = "async_path", priority = 6 }, + { name = "zsh", priority = 5 }, + { name = "git", priority = 4 }, + { name = "emoji", keyword_length = 2 }, + { name = "neorg" }, + { name = "calc" }, + { name = "npm", keyword_length = 2 }, + { name = "spell", keyword_length = 2 }, + }), + sorting = { + comparators = { + compare.score, + compare.offset, + compare.recently_used, + compare.exact, + require("cmp_fuzzy_buffer.compare"), + compare.kind, + compare.sort_text, + compare.length, + compare.order, + }, + }, + }) + + -- Git Commit Completions + cmp.setup.filetype("gitcommit", { + sources = cmp.config.sources({ + { name = "conventionalcommits", priority = 3 }, + { name = " git", priority = 2 }, + { name = "emoji", keyword_length = 2, priority = 1 }, + }), + }) + + cmp.setup.filetype("toml", { sources = cmp.config.sources({ { name = "crates" } }) }) + + -- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline("/", { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ { name = "fuzzy_buffer" } }), + }) + + cmp.setup.cmdline("?", { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ { name = "fuzzy_buffer" } }), + }) + + cmp.setup.cmdline("@", { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = "fuzzy_buffer" }, + { name = "cmdline_history" }, + }), + }) + + -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline(":", { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { + name = "cmdline", + option = { + ignore_cmds = { "!" }, + }, + }, + { name = "cmdline_history" }, + { name = "fuzzy_buffer" }, + }), + }) + end, + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/comment.lua b/dots/.config/nvim/lua/plugins/configs/comment.lua new file mode 100644 index 00000000..60980b83 --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/comment.lua @@ -0,0 +1,13 @@ +return { + { + "terrortylor/nvim-comment", + cmd = "CommentToggle", + config = function() + require("nvim_comment").setup({}) + end, + keys = { + { "/", "CommentToggle", desc = "Toggle Comment"}, + { "/", ":'<,'>CommentToggle", desc = "Toggle Selection Comment", mode = { "v" } }, + }, + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/dap-ui.lua b/dots/.config/nvim/lua/plugins/configs/dap-ui.lua deleted file mode 100755 index 9c3d0079..00000000 --- a/dots/.config/nvim/lua/plugins/configs/dap-ui.lua +++ /dev/null @@ -1,9 +0,0 @@ -local fn = vim.fn - -require("dapui").setup({}) - -fn.sign_define("DapBreakpoint", { text = "● ", texthl = "DiagnosticSignError", linehl = "", numhl = "" }) -fn.sign_define("DapBreakpointCondition", { text = "● ", texthl = "DiagnosticSignWarn", linehl = "", numhl = "" }) -fn.sign_define("DapLogPoint", { text = "● ", texthl = "DiagnosticSignInfo", linehl = "", numhl = "" }) -fn.sign_define("DapStopped", { text = "→ ", texthl = "DiagnosticSignWarn", linehl = "", numhl = "" }) -fn.sign_define("DapBreakpointReject", { text = "●", texthl = "DiagnosticSignHint", linehl = "", numhl = "" }) diff --git a/dots/.config/nvim/lua/plugins/configs/dap.lua b/dots/.config/nvim/lua/plugins/configs/dap.lua new file mode 100644 index 00000000..ee4647c7 --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/dap.lua @@ -0,0 +1,278 @@ +return { + { + "rcarriga/nvim-dap-ui", + event = { "BufReadPre", "BufNewFile" }, + keys = { + { + "dt", + function() + require("dapui").toggle() + end, + desc = "DAP: Toggle UI", + }, + }, + dependencies = { + "mfussenegger/nvim-dap", + }, + opts = function() + vim.fn.sign_define( + "DapBreakpoint", + { text = "● ", texthl = "DiagnosticSignError", linehl = "", numhl = "" } + ) + vim.fn.sign_define( + "DapBreakpointCondition", + { text = "● ", texthl = "DiagnosticSignWarn", linehl = "", numhl = "" } + ) + vim.fn.sign_define("DapLogPoint", { text = "● ", texthl = "DiagnosticSignInfo", linehl = "", numhl = "" }) + vim.fn.sign_define("DapStopped", { text = "→ ", texthl = "DiagnosticSignWarn", linehl = "", numhl = "" }) + vim.fn.sign_define( + "DapBreakpointReject", + { text = "●", texthl = "DiagnosticSignHint", linehl = "", numhl = "" } + ) + return {} + end, + }, + { + "theHamsta/nvim-dap-virtual-text", + event = { "BufReadPre", "BufNewFile" }, + config = true, + }, + { + "mfussenegger/nvim-dap", + dependencies = { + { + "mfussenegger/nvim-dap-python", + config = function() + local dap_python = require("dap-python") + dap_python.test_runner = "pytest" + dap_python.setup(vim.fn.stdpath("data") .. "/mason/packages/debugpy/venv/bin/python3") + end, + }, + }, + keys = { + { "d", desc = "> DAP" }, + { + "dc", + "DapContinue", + desc = "DAP: Continue", + }, + { + "de", + "DapTerminate", + desc = "DAP: Terminate", + }, + { + "db", + "DapToggleBreakpoint", + desc = "DAP: Toggle Breakpoint", + }, + { + "dr", + function() + require("dap").set_breakpoint(vim.fn.input("Breakpoint Condition: ")) + end, + desc = "DAP: Set Conditional Breakpoint", + }, + { + "dp", + function() + require("dap").set_breakpoint(nil, nil, vim.fn.input("Log point message: ")) + end, + desc = "DAP: Set Log Breakpoint", + }, + { + "", + "DapStepOver", + desc = "DAP: Step Over", + }, + { + "", + "DapStepInto", + desc = "DAP: Step Into", + }, + { + "", + "DapStepOut", + desc = "DAP: Step Out", + }, + { + "", + function() + require("dap").step_back() + end, + desc = "DAP: Step Back", + }, + { + "dR", + function() + require("dap").run_to_cursor() + end, + desc = "DAP: Run to Cursor", + }, + { + "do", + function() + require("dap").repl.open() + end, + desc = "DAP: Open Repl", + }, + { + "dl", + function() + require("dap").run_last() + end, + desc = "DAP: Run Last", + }, + event = { "BufReadPre", "BufNewFile" }, + config = function() + require("dap.ext.vscode").load_launchjs() + + local dap = require("dap") + + --- Gets a path for a given program in the environment + ---@param program string String of a program in the Mason packages + ---@return Path Full path to the program if found, or nil if not + local function get_program_path(program) + local program_path = vim.fn.stdpath("data") .. "/mason/packages/" .. program .. "/" .. program + return program_path + end + + local lldb_path = get_program_path("codelldb") + -- Adapaters + dap.adapters.lldb = { + type = "server", + port = "${port}", + executable = { + command = lldb_path, + args = { "--port", "${port}" }, + }, + name = "lldb", + } + + dap.adapters.coreclr = { + type = "executable", + command = get_program_path("netcoredbg"), + args = { "--interpreter=vscode" }, + } + + dap.adapters.bashdb = { + type = "executable", + command = vim.fn.stdpath("data") .. "/mason/packages/bash-debug-adapter/bash-debug-adapter", + name = "bashdb", + } + + -- configurations + dap.configurations.cpp = { + { + name = "Launch", + type = "lldb", + request = "launch", + program = function() + return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") + end, + cwd = "${workspaceFolder}", + stopOnEntry = false, + args = {}, + + -- if you change `runInTerminal` to true, you might need to change the yama/ptrace_scope setting: + -- + -- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope + -- + -- Otherwise you might get the following error: + -- + -- Error on launch: Failed to attach to the target process + -- + -- But you should be aware of the implications: + -- https://www.kernel.org/doc/html/latest/admin-guide/LSM/Yama.html + runInTerminal = false, + }, + } + + dap.configurations.c = dap.configurations.cpp + dap.configurations.asm = dap.configurations.cpp + dap.configurations.rust = dap.configurations.cpp + + vim.g.dotnet_build_project = function() + local default_path = vim.fn.getcwd() .. "/" + if vim.g["dotnet_last_proj_path"] ~= nil then + default_path = vim.g["dotnet_last_proj_path"] + end + local path = vim.fn.input("Path to your *proj file", default_path, "file") + vim.g["dotnet_last_proj_path"] = path + local cmd = "dotnet build -c Debug " .. path .. " > /dev/null" + print("") + print("Cmd to execute: " .. cmd) + local f = os.execute(cmd) + if f == 0 then + print("\nBuild: ✔️ ") + else + print("\nBuild: ❌ (code: " .. f .. ")") + end + end + + vim.g.dotnet_get_dll_path = function() + local request = function() + return vim.fn.input("Path to dll", vim.fn.getcwd() .. "/bin/Debug/", "file") + end + + if vim.g["dotnet_last_dll_path"] == nil then + vim.g["dotnet_last_dll_path"] = request() + else + if + vim.fn.confirm( + "Do you want to change the path to dll?\n" .. vim.g["dotnet_last_dll_path"], + "&yes\n&no", + 2 + ) == 1 + then + vim.g["dotnet_last_dll_path"] = request() + end + end + + return vim.g["dotnet_last_dll_path"] + end + + local config = { + { + type = "coreclr", + name = "launch - netcoredbg", + request = "launch", + program = function() + if vim.fn.confirm("Should I recompile first?", "&yes\n&no", 2) == 1 then + vim.g.dotnet_build_project() + end + return vim.g.dotnet_get_dll_path() + end, + }, + } + + dap.configurations.cs = config + dap.configurations.fsharp = config + + dap.configurations.sh = { + { + type = "bashdb", + request = "launch", + name = "Launch file", + showDebugOutput = true, + pathBashdb = vim.fn.stdpath("data") + .. "/mason/packages/bash-debug-adapter/extension/bashdb_dir/bashdb", + pathBashdbLib = vim.fn.stdpath("data") + .. "/mason/packages/bash-debug-adapter/extension/bashdb_dir", + trace = true, + file = "${file}", + program = "${file}", + cwd = "${workspaceFolder}", + pathCat = "cat", + pathBash = "/bin/bash", + pathMkfifo = "mkfifo", + pathPkill = "pkill", + args = {}, + env = {}, + terminalKind = "integrated", + }, + } + end, + }, + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/git.lua b/dots/.config/nvim/lua/plugins/configs/git.lua new file mode 100644 index 00000000..71c07384 --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/git.lua @@ -0,0 +1,74 @@ +return { + { + "NeogitOrg/neogit", + cmd = { "Neogit" }, + dev = true, + keys = { + { "g", desc = "> Git" }, + { "gg", "Neogit", desc = "Neogit: Open" }, + }, + opts = function() + vim.api.nvim_create_autocmd("FileType", { + pattern = "*Neogit*", + callback = function() + vim.opt_local.list = false + end, + }) + + return { + disable_insert_on_commit = "auto", + disable_commit_confirmation = true, + disable_builtin_notifications = true, + integrations = { + diffview = true, + telescope = true, + }, + } + end, + dependencies = { + { + keys = { + { "gd", "DiffviewOpen", desc = "Diff View: Open" }, + {"gh", "DiffviewFileHistory", desc = "Diff View: File History" } + + }, + "sindrets/diffview.nvim", + cmd = { + "DiffviewToggleFiles", + "DiffviewFileHistory", + "DiffviewFocusFiles", + "DiffviewRefresh", + "DiffviewClose", + "DiffviewOpen", + "DiffviewLog" + }, + opts = { + enhanced_diff_hl = true, + }, + }, + "nvim-lua/plenary.nvim", + "nvim-telescope/telescope.nvim", + }, + }, + { + "tpope/vim-fugitive", + -- event = "VeryLazy", + }, + { + "lewis6991/gitsigns.nvim", + event = { "BufReadPre", "BufNewFile" }, + keys = { + { "]g", "Gitsigns next_hunk", desc = "Gitsigns: Next Hunk" }, + { "[g", "Gitsigns prev_hunk", desc = "Gitsigns: Prev Hunk" }, + { "gs", "Gitsigns stage_hunk", desc = "Gitsigns: Stage Hunk" }, + { "gr", "Gitsigns reset_hunk", desc = "Gitsigns: Reset Hunk" }, + { "gu", "Gitsigns undo_stage_hunk", desc = "Gitsigns: Unstage Hunk" }, + }, + opts = { + current_line_blame = true, + current_line_blame_opts = { + delay = 0, + }, + }, + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/github.lua b/dots/.config/nvim/lua/plugins/configs/github.lua new file mode 100644 index 00000000..adf70863 --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/github.lua @@ -0,0 +1,13 @@ +return { + { + "ldelossa/gh.nvim", + cmd = { "GH" }, + dependencies = { "ldelossa/litee.nvim" }, + config = function() + require("litee.lib").setup() + require("litee.gh").setup({ + refresh_interval = 60000, + }) + end, + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/hop.lua b/dots/.config/nvim/lua/plugins/configs/hop.lua new file mode 100644 index 00000000..125d757d --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/hop.lua @@ -0,0 +1,23 @@ +return { + { + "phaazon/hop.nvim", + keys = { + {"f", function() require("hop").hint_char1({ current_line_only = false, }) end, desc = "Hop: Character", mode = { "" } }, + {";l", "HopLineStart", desc = "Hop: Line Start" }, + {";s", "HopPattern", desc = "Hop: Pattern" }, + {";;", "HopWord", desc = "Hop: Word" }, + {";a", "HopAnywhere", desc = "Hop: Anywhere" }, + {";v", "HopVertical", desc = "Hop Vertical" }, + }, + cmd = { + "HopLineStart", + "HopPattern", + "HopWord", + "HopAnywhere", + "HopVertical", + }, + opts = { + keys = "etovxqpdygfblzhckisuran", + }, + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/hydra.lua b/dots/.config/nvim/lua/plugins/configs/hydra.lua index 7be1b521..1f3c0fb5 100644 --- a/dots/.config/nvim/lua/plugins/configs/hydra.lua +++ b/dots/.config/nvim/lua/plugins/configs/hydra.lua @@ -1,37 +1,50 @@ -local hydra = require("hydra") -local wk = require("which-key") -wk.register({ - h = { - name = "Hydra", - o = { "Options" }, - g = { "Git Signs" }, - d = { "Diagram" }, - }, -}, { prefix = "" }) - --- Side Scroll -hydra({ - name = "Side scroll", - config = { - { - position = "bottom-right", - border = "rounded", +return { + { + "anuvyklack/hydra.nvim", + dependencies = { + "anuvyklack/keymap-layer.nvim", + "lewis6991/gitsigns.nvim", + "jbyuki/venn.nvim", + "folke/which-key.nvim", }, - }, - mode = "n", - body = "z", - heads = { - { "h", "5zh" }, - { "l", "5zl", { desc = "←/→" } }, - { "H", "zH" }, - { "L", "zL", { desc = "half screen ←/→" } }, - }, -}) + keys = { + { "h", desc = "> Hydra" }, + }, + config = function() + local hydra = require("hydra") + local wk = require("which-key") + wk.register({ + h = { + name = "Hydra", + o = { "Options" }, + g = { "Git Signs" }, + d = { "Diagram" }, + }, + }, { prefix = "" }) --- Git Integration -local gitsigns = require("gitsigns") + -- Side Scroll + hydra({ + name = "Side scroll", + config = { + { + position = "bottom-right", + border = "rounded", + }, + }, + mode = "n", + body = "z", + heads = { + { "h", "5zh" }, + { "l", "5zl", { desc = "←/→" } }, + { "H", "zH" }, + { "L", "zL", { desc = "half screen ←/→" } }, + }, + }) -local hint = [[ + -- Git Integration + local gitsigns = require("gitsigns") + + local hint = [[ _J_: next hunk _s_: stage hunk _d_: show deleted _b_: blame line _K_: prev hunk _u_: undo stage hunk _p_: preview hunk _B_: blame show full ^ ^ _S_: stage buffer ^ ^ _/_: show base file @@ -39,129 +52,129 @@ local hint = [[ ^ ^ __: Neogit _q_: exit ]] -hydra({ - hint = hint, - config = { - color = "pink", - invoke_on_body = true, - hint = { - position = "bottom-right", - border = "rounded", - }, - on_enter = function() - vim.bo.modifiable = false - gitsigns.toggle_signs(true) - gitsigns.toggle_linehl(true) - end, - on_exit = function() - gitsigns.toggle_signs(false) - gitsigns.toggle_linehl(false) - gitsigns.toggle_deleted(false) - end, - }, - mode = { "n", "x" }, - body = "hg", - heads = { - { - "J", - function() - if vim.wo.diff then - return "]c" - end - vim.schedule(function() - gitsigns.next_hunk() - end) - return "" - end, - { expr = true }, - }, - { - "K", - function() - if vim.wo.diff then - return "[c" - end - vim.schedule(function() - gitsigns.prev_hunk() - end) - return "" - end, - { expr = true }, - }, - { "s", ":Gitsigns stage_hunk", { silent = true } }, - { "u", gitsigns.undo_stage_hunk }, - { "S", gitsigns.stage_buffer }, - { "p", gitsigns.preview_hunk }, - { "d", gitsigns.toggle_deleted, { nowait = true } }, - { "b", gitsigns.blame_line }, - { - "B", - function() - gitsigns.blame_line({ full = true }) - end, - }, - { "/", gitsigns.show, { exit = true } }, -- show the base of the file - { "", "Neogit", { exit = true } }, - { "q", nil, { exit = true, nowait = true } }, - }, -}) + hydra({ + hint = hint, + config = { + color = "pink", + invoke_on_body = true, + hint = { + position = "bottom-right", + border = "rounded", + }, + on_enter = function() + vim.bo.modifiable = false + gitsigns.toggle_signs(true) + gitsigns.toggle_linehl(true) + end, + on_exit = function() + gitsigns.toggle_signs(false) + gitsigns.toggle_linehl(false) + gitsigns.toggle_deleted(false) + end, + }, + mode = { "n", "x" }, + body = "hg", + heads = { + { + "J", + function() + if vim.wo.diff then + return "]c" + end + vim.schedule(function() + gitsigns.next_hunk() + end) + return "" + end, + { expr = true }, + }, + { + "K", + function() + if vim.wo.diff then + return "[c" + end + vim.schedule(function() + gitsigns.prev_hunk() + end) + return "" + end, + { expr = true }, + }, + { "s", ":Gitsigns stage_hunk", { silent = true } }, + { "u", gitsigns.undo_stage_hunk }, + { "S", gitsigns.stage_buffer }, + { "p", gitsigns.preview_hunk }, + { "d", gitsigns.toggle_deleted, { nowait = true } }, + { "b", gitsigns.blame_line }, + { + "B", + function() + gitsigns.blame_line({ full = true }) + end, + }, + { "/", gitsigns.show, { exit = true } }, -- show the base of the file + { "", "Neogit", { exit = true } }, + { "q", nil, { exit = true, nowait = true } }, + }, + }) --- Hydra to repeat expanding windows -hydra({ - name = "Window Sizing", - mode = "n", - body = "", - config = { - { - position = "bottom-right", - border = "rounded", - }, - }, - heads = { - { "<", "2<" }, - { ">", "2>", { desc = "←/→" } }, - { "+", "2+" }, - { "-", "2-", { desc = "↑/↓" } }, - }, -}) + -- Hydra to repeat expanding windows + hydra({ + name = "Window Sizing", + mode = "n", + body = "", + config = { + { + position = "bottom-right", + border = "rounded", + }, + }, + heads = { + { "<", "2<" }, + { ">", "2>", { desc = "←/→" } }, + { "+", "2+" }, + { "-", "2-", { desc = "↑/↓" } }, + }, + }) --- Hydra for diagrams + -- Hydra for diagrams -hydra({ - name = "Draw Diagram", - hint = [[ + hydra({ + name = "Draw Diagram", + hint = [[ Arrow^^^^^^ Select region with ^ ^ _K_ ^ ^ _f_: surround it with box _H_ ^ ^ _L_ ^ ^ _J_ ^ ^ __ ]], - config = { - color = "pink", - invoke_on_body = true, - hint = { - border = "rounded", - }, - on_enter = function() - vim.o.virtualedit = "all" - vim.o.cursorline = true - vim.o.cursorcolumn = true - end, - }, - mode = "n", - body = "hd", - heads = { - { "H", "h:VBox" }, - { "J", "j:VBox" }, - { "K", "k:VBox" }, - { "L", "l:VBox" }, - { "f", ":VBox", { mode = "v" } }, - { "", nil, { exit = true } }, - }, -}) + config = { + color = "pink", + invoke_on_body = true, + hint = { + border = "rounded", + }, + on_enter = function() + vim.o.virtualedit = "all" + vim.o.cursorline = true + vim.o.cursorcolumn = true + end, + }, + mode = "n", + body = "hd", + heads = { + { "H", "h:VBox" }, + { "J", "j:VBox" }, + { "K", "k:VBox" }, + { "L", "l:VBox" }, + { "f", ":VBox", { mode = "v" } }, + { "", nil, { exit = true } }, + }, + }) -hydra({ - name = "Options", - hint = [[ + hydra({ + name = "Options", + hint = [[ ^ ^ Options ^ _v_ %{ve} virtual edit @@ -174,109 +187,112 @@ hydra({ ^ ^^^^ __ ]], - config = { - color = "amaranth", - invoke_on_body = true, - hint = { - border = "rounded", - position = "middle", - }, + config = { + color = "amaranth", + invoke_on_body = true, + hint = { + border = "rounded", + position = "middle", + }, + }, + mode = { "n", "x" }, + body = "ho", + heads = { + { + "n", + function() + if vim.o.number == true then + vim.o.number = false + else + vim.o.number = true + end + end, + { desc = "number" }, + }, + { + "r", + function() + if vim.o.relativenumber == true then + vim.o.relativenumber = false + else + vim.o.number = true + vim.o.relativenumber = true + end + end, + { desc = "relativenumber" }, + }, + { + "v", + function() + if vim.o.virtualedit == "all" then + vim.o.virtualedit = "block" + else + vim.o.virtualedit = "all" + end + end, + { desc = "virtualedit" }, + }, + { + "i", + function() + if vim.o.list == true then + vim.o.list = false + else + vim.o.list = true + end + end, + { desc = "show invisible" }, + }, + { + "s", + function() + if vim.o.spell == true then + vim.o.spell = false + else + vim.o.spell = true + end + end, + { desc = "spell" }, + }, + { + "w", + function() + if vim.o.wrap ~= true then + vim.o.wrap = true + -- Dealing with word wrap: + -- If cursor is inside very long line in the file than wraps + -- around several rows on the screen, then 'j' key moves you to + -- the next line in the file, but not to the next row on the + -- screen under your previous position as in other editors. These + -- bindings fixes this. + vim.keymap.set("n", "k", function() + return vim.v.count > 0 and "k" or "gk" + end, { expr = true, desc = "k or gk" }) + vim.keymap.set("n", "j", function() + return vim.v.count > 0 and "j" or "gj" + end, { expr = true, desc = "j or gj" }) + else + vim.o.wrap = false + vim.keymap.del("n", "k") + vim.keymap.del("n", "j") + end + end, + { desc = "wrap" }, + }, + { + "c", + function() + if vim.o.cursorline == true then + vim.o.cursorline = false + else + vim.o.cursorline = true + end + end, + { desc = "cursor line" }, + }, + { "", nil, { exit = true } }, + }, + }) + end, }, - mode = { "n", "x" }, - body = "ho", - heads = { - { - "n", - function() - if vim.o.number == true then - vim.o.number = false - else - vim.o.number = true - end - end, - { desc = "number" }, - }, - { - "r", - function() - if vim.o.relativenumber == true then - vim.o.relativenumber = false - else - vim.o.number = true - vim.o.relativenumber = true - end - end, - { desc = "relativenumber" }, - }, - { - "v", - function() - if vim.o.virtualedit == "all" then - vim.o.virtualedit = "block" - else - vim.o.virtualedit = "all" - end - end, - { desc = "virtualedit" }, - }, - { - "i", - function() - if vim.o.list == true then - vim.o.list = false - else - vim.o.list = true - end - end, - { desc = "show invisible" }, - }, - { - "s", - function() - if vim.o.spell == true then - vim.o.spell = false - else - vim.o.spell = true - end - end, - { desc = "spell" }, - }, - { - "w", - function() - if vim.o.wrap ~= true then - vim.o.wrap = true - -- Dealing with word wrap: - -- If cursor is inside very long line in the file than wraps - -- around several rows on the screen, then 'j' key moves you to - -- the next line in the file, but not to the next row on the - -- screen under your previous position as in other editors. These - -- bindings fixes this. - vim.keymap.set("n", "k", function() - return vim.v.count > 0 and "k" or "gk" - end, { expr = true, desc = "k or gk" }) - vim.keymap.set("n", "j", function() - return vim.v.count > 0 and "j" or "gj" - end, { expr = true, desc = "j or gj" }) - else - vim.o.wrap = false - vim.keymap.del("n", "k") - vim.keymap.del("n", "j") - end - end, - { desc = "wrap" }, - }, - { - "c", - function() - if vim.o.cursorline == true then - vim.o.cursorline = false - else - vim.o.cursorline = true - end - end, - { desc = "cursor line" }, - }, - { "", nil, { exit = true } }, - }, -}) +} diff --git a/dots/.config/nvim/lua/plugins/configs/indent-blankline.lua b/dots/.config/nvim/lua/plugins/configs/indent-blankline.lua old mode 100755 new mode 100644 index 871eed52..878bbe17 --- a/dots/.config/nvim/lua/plugins/configs/indent-blankline.lua +++ b/dots/.config/nvim/lua/plugins/configs/indent-blankline.lua @@ -1,34 +1,44 @@ -local g = vim.g +return { + { + "lukas-reineke/indent-blankline.nvim", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + "nvim-treesitter/nvim-treesitter" + }, + opts = function() + local g = vim.g -g.indent_blankline_char = "▏" -g.indent_blankline_context_char = "▏" + g.indent_blankline_char = "▏" + g.indent_blankline_context_char = "▏" --- Disable indent-blankline on these pages. -g.indent_blankline_filetype_exclude = { - "help", - "terminal", - "alpha", - "packer", - "lsp-installer", - "lspinfo", - "mason.nvim", - "mason", - "man", - "OverseerForm", - "noice", - "lazy", - "NeogitStatus", - "NeogitHelpPopup", - "NeogitPopup", - "NeogitLogView", + -- Disable indent-blankline on these pages. + g.indent_blankline_filetype_exclude = { + "help", + "terminal", + "alpha", + "packer", + "lsp-installer", + "lspinfo", + "mason.nvim", + "mason", + "man", + "OverseerForm", + "noice", + "lazy", + "NeogitStatus", + "NeogitHelpPopup", + "NeogitPopup", + "NeogitLogView", + } + + g.indent_blankline_buftype_exclude = { "terminal" } + g.indent_blankline_show_trailing_blankline_indent = false + g.indent_blankline_show_first_indent_level = true + + return { + show_current_context = true, + show_current_context_start = true, + } + end, + }, } - -g.indent_blankline_buftype_exclude = { "terminal" } -g.indent_blankline_show_trailing_blankline_indent = false -g.indent_blankline_show_first_indent_level = true - -require("indent_blankline").setup({ - -- space_char_blankline = " ", - show_current_context = true, - show_current_context_start = true, -}) diff --git a/dots/.config/nvim/lua/plugins/configs/kanagawa.lua b/dots/.config/nvim/lua/plugins/configs/kanagawa.lua index 3304027f..eac8bd41 100644 --- a/dots/.config/nvim/lua/plugins/configs/kanagawa.lua +++ b/dots/.config/nvim/lua/plugins/configs/kanagawa.lua @@ -1,199 +1,210 @@ -vim.opt.fillchars:append({ - horiz = "─", - horizup = "┴", - horizdown = "┬", - vert = "│", - vertleft = "┤", - vertright = "├", - verthoriz = "┼", -}) +return { + { + "rebelot/kanagawa.nvim", + priority = 1000, + build = function() + require("plugins.configs.kanagawa") + vim.cmd.KanagawaCompile() + end, + ---@param opts KanagawaConfig + config = function() + vim.api.nvim_create_autocmd("BufWritePost", { + pattern = "lua/plugins/configs/kanagawa.lua", + callback = function() + vim.schedule(vim.cmd.KanagawaCompile) + end, + }) -require("kanagawa").setup({ - transparent = true, - dim_inactive = true, - globalStatus = true, - theme = "dragon", - colors = { - theme = { - all = { - ui = { - bg_gutter = "NONE", + require("kanagawa").setup({ + transparent = true, + dim_inactive = true, + globalStatus = true, + theme = "dragon", + colors = { + theme = { + all = { + ui = { + bg_gutter = "NONE", + }, + }, + }, }, - }, - }, + overrides = function(palette) + local colors = palette.palette + vim.api.nvim_set_hl(0, "NvimNotifyError", { fg = colors.samuraiRed }) + vim.api.nvim_set_hl(0, "NvimNotifyWarn", { fg = colors.roninYellow }) + vim.api.nvim_set_hl(0, "NvimNotifyInfo", { fg = colors.springGreen }) + vim.api.nvim_set_hl(0, "NvimNotifyDebug", { fg = colors.crystalBlue }) + vim.api.nvim_set_hl(0, "NvimNotifyTrace", { fg = colors.oniViolet }) + + local overrides = { + DiffAdd = { bg = colors.winterGreen, fg = colors.autumnGreen }, + DiffDelete = { bg = colors.winterREd, fg = colors.autumnRed }, + NeogitPopupSectionTitle = { fg = colors.crystalBlue }, + NeogitPopupConfigEnabled = { fg = colors.springBlue, italic = true }, + NeogitPopupActionkey = { fg = colors.surimiOrange }, + NeogitPopupConfigKey = { fg = colors.peachRed }, + NeogitHunkHeader = { fg = colors.crystalBlue, bg = colors.sumiInk2 }, + NeogitHunkHeaderHighlight = { fg = colors.roninYellow, bg = colors.sumiInk1 }, + NeogitBranch = { fg = colors.autumnYellow, bold = true }, + NeogitUnmergedInto = { fg = colors.surimiOrange, bold = true }, + NeogitRemote = { fg = colors.carpYellow, bold = true }, + NeogitDiffContext = { bg = colors.sumiInk3 }, + NeogitDiffContextHighlight = { bg = colors.sumiInk4 }, + NeogitCursorLine = { link = "CursorLine" }, + NeogitDiffDelete = { link = "DiffDelete" }, + NeogitDiffDeleteHighlight = { link = "DiffDelete" }, + NeogitDiffHeader = { fg = colors.oniViolet, bg = colors.sumiInk0, bold = true }, + NeogitDiffHeaderHighlight = { fg = colors.sakuraPink, bg = colors.sumiInk0, bold = true }, + NeogitDiffAdd = { link = "DiffAdd" }, + NeogitDiffAddHighlight = { link = "DiffAdd" }, + NeogitStagedChanges = { fg = colors.surimiOrange, bold = true }, + NeogitUnpulledChanges = { fg = colors.peachRed, bold = true }, + NeogitUnmergedChanges = { fg = colors.springGreen, bold = true }, + NeogitUnstagedChanges = { fg = colors.peachRed, bold = true }, + NeogitUntrackedFiles = { fg = colors.peachRed, bold = true }, + NeogitRecentCommits = { fg = colors.crystalBlue, bold = true }, + NeogitCommitViewHeader = { fg = colors.crystalBlue, bold = true, italic = true }, + NeogitFilePath = { fg = colors.autumnYellow, italic = true }, + NeogitNotificationInfo = { fg = colors.springGreen, bold = true }, + NeogitNotificationWarning = { fg = colors.roninYellow, bold = true }, + NeogitNotificationError = { fg = colors.samuraiRed, bold = true }, + menuSel = { bg = colors.sumiInk0, fg = "NONE" }, + Pmenu = { fg = colors.fujiWhite, bg = colors.sumiInk2 }, + CmpItemAbbrDeprecated = { fg = colors.fujiGray, bg = "NONE" }, + CmpItemAbbrMatch = { fg = colors.crystalBlue, bg = "NONE" }, + CmpItemAbbrMatchFuzzy = { fg = colors.crystalBlue, bg = "NONE" }, + CmpItemMenu = { fg = colors.roninYellow, bg = "NONE" }, + CmpItemKindField = { fg = colors.fujiWhite, bg = colors.sakuraPink }, + CmpItemKindProperty = { fg = colors.fujiWhite, bg = colors.sakuraPink }, + CmpItemKindEvent = { fg = colors.fujiWhite, bg = colors.sakuraPink }, + CmpItemKindText = { fg = colors.fujiWhite, bg = colors.dragonBlue }, + CmpItemKindEnum = { fg = colors.fujiWhite, bg = colors.crystalBlue }, + CmpItemKindKeyword = { fg = colors.fujiWhite, bg = colors.springBlue }, + CmpItemKindConstant = { fg = colors.fujiWhite, bg = colors.crystalBlue }, + CmpItemKindConstructor = { fg = colors.fujiWhite, bg = colors.crystalBlue }, + CmpItemKindReference = { fg = colors.fujiWhite, bg = colors.crystalBlue }, + CmpItemKindFunction = { fg = colors.fujiWhite, bg = colors.oniViolet }, + CmpItemKindStruct = { fg = colors.fujiWhite, bg = colors.oniViolet }, + CmpItemKindClass = { fg = colors.fujiWhite, bg = colors.oniViolet }, + CmpItemKindModule = { fg = colors.fujiWhite, bg = colors.oniViolet }, + CmpItemKindOperator = { fg = colors.fujiWhite, bg = colors.oniViolet }, + CmpItemKindVariable = { fg = colors.fujiWhite, bg = colors.roninYellow }, + CmpItemKindFile = { fg = colors.fujiWhite, bg = colors.autumnYellow }, + CmpItemKindUnit = { fg = colors.fujiWhite, bg = colors.autumnYellow }, + CmpItemKindSnippet = { fg = colors.fujiWhite, bg = colors.autumnYellow }, + CmpItemKindFolder = { fg = colors.fujiWhite, bg = colors.autumnYellow }, + CmpItemKindMethod = { fg = colors.fujiWhite, bg = colors.autumnGreen }, + CmpItemKindValue = { fg = colors.fujiWhite, bg = colors.autumnGreen }, + CmpItemKindEnumMember = { fg = colors.fujiWhite, bg = colors.autumnGreen }, + CmpItemKindInterface = { fg = colors.fujiWhite, bg = colors.waveRed }, + CmpItemKindColor = { fg = colors.fujiWhite, bg = colors.waveAqua2 }, + CmpItemKindTypeParameter = { fg = colors.fujiWhite, bg = colors.waveAqua2 }, + CmpCustomSelectionGit = { fg = colors.fujiWhite, bg = colors.roninYellow }, + CmpCustomSelectionBuffer = { fg = colors.fujiWhite, bg = colors.dragonBlue }, + CmpCustomSelectionPath = { fg = colors.fujiWhite, bg = colors.autumnYellow }, + CmpCustomSelectionCalculator = { fg = colors.fujiWhite, bg = colors.waveBlue2 }, + CmpCustomSelectionNeorg = { fg = colors.fujiWhite, bg = colors.waveAqua1 }, + CmpCustomSelectionEmoji = { fg = colors.fujiWhite, bg = colors.dragonBlue }, + CmpCustomSelectionZsh = { fg = colors.fujiWhite, bg = colors.springGreen }, + CmpCustomSelectionCrates = { fg = colors.fujiWhite, bg = colors.roninYellow }, + CmpCustomSelectionCmdHistory = { fg = colors.fujiWhite, bg = colors.waveBlue2 }, + CmpCustomSelectionRipgrep = { fg = colors.fujiWhite, bg = colors.dragonBlue }, + CmpCustomSelectionNpm = { fg = colors.fujiWhite, bg = colors.peachRed }, + CmpCustomSelectionCommit = { fg = colors.fujiWhite, bg = colors.peachRed }, + CmpCustomSelectionSpell = { fg = colors.fujiWhite, bg = colors.waveRed }, + TelescopeNormal = { bg = colors.sumiInk2 }, + TelescopeBorder = { bg = colors.sumiInk2, fg = colors.sumiInk1 }, + TelescopePromptBorder = { bg = colors.sumiInk0, fg = colors.sumiInk0 }, + TelescopePromptNormal = { bg = colors.sumiInk0, fg = colors.fujiWhite }, + TelescopePromptTitle = { fg = colors.sumiInk0, bg = colors.oniViolet }, + TelescopePreviewTitle = { fg = colors.sumiInk0, bg = colors.sakuraPink }, + TelescopePreviewNormal = { bg = colors.sumiInk4 }, + TelescopePreviewBorder = { link = "TelescopePreviewNormal" }, + TelescopeResultsTitle = { fg = "NONE", bg = "NONE" }, + WinSeparator = { fg = colors.sumiInk4, bg = "NONE" }, + MiniCursorword = { bg = colors.waveBlue2 }, + MiniCursorwordCurrent = { bg = colors.waveBlue2 }, + rainbowcol1 = { fg = colors.oniViolet }, + rainbowcol2 = { fg = colors.crystalBlue }, + rainbowcol3 = { fg = colors.lightBlue }, + rainbowcol4 = { fg = colors.sakuraPink }, + rainbowcol5 = { fg = colors.springGreen }, + rainbowcol6 = { fg = colors.springViolet2 }, + rainbowcol7 = { fg = colors.carpYellow }, + packerSuccess = { fg = colors.autumnGreen, bg = "NONE" }, + WinBar = { fg = colors.fujiWhite, bg = colors.sumiInk1 }, + WinBarNC = { fg = colors.fujiWhite, bg = colors.sumiInk1 }, + NeoTreeNormal = { bg = colors.sumiInk1 }, + NeoTreeNormalNC = { bg = colors.sumiInk1 }, + NoiceCmdlineIconCmdline = { fg = colors.oniViolet }, + NoiceCmdlinePopupBorderCmdline = { fg = colors.oniViolet }, + NoiceCmdlineIconFilter = { fg = colors.springGreen }, + NoiceCmdlinePopupBorderFilter = { fg = colors.springGreen }, + NoiceCmdLineIconLua = { fg = colors.crystalBlue }, + NoiceCmdlinePopupBorderLua = { fg = colors.crystalBlue }, + NoiceCmdlineIconHelp = { fg = colors.surimiOrange }, + NoiceCmdlinePopupBorderHelp = { fg = colors.surimiOrange }, + NoiceCmdLineIconSearch = { fg = colors.roninYellow }, + NoiceCmdlinePopupBorderSearch = { fg = colors.roninYellow }, + NoiceCmdlineIconIncRename = { fg = colors.peachRed }, + NoiceCmdlinePopupdBorderIncRename = { fg = colors.peachRed }, + NoiceMini = { bg = colors.sumiInk4 }, + NoiceLspProgressClient = { fg = colors.oniViolet, bold = true }, + Folded = { bg = colors.waveBlue1 }, + UfoFoldedBg = { bg = colors.waveBlue1 }, + TSRainbowRed = { fg = colors.peachRed }, + TSRainbowYellow = { fg = colors.carpYellow }, + TSRainbowBlue = { fg = colors.crystalBlue }, + TSRainbowGreen = { fg = colors.springGreen }, + TSRainbowViolet = { fg = colors.oniViolet }, + TSRainbowCyan = { fg = colors.lightBlue }, + SmoothCursorCursor = { fg = colors.roninYellow }, + SmoothCursorTrailBig1 = { fg = colors.autumnYellow }, + SmoothCursorTrailBig2 = { fg = colors.crystalBlue }, + SmoothCursorTrailMedium = { fg = colors.oniViolet }, + SmoothCursorTrailSmall = { fg = colors.springBlue }, + SmoothCursorTrailXSmall = { fg = colors.waveAqua2 }, + TreesitterContext = { bg = colors.sumiInk0 }, + FloatTitle = { bg = "NONE" }, + DiffviewFilePanelTitle = { fg = colors.crystalBlue }, + Headline = { bg = colors.sumiInk2 }, + HeadlineReversed = { bg = colors.sumiInk1 }, + LspInlayHint = { link = "Comment", italic = true }, + ["@text.title.1.marker.markdown"] = { fg = colors.surimiOrange }, + ["@text.title.2.marker.markdown"] = { fg = colors.surimiOrange }, + ["@text.title.3.marker.markdown"] = { fg = colors.surimiOrange }, + ["@text.title.4.marker.markdown"] = { fg = colors.surimiOrange }, + ["@text.title.5.marker.markdown"] = { fg = colors.surimiOrange }, + ["@text.title.6.marker.markdown"] = { fg = colors.surimiOrange }, + RainbowDelimiterRed = { fg = colors.peachRed }, + RainbowDelimiterYellow = { fg = colors.autumnYellow }, + RainbowDelimiterBlue = { fg = colors.crystalBlue }, + RainbowDelimiterOrange = { fg = colors.surimiOrange }, + RainbowDelimiterGreen = { fg = colors.springGreen }, + RainbowDelimiterViolet = { fg = colors.oniViolet }, + RainbowDelimiterCyan = { fg = colors.lightBlue }, + NotifyERRORBorder = { link = "NvimNotifyError" }, + NotifyERRORIcon = { link = "NvimNotifyError" }, + NotifyERRORTitle = { link = "NvimNotifyError" }, + NotifyWARNBorder = { link = "NvimNotifyWarn" }, + NotifyWARNIcon = { link = "NvimNotifyWarn" }, + NotifyWARNTitle = { link = "NvimNotifyWarn" }, + NotifyINFOBorder = { link = "NvimNotifyInfo" }, + NotifyINFOIcon = { link = "NvimNotifyInfo" }, + NotifyINFOTitle = { link = "NvimNotifyInfo" }, + NotifyDEBUGBorder = { link = "NvimNotifyDebug" }, + NotifyDEBUGIcon = { link = "NvimNotifyDebug" }, + NotifyDEBUGTitle = { link = "NvimNotifyDebug" }, + NotifyTRACEBorder = { link = "NvimNotifyTrace" }, + NotifyTRACEIcon = { link = "NvimNotifyTrace" }, + NotifyTRACETitle = { link = "NvimNotifyTrace" }, + } + + return overrides + end, + }) + vim.cmd.colorscheme("kanagawa") + end, }, - overrides = function(palette) - local colors = palette.palette - vim.api.nvim_set_hl(0, "NvimNotifyError", { fg = colors.samuraiRed }) - vim.api.nvim_set_hl(0, "NvimNotifyWarn", { fg = colors.roninYellow }) - vim.api.nvim_set_hl(0, "NvimNotifyInfo", { fg = colors.springGreen }) - vim.api.nvim_set_hl(0, "NvimNotifyDebug", { fg = colors.crystalBlue }) - vim.api.nvim_set_hl(0, "NvimNotifyTrace", { fg = colors.oniViolet }) - - local overrides = { - DiffAdd = { bg = colors.winterGreen, fg = colors.autumnGreen }, - DiffDelete = { bg = colors.winterREd, fg = colors.autumnRed }, - NeogitPopupSectionTitle = { fg = colors.crystalBlue }, - NeogitPopupConfigEnabled = { fg = colors.springBlue, italic = true }, - NeogitPopupActionkey = { fg = colors.surimiOrange }, - NeogitPopupConfigKey = { fg = colors.peachRed }, - NeogitHunkHeader = { fg = colors.crystalBlue, bg = colors.sumiInk2 }, - NeogitHunkHeaderHighlight = { fg = colors.roninYellow, bg = colors.sumiInk1 }, - NeogitBranch = { fg = colors.autumnYellow, bold = true }, - NeogitUnmergedInto = { fg = colors.surimiOrange, bold = true }, - NeogitRemote = { fg = colors.carpYellow, bold = true }, - NeogitDiffContext = { bg = colors.sumiInk3 }, - NeogitDiffContextHighlight = { bg = colors.sumiInk4 }, - NeogitCursorLine = { link = "CursorLine" }, - NeogitDiffDelete = { link = "DiffDelete" }, - NeogitDiffDeleteHighlight = { link = "DiffDelete" }, - NeogitDiffHeader = { fg = colors.oniViolet, bg = colors.sumiInk0, bold = true }, - NeogitDiffHeaderHighlight = { fg = colors.sakuraPink, bg = colors.sumiInk0, bold = true }, - NeogitDiffAdd = { link = "DiffAdd" }, - NeogitDiffAddHighlight = { link = "DiffAdd" }, - NeogitStagedChanges = { fg = colors.surimiOrange, bold = true }, - NeogitUnpulledChanges = { fg = colors.peachRed, bold = true }, - NeogitUnmergedChanges = { fg = colors.springGreen, bold = true }, - NeogitUnstagedChanges = { fg = colors.peachRed, bold = true }, - NeogitUntrackedFiles = { fg = colors.peachRed, bold = true }, - NeogitRecentCommits = { fg = colors.crystalBlue, bold = true }, - NeogitCommitViewHeader = { fg = colors.crystalBlue, bold = true, italic = true }, - NeogitFilePath = { fg = colors.autumnYellow, italic = true }, - NeogitNotificationInfo = { fg = colors.springGreen, bold = true }, - NeogitNotificationWarning = { fg = colors.roninYellow, bold = true }, - NeogitNotificationError = { fg = colors.samuraiRed, bold = true }, - menuSel = { bg = colors.sumiInk0, fg = "NONE" }, - Pmenu = { fg = colors.fujiWhite, bg = colors.sumiInk2 }, - CmpItemAbbrDeprecated = { fg = colors.fujiGray, bg = "NONE" }, - CmpItemAbbrMatch = { fg = colors.crystalBlue, bg = "NONE" }, - CmpItemAbbrMatchFuzzy = { fg = colors.crystalBlue, bg = "NONE" }, - CmpItemMenu = { fg = colors.roninYellow, bg = "NONE" }, - CmpItemKindField = { fg = colors.fujiWhite, bg = colors.sakuraPink }, - CmpItemKindProperty = { fg = colors.fujiWhite, bg = colors.sakuraPink }, - CmpItemKindEvent = { fg = colors.fujiWhite, bg = colors.sakuraPink }, - CmpItemKindText = { fg = colors.fujiWhite, bg = colors.dragonBlue }, - CmpItemKindEnum = { fg = colors.fujiWhite, bg = colors.crystalBlue }, - CmpItemKindKeyword = { fg = colors.fujiWhite, bg = colors.springBlue }, - CmpItemKindConstant = { fg = colors.fujiWhite, bg = colors.crystalBlue }, - CmpItemKindConstructor = { fg = colors.fujiWhite, bg = colors.crystalBlue }, - CmpItemKindReference = { fg = colors.fujiWhite, bg = colors.crystalBlue }, - CmpItemKindFunction = { fg = colors.fujiWhite, bg = colors.oniViolet }, - CmpItemKindStruct = { fg = colors.fujiWhite, bg = colors.oniViolet }, - CmpItemKindClass = { fg = colors.fujiWhite, bg = colors.oniViolet }, - CmpItemKindModule = { fg = colors.fujiWhite, bg = colors.oniViolet }, - CmpItemKindOperator = { fg = colors.fujiWhite, bg = colors.oniViolet }, - CmpItemKindVariable = { fg = colors.fujiWhite, bg = colors.roninYellow }, - CmpItemKindFile = { fg = colors.fujiWhite, bg = colors.autumnYellow }, - CmpItemKindUnit = { fg = colors.fujiWhite, bg = colors.autumnYellow }, - CmpItemKindSnippet = { fg = colors.fujiWhite, bg = colors.autumnYellow }, - CmpItemKindFolder = { fg = colors.fujiWhite, bg = colors.autumnYellow }, - CmpItemKindMethod = { fg = colors.fujiWhite, bg = colors.autumnGreen }, - CmpItemKindValue = { fg = colors.fujiWhite, bg = colors.autumnGreen }, - CmpItemKindEnumMember = { fg = colors.fujiWhite, bg = colors.autumnGreen }, - CmpItemKindInterface = { fg = colors.fujiWhite, bg = colors.waveRed }, - CmpItemKindColor = { fg = colors.fujiWhite, bg = colors.waveAqua2 }, - CmpItemKindTypeParameter = { fg = colors.fujiWhite, bg = colors.waveAqua2 }, - CmpCustomSelectionGit = { fg = colors.fujiWhite, bg = colors.roninYellow }, - CmpCustomSelectionBuffer = { fg = colors.fujiWhite, bg = colors.dragonBlue }, - CmpCustomSelectionPath = { fg = colors.fujiWhite, bg = colors.autumnYellow }, - CmpCustomSelectionCalculator = { fg = colors.fujiWhite, bg = colors.waveBlue2 }, - CmpCustomSelectionNeorg = { fg = colors.fujiWhite, bg = colors.waveAqua1 }, - CmpCustomSelectionEmoji = { fg = colors.fujiWhite, bg = colors.dragonBlue }, - CmpCustomSelectionZsh = { fg = colors.fujiWhite, bg = colors.springGreen }, - CmpCustomSelectionCrates = { fg = colors.fujiWhite, bg = colors.roninYellow }, - CmpCustomSelectionCmdHistory = { fg = colors.fujiWhite, bg = colors.waveBlue2 }, - CmpCustomSelectionRipgrep = { fg = colors.fujiWhite, bg = colors.dragonBlue }, - CmpCustomSelectionNpm = { fg = colors.fujiWhite, bg = colors.peachRed }, - CmpCustomSelectionCommit = { fg = colors.fujiWhite, bg = colors.peachRed }, - CmpCustomSelectionSpell = { fg = colors.fujiWhite, bg = colors.waveRed }, - TelescopeNormal = { bg = colors.sumiInk2 }, - TelescopeBorder = { bg = colors.sumiInk2, fg = colors.sumiInk1 }, - TelescopePromptBorder = { bg = colors.sumiInk0, fg = colors.sumiInk0 }, - TelescopePromptNormal = { bg = colors.sumiInk0, fg = colors.fujiWhite }, - TelescopePromptTitle = { fg = colors.sumiInk0, bg = colors.oniViolet }, - TelescopePreviewTitle = { fg = colors.sumiInk0, bg = colors.sakuraPink }, - TelescopePreviewNormal = { bg = colors.sumiInk4 }, - TelescopePreviewBorder = { link = "TelescopePreviewNormal" }, - TelescopeResultsTitle = { fg = "NONE", bg = "NONE" }, - WinSeparator = { fg = colors.sumiInk4, bg = "NONE" }, - MiniCursorword = { bg = colors.waveBlue2 }, - MiniCursorwordCurrent = { bg = colors.waveBlue2 }, - rainbowcol1 = { fg = colors.oniViolet }, - rainbowcol2 = { fg = colors.crystalBlue }, - rainbowcol3 = { fg = colors.lightBlue }, - rainbowcol4 = { fg = colors.sakuraPink }, - rainbowcol5 = { fg = colors.springGreen }, - rainbowcol6 = { fg = colors.springViolet2 }, - rainbowcol7 = { fg = colors.carpYellow }, - packerSuccess = { fg = colors.autumnGreen, bg = "NONE" }, - WinBar = { fg = colors.fujiWhite, bg = colors.sumiInk1 }, - WinBarNC = { fg = colors.fujiWhite, bg = colors.sumiInk1 }, - NeoTreeNormal = { bg = colors.sumiInk1 }, - NeoTreeNormalNC = { bg = colors.sumiInk1 }, - NoiceCmdlineIconCmdline = { fg = colors.oniViolet }, - NoiceCmdlinePopupBorderCmdline = { fg = colors.oniViolet }, - NoiceCmdlineIconFilter = { fg = colors.springGreen }, - NoiceCmdlinePopupBorderFilter = { fg = colors.springGreen }, - NoiceCmdLineIconLua = { fg = colors.crystalBlue }, - NoiceCmdlinePopupBorderLua = { fg = colors.crystalBlue }, - NoiceCmdlineIconHelp = { fg = colors.surimiOrange }, - NoiceCmdlinePopupBorderHelp = { fg = colors.surimiOrange }, - NoiceCmdLineIconSearch = { fg = colors.roninYellow }, - NoiceCmdlinePopupBorderSearch = { fg = colors.roninYellow }, - NoiceCmdlineIconIncRename = { fg = colors.peachRed }, - NoiceCmdlinePopupdBorderIncRename = { fg = colors.peachRed }, - NoiceMini = { bg = colors.sumiInk4 }, - NoiceLspProgressClient = { fg = colors.oniViolet, bold = true }, - Folded = { bg = colors.waveBlue1 }, - UfoFoldedBg = { bg = colors.waveBlue1 }, - TSRainbowRed = { fg = colors.peachRed }, - TSRainbowYellow = { fg = colors.carpYellow }, - TSRainbowBlue = { fg = colors.crystalBlue }, - TSRainbowGreen = { fg = colors.springGreen }, - TSRainbowViolet = { fg = colors.oniViolet }, - TSRainbowCyan = { fg = colors.lightBlue }, - SmoothCursorCursor = { fg = colors.roninYellow }, - SmoothCursorTrailBig1 = { fg = colors.autumnYellow }, - SmoothCursorTrailBig2 = { fg = colors.crystalBlue }, - SmoothCursorTrailMedium = { fg = colors.oniViolet }, - SmoothCursorTrailSmall = { fg = colors.springBlue }, - SmoothCursorTrailXSmall = { fg = colors.waveAqua2 }, - TreesitterContext = { bg = colors.sumiInk0 }, - FloatTitle = { bg = "NONE" }, - DiffviewFilePanelTitle = { fg = colors.crystalBlue }, - Headline = { bg = colors.sumiInk2 }, - HeadlineReversed = { bg = colors.sumiInk1 }, - LspInlayHint = { link = "Comment", italic = true }, - ["@text.title.1.marker.markdown"] = { fg = colors.surimiOrange }, - ["@text.title.2.marker.markdown"] = { fg = colors.surimiOrange }, - ["@text.title.3.marker.markdown"] = { fg = colors.surimiOrange }, - ["@text.title.4.marker.markdown"] = { fg = colors.surimiOrange }, - ["@text.title.5.marker.markdown"] = { fg = colors.surimiOrange }, - ["@text.title.6.marker.markdown"] = { fg = colors.surimiOrange }, - RainbowDelimiterRed = { fg = colors.peachRed }, - RainbowDelimiterYellow = { fg = colors.autumnYellow }, - RainbowDelimiterBlue = { fg = colors.crystalBlue }, - RainbowDelimiterOrange = { fg = colors.surimiOrange }, - RainbowDelimiterGreen = { fg = colors.springGreen }, - RainbowDelimiterViolet = { fg = colors.oniViolet }, - RainbowDelimiterCyan = { fg = colors.lightBlue }, - NotifyERRORBorder = { link = "NvimNotifyError" }, - NotifyERRORIcon = { link = "NvimNotifyError" }, - NotifyERRORTitle = { link = "NvimNotifyError" }, - NotifyWARNBorder = { link = "NvimNotifyWarn" }, - NotifyWARNIcon = { link = "NvimNotifyWarn" }, - NotifyWARNTitle = { link = "NvimNotifyWarn" }, - NotifyINFOBorder = { link = "NvimNotifyInfo" }, - NotifyINFOIcon = { link = "NvimNotifyInfo" }, - NotifyINFOTitle = { link = "NvimNotifyInfo" }, - NotifyDEBUGBorder = { link = "NvimNotifyDebug" }, - NotifyDEBUGIcon = { link = "NvimNotifyDebug" }, - NotifyDEBUGTitle = { link = "NvimNotifyDebug" }, - NotifyTRACEBorder = { link = "NvimNotifyTrace" }, - NotifyTRACEIcon = { link = "NvimNotifyTrace" }, - NotifyTRACETitle = { link = "NvimNotifyTrace" }, - } - - return overrides - end, -}) +} diff --git a/dots/.config/nvim/lua/plugins/configs/lastplace.lua b/dots/.config/nvim/lua/plugins/configs/lastplace.lua new file mode 100644 index 00000000..c4011344 --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/lastplace.lua @@ -0,0 +1,11 @@ +return { + { + "ethanholz/nvim-lastplace", + event = { "BufReadPre", "BufNewFile" }, + opts = { + lastplace_ignore_buftype = { "quickfix", "nofile", "help" }, + lastplace_ignore_filetype = { "gitcommit", "gitrebase", "svn", "hgcommit", "fugitive" }, + lastplace_open_folds = true, + }, + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/lib.lua b/dots/.config/nvim/lua/plugins/configs/lib.lua new file mode 100644 index 00000000..cba79c88 --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/lib.lua @@ -0,0 +1,19 @@ +return { + { + "nvim-tree/nvim-web-devicons", + lazy = true, + }, + { + "nvim-lua/plenary.nvim", + lazy = true, + }, + { + "stevearc/dressing.nvim", + lazy = true, + }, + { + "folke/which-key.nvim", + lazy = true, + opts = {}, + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/live-command.lua b/dots/.config/nvim/lua/plugins/configs/live-command.lua new file mode 100644 index 00000000..cbf13383 --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/live-command.lua @@ -0,0 +1,26 @@ +return { + { + "smjonas/live-command.nvim", + cmd = { + "Norm", + "Reg", + "GG", + }, + config = function() + require("live-command").setup({ + commands = { + GG = { cmd = "g" }, + Norm = { cmd = "norm" }, + Reg = { + cmd = "norm", + -- This will transform ":5Reg a" into ":norm 5@a" + args = function(opts) + return (opts.count == -1 and "" or opts.count) .. "@" .. opts.args + end, + range = "", + }, + }, + }) + end, + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/log.lua b/dots/.config/nvim/lua/plugins/configs/log.lua new file mode 100644 index 00000000..329f4881 --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/log.lua @@ -0,0 +1,6 @@ +return { + { + "MTDL9/vim-log-highlighting", + ft = "log", + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/lsp.lua b/dots/.config/nvim/lua/plugins/configs/lsp.lua old mode 100755 new mode 100644 index cf668c2c..623eda7e --- a/dots/.config/nvim/lua/plugins/configs/lsp.lua +++ b/dots/.config/nvim/lua/plugins/configs/lsp.lua @@ -1,354 +1,515 @@ -local mason_lspconfig = require("mason-lspconfig") -local lspconfig = require("lspconfig") - --- NOTE: Keep this near top -mason_lspconfig.setup({ - automatic_installation = true, - ensure_installed = { - "tsserver", +return { + { + "jose-elias-alvarez/null-ls.nvim", + event = { "BufReadPre", "BufNewFile" }, + opts = function() + local null_ls = require("null-ls") + return { + sources = { + null_ls.builtins.diagnostics.hadolint, + null_ls.builtins.code_actions.refactoring, + null_ls.builtins.formatting.black, + null_ls.builtins.formatting.stylua, + null_ls.builtins.formatting.prettier, + }, + } + end, }, -}) - -local function on_attach(client, bufnr) - -- Set autocommands conditional on server_capabilities - vim.notify("Attached server " .. client.name, "info", { - title = "LSP", - }) - - -- Enable inlay hints if the language server provides them - if client.server_capabilities.inlayHintProvider then - vim.lsp.inlay_hint(bufnr, true) - end -end - -local lsp_capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()) -local opts = { - capabilities = lsp_capabilities, - on_attach = on_attach, -} - -local lsp_server_bin_dir = vim.fn.stdpath("data") .. "/mason/bin/" -local rust_tools = require("rust-tools") -local codelldb_path = lsp_server_bin_dir .. "codelldb" -local liblldb_path = vim.fn.stdpath("data") .. "/mason/packages/codelldb/extension/lldb/lib/liblldb.so" -local rustopts = { - server = opts, - dap = { - adapter = require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path), + { + url = "https://git.sr.ht/~whynothugo/lsp_lines.nvim", + event = "LspAttach", + keys = { + { + "lt", + function() + require("lsp_lines").toggle() + end, + desc = "LSP: Toggle Diagnostic Appearance", + }, + { + "lt", + function() + local virtual_lines_enabled = not vim.diagnostic.config().virtual_lines + vim.diagnostic.config({ + virtual_lines = virtual_lines_enabled, + virtual_text = not virtual_lines_enabled, + }) + end, + desc = "LSP: Toggle Diagnostic Style", + }, + }, + config = true, }, - tools = { - -- how to execute terminal commands - -- options right now: termopen / quickfix - executor = require("rust-tools/executors").termopen, - -- callback to execute once rust-analyzer is done initializing the workspace - -- The callback receives one parameter indicating the `health` of the server: "ok" | "warning" | "error" - on_initialized = nil, - -- These apply to the default RustSetInlayHints command - inlay_hints = { - -- automatically set inlay hints (type hints) - -- default: true - auto = false, - -- Only show inlay hints for the current line - only_current_line = false, - -- whether to show parameter hints with the inlay hints or not - -- default: true - show_parameter_hints = true, - -- prefix for parameter hints - -- default: "<-" - parameter_hints_prefix = "<- ", - -- prefix for all the other hints (type, chaining) - -- default: "=>" - other_hints_prefix = "=> ", - -- whether to align to the lenght of the longest line in the file - max_len_align = false, - -- padding from the left if max_len_align is true - max_len_align_padding = 1, - -- whether to align to the extreme right or not - right_align = false, - -- padding from the right if right_align is true - right_align_padding = 7, - -- The color of the hints - highlight = "Comment", + { + "smjonas/inc-rename.nvim", + cmd = { "Increname" }, + keys = { + { "ln", ":IncRename ", desc = "LSP: Rename" }, }, - hover_actions = { - auto_focus = true, + opts = {}, + }, + { + "kosayoda/nvim-lightbulb", + event = "LspAttach", + dependencies = { + "antoinemadec/FixCursorHold.nvim", }, - server = { - on_attach = function(client, bufnr) - vim.keymap.set("n", "fr", rust_tools.runnables.runnables, { - buffer = bufnr, - }) - - vim.keymap.set("n", "fd", rust_tools.debuggables.debuggables, { - buffer = bufnr, - }) - - vim.keymap.set("n", "fp", rust_tools.parent_module.parent_module, { - buffer = bufnr, - }) - - vim.keymap.set("n", "fJ", rust_tools.join_lines.join_lines, { - buffer = bufnr, - }) - - vim.keymap.set("n", "fH", rust_tools.hover_range.hover_range, { - buffer = bufnr, - }) - - vim.keymap.set("n", "fm", rust_tools.expand_macro.expand_macro, { - buffer = bufnr, - }) - - vim.keymap.set("n", "fc", rust_tools.open_cargo_toml.open_cargo_toml, { - buffer = bufnr, - }) - - vim.keymap.set("n", "fk", ":RustMoveItemUp", { - buffer = bufnr, - }) - - vim.keymap.set("n", "fj", ":RustMoveItemDown", { - buffer = bufnr, - }) - - vim.keymap.set("n", "fh", rust_tools.hover_actions.hover_actions, { - buffer = bufnr, - }) - - vim.keymap.set("n", "fa", rust_tools.code_action_group.code_action_group, { - buffer = bufnr, - }) - on_attach(client, bufnr) - end, + opts = function() + local text_icon = "" + local nvim_lightbulb = require("nvim-lightbulb") + vim.fn.sign_define( + "LightBulbSign", + { text = text_icon, numhl = "DiagnosticSignHint", texthl = "DiagnosticSignHint", priority = 9 } + ) + vim.api.nvim_create_autocmd("CursorHold,CursorHoldI", { + callback = nvim_lightbulb.update_lightbulb, + }) + return { + sign = { + priority = 9, + text = text_icon, + }, + } + end, + }, + { + "neovim/nvim-lspconfig", + dependencies = { + "folke/neodev.nvim", + "Decodetalkers/csharpls-extended-lsp.nvim", + "williamboman/mason-lspconfig.nvim", + "williamboman/mason.nvim", + "simrat39/rust-tools.nvim", + "Hoffs/omnisharp-extended-lsp.nvim", + "b0o/schemastore.nvim", + { + "pmizio/typescript-tools.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + }, + { + "m-demare/hlargs.nvim", + event = { "BufReadPre", "BufNewFile" }, + config = true, + }, }, + keys = { + { "l", desc = "> LSP" }, + { + "lh", + function() + if vim.diagnostic.is_disabled() then + vim.diagnostic.enable() + else + vim.diagnostic.disable() + end + end, + desc = "LSP: Toggle Diagnostics", + }, + { "lD", vim.lsp.buf.declaration, desc = "LSP: Declaration" }, + { "k", vim.lsp.buf.hover, desc = "LSP: Hover" }, + { "K", vim.lsp.buf.signature_help, desc = "LSP: Sig Help" }, + { "lc", vim.lsp.buf.code_action, desc = "LSP: Code Action" }, + { "lR", ":LspRestart", desc = "LSP: Restart" }, + { + "ls", + function() + vim.diagnostic.open_float(nil, { focus = true, scope = "cursor" }) + vim.cmd.vsplit() + end, + desc = "LSP: Diagnostic Open Float", + }, + { + "lf", + function() + vim.lsp.buf.format({ async = true }) + end, + desc = "LSP: Format", + }, + { "[l", vim.diagnostic.goto_prev, desc = "LSP: Diagnostic Previous" }, + { "]l", vim.diagnostic.goto_next, desc = "LSP: Diagnostic Next" }, + { + "lt", + function() + local virtual_lines_enabled = not vim.diagnostic.config().virtual_lines + vim.diagnostic.config({ + virtual_lines = virtual_lines_enabled, + virtual_text = not virtual_lines_enabled, + }) + end, + desc = "LSP: Toggle Diagnostic Style", + }, + { + "lT", + function() + vim.lsp.inlay_hint(0, nil) + end, + desc = "LSP: Toggle Inlay Hints", + }, + }, + event = { "BufReadPre", "BufNewFile" }, + config = function() + require("mason").setup({}) + + local mason_lspconfig = require("mason-lspconfig") + local lspconfig = require("lspconfig") + + -- NOTE: Keep this near top + mason_lspconfig.setup({ + automatic_installation = true, + ensure_installed = { + "tsserver", + }, + }) + + local function on_attach(client, bufnr) + -- Set autocommands conditional on server_capabilities + vim.notify("Attached server " .. client.name, "info", { + title = "LSP", + }) + + local capabilities = client.server_capabilities + -- Enable inlay hints if the language server provides them + if capabilities.inlayHintProvider then + vim.lsp.inlay_hint(bufnr, true) + end + + if capabilities.semanticTokensProvider and capabilities.semanticTokensProvider.full then + require("hlargs").disable_buf(bufnr) + end + end + + local lsp_capabilities = + require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()) + local opts = { + capabilities = lsp_capabilities, + on_attach = on_attach, + } + + local lsp_server_bin_dir = vim.fn.stdpath("data") .. "/mason/bin/" + local rust_tools = require("rust-tools") + local codelldb_path = lsp_server_bin_dir .. "codelldb" + local liblldb_path = vim.fn.stdpath("data") .. "/mason/packages/codelldb/extension/lldb/lib/liblldb.so" + local rustopts = { + server = opts, + dap = { + adapter = require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path), + }, + tools = { + -- how to execute terminal commands + -- options right now: termopen / quickfix + executor = require("rust-tools/executors").termopen, + -- callback to execute once rust-analyzer is done initializing the workspace + -- The callback receives one parameter indicating the `health` of the server: "ok" | "warning" | "error" + on_initialized = nil, + -- These apply to the default RustSetInlayHints command + inlay_hints = { + -- automatically set inlay hints (type hints) + -- default: true + auto = false, + -- Only show inlay hints for the current line + only_current_line = false, + -- whether to show parameter hints with the inlay hints or not + -- default: true + show_parameter_hints = true, + -- prefix for parameter hints + -- default: "<-" + parameter_hints_prefix = "<- ", + -- prefix for all the other hints (type, chaining) + -- default: "=>" + other_hints_prefix = "=> ", + -- whether to align to the lenght of the longest line in the file + max_len_align = false, + -- padding from the left if max_len_align is true + max_len_align_padding = 1, + -- whether to align to the extreme right or not + right_align = false, + -- padding from the right if right_align is true + right_align_padding = 7, + -- The color of the hints + highlight = "Comment", + }, + hover_actions = { + auto_focus = true, + }, + server = { + on_attach = function(client, bufnr) + vim.keymap.set("n", "fr", rust_tools.runnables.runnables, { + buffer = bufnr, + }) + + vim.keymap.set("n", "fd", rust_tools.debuggables.debuggables, { + buffer = bufnr, + }) + + vim.keymap.set("n", "fp", rust_tools.parent_module.parent_module, { + buffer = bufnr, + }) + + vim.keymap.set("n", "fJ", rust_tools.join_lines.join_lines, { + buffer = bufnr, + }) + + vim.keymap.set("n", "fH", rust_tools.hover_range.hover_range, { + buffer = bufnr, + }) + + vim.keymap.set("n", "fm", rust_tools.expand_macro.expand_macro, { + buffer = bufnr, + }) + + vim.keymap.set("n", "fc", rust_tools.open_cargo_toml.open_cargo_toml, { + buffer = bufnr, + }) + + vim.keymap.set("n", "fk", ":RustMoveItemUp", { + buffer = bufnr, + }) + + vim.keymap.set("n", "fj", ":RustMoveItemDown", { + buffer = bufnr, + }) + + vim.keymap.set("n", "fh", rust_tools.hover_actions.hover_actions, { + buffer = bufnr, + }) + + vim.keymap.set("n", "fa", rust_tools.code_action_group.code_action_group, { + buffer = bufnr, + }) + on_attach(client, bufnr) + end, + }, + }, + } + rust_tools.setup(rustopts) + + -- NOTE: ANSIBLE LSP + -- I use ansible a lot, define exceptions for servers that can use + -- server:setup & vim.cmd at the bottom here + lspconfig.ansiblels.setup({ + capabilities = lsp_capabilities, + on_attach = on_attach, + settings = { + ansible = { + ansible = { + useFullyQualifiedCollectionNames = true, + path = "ansible", + }, + ansibleLint = { + enabled = true, + path = "ansible-lint", + }, + python = { + interpreterPath = "python3", + }, + completion = { + provideRedirectModules = true, + }, + }, + }, + }) + + -- NOTE: LUA LSP + require("neodev").setup({ + override = function(root_dir, library) + if root_dir:find("/tmp", 1, true) == 1 then + library.enabled = true + library.plugins = true + end + end, + }) + + lspconfig.lua_ls.setup({ + settings = { + Lua = { + completion = { + callSnippet = "Replace", + }, + }, + }, + }) + + -- NOTE: PYTHON LSP + lspconfig.pylsp.setup({ + filetypes = { "python" }, + settings = { + formatCommand = { "black" }, + pylsp = { + plugins = { + jedi_completion = { + include_params = true, + fuzzy = true, + eager = true, + }, + jedi_signature_help = { enabled = true }, + pyflakes = { enabled = true }, + pycodestyle = { + enabled = true, + ignore = { "E501", "E231", "W503", "E731" }, + maxLineLength = 120, + }, + mypy = { enabled = true }, + yapf = { enabled = true }, + rope_completion = { + enabled = true, + eager = true, + }, + }, + }, + }, + capabilities = lsp_capabilities, + on_attach = on_attach, + }) + + lspconfig.yamlls.setup({ + settings = { + redhat = { + telemetry = { + enabled = false, + }, + }, + yaml = { + schemas = require("schemastore").yaml.schemas({}), + }, + }, + capabilities = lsp_capabilities, + on_attach = on_attach, + }) + + lspconfig.csharp_ls.setup({ + handlers = { + ["textDocument/definition"] = require("csharpls_extended").handler, + }, + capabilities = lsp_capabilities, + on_attach = on_attach, + }) + + -- lspconfig.omnisharp.setup({ + -- cmd = { + -- vim.fn.stdpath("data") .. "/mason/bin/omnisharp", + -- "--languageserver", + -- "--hostPID", + -- tostring(vim.fn.getpid()), + -- }, + -- + -- handlers = { + -- ["textDocument/definition"] = require("omnisharp_extended").handler, + -- }, + -- enable_import_completion = true, + -- enable_roslyn_analyzers = true, + -- organize_imports_on_format = true, + -- capabilities = lsp_capabilities, + -- on_attach = on_attach, + -- }) + + lspconfig.jsonls.setup({ + settings = { + schemas = require("schemastore").json.schemas(), + validate = { enable = true }, + }, + capabilities = lsp_capabilities, + on_attach = on_attach, + }) + + lspconfig.powershell_es.setup({ + bundle_path = vim.fn.stdpath("data") .. "/mason/packages/powershell-editor-services/", + capabilities = lsp_capabilities, + on_attach = on_attach, + }) + + lspconfig.azure_pipelines_ls.setup({ + cmd = { lsp_server_bin_dir .. "azure-pipelines-language-server", "--stdio" }, + settings = { + redhat = { + telemetry = { + enabled = false, + }, + }, + yaml = { + schemas = { + ["https://raw.githubusercontent.com/microsoft/azure-pipelines-vscode/master/service-schema.json"] = { + "*", + }, + }, + }, + }, + filetypes = { "azure-pipelines" }, + capabilities = lsp_capabilities, + on_attach = on_attach, + }) + + lspconfig.texlab.setup({ + settings = { + texlab = { + build = { + onSave = true, + executable = "tectonic", + forwardSearchAfter = true, + args = { "-X", "compile", "%f", "--synctex" }, + }, + forwardSearch = { + executable = "zathura", + args = { "--synctex-forward", "%l:1:%f", "%p" }, + }, + }, + }, + }) + + -- Custom config from typescript tools + require("typescript-tools").setup({ + on_attach = on_attach, + settings = { + tsserver_file_preferences = { + includeInlayParameterNameHints = "all", + includeInlayEnumMemberValueHints = true, + includeInlayFunctionLikeReturnTypeHints = true, + includeInlayFunctionParameterTypeHints = true, + includeInlayPropertyDeclarationTypeHints = true, + includeInlayVariableTypeHints = true, + }, + }, + }) + + -- NOTE: GENERIC LSP SERVERS + for _, server in ipairs({ + "clangd", + "cmake", + "bashls", + "dockerls", + "docker_compose_language_service", + "eslint", + "html", + "cssls", + "jdtls", + "kotlin_language_server", + "terraformls", + "tflint", + "vimls", + "rnix", + "marksman", + "asm_lsp", + }) do + lspconfig[server].setup(opts) + end + + -- Custom Servers outside of lspconfig + vim.api.nvim_create_autocmd("FileType", { + pattern = "nginx", + desc = "Nginx Language Server Handler", + callback = function() + local client_id = vim.lsp.start({ + name = "Nginx-ls", + cmd = { lsp_server_bin_dir .. "nginx-language-server" }, + root_dir = vim.fn.getcwd(), + capabilities = lsp_capabilities, + on_attach = on_attach, + }) + + if client_id then + vim.lsp.buf_attach_client(0, client_id) + end + end, + }) + end, }, } -rust_tools.setup(rustopts) - --- NOTE: ANSIBLE LSP --- I use ansible a lot, define exceptions for servers that can use --- server:setup & vim.cmd at the bottom here -lspconfig.ansiblels.setup({ - capabilities = lsp_capabilities, - on_attach = on_attach, - settings = { - ansible = { - ansible = { - useFullyQualifiedCollectionNames = true, - path = "ansible", - }, - ansibleLint = { - enabled = true, - path = "ansible-lint", - }, - python = { - interpreterPath = "python3", - }, - completion = { - provideRedirectModules = true, - }, - }, - }, -}) - --- NOTE: LUA LSP -require("neodev").setup({ - override = function(root_dir, library) - if root_dir:find("/tmp", 1, true) == 1 then - library.enabled = true - library.plugins = true - end - end, -}) - -lspconfig.lua_ls.setup({ - settings = { - Lua = { - completion = { - callSnippet = "Replace", - }, - }, - }, -}) - --- NOTE: PYTHON LSP -lspconfig.pylsp.setup({ - filetypes = { "python" }, - settings = { - formatCommand = { "black" }, - pylsp = { - plugins = { - jedi_completion = { - include_params = true, - fuzzy = true, - eager = true, - }, - jedi_signature_help = { enabled = true }, - pyflakes = { enabled = true }, - pycodestyle = { - enabled = true, - ignore = { "E501", "E231", "W503", "E731" }, - maxLineLength = 120, - }, - mypy = { enabled = true }, - yapf = { enabled = true }, - rope_completion = { - enabled = true, - eager = true, - }, - }, - }, - }, - capabilities = lsp_capabilities, - on_attach = on_attach, -}) - -lspconfig.yamlls.setup({ - settings = { - redhat = { - telemetry = { - enabled = false, - }, - }, - yaml = { - schemas = require("schemastore").yaml.schemas({}), - }, - }, - capabilities = lsp_capabilities, - on_attach = on_attach, -}) - -lspconfig.csharp_ls.setup({ - handlers = { - ["textDocument/definition"] = require("csharpls_extended").handler, - }, - capabilities = lsp_capabilities, - on_attach = on_attach, -}) - --- lspconfig.omnisharp.setup({ --- cmd = { --- vim.fn.stdpath("data") .. "/mason/bin/omnisharp", --- "--languageserver", --- "--hostPID", --- tostring(vim.fn.getpid()), --- }, --- --- handlers = { --- ["textDocument/definition"] = require("omnisharp_extended").handler, --- }, --- enable_import_completion = true, --- enable_roslyn_analyzers = true, --- organize_imports_on_format = true, --- capabilities = lsp_capabilities, --- on_attach = on_attach, --- }) - -lspconfig.jsonls.setup({ - settings = { - schemas = require("schemastore").json.schemas(), - validate = { enable = true }, - }, - capabilities = lsp_capabilities, - on_attach = on_attach, -}) - -lspconfig.powershell_es.setup({ - bundle_path = vim.fn.stdpath("data") .. "/mason/packages/powershell-editor-services/", - capabilities = lsp_capabilities, - on_attach = on_attach, -}) - -lspconfig.azure_pipelines_ls.setup({ - cmd = { lsp_server_bin_dir .. "azure-pipelines-language-server", "--stdio" }, - settings = { - redhat = { - telemetry = { - enabled = false, - }, - }, - yaml = { - schemas = { - ["https://raw.githubusercontent.com/microsoft/azure-pipelines-vscode/master/service-schema.json"] = { - "*", - }, - }, - }, - }, - filetypes = { "azure-pipelines" }, - capabilities = lsp_capabilities, - on_attach = on_attach, -}) - -lspconfig.texlab.setup({ - settings = { - texlab = { - build = { - onSave = true, - executable = "tectonic", - forwardSearchAfter = true, - args = { "-X", "compile", "%f", "--synctex" }, - }, - forwardSearch = { - executable = "zathura", - args = { "--synctex-forward", "%l:1:%f", "%p" }, - }, - }, - }, -}) - --- Custom config from typescript tools -require("typescript-tools").setup({ - on_attach = on_attach, - settings = { - tsserver_file_preferences = { - includeInlayParameterNameHints = "all", - includeInlayEnumMemberValueHints = true, - includeInlayFunctionLikeReturnTypeHints = true, - includeInlayFunctionParameterTypeHints = true, - includeInlayPropertyDeclarationTypeHints = true, - includeInlayVariableTypeHints = true, - }, - }, -}) - --- NOTE: GENERIC LSP SERVERS -for _, server in ipairs({ - "clangd", - "cmake", - "bashls", - "dockerls", - "docker_compose_language_service", - "eslint", - "html", - "cssls", - "jdtls", - "kotlin_language_server", - "terraformls", - "tflint", - "vimls", - "rnix", - "marksman", - "asm_lsp", -}) do - lspconfig[server].setup(opts) -end - --- Custom Servers outside of lspconfig -vim.api.nvim_create_autocmd("FileType", { - pattern = "nginx", - desc = "Nginx Language Server Handler", - callback = function() - local client_id = vim.lsp.start({ - name = "Nginx-ls", - cmd = { lsp_server_bin_dir .. "nginx-language-server" }, - root_dir = vim.fn.getcwd(), - capabilities = lsp_capabilities, - on_attach = on_attach, - }) - - if client_id then - vim.lsp.buf_attach_client(0, client_id) - end - end, -}) diff --git a/dots/.config/nvim/lua/plugins/configs/lualine.lua b/dots/.config/nvim/lua/plugins/configs/lualine.lua new file mode 100644 index 00000000..7f8bfd7b --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/lualine.lua @@ -0,0 +1,232 @@ +---@diagnostic disable: missing-fields +return { + { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + opts = function() + local present, lualine = pcall(require, "lualine") + if not present then + return + end + + -- Thanks to rockyzhang24 (github.com/rockyzhang24) + + local function simplifiedMode(str) + return "󰀘 " .. (str == "V-LINE" and "VL" or (str == "V-BLOCK" and "VB" or str:sub(1, 1))) + end + + -- For location, show total lines + local function customLocation(str) + return string.gsub(str, "%w+", "%1" .. "/%%L", 1) + end + + -- For progress, add a fancy icon + local function customProgress(str) + return " " .. str + end + + -- For filename, show the filename and the filesize + local function fileNameAndSize(str) + -- For doc, only show filename + if string.find(str, ".*/doc/.*%.txt") then + str = vim.fn.expand("%:t") + end + local size = require("lualine.components.filesize")() + return size == "" and str or str .. " [" .. size .. "]" + end + + local function show_macro_recording() + local recording_register = vim.fn.reg_recording() + if recording_register == "" then + return "" + else + return "Recording @" .. recording_register + end + end + + local show_lsp_name = { + function() + local buf_ft = vim.api.nvim_get_option_value("filetype", { scope = "local" }) + local clients = vim.lsp.get_clients({}) + if next(clients) == nil then + return "No Active Lsp" + else + local msg = nil + for _, client in ipairs(clients) do + local filetypes = client.config.filetypes + -- Prep filetypes for indexing, some language servers only register with a single filetype so we need to + -- convert them into a blob so vim.fn.index doesn't throw a fit + if type(filetypes) == "string" then + filetypes = { filetypes } + end + + if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then + if not msg then + msg = client.name + else + msg = msg .. ", " .. client.name + end + end + end + return msg or "No Active Lsp" + end + end, + icon = " LSP:", + color = { fg = "#957fb8" }, + } + + local macro_refresh_places = { "statusline", "winbar" } + vim.api.nvim_create_autocmd("RecordingEnter", { + callback = function() + lualine.refresh({ + place = macro_refresh_places, + }) + end, + }) + + vim.api.nvim_create_autocmd("RecordingLeave", { + callback = function() + lualine.refresh({ + place = macro_refresh_places, + }) + end, + }) + + return { + options = { + icons_enabled = true, + theme = "auto", + component_separators = { left = "", right = "" }, + section_separators = { left = "", right = "" }, + disabled_filetypes = { "alpha", "neo-tree" }, + always_divide_middle = true, + globalstatus = true, + }, + winbar = { + lualine_a = { + { + "filename", + path = 1, + }, + }, + lualine_b = { + { + "macro-recording", + color = { + fg = "#FF9E3B", + }, + fmt = show_macro_recording, + }, + show_lsp_name, + { + "diagnostics", + sources = { "nvim_diagnostic" }, + symbols = { error = " ", warn = " ", info = " ", hint = " " }, + }, + }, + lualine_c = {}, + lualine_x = { + "encoding", + "fileformat", + "filetype", + }, + lualine_y = { + { + "location", + fmt = customLocation, + }, + }, + lualine_z = { + { + "progress", + fmt = customProgress, + }, + }, + }, + inactive_winbar = { + lualine_a = { { "filename", path = 1 } }, + lualine_b = { show_lsp_name }, + lualine_c = {}, + lualine_x = { + "filetype", + }, + lualine_y = {}, + lualine_z = {}, + }, + sections = { + lualine_a = { + { + "mode", + fmt = simplifiedMode, + }, + }, + lualine_b = { + { + "branch", + icon = "", + }, + { + "diff", + symbols = { added = " ", modified = " ", removed = " " }, + }, + { + "macro-recording", + color = { + fg = "#FF9E3B", + }, + fmt = show_macro_recording, + }, + }, + lualine_c = { + { + "filename", + path = 3, + symbols = { + modified = "[+]", + readonly = "[]", + unnamed = "[No Name]", + }, + fmt = fileNameAndSize, + }, + }, + + -- Right + lualine_x = { + { + function() + local lazy_stats = require("lazy").stats() + local plugin_count = lazy_stats.count + local loaded_plugins = lazy_stats.loaded + return "" .. loaded_plugins .. "/" .. plugin_count .. " " + end, + }, + { + require("lazy.status").updates, + cond = require("lazy.status").has_updates, + }, + }, + lualine_y = { + { + "buffers", + mode = 2, + show_filename_only = false, + }, + }, + lualine_z = { + { "tabs" }, + }, + }, + inactive_sections = {}, + tabline = {}, + extensions = { + "aerial", + "fugitive", + "nvim-tree", + "neo-tree", + "quickfix", + "toggleterm", + }, + } + end, + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/markdown.lua b/dots/.config/nvim/lua/plugins/configs/markdown.lua new file mode 100644 index 00000000..564d20c3 --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/markdown.lua @@ -0,0 +1,7 @@ +return { + { + "iamcco/markdown-preview.nvim", + build = "cd app && npm install", + ft = { "markdown" }, + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/mini.lua b/dots/.config/nvim/lua/plugins/configs/mini.lua new file mode 100644 index 00000000..f9a50eec --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/mini.lua @@ -0,0 +1,10 @@ +return { + { + "echasnovski/mini.nvim", + event = { "BufReadPre", "BufNewFile" }, + config = function() + require("mini.align").setup({}) + require("mini.cursorword").setup({}) + end, + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/mkdir.lua b/dots/.config/nvim/lua/plugins/configs/mkdir.lua new file mode 100644 index 00000000..4578acb7 --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/mkdir.lua @@ -0,0 +1,6 @@ +return { + { + "jghauser/mkdir.nvim", + event = "BufWritePre" + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/move.lua b/dots/.config/nvim/lua/plugins/configs/move.lua new file mode 100644 index 00000000..5f3c293c --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/move.lua @@ -0,0 +1,12 @@ +return { + { + "matze/vim-move", + event = "VeryLazy", + keys = { + "", + "", + "", + "" + } + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/neo-tree.lua b/dots/.config/nvim/lua/plugins/configs/neo-tree.lua new file mode 100644 index 00000000..11c41d50 --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/neo-tree.lua @@ -0,0 +1,32 @@ +return { + { + "nvim-neo-tree/neo-tree.nvim", + dependencies = { + "nvim-tree/nvim-web-devicons", + "nvim-lua/plenary.nvim", + "MunifTanjim/nui.nvim", + }, + cmd = "Neotree", + keys = { + { "nt", "Neotree show toggle focus", desc = "Neotree: Toggle" }, + }, + opts = function() + vim.g.neo_tree_remove_legacy_commands = 1 + + return { + source_selector = { + winbar = true, + }, + filesystem = { + use_libuv_file_watcher = true, + }, + window = { + mappings = { + [""] = "none", + ["/"] = "none", + }, + }, + } + end, + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/neoclip.lua b/dots/.config/nvim/lua/plugins/configs/neoclip.lua new file mode 100644 index 00000000..33c61b62 --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/neoclip.lua @@ -0,0 +1,13 @@ +return { + { + "AckslD/nvim-neoclip.lua", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + { "tami5/sqlite.lua" }, + { "nvim-telescope/telescope.nvim" }, + }, + opts = { + enable_persistent_history = true, + }, + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/neoformat.lua b/dots/.config/nvim/lua/plugins/configs/neoformat.lua old mode 100755 new mode 100644 index 72a2c975..fad9906d --- a/dots/.config/nvim/lua/plugins/configs/neoformat.lua +++ b/dots/.config/nvim/lua/plugins/configs/neoformat.lua @@ -1,8 +1,14 @@ -vim.cmd([[ -let g:neoformat_python_black = { - \ 'exe': 'black', - \ 'stdin': 1, - \ 'args': ['-q', '-'], - \ } -let g:neoformat_enabled_python = ['black'] -]]) +return { + { + "sbdchd/neoformat", + cmd = "Neoformat", + config = function() + vim.g.neoformat_python_black = { + exe = "black", + stdin = 1, + args = { "-q", "-" } + } + vim.g.neoformat_enabled_python = { "black" } + end, + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/neogit.lua b/dots/.config/nvim/lua/plugins/configs/neogit.lua deleted file mode 100644 index d399dd5b..00000000 --- a/dots/.config/nvim/lua/plugins/configs/neogit.lua +++ /dev/null @@ -1,17 +0,0 @@ -local neogit = require("neogit") -neogit.setup({ - disable_insert_on_commit = "auto", - disable_commit_confirmation = true, - disable_builtin_notifications = true, - integrations = { - diffview = true, - telescope = true, - }, -}) - -vim.api.nvim_create_autocmd("FileType", { - pattern = "*Neogit*", - callback = function() - vim.opt_local.list = false - end, -}) diff --git a/dots/.config/nvim/lua/plugins/configs/neoscroll.lua b/dots/.config/nvim/lua/plugins/configs/neoscroll.lua new file mode 100644 index 00000000..f29e575a --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/neoscroll.lua @@ -0,0 +1,9 @@ +return { + { + "karb94/neoscroll.nvim", + event = "WinScrolled", + opts = { + easing_function = "circular", + }, + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/neotree.lua b/dots/.config/nvim/lua/plugins/configs/neotree.lua deleted file mode 100644 index 11d7a649..00000000 --- a/dots/.config/nvim/lua/plugins/configs/neotree.lua +++ /dev/null @@ -1,17 +0,0 @@ -local neotree = require("neo-tree") - -vim.g.neo_tree_remove_legacy_commands = 1 -neotree.setup({ - source_selector = { - winbar = true, - }, - filesystem = { - use_libuv_file_watcher = true, - }, - window = { - mappings = { - [""] = "none", - ["/"] = "none", - }, - }, -}) diff --git a/dots/.config/nvim/lua/plugins/configs/nftables.lua b/dots/.config/nvim/lua/plugins/configs/nftables.lua new file mode 100644 index 00000000..1ea6224c --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/nftables.lua @@ -0,0 +1,6 @@ +return { + { + "nfnty/vim-nftables", + ft = { "nftables" }, + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/nibbler.lua b/dots/.config/nvim/lua/plugins/configs/nibbler.lua new file mode 100644 index 00000000..8faabcb9 --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/nibbler.lua @@ -0,0 +1,17 @@ +return { + { + "skosulor/nibbler", + event = { "BufReadPre", "BufNewFile" }, + cmd = { + "NibblerToBin", + "NibblerToHex", + "NibblerToDec", + "NibblerToCArray", + "NibblerHexStringToCArray", + "NibblerToggle", + }, + opts = { + display_enabled = true, + }, + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/noice.lua b/dots/.config/nvim/lua/plugins/configs/noice.lua index 1d52c083..61ce92cb 100644 --- a/dots/.config/nvim/lua/plugins/configs/noice.lua +++ b/dots/.config/nvim/lua/plugins/configs/noice.lua @@ -1,14 +1,85 @@ -require("noice").setup({ - lsp = { - override = { - ["vim.lsp.util.convert_input_to_markdown_lines"] = true, - ["vim.lsp.util.stylize_markdown"] = true, - ["cmp.entry.get_documentation"] = true, +return { + { + "folke/noice.nvim", + event = "VeryLazy", + opts = { + lsp = { + override = { + ["vim.lsp.util.convert_input_to_markdown_lines"] = true, + ["vim.lsp.util.stylize_markdown"] = true, + ["cmp.entry.get_documentation"] = true, + }, + }, + presets = { + long_message_to_split = true, + inc_rename = true, + command_palette = true, + }, + views = { + cmdline_popup = { + border = { + style = "none", + }, + position = { + row = "99%", + col = "0%", + }, + }, + }, + popupmenu = { + backend = "cmp" + } + }, + dependencies = { + -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries + "MunifTanjim/nui.nvim", + { + "rcarriga/nvim-notify", + keys = { + { + "nd", + function() + require("notify").dismiss({ + pending = true, + silent = true + }) + end, + desc = "Notifications: Dismiss", + }, + }, + opts = { -- Animation style () + stages = "slide", + fps = 60, + + -- Function called when a new window is opened, use for changing win settings/config + on_open = nil, + + -- Function called when a window is closed + on_close = nil, + + -- Render function for notifications. See notify-render() + render = "default", + + -- Default timeout for notifications + timeout = 5000, + + -- For stages that change opacity this is treated as the highlight behind the window + -- Set this to either a highlight group, an RGB hex value e.g. "#000000" or a function returning an RGB code for dynamic values + background_colour = "#000000", + + -- Minimum width for notification windows + minimum_width = 50, + + -- Icons for the different levels + icons = { + ERROR = "", + WARN = "", + INFO = "", + DEBUG = "", + TRACE = "✎", + }, + }, + }, }, }, - - presets = { - long_message_to_split = true, - inc_rename = true, - }, -}) +} diff --git a/dots/.config/nvim/lua/plugins/configs/null_ls.lua b/dots/.config/nvim/lua/plugins/configs/null_ls.lua deleted file mode 100755 index fb317fdb..00000000 --- a/dots/.config/nvim/lua/plugins/configs/null_ls.lua +++ /dev/null @@ -1,11 +0,0 @@ -local null_ls = require("null-ls") - -null_ls.setup({ - sources = { - null_ls.builtins.diagnostics.hadolint, - null_ls.builtins.code_actions.refactoring, - null_ls.builtins.formatting.black, - null_ls.builtins.formatting.stylua, - null_ls.builtins.formatting.prettier, - }, -}) diff --git a/dots/.config/nvim/lua/plugins/configs/nvim-notify.lua b/dots/.config/nvim/lua/plugins/configs/nvim-notify.lua deleted file mode 100755 index bec74b52..00000000 --- a/dots/.config/nvim/lua/plugins/configs/nvim-notify.lua +++ /dev/null @@ -1,35 +0,0 @@ -require("notify").setup({ - -- Animation style (see below for details) - stages = "slide", - fps = 60, - - -- Function called when a new window is opened, use for changing win settings/config - on_open = nil, - - -- Function called when a window is closed - on_close = nil, - - -- Render function for notifications. See notify-render() - render = "default", - - -- Default timeout for notifications - timeout = 5000, - - -- For stages that change opacity this is treated as the highlight behind the window - -- Set this to either a highlight group, an RGB hex value e.g. "#000000" or a function returning an RGB code for dynamic values - background_colour = "#000000", - - -- Minimum width for notification windows - minimum_width = 50, - - -- Icons for the different levels - icons = { - ERROR = "", - WARN = "", - INFO = "", - DEBUG = "", - TRACE = "✎", - }, -}) - --- vim.notify = require('notify') diff --git a/dots/.config/nvim/lua/plugins/configs/nvim-ufo.lua b/dots/.config/nvim/lua/plugins/configs/nvim-ufo.lua index 2aad4c10..0e06e924 100644 --- a/dots/.config/nvim/lua/plugins/configs/nvim-ufo.lua +++ b/dots/.config/nvim/lua/plugins/configs/nvim-ufo.lua @@ -1,46 +1,51 @@ -vim.o.foldcolumn = "1" -vim.o.foldlevel = 99 -vim.o.foldlevelstart = 99 -vim.o.foldenable = true +return { + { + "kevinhwang91/nvim-ufo", + dependencies = { + "kevinhwang91/promise-async", + }, + event = { "BufReadPre", "BufNewFile" }, + opts = function() + vim.keymap.set("n", "zR", require("ufo").openAllFolds) + vim.keymap.set("n", "zM", require("ufo").closeAllFolds) --- Using ufo provider need remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself -vim.keymap.set("n", "zR", require("ufo").openAllFolds) -vim.keymap.set("n", "zM", require("ufo").closeAllFolds) - --- Show numbers for fold text -local handler = function(virtText, lnum, endLnum, width, truncate) - local newVirtText = {} - local suffix = (" 󰁂 %d "):format(endLnum - lnum) - local sufWidth = vim.fn.strdisplaywidth(suffix) - local targetWidth = width - sufWidth - local curWidth = 0 - for _, chunk in ipairs(virtText) do - local chunkText = chunk[1] - local chunkWidth = vim.fn.strdisplaywidth(chunkText) - if targetWidth > curWidth + chunkWidth then - table.insert(newVirtText, chunk) - else - chunkText = truncate(chunkText, targetWidth - curWidth) - local hlGroup = chunk[2] - table.insert(newVirtText, { chunkText, hlGroup }) - chunkWidth = vim.fn.strdisplaywidth(chunkText) - -- str width returned from truncate() may less than 2nd argument, need padding - if curWidth + chunkWidth < targetWidth then - suffix = suffix .. (" "):rep(targetWidth - curWidth - chunkWidth) + -- Show numbers for fold text + local handler = function(virtText, lnum, endLnum, width, truncate) + local newVirtText = {} + local suffix = (" 󰁂 %d "):format(endLnum - lnum) + local sufWidth = vim.fn.strdisplaywidth(suffix) + local targetWidth = width - sufWidth + local curWidth = 0 + for _, chunk in ipairs(virtText) do + local chunkText = chunk[1] + local chunkWidth = vim.fn.strdisplaywidth(chunkText) + if targetWidth > curWidth + chunkWidth then + table.insert(newVirtText, chunk) + else + chunkText = truncate(chunkText, targetWidth - curWidth) + local hlGroup = chunk[2] + table.insert(newVirtText, { chunkText, hlGroup }) + chunkWidth = vim.fn.strdisplaywidth(chunkText) + -- str width returned from truncate() may less than 2nd argument, need padding + if curWidth + chunkWidth < targetWidth then + suffix = suffix .. (" "):rep(targetWidth - curWidth - chunkWidth) + end + break + end + curWidth = curWidth + chunkWidth + end + table.insert(newVirtText, { suffix, "@conditional" }) + return newVirtText end - break - end - curWidth = curWidth + chunkWidth - end - table.insert(newVirtText, { suffix, "@conditional" }) - return newVirtText -end -local ft_options = { norg = "" } -require("ufo").setup({ - provider_selector = function(bufnr, filetype, buftype) - return ft_options[filetype] or { "treesitter", "indent" } - end, - fold_virt_text_handler = handler, - disabled = { "norg" }, -}) + local ft_options = { norg = "" } + return { + provider_selector = function(_, filetype, _) + return ft_options[filetype] or { "treesitter", "indent" } + end, + fold_virt_text_handler = handler, + disabled = { "norg" }, + } + end, + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/overseer.lua b/dots/.config/nvim/lua/plugins/configs/overseer.lua new file mode 100644 index 00000000..c5e4192e --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/overseer.lua @@ -0,0 +1,26 @@ +return { + { + "stevearc/overseer.nvim", + cmd = { + "OverseerRun", + "OverseerInfo", + "OverseerOpen", + "OverseerBuild", + "OverseerClose", + "OverseerRunCmd", + "OverseerToggle", + "OverseerClearCache", + "OverseerLoadBundle", + "OverseerSaveBundle", + "OverseerTaskAction", + "OverseerQuickAction", + "OverseerDeleteBundle", + }, + keys = { + { "or", desc = "> Overseer" }, + { "or", vim.cmd.OverseerRun, desc = "Overseer: Run" }, + { "ot", vim.cmd.OverseerToggle, desc = "Overseer: Toggle" }, + }, + opts = {}, + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/python-dap.lua b/dots/.config/nvim/lua/plugins/configs/python-dap.lua deleted file mode 100755 index 2b1f8404..00000000 --- a/dots/.config/nvim/lua/plugins/configs/python-dap.lua +++ /dev/null @@ -1,3 +0,0 @@ -local dap_python = require("dap-python") -dap_python.setup(vim.fn.stdpath("data") .. "/mason/packages/debugpy/venv/bin/python3") -dap_python.test_runner = "pytest" diff --git a/dots/.config/nvim/lua/plugins/configs/statuscol.lua b/dots/.config/nvim/lua/plugins/configs/statuscol.lua new file mode 100644 index 00000000..8ca49127 --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/statuscol.lua @@ -0,0 +1,50 @@ +return { + { + "gen740/SmoothCursor.nvim", + event = { "BufReadPre", "BufNewFile" }, + opts = { + priority = 8, + fancy = { + enable = true, + head = { cursor = "⯈", texthl = "SmoothCursorCursor", linehl = nil }, + body = { + { cursor = "", texthl = "SmoothCursorTrailBig1" }, + { cursor = "", texthl = "SmoothCursorTrailBig2" }, + { cursor = "󰝥", texthl = "SmoothCursorTrailMedium" }, + { cursor = "󰝥", texthl = "SmoothCursorTrailMedium" }, + { cursor = "•", texthl = "SmoothCursorTrailSmall" }, + { cursor = ".", texthl = "SmoothCursorTrailXSmall" }, + { cursor = ".", texthl = "SmoothCursorTrailXSmall" }, + }, + }, + disabled_filetypes = { "NeogitNotification" }, + }, + }, + { + "luukvbaal/statuscol.nvim", + event = { "BufReadPre", "BufNewFile" }, + opts = function() + local builtin = require("statuscol.builtin") + return { + foldfunc = "builtin", + setopt = true, + relculright = false, + segments = { + { text = { "%s" }, click = "v:lua.ScSa" }, + { text = { builtin.lnumfunc }, click = "v:lua.ScLa" }, + { text = { " ", builtin.foldfunc, " " }, click = "v:lua.ScFa" }, + }, + } + end, + }, + { + "lewis6991/gitsigns.nvim", + event = { "BufReadPre", "BufNewFile" }, + opts = { + current_line_blame = true, + current_line_blame_opts = { + delay = 0, + }, + }, + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/statusline.lua b/dots/.config/nvim/lua/plugins/configs/statusline.lua deleted file mode 100755 index fe5db2cd..00000000 --- a/dots/.config/nvim/lua/plugins/configs/statusline.lua +++ /dev/null @@ -1,224 +0,0 @@ -local util = require("utils.funcs") -local present, lualine = pcall(require, "lualine") -if not present then - return -end - --- Thanks to rockyzhang24 (github.com/rockyzhang24) - -local function simplifiedMode(str) - return "󰀘 " .. (str == "V-LINE" and "VL" or (str == "V-BLOCK" and "VB" or str:sub(1, 1))) -end - --- For location, show total lines -local function customLocation(str) - return string.gsub(str, "%w+", "%1" .. "/%%L", 1) -end - --- For progress, add a fancy icon -local function customProgress(str) - return " " .. str -end - --- For filename, show the filename and the filesize -local function fileNameAndSize(str) - -- For doc, only show filename - if string.find(str, ".*/doc/.*%.txt") then - str = vim.fn.expand("%:t") - end - local size = require("lualine.components.filesize")() - return size == "" and str or str .. " [" .. size .. "]" -end - -local function show_macro_recording() - local recording_register = vim.fn.reg_recording() - if recording_register == "" then - return "" - else - return "Recording @" .. recording_register - end -end - -local show_lsp_name = { - function() - local buf_ft = vim.api.nvim_get_option_value("filetype", { scope = "local" }) - local clients = vim.lsp.get_active_clients() - if next(clients) == nil then - return "No Active Lsp" - else - local msg = nil - for _, client in ipairs(clients) do - local filetypes = client.config.filetypes - -- Prep filetypes for indexing, some language servers only register with a single filetype so we need to - -- convert them into a blob so vim.fn.index doesn't throw a fit - if type(filetypes) == "string" then - filetypes = { filetypes } - end - - if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then - if not msg then - msg = client.name - else - msg = msg .. ", " .. client.name - end - end - end - return msg or "No Active Lsp" - end - end, - icon = " LSP:", - color = { fg = "#957fb8" }, -} - -lualine.setup({ - options = { - icons_enabled = true, - theme = "auto", - component_separators = { left = "", right = "" }, - section_separators = { left = "", right = "" }, - disabled_filetypes = { "alpha", "neo-tree" }, - always_divide_middle = true, - globalstatus = true, - }, - winbar = { - lualine_a = { - { - "filename", - path = 1, - }, - }, - lualine_b = { - { - "macro-recording", - color = { - fg = "#FF9E3B", - }, - fmt = show_macro_recording, - }, - show_lsp_name, - { - "diagnostics", - sources = { "nvim_diagnostic" }, - symbols = { error = " ", warn = " ", info = " ", hint = " " }, - }, - }, - lualine_c = {}, - lualine_x = { - "encoding", - "fileformat", - "filetype", - }, - lualine_y = { - { - "location", - fmt = customLocation, - }, - }, - lualine_z = { - { - "progress", - fmt = customProgress, - }, - }, - }, - inactive_winbar = { - lualine_a = { { "filename", path = 1 } }, - lualine_b = { show_lsp_name }, - lualine_c = {}, - lualine_x = { - "filetype", - }, - lualine_y = {}, - lualine_z = {}, - }, - sections = { - lualine_a = { - { - "mode", - fmt = simplifiedMode, - }, - }, - lualine_b = { - { - "branch", - icon = "", - }, - { - "diff", - symbols = { added = " ", modified = " ", removed = " " }, - }, - { - "macro-recording", - color = { - fg = "#FF9E3B", - }, - fmt = show_macro_recording, - }, - }, - lualine_c = { - { - "filename", - path = 3, - symbols = { - modified = "[+]", - readonly = "[]", - unnamed = "[No Name]", - }, - fmt = fileNameAndSize, - }, - }, - - -- Right - lualine_x = { - { - function() - local lazy_stats = require("lazy").stats() - local plugin_count = lazy_stats.count - local loaded_plugins = lazy_stats.loaded - return "" .. loaded_plugins .. "/" .. plugin_count .. " " - end, - }, - { - require("lazy.status").updates, - cond = require("lazy.status").has_updates, - }, - }, - lualine_y = { - { - "buffers", - mode = 2, - show_filename_only = false, - }, - }, - lualine_z = { - { "tabs" }, - }, - }, - inactive_sections = {}, - tabline = {}, - extensions = { - "aerial", - "fugitive", - "nvim-tree", - "neo-tree", - "quickfix", - "toggleterm", - }, -}) - -local macro_refresh_places = { "statusline", "winbar" } -vim.api.nvim_create_autocmd("RecordingEnter", { - callback = function() - lualine.refresh({ - place = macro_refresh_places, - }) - end, -}) - -vim.api.nvim_create_autocmd("RecordingLeave", { - callback = function() - lualine.refresh({ - place = macro_refresh_places, - }) - end, -}) diff --git a/dots/.config/nvim/lua/plugins/configs/surround.lua b/dots/.config/nvim/lua/plugins/configs/surround.lua new file mode 100644 index 00000000..d2078542 --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/surround.lua @@ -0,0 +1,7 @@ +return { + { + "kylechui/nvim-surround", + event = { "BufReadPre", "BufNewFile" }, + opts = {}, + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/telescope-nvim.lua b/dots/.config/nvim/lua/plugins/configs/telescope-nvim.lua deleted file mode 100755 index 9a60b8d5..00000000 --- a/dots/.config/nvim/lua/plugins/configs/telescope-nvim.lua +++ /dev/null @@ -1,150 +0,0 @@ -local telescope = require("telescope") -local actions = require("telescope.actions") - -telescope.setup({ - pickers = { - find_files = { - find_command = { - "fd", - "--no-ignore", - }, - hidden = true, - }, - }, - defaults = { - vimgrep_arguments = { - "rg", - "--color=never", - "--no-heading", - "--with-filename", - "--line-number", - "--column", - "--hidden", - "--smart-case", - }, - history = { - path = "~/.local/share/nvim/databases/telescope_history.sqlite3", - limit = 1000, - }, - mappings = { - i = { - [""] = actions.cycle_history_next, - [""] = actions.cycle_history_prev, - }, - }, - prompt_prefix = "  ", - selection_caret = " ", - entry_prefix = " ", - initial_mode = "insert", - selection_strategy = "reset", - sorting_strategy = "ascending", - layout_strategy = "flex", - layout_config = { - vertical = { - prompt_position = "top", - width = 0.90, - height = 0.98, - preview_height = 0.65, - }, - horizontal = { - prompt_position = "top", - width = 0.90, - height = 0.98, - preview_width = 0.70, - }, - flex = { - flip_cloumns = 120, - }, - }, - file_sorter = require("telescope.sorters").get_fuzzy_file, - generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter, - path_display = { "truncate" }, - winblend = 0, - border = {}, - borderchars = { " ", "", "", "", "", "", "", "" }, - results_title = false, - color_devicons = true, - use_less = true, - set_env = { ["COLORTERM"] = "truecolor" }, - file_previewer = require("telescope.previewers").vim_buffer_cat.new, - grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new, - qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new, - buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker, - }, - extensions = { - media_files = { - filetypes = { "png", "webp", "jpg", "jpeg" }, - find_cmd = "rg", - }, - ["ui-select"] = { - require("telescope.themes").get_dropdown(), - }, - undo = { - side_by_side = true, - use_delta = true, - mappings = { - i = { - [""] = require("telescope-undo.actions").yank_additions, - [""] = require("telescope-undo.actions").yank_deletions, - [""] = require("telescope-undo.actions").restore, - }, - }, - layout_strategy = "vertical", - layout_config = { - preview_height = 0.8, - }, - }, - }, -}) - -telescope.load_extension("media_files") -telescope.load_extension("find_directories") -telescope.load_extension("file_browser") -telescope.load_extension("notify") -telescope.load_extension("fzf") -telescope.load_extension("ui-select") -telescope.load_extension("smart_history") -telescope.load_extension("undo") - -vim.api.nvim_create_user_command("Search", function() - -- Thank you u/SPEKTRUMdagreat :) - local search = vim.fn.input("Search: ") - local pickers = require("telescope.pickers") - local finders = require("telescope.finders") - local conf = require("telescope.config").values - ---@diagnostic disable-next-line: redefined-local - local actions = require("telescope.actions") - local action_state = require("telescope.actions.state") - - -- our picker function: colors - local searcher = function(opts) - opts = opts or {} - pickers - .new(opts, { - prompt_title = "OmniSearch", - finder = finders.new_table({ - results = { - { "Stack Overflow", ("www.stackoverflow.com/search\\?q\\=" .. search:gsub(" ", "+")) }, - { "Google Search", ("www.google.com/search\\?q\\=" .. search:gsub(" ", "+")) }, - { "Youtube", ("https://www.youtube.com/results\\?search_query\\=" .. search:gsub(" ", "+")) }, - { "Wikipedia", ("https://en.wikipedia.org/w/index.php\\?search\\=" .. search:gsub(" ", "+")) }, - { "Github", ("https://github.com/search\\?q\\=" .. search:gsub(" ", "+")) }, - }, - entry_maker = function(entry) - return { value = entry, display = entry[1], ordinal = entry[1] } - end, - }), - sorter = conf.generic_sorter(opts), - attach_mappings = function(prompt_bufnr, map) - actions.select_default:replace(function() - actions.close(prompt_bufnr) - local selection = action_state.get_selected_entry() - vim.cmd(("silent execute '!firefox-developer-edition %s &'"):format(selection["value"][2])) - end) - return true - end, - }) - :find() - end - searcher(require("telescope.themes").get_dropdown({})) -end, { nargs = 0 }) diff --git a/dots/.config/nvim/lua/plugins/configs/telescope.lua b/dots/.config/nvim/lua/plugins/configs/telescope.lua new file mode 100644 index 00000000..b25c4129 --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/telescope.lua @@ -0,0 +1,214 @@ +return { + { + "nvim-telescope/telescope.nvim", + cmd = { + "Telescope", + "Search", + }, + keys = { + { + "lq", + ":Telescope diagnostics bufnr=0", + desc = "LSP: Telescope Diagnostics", + }, + { "t", desc = "> Telescope" }, + { "tg", desc = "> Telescope: Git" }, + { "tw", ":Telescope live_grep", desc = "Telescope: Grep for Word" }, + { "tgs", ":Telescope git_status", desc = "Telescope: Git Status" }, + { "tgc", ":Telescope git_commits", desc = "Telescope: Git Commits" }, + { "tgb", ":Telescope git_branches", desc = "Telescope: Git Branches" }, + { "tf", ":Telescope find_files", desc = "Telescope: Find Files" }, + { "td", ":Telescope find_directories", desc = "Telescope: Find Directories" }, + { "tb", ":Telescope buffers", desc = "Telescope: Buffers" }, + { "th", ":Telescope help_tags", desc = "Telescope: Help Tags" }, + { "to", ":Telescope oldfiles", desc = "Telescope: Recent Files" }, + { "tn", ":Telescope neoclip default", desc = "Telescope: Neoclip Buffer" }, + { "tr", ":Telescope resume", desc = "Telescope: Resume" }, + { "tR", ":Telescope registers", desc = "Telescope: Registers" }, + { "tt", ":Telescope file_browser", desc = "Telescope: File Tree" }, + { "ts", ":Telescope spell_suggest", desc = "Telescope: Spell Suggest" }, + { "tl", ":Telescope resume", desc = "Telescope: Previous State" }, + { "tT", ":TodoTelescope", desc = "Telescope: Todo Items" }, + { "tk", ":Telescope keymaps", desc = "Telescope: Keymaps" }, + { "tc", ":Telescope commands", desc = "Telescope: Commands" }, + { "tu", ":Telescope undo", desc = "Telescope: Undo History" }, + { "lq", ":Telescope diagnostics bufnr=0", desc = "LSP: Telescope Diagnostics" }, + { "nv", ":Telescope notify", desc = "Notifications: Search" }, + }, + dependencies = { + "nvim-telescope/telescope-media-files.nvim", + "nvim-telescope/telescope-file-browser.nvim", + "artart222/telescope_find_directories", + "nvim-telescope/telescope-ui-select.nvim", + "debugloop/telescope-undo.nvim", + "rcarriga/nvim-notify", + { "nvim-telescope/telescope-smart-history.nvim", dependencies = "tami5/sqlite.lua" }, + { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, + }, + config = function() + local telescope = require("telescope") + local actions = require("telescope.actions") + + telescope.setup({ + pickers = { + find_files = { + find_command = { + "fd", + "--no-ignore", + }, + hidden = true, + }, + }, + defaults = { + vimgrep_arguments = { + "rg", + "--color=never", + "--no-heading", + "--with-filename", + "--line-number", + "--column", + "--hidden", + "--smart-case", + }, + history = { + path = "~/.local/share/nvim/databases/telescope_history.sqlite3", + limit = 1000, + }, + mappings = { + i = { + [""] = actions.cycle_history_next, + [""] = actions.cycle_history_prev, + }, + }, + prompt_prefix = "  ", + selection_caret = " ", + entry_prefix = " ", + initial_mode = "insert", + selection_strategy = "reset", + sorting_strategy = "ascending", + layout_strategy = "flex", + layout_config = { + vertical = { + prompt_position = "top", + width = 0.90, + height = 0.98, + preview_height = 0.65, + }, + horizontal = { + prompt_position = "top", + width = 0.90, + height = 0.98, + preview_width = 0.70, + }, + flex = { + flip_cloumns = 120, + }, + }, + file_sorter = require("telescope.sorters").get_fuzzy_file, + generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter, + path_display = { "truncate" }, + winblend = 0, + border = {}, + borderchars = { " ", "", "", "", "", "", "", "" }, + results_title = false, + color_devicons = true, + use_less = true, + set_env = { ["COLORTERM"] = "truecolor" }, + file_previewer = require("telescope.previewers").vim_buffer_cat.new, + grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new, + qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new, + buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker, + }, + extensions = { + media_files = { + filetypes = { "png", "webp", "jpg", "jpeg" }, + find_cmd = "rg", + }, + ["ui-select"] = { + require("telescope.themes").get_dropdown(), + }, + undo = { + side_by_side = true, + use_delta = true, + mappings = { + i = { + [""] = require("telescope-undo.actions").yank_additions, + [""] = require("telescope-undo.actions").yank_deletions, + [""] = require("telescope-undo.actions").restore, + }, + }, + layout_strategy = "vertical", + layout_config = { + preview_height = 0.8, + }, + }, + }, + }) + + telescope.load_extension("media_files") + telescope.load_extension("find_directories") + telescope.load_extension("file_browser") + telescope.load_extension("notify") + telescope.load_extension("fzf") + telescope.load_extension("ui-select") + telescope.load_extension("smart_history") + telescope.load_extension("undo") + + vim.api.nvim_create_user_command("Search", function() + -- Thank you u/SPEKTRUMdagreat :) + local search = vim.fn.input("Search: ") + local pickers = require("telescope.pickers") + local finders = require("telescope.finders") + local conf = require("telescope.config").values + ---@diagnostic disable-next-line: redefined-local + local actions = require("telescope.actions") + local action_state = require("telescope.actions.state") + + -- our picker function: colors + local searcher = function(opts) + opts = opts or {} + pickers + .new(opts, { + prompt_title = "OmniSearch", + finder = finders.new_table({ + results = { + { + "Stack Overflow", + ("www.stackoverflow.com/search\\?q\\=" .. search:gsub(" ", "+")), + }, + { "Google Search", ("www.google.com/search\\?q\\=" .. search:gsub(" ", "+")) }, + { + "Youtube", + ("https://www.youtube.com/results\\?search_query\\=" .. search:gsub(" ", "+")), + }, + { + "Wikipedia", + ("https://en.wikipedia.org/w/index.php\\?search\\=" .. search:gsub(" ", "+")), + }, + { "Github", ("https://github.com/search\\?q\\=" .. search:gsub(" ", "+")) }, + }, + entry_maker = function(entry) + return { value = entry, display = entry[1], ordinal = entry[1] } + end, + }), + sorter = conf.generic_sorter(opts), + attach_mappings = function(prompt_bufnr, _) + actions.select_default:replace(function() + actions.close(prompt_bufnr) + local selection = action_state.get_selected_entry() + vim.cmd( + ("silent execute '!firefox-developer-edition %s &'"):format( + selection["value"][2] + ) + ) + end) + return true + end, + }) + :find() + end + searcher(require("telescope.themes").get_dropdown({})) + end, { nargs = 0 }) + end, + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/tint.lua b/dots/.config/nvim/lua/plugins/configs/tint.lua new file mode 100644 index 00000000..aa80906e --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/tint.lua @@ -0,0 +1,28 @@ +return { + { + "levouh/tint.nvim", + event = "WinLeave", + opts = { + highlight_ignore_patterns = { + "WinSeparator", + }, + window_ignore_function = function(winid) + local bufid = vim.api.nvim_win_get_buf(winid) + + local ignoredFiletypes = { "DiffviewFiles", "DiffviewFileHistory", "neo-tree" } + local ignoredBuftypes = { "terminal" } + + local isDiff = vim.api.nvim_win_get_option(winid, "diff") + local isFloating = vim.api.nvim_win_get_config(winid).relative ~= "" + local isIgnoredBuftype = + vim.tbl_contains(ignoredBuftypes, vim.api.nvim_buf_get_option(bufid, "buftype")) + local isIgnoredFiletype = + vim.tbl_contains(ignoredFiletypes, vim.api.nvim_buf_get_option(bufid, "filetype")) + + return isDiff or isFloating or isIgnoredBuftype or isIgnoredFiletype + end, + tint = -30, + saturation = 0.8, + }, + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/toggleterm.lua b/dots/.config/nvim/lua/plugins/configs/toggleterm.lua new file mode 100644 index 00000000..05ae34fe --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/toggleterm.lua @@ -0,0 +1,27 @@ +return { + { + "akinsho/toggleterm.nvim", + keys = { + {"", "ToggleTerm", desc = "ToggleTerm: Toggle" }, + }, + opts = { + start_in_insert = false, + direction = "float", + autochdir = true, + winbar = { + enable = true, + name_formatter = function(term) -- term: Terminal + return term.name + end, + }, + }, + cmd = { + "ToggleTerm", + "ToggleTermSetName", + "ToggleTermToggleAll", + "ToggleTermSendCurrentLine", + "ToggleTermSendVisualLines", + "ToggleTermSendVisualSelection", + }, + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/treesitter.lua b/dots/.config/nvim/lua/plugins/configs/treesitter.lua old mode 100755 new mode 100644 index 15562ff5..2832d6fb --- a/dots/.config/nvim/lua/plugins/configs/treesitter.lua +++ b/dots/.config/nvim/lua/plugins/configs/treesitter.lua @@ -1,101 +1,208 @@ -local nvim_treesitter = require("nvim-treesitter.configs") - -local treesitter_dir = vim.fn.stdpath("data") .. "/treesitter" - -vim.opt.runtimepath:append(treesitter_dir) - -nvim_treesitter.setup({ - parser_install_dir = treesitter_dir, - ensure_installed = "all", - incremental_selection = { - enable = true, - keymaps = { - init_selection = "", - scope_incremental = "", - node_incremental = "", - node_decremental = "", +---@diagnostic disable: missing-fields +return { + { + "danymat/neogen", + keys = { + { "ng", desc = "> Neogen" }, + { "ngf", "Neogen func", desc = "Neogen: Function Annotation" }, + { "ngc", "Neogen class", desc = "Neogen: Class Annotation" }, + { "ngt", "Neogen type", desc = "Neogen: Type Annotation" }, + { "ngb", "Neogen file", desc = "Neogen: File Annotation" }, + }, + cmd = { + "Neogen", + }, + dependencies = "nvim-treesitter/nvim-treesitter", + opts = { + snippet_engine = "luasnip", + languages = { + cs = { + template = { + annotation_convention = "xmldoc", + }, + }, + }, }, }, - highlight = { - enable = true, - additional_vim_regex_highlighting = false, - disable = function(_, buf) - local disabled_filetypes = { - "tex", - } - - for _, ft in ipairs(disabled_filetypes) do - if vim.bo.filetype == ft then - return true - end - end - - local max_filesize = 100 * 1024 -- 100 KB - local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) - if ok and stats and stats.size > max_filesize then - return true - end + { + "nvim-treesitter/nvim-treesitter-context", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + "nvim-treesitter/nvim-treesitter", + }, + config = function() + require("treesitter-context").setup({}) + vim.cmd.TSContextEnable() end, }, - matchup = { enable = true }, - autotag = { - enable = true, - }, - indent = { enable = true }, - textobjects = { - select = { - enable = true, - lookahead = true, - disable = function(lang, bufnr) - local mode = vim.fn.mode() - if mode == "c" then - return true - end - end, - keymaps = { - ["af"] = "@function.outer", - ["if"] = "@function.inner", - ["ac"] = "@class.outer", - ["ic"] = "@class.inner", - ["ib"] = "@block.inner", - ["ab"] = "@block.outer", - ["as"] = { query = "@scope", query_group = "locals", desc = "Select language scope" }, - }, - }, - move = { - enable = true, - disable = function(lang, bufnr) - local mode = vim.fn.mode() - if mode == "c" then - return true - end - end, - set_jumps = true, - goto_next_start = { - ["]fs"] = "@function.outer", - ["]bs"] = "@block.outer", - }, - goto_next_end = { - ["]fe"] = "@function.outer", - ["]be"] = "@block.outer", - }, - goto_previous_start = { - ["[fs"] = "@function.outer", - ["[bs"] = "@block.outer", - }, - goto_previous_end = { - ["[fe"] = "@function.outer", - ["[bs"] = "@block.outer", - }, + { + "windwp/nvim-ts-autotag", + dependencies = { "nvim-treesitter/nvim-treesitter" }, + event = { "BufReadPre", "BufNewFile" }, + config = true, + ft = { + "astro", + "glimmer", + "handlebars", + "html", + "javascript", + "jsx", + "markdown", + "php", + "rescript", + "svelte", + "tsx", + "typescript", + "vue", + "xml", }, }, - playground = { - enable = true, + { + url = "https://gitlab.com/HiPhish/rainbow-delimiters.nvim", + dependencies = { "nvim-treesitter/nvim-treesitter" }, + event = { "BufReadPre", "BufNewFile" }, + config = function() + local rainbow_delimiters = require("rainbow-delimiters") + vim.g.rainbow_delimiters = { + strategy = { + on_attach = function() + if vim.fn.line("$") > 10000 then + return nil + elseif vim.fn.line("$") > 1000 then + return rainbow_delimiters.strategy["global"] + end + return rainbow_delimiters.strategy["local"] + end, + }, + query = { + [""] = "rainbow-delimiters", + lua = "rainbow-blocks", + latex = "rainbow-blocks", + html = "rainbow-blocks", + javascript = "rainbow-delimiters-react", + tsx = "rainbow-parens", + verilog = "rainbow-blocks", + }, + highlight = { + "RainbowDelimiterRed", + "RainbowDelimiterYellow", + "RainbowDelimiterBlue", + "RainbowDelimiterOrange", + "RainbowDelimiterGreen", + "RainbowDelimiterViolet", + "RainbowDelimiterCyan", + }, + } + end, }, - query_linter = { - enable = true, - }, -}) + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + event = { "BufReadPost", "BufNewFile" }, + dependencies = { + "nvim-treesitter/playground", + { + "pfeiferj/nvim-hurl", + config = true, + }, + }, + config = function() + local treesitter_dir = vim.fn.stdpath("data") .. "/treesitter" -require("treesitter-context").setup({}) -vim.cmd.TSContextEnable() + vim.opt.runtimepath:append(treesitter_dir) + + require("nvim-treesitter.configs").setup({ + parser_install_dir = treesitter_dir, + ensure_installed = "all", + incremental_selection = { + enable = true, + keymaps = { + init_selection = "", + scope_incremental = "", + node_incremental = "", + node_decremental = "", + }, + }, + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + disable = function(_, buf) + local disabled_filetypes = { + "tex", + } + + for _, ft in ipairs(disabled_filetypes) do + if vim.bo.filetype == ft then + return true + end + end + + local max_filesize = 100 * 1024 -- 100 KB + local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) + if ok and stats and stats.size > max_filesize then + return true + end + end, + }, + matchup = { enable = true }, + autotag = { + enable = true, + }, + indent = { enable = true }, + -- textobjects = { + -- select = { + -- enable = true, + -- lookahead = true, + -- disable = function(lang, bufnr) + -- local mode = vim.fn.mode() + -- if mode == "c" then + -- return true + -- end + -- end, + -- keymaps = { + -- ["af"] = "@function.outer", + -- ["if"] = "@function.inner", + -- ["ac"] = "@class.outer", + -- ["ic"] = "@class.inner", + -- ["ib"] = "@block.inner", + -- ["ab"] = "@block.outer", + -- ["as"] = { query = "@scope", query_group = "locals", desc = "Select language scope" }, + -- }, + -- }, + -- move = { + -- enable = true, + -- disable = function(lang, bufnr) + -- local mode = vim.fn.mode() + -- if mode == "c" then + -- return true + -- end + -- end, + -- set_jumps = true, + -- goto_next_start = { + -- ["]fs"] = "@function.outer", + -- ["]bs"] = "@block.outer", + -- }, + -- goto_next_end = { + -- ["]fe"] = "@function.outer", + -- ["]be"] = "@block.outer", + -- }, + -- goto_previous_start = { + -- ["[fs"] = "@function.outer", + -- ["[bs"] = "@block.outer", + -- }, + -- goto_previous_end = { + -- ["[fe"] = "@function.outer", + -- ["[bs"] = "@block.outer", + -- }, + -- }, + -- }, + playground = { + enable = true, + }, + query_linter = { + enable = true, + }, + }) + end, + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/trouble.lua b/dots/.config/nvim/lua/plugins/configs/trouble.lua new file mode 100644 index 00000000..40598eb5 --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/trouble.lua @@ -0,0 +1,53 @@ +return { + { + "folke/todo-comments.nvim", + event = { "BufReadPre", "BufNewFile" }, + keys = { + { "xt", "TodoTrouble", desc = "Trouble: Todo Items" }, + }, + cmd = { + "TodoTrouble", + "TodoTelescope", + "TodoQuickFix", + "TodoLocList", + }, + dependencies = { "nvim-lua/plenary.nvim" }, + config = true, + }, + { + "folke/trouble.nvim", + keys = { + { "x", desc = "> Trouble" }, + { "lr", "TroubleToggle lsp_references", desc = "LSP: References" }, + { + "li", + "TroubleToggle lsp_implementations", + desc = "LSP: Implementation", + }, + { "ld", "TroubleToggle lsp_definitions", desc = "LSP: Definition" }, + { "xd", "TroubleToggle document_diagnostics", desc = "Trouble: Document Diagnostics" }, + { "xl", "TroubleToggle loclist", desc = "Trouble: Loclist" }, + { "xq", "TroubleToggle quickfix", desc = "Trouble: Quickfix" }, + { "xt", "TodoTrouble", desc = "Trouble: Todo Items" }, + }, + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function() + require("trouble").setup({ + auto_close = true, + position = "right", + }) + vim.api.nvim_create_autocmd("BufLeave", { + pattern = "*Trouble*", + callback = function() + vim.api.nvim_win_close(0, true) + end, + }) + end, + cmd = { + "Trouble", + "TroubleClose", + "TroubleToggle", + "TroubleRefresh", + }, + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/vim-visual-multi.lua b/dots/.config/nvim/lua/plugins/configs/vim-visual-multi.lua new file mode 100644 index 00000000..cddb1c97 --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/vim-visual-multi.lua @@ -0,0 +1,9 @@ +return { + { + "mg979/vim-visual-multi", + event = "VeryLazy", + config = function() + vim.cmd.VMTheme("codedark") + end, + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/vimtex.lua b/dots/.config/nvim/lua/plugins/configs/vimtex.lua new file mode 100644 index 00000000..ed85db67 --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/vimtex.lua @@ -0,0 +1,10 @@ +return { + { + "lervag/vimtex", + ft = "tex", + config = function() + vim.g.vimtext_view_method = "zathura" + vim.g.vimtex_view_general_viewer = "zathura" + end, + }, +} diff --git a/dots/.config/nvim/lua/plugins/configs/which-key.lua b/dots/.config/nvim/lua/plugins/configs/which-key.lua new file mode 100644 index 00000000..6126109a --- /dev/null +++ b/dots/.config/nvim/lua/plugins/configs/which-key.lua @@ -0,0 +1,11 @@ +return { + { + "folke/which-key.nvim", + event = "VeryLazy", + config = function() + local wk = require("which-key") + wk.setup() + end, + opts = {}, + }, +} diff --git a/dots/.config/nvim/lua/plugins/init.lua b/dots/.config/nvim/lua/plugins/init.lua index c5b3dcea..6e83a0a3 100755 --- a/dots/.config/nvim/lua/plugins/init.lua +++ b/dots/.config/nvim/lua/plugins/init.lua @@ -1 +1,50 @@ -require("plugins.plugins") +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.notify("Installing Lazy plugin manager, please wait...") + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "--single-branch", + "https://github.com/folke/lazy.nvim.git", + lazypath, + }) +end +vim.opt.runtimepath:prepend(lazypath) + +local lazy = require("lazy") + +lazy.setup("plugins.configs", { + defaults = { + version = false, + lazy = false, + }, + colorscheme = function() + vim.cmd.colorscheme("kanagawa") + vim.notify("WTF!") + end, + checker = { + enabled = true, + concurrency = 20, + notify = false, + }, + lockfile = vim.fn.stdpath("config") .. "/lazy-lock.json", + dev = { + path = "~/Git/Neovim", + }, + install = { + missing = true, + colorscheme = { "kanagawa" }, + }, + performance = { + rtp = { + disabled_plugins = { + "gzip", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, +}) diff --git a/dots/.config/nvim/lua/plugins/mappings.lua b/dots/.config/nvim/lua/plugins/mappings.lua deleted file mode 100755 index 70f811f2..00000000 --- a/dots/.config/nvim/lua/plugins/mappings.lua +++ /dev/null @@ -1,339 +0,0 @@ -local loaded = pcall(require, "plenary.async") - -if not loaded then - return -end - -local wk = require("which-key") - --- Telescope mappings -wk.register({ - t = { - name = "Telescope", - }, -}, { prefix = "" }) -vim.keymap.set("n", "tw", ":Telescope live_grep", { silent = true, desc = "Telescope: Grep for Word" }) -vim.keymap.set("n", "tgs", ":Telescope git_status", { silent = true, desc = "Telescope: Git Status" }) -vim.keymap.set("n", "tgc", ":Telescope git_commits", { silent = true, desc = "Telescope: Git Commits" }) -vim.keymap.set("n", "tgb", ":Telescope git_branches", { silent = true, desc = "Telescope: Git Branches" }) -vim.keymap.set("n", "tf", ":Telescope find_files", { silent = true, desc = "Telescope: Find Files" }) -vim.keymap.set( - "n", - "td", - ":Telescope find_directories", - { silent = true, desc = "Telescope: Find Directories" } -) -vim.keymap.set("n", "tb", ":Telescope buffers", { silent = true, desc = "Telescope: Buffers" }) -vim.keymap.set("n", "th", ":Telescope help_tags", { silent = true, desc = "Telescope: Help Tags" }) -vim.keymap.set("n", "to", ":Telescope oldfiles", { silent = true, desc = "Telescope: Recent Files" }) -vim.keymap.set( - "n", - "tn", - ":Telescope neoclip default", - { silent = true, desc = "Telescope: Neoclip Buffer" } -) -vim.keymap.set("n", "tr", ":Telescope resume", { silent = true, desc = "Telescope: Resume" }) -vim.keymap.set("n", "tR", ":Telescope registers", { silent = true, desc = "Telescope: Registers" }) -vim.keymap.set("n", "tt", ":Telescope file_browser", { silent = true, desc = "Telescope: File Tree" }) -vim.keymap.set("n", "ts", ":Telescope spell_suggest", { silent = true, desc = "Telescope: Spell Suggest" }) -vim.keymap.set("n", "tl", ":Telescope resume", { silent = true, desc = "Telescope: Previous State" }) -vim.keymap.set("n", "tT", ":TodoTelescope", { silent = true, desc = "Telescope: Todo Items" }) -vim.keymap.set("n", "tk", ":Telescope keymaps", { silent = true, desc = "Telescope: Keymaps" }) -vim.keymap.set("n", "tc", ":Telescope commands", { silent = true, desc = "Telescope: Commands" }) -vim.keymap.set("n", "tu", ":Telescope undo", { silent = true, desc = "Telescope: Undo History" }) - --- Lsp Mappings -wk.register({ - l = { - name = "LSP", - }, -}, { prefix = "" }) -vim.keymap.set("n", "lD", vim.lsp.buf.declaration, { silent = true, desc = "LSP: Declaration" }) -vim.keymap.set("n", "ld", "TroubleToggle lsp_definitions", { silent = true, desc = "LSP: Definition" }) -vim.keymap.set("n", "k", vim.lsp.buf.hover, { silent = true, desc = "LSP: Hover" }) -vim.keymap.set("n", "K", vim.lsp.buf.signature_help, { silent = true, desc = "LSP: Sig Help" }) -vim.keymap.set( - "n", - "li", - "TroubleToggle lsp_implementations", - { silent = true, desc = "LSP: Implementation" } -) -vim.keymap.set( - "n", - "la", - vim.lsp.buf.add_workspace_folder, - { silent = true, desc = "LSP: Add Workspace Folder" } -) -vim.keymap.set( - "n", - "lx", - vim.lsp.buf.remove_workspace_folder, - { silent = true, desc = "LSP: Remove Workspace Folder" } -) -vim.keymap.set("n", "ll", function() - local output_workspaces = "" - for _, workspace in ipairs(vim.lsp.buf.list_workspace_folders()) do - output_workspaces = string.format("%s- %s\n", output_workspaces, vim.inspect(workspace):gsub('%"', "")) - end - vim.notify(output_workspaces:gsub("\n[^\n]*$", ""), "info", { title = "LSP: Workspaces" }) -end, { silent = true, desc = "LSP: List Workspaces" }) -vim.keymap.set("n", "ln", ":IncRename ", { silent = true, desc = "LSP: Rename" }) -vim.keymap.set("n", "lc", vim.lsp.buf.code_action, { silent = true, desc = "LSP: Code Action" }) -vim.keymap.set("n", "lr", "TroubleToggle lsp_references", { silent = true, desc = "LSP: References" }) -vim.keymap.set("n", "lR", ":LspRestart", { silent = true, desc = "LSP: Restart" }) -vim.keymap.set("n", "ls", function() - vim.diagnostic.open_float(nil, { focus = true, scope = "cursor" }) - vim.cmd.vsplit() -end, { silent = true, desc = "LSP: Diagnostic Open Float" }) -vim.keymap.set("n", "lf", function() - vim.lsp.buf.format({ async = true }) -end, { silent = true, desc = "LSP: Format" }) -vim.keymap.set("n", "[l", vim.diagnostic.goto_prev, { silent = true, desc = "LSP: Diagnostic Previous" }) -vim.keymap.set("n", "]l", vim.diagnostic.goto_next, { silent = true, desc = "LSP: Diagnostic Next" }) -vim.keymap.set( - "n", - "lq", - ":Telescope diagnostics bufnr=0", - { silent = true, desc = "LSP: Telescope Diagnostics" } -) -vim.keymap.set("n", "lt", function() - local virtual_lines_enabled = not vim.diagnostic.config().virtual_lines - vim.diagnostic.config({ virtual_lines = virtual_lines_enabled, virtual_text = not virtual_lines_enabled }) -end, { - desc = "LSP: Toggle Diagnostic Style", -}) -vim.keymap.set("n", "lT", function() - vim.lsp.inlay_hint(0, nil) -end, { - desc = "LSP: Toggle Inlay Hints", -}) - --- Formatter -vim.keymap.set("n", "nf", ":Neoformat", { silent = true, desc = "Neoformat" }) - --- DAP Mappings -wk.register({ - d = { - name = "DAP", - }, -}, { prefix = "" }) -local dap = require("dap") -vim.keymap.set("n", "dc", dap.continue, { silent = true, desc = "DAP: Continue" }) -vim.keymap.set("n", "de", dap.terminate, { silent = true, desc = "DAP: Terminate" }) -vim.keymap.set("n", "db", dap.toggle_breakpoint, { silent = true, desc = "DAP: Toggle Breakpoint" }) -vim.keymap.set("n", "dr", function() - dap.set_breakpoint(vim.fn.input("Breakpoint Condition: ")) -end, { silent = true, desc = "DAP: Set Conditional Breakpoint" }) - -vim.keymap.set("n", "dp", function() - dap.set_breakpoint(nil, nil, vim.fn.input("Log point message: ")) -end, { silent = true, desc = "DAP: Set Log Breakpoint" }) -vim.keymap.set("n", "", dap.step_over, { silent = true, desc = "DAP: Step Over" }) -vim.keymap.set("n", "", dap.step_into, { silent = true, desc = "DAP: Step Into" }) -vim.keymap.set("n", "", dap.step_out, { silent = true, desc = "DAP: Step Out" }) -vim.keymap.set("n", "", dap.step_back, { silent = true, desc = "DAP: Step Back" }) -vim.keymap.set("n", "dR", dap.run_to_cursor, { silent = true, desc = "DAP: Run to Cursor" }) -vim.keymap.set("n", "do", dap.repl.open, { silent = true, desc = "DAP: Open Repl" }) -vim.keymap.set("n", "dt", require("dapui").toggle, { silent = true, desc = "DAP: Toggle UI" }) -vim.keymap.set("n", "dl", dap.run_last, { silent = true, desc = "DAP: Run Last" }) - --- Comments -vim.keymap.set("n", "/", ":CommentToggle", { silent = true, desc = "Toggle Comment" }) -vim.keymap.set("v", "/", ":'<,'>CommentToggle", { silent = true, desc = "Toggle Selection Comment" }) - --- Buffer mappings -vim.keymap.set("n", "", ":bprevious", { silent = true, desc = "Go to Previous Buffer" }) -vim.keymap.set("n", "", ":bnext", { silent = true, desc = "Go to Next Buffer" }) -vim.keymap.set("n", "", function() - require("bufdelete").bufdelete(0) -end, { silent = true, desc = "Close Buffer" }) - --- Vim Notify Mappings -vim.keymap.set("n", "nv", ":Telescope notify", { silent = true, desc = "Notifications: Search" }) -vim.keymap.set("n", "nd", require("notify").dismiss, { silent = true, desc = "Notifications: Dismiss" }) - --- Whichkey Mappings -vim.keymap.set("n", "ww", ":WhichKey", { silent = true, desc = "Show Keybinds" }) - --- Neogen Mappings -wk.register({ - n = { - g = { - name = "Neogen", - }, - }, -}, { prefix = "" }) -vim.keymap.set("n", "ngf", ":Neogen func", { silent = true, desc = "Neogen: Function Annotation" }) -vim.keymap.set("n", "ngc", ":Neogen class", { silent = true, desc = "Neogen: Class Annotation" }) -vim.keymap.set("n", "ngt", ":Neogen type", { silent = true, desc = "Neogen: Type Annotation" }) -vim.keymap.set("n", "ngb", ":Neogen file", { silent = true, desc = "Neogen: File Annotation" }) - --- Nvim Tree Mappings -vim.keymap.set("n", "nt", ":Neotree show toggle focus", { silent = true, desc = "Neotree: Toggle" }) - --- Plenary Mappings -vim.keymap.set("n", "pt", "PlenaryTestFile", { silent = true, desc = "Plenary: Test File" }) -wk.register({ - p = { - name = "Plenary", - }, -}, { prefix = "" }) - --- Neogit Mappings -wk.register({ - g = { - name = "Git", - }, -}, { prefix = "" }) -vim.keymap.set("n", "gg", require("neogit").open, { silent = true, desc = "Neogit: Open" }) - --- Gitsigns Mappings -vim.keymap.set("n", "]g", "Gitsigns next_hunk", { silent = true, desc = "Gitsigns: Next Hunk" }) -vim.keymap.set("n", "[g", "Gitsigns prev_hunk", { silent = true, desc = "Gitsigns: Prev Hunk" }) -vim.keymap.set("n", "gs", "Gitsigns stage_hunk", { silent = true, desc = "Gitsigns: Stage Hunk" }) -vim.keymap.set("n", "gr", "Gitsigns reset_hunk", { silent = true, desc = "Gitsigns: Reset Hunk" }) -vim.keymap.set( - "n", - "gu", - "Gitsigns undo_stage_hunk", - { silent = true, desc = "Gitsigns: Unstage Hunk" } -) - --- Diffview Mappings -vim.keymap.set("n", "gd", "DiffviewOpen", { silent = true, desc = "Diff View: Open" }) -vim.keymap.set("n", "gh", "DiffviewFileHistory", { silent = true, desc = "Diff View: File History" }) - --- Hop Mappings -local hop = require("hop") - -vim.keymap.set("", "f", function() - hop.hint_char1({ - current_line_only = false, - }) -end, { silent = true, desc = "Hop: Character" }) - --- Hop Bindings -vim.keymap.set("", ";l", "HopLineStart", { silent = true, desc = "Hop: Line Start" }) -vim.keymap.set("", ";s", "HopPattern", { silent = true, desc = "Hop: Pattern" }) -vim.keymap.set("", ";;", "HopWord", { silent = true, desc = "Hop: Word" }) -vim.keymap.set("", ";a", "HopAnywhere", { silent = true, desc = "Hop: Anywhere" }) -vim.keymap.set("", ";v", "HopVertical", { silent = true, desc = "Hop Vertical" }) - --- Term/Open bindings -vim.keymap.set("n", "", "ToggleTerm", { silent = true, desc = "Toggle Terminal" }) - --- Overseer mappings -wk.register({ - o = { - name = "Overseer", - }, -}, { prefix = "" }) -vim.keymap.set("n", "or", vim.cmd.OverseerRun, { silent = true, desc = "Overseer: Run" }) -vim.keymap.set("n", "ot", vim.cmd.OverseerToggle, { silent = true, desc = "Overseer: Toggle" }) - -vim.keymap.set("v", "sc", ":'<,'>Silicon", { silent = true, desc = "Silicon: Copy" }) - --- Trouble mappings --- NOTE: there is a references mapping placed in the LSP bindings region -wk.register({ - x = { - name = "Trouble", - }, -}, { prefix = "" }) -vim.keymap.set("n", "xx", "TroubleToggle", { silent = true, desc = "Trouble: Toggle" }) -vim.keymap.set( - "n", - "xw", - "TroubleToggle workspace_diagnostics", - { silent = true, desc = "Trouble: Workspace Diagnostics" } -) -vim.keymap.set( - "n", - "xd", - "TroubleToggle document_diagnostics", - { silent = true, desc = "Trouble: Document Diagnostics" } -) -vim.keymap.set("n", "xl", "TroubleToggle loclist", { silent = true, desc = "Trouble: Loclist" }) -vim.keymap.set("n", "xq", "TroubleToggle quickfix", { silent = true, desc = "Trouble: Quickfix" }) -vim.keymap.set("n", "xt", "TodoTrouble", { silent = true, desc = "Trouble: Todo Items" }) - --- Autolist mappings -local autolist_group = vim.api.nvim_create_augroup("Autolist", {}) --- NOTE: Why is this wrapped in an autocmd you ask? Because we want to bind these for buffer local *only*. We do not --- want to pollute the global keymaps with autolist as autolist only supports certain filetypes. -vim.api.nvim_create_autocmd("filetype", { - group = autolist_group, - pattern = { - "markdown", - "text", - "tex", - "plaintex", - "norg", - }, - callback = function() - if pcall(require, "autolist") then - vim.keymap.set( - "i", - "", - "AutolistTab", - { silent = true, desc = "Autolist: Tab", buffer = true } - ) - vim.keymap.set( - "i", - "", - "AutolistShiftTab", - { silent = true, desc = "Autolist: Shift Tab", buffer = true } - ) - vim.keymap.set( - "i", - "", - "AutolistNewBullet", - { silent = true, desc = "Autolist: New Bullet", buffer = true } - ) - vim.keymap.set( - "n", - "o", - "oAutolistNewBullet", - { silent = true, desc = "Autolist: New Bullet", buffer = true } - ) - vim.keymap.set( - "n", - "O", - "OAutolistNewBulletBefore", - { silent = true, desc = "Autolist: New Bullet Before", buffer = true } - ) - vim.keymap.set( - "n", - "", - "AutolistToggleCheckbox", - { silent = true, desc = "Autolist: Toggle Checkbox", buffer = true } - ) - - -- functions to recalculate list on edit - vim.keymap.set( - "n", - ">>", - ">>AutolistRecalculate", - { silent = true, desc = "Autolist: Indent", buffer = true } - ) - vim.keymap.set( - "n", - "<<", - "<<AutolistRecalculate", - { silent = true, desc = "Autolist: Dedent", buffer = true } - ) - vim.keymap.set( - "n", - "dd", - "ddAutolistRecalculate", - { silent = true, desc = "Autolist: Delete", buffer = true } - ) - vim.keymap.set( - "v", - "d", - "dAutolistRecalculate", - { silent = true, desc = "Autolist: Delete", buffer = true } - ) - end - end, -}) diff --git a/dots/.config/nvim/lua/plugins/plugins.lua b/dots/.config/nvim/lua/plugins/plugins.lua deleted file mode 100755 index 5c27c73f..00000000 --- a/dots/.config/nvim/lua/plugins/plugins.lua +++ /dev/null @@ -1,858 +0,0 @@ ----@diagnostic disable: missing-fields --- Packer strap, install packer automatically and configure plugins --- See the end of this file for how the variable `packer_strap` gets used -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.loop.fs_stat(lazypath) then - vim.notify("Installing Lazy plugin manager, please wait...") - vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "--single-branch", - "https://github.com/folke/lazy.nvim.git", - lazypath, - }) -end -vim.opt.runtimepath:prepend(lazypath) - -local lazy = require("lazy") - -lazy.setup({ - -- Lazy itself - { "folke/lazy.nvim" }, - - -- Commonly used library - { - "nvim-lua/plenary.nvim", - lazy = true, - }, - - -- Much nicer ui, integrates cmdheight = 0 wella - { - "folke/noice.nvim", - priorty = 900, - config = function() - -- NOTE: Might be redundant, to check later - require("plugins.configs.nvim-notify") - require("plugins.configs.noice") - end, - dependencies = { - -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries - "MunifTanjim/nui.nvim", - "rcarriga/nvim-notify", - "hrsh7th/nvim-cmp", - }, - }, - - -- Color schemes - { - "rebelot/kanagawa.nvim", - build = function() - require("plugins.configs.kanagawa") - vim.cmd.KanagawaCompile() - end, - config = function() - require("plugins.configs.kanagawa") - vim.cmd.colorscheme("kanagawa") - vim.api.nvim_create_autocmd("BufWritePost", { - pattern = "lua/plugins/configs/kanagawa.lua", - callback = function() - vim.schedule(vim.cmd.KanagawaCompile) - end, - }) - end, - }, - - -- Icons for folders, files, etc. - { - "nvim-tree/nvim-web-devicons", - lazy = true, - }, - - -- Statusline. - { - "nvim-lualine/lualine.nvim", - event = "VeryLazy", - config = function() - require("plugins.configs.statusline") - end, - }, - - -- Indentation Guides - { - "lukas-reineke/indent-blankline.nvim", - event = "VeryLazy", - config = function() - require("plugins.configs.indent-blankline") - end, - }, - - -- Treesitter - { - "nvim-treesitter/nvim-treesitter", - build = ":TSUpdate", - dependencies = { - "nvim-treesitter/nvim-treesitter-context", - "nvim-treesitter/playground", - "windwp/nvim-ts-autotag", - "nvim-treesitter/nvim-treesitter-textobjects", - { "pfeiferj/nvim-hurl", config = true }, - }, - config = function() - require("plugins.configs.treesitter") - end, - }, - - -- Rainbow braces/brackets/etc - { - url = "https://gitlab.com/HiPhish/rainbow-delimiters.nvim", - config = function() - local rainbow_delimiters = require("rainbow-delimiters") - vim.g.rainbow_delimiters = { - strategy = { - on_attach = function() - if vim.fn.line("$") > 10000 then - return nil - elseif vim.fn.line("$") > 1000 then - return rainbow_delimiters.strategy["global"] - end - return rainbow_delimiters.strategy["local"] - end, - }, - query = { - [""] = "rainbow-delimiters", - lua = "rainbow-blocks", - latex = "rainbow-blocks", - html = "rainbow-blocks", - javascript = "rainbow-delimiters-react", - tsx = "rainbow-parens", - verilog = "rainbow-blocks", - }, - highlight = { - "RainbowDelimiterRed", - "RainbowDelimiterYellow", - "RainbowDelimiterBlue", - "RainbowDelimiterOrange", - "RainbowDelimiterGreen", - "RainbowDelimiterViolet", - "RainbowDelimiterCyan", - }, - } - end, - }, - - -- Dashboard when no file is given to nvim - { - "goolord/alpha-nvim", - dependencies = { "nvim-tree/nvim-web-devicons" }, - config = function() - require("plugins.configs.alpha") - end, - }, - - -- Telescope - { - "nvim-telescope/telescope.nvim", - cmd = { - "Telescope", - }, - dependencies = { - "nvim-telescope/telescope-media-files.nvim", - "nvim-telescope/telescope-file-browser.nvim", - "artart222/telescope_find_directories", - "nvim-telescope/telescope-ui-select.nvim", - "debugloop/telescope-undo.nvim", - { "nvim-telescope/telescope-smart-history.nvim", dependencies = "tami5/sqlite.lua" }, - { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, - }, - config = function() - require("plugins.configs.telescope-nvim") - end, - }, - - { - "stevearc/dressing.nvim", - event = "VeryLazy", - }, - - -- File Tree - { - "nvim-neo-tree/neo-tree.nvim", - dependencies = { - "nvim-tree/nvim-web-devicons", - "nvim-lua/plenary.nvim", - "MunifTanjim/nui.nvim", - }, - config = function() - require("plugins.configs.neotree") - end, - cmd = "Neotree", - }, - - -- Lspconfig - { - "neovim/nvim-lspconfig", - dependencies = { - "folke/neodev.nvim", - "Decodetalkers/csharpls-extended-lsp.nvim", - "williamboman/mason-lspconfig.nvim", - "williamboman/mason.nvim", - "simrat39/rust-tools.nvim", - "Hoffs/omnisharp-extended-lsp.nvim", - "b0o/schemastore.nvim", - - { - "pmizio/typescript-tools.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, - }, - }, - config = function() - require("mason").setup({}) - require("plugins.configs.lsp") - end, - }, - - -- Show code actions - { - "kosayoda/nvim-lightbulb", - dependencies = { - "antoinemadec/FixCursorHold.nvim", - }, - config = function() - local text_icon = "" - local nvim_lightbulb = require("nvim-lightbulb") - nvim_lightbulb.setup({ - sign = { - priority = 9, - text = text_icon, - }, - }) - vim.fn.sign_define( - "LightBulbSign", - { text = text_icon, numhl = "DiagnosticSignHint", texthl = "DiagnosticSignHint", priority = 9 } - ) - vim.api.nvim_create_autocmd("CursorHold,CursorHoldI", { - callback = nvim_lightbulb.update_lightbulb, - }) - end, - }, - - -- Incremental rename, easier to view renames - { - "smjonas/inc-rename.nvim", - event = "VeryLazy", - opts = {}, - }, - - -- Better LSP Virtual Text Lines - { - url = "https://git.sr.ht/~whynothugo/lsp_lines.nvim", - event = "VeryLazy", - opts = {}, - }, - - -- Lsp From Null LS - { - "jose-elias-alvarez/null-ls.nvim", - event = "VeryLazy", - config = function() - require("plugins.configs.null_ls") - end, - }, - - -- Autopairs - { - "windwp/nvim-autopairs", - event = "VeryLazy", - opts = {}, - }, - - -- Code completion - { - "hrsh7th/nvim-cmp", - event = "VeryLazy", - dependencies = { - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-cmdline", - "hrsh7th/cmp-emoji", - "hrsh7th/cmp-nvim-lsp-document-symbol", - "hrsh7th/cmp-calc", - "davidsierradz/cmp-conventionalcommits", - "tamago324/cmp-zsh", - "dmitmel/cmp-cmdline-history", - "David-Kunz/cmp-npm", - "lukas-reineke/cmp-rg", - "onsails/lspkind.nvim", - "f3fora/cmp-spell", - "FelipeLema/cmp-async-path", - { - "petertriho/cmp-git", - dependencies = { "nvim-lua/plenary.nvim" }, - opts = { filetypes = { "*" } }, - }, - -- Snippets - { - "L3MON4D3/LuaSnip", - build = "make install_jsregexp", - event = "VeryLazy", - dependencies = { - "rafamadriz/friendly-snippets", - "saadparwaiz1/cmp_luasnip", - }, - }, - }, - config = function() - require("plugins.configs._cmp") - end, - }, - - { - "tzachar/cmp-fuzzy-buffer", - event = "VeryLazy", - dependencies = { "hrsh7th/nvim-cmp", "tzachar/fuzzy.nvim" }, - }, - { - "saecki/crates.nvim", - dependencies = { { "nvim-lua/plenary.nvim" } }, - ft = "toml", - opts = {}, - }, - - -- DAP, debugger - { - "mfussenegger/nvim-dap", - event = "VeryLazy", - config = function() - require("dap.ext.vscode").load_launchjs() - require("plugins.configs._dap") - end, - }, - - -- Python debugger, dapinstall does not play nice with debugpy - { - "mfussenegger/nvim-dap-python", - event = "VeryLazy", - config = function() - require("plugins.configs.python-dap") - end, - }, - - -- Virtual Text for DAP - { - "theHamsta/nvim-dap-virtual-text", - event = "VeryLazy", - opts = {}, - }, - - -- Fancy ui for dap - { - "rcarriga/nvim-dap-ui", - event = "VeryLazy", - config = function() - require("plugins.configs.dap-ui") - end, - }, - - -- Code formatting - { - "sbdchd/neoformat", - cmd = "Neoformat", - config = function() - require("plugins.configs.neoformat") - end, - }, - - { - "luukvbaal/statuscol.nvim", - event = "VeryLazy", - config = function() - local builtin = require("statuscol.builtin") - require("statuscol").setup({ - foldfunc = "builtin", - setopt = true, - relculright = false, - segments = { - { text = { "%s" }, click = "v:lua.ScSa" }, - { text = { builtin.lnumfunc }, click = "v:lua.ScLa" }, - { text = { " ", builtin.foldfunc, " " }, click = "v:lua.ScFa" }, - }, - }) - end, - }, - - { - "kevinhwang91/nvim-ufo", - dependencies = { - "kevinhwang91/promise-async", - }, - event = "VeryLazy", - config = function() - require("plugins.configs.nvim-ufo") - end, - }, - - -- Git signs - { - "lewis6991/gitsigns.nvim", - event = "VeryLazy", - opts = { - current_line_blame = true, - current_line_blame_opts = { - delay = 0, - }, - }, - }, - - -- Highlight certain comments, TODO, BUG, etc. - { - "folke/todo-comments.nvim", - cmd = { - "TodoTrouble", - }, - opts = {}, - }, - - -- Show possible key bindings during typing - { - "folke/which-key.nvim", - lazy = true, - opts = {}, - }, - - -- Create full path if not existing on write - { - "jghauser/mkdir.nvim", - }, - - -- Text commenting - { - "terrortylor/nvim-comment", - event = "VeryLazy", - cmd = "CommentToggle", - config = function() - require("nvim_comment").setup() - end, - }, - - -- Move selections with alt+movement key - { - "matze/vim-move", - event = "VeryLazy", - }, - - -- Register support in telescope with persistent save - { - "AckslD/nvim-neoclip.lua", - event = "VeryLazy", - dependencies = { - { "tami5/sqlite.lua" }, - { "nvim-telescope/telescope.nvim" }, - }, - opts = { - enable_persistent_history = true, - }, - }, - - -- Markdown Previewer - { - "iamcco/markdown-preview.nvim", - build = "cd app && npm install", - ft = { "markdown" }, - }, - - -- Better Git integration - { - "NeogitOrg/neogit", - dev = true, - lazy = true, - config = function() - require("plugins.configs.neogit") - end, - dependencies = { - { - "sindrets/diffview.nvim", - opts = { - enhanced_diff_hl = true, - }, - }, - "nvim-lua/plenary.nvim", - "nvim-telescope/telescope.nvim", - }, - }, - - { - "tpope/vim-fugitive", - event = "VeryLazy", - }, - - -- Better search display - { - "kevinhwang91/nvim-hlslens", - event = "VeryLazy", - opts = {}, - }, - - -- Log Syntax Highlighting - { - "MTDL9/vim-log-highlighting", - event = "VeryLazy", - ft = "log", - }, - - -- Lots of small modules pulled into - -- one git repository - { - "echasnovski/mini.nvim", - event = "VeryLazy", - config = function() - require("mini.align").setup({}) - require("mini.cursorword").setup({}) - end, - }, - - -- Smoother Scrolling - { - "karb94/neoscroll.nvim", - event = "VeryLazy", - opts = { - easing_function = "circular", - }, - }, - - -- Generate function/class/etc annotations - { - "danymat/neogen", - cmd = { - "Neogen", - }, - dependencies = "nvim-treesitter/nvim-treesitter", - opts = { - snippet_engine = "luasnip", - languages = { - cs = { - template = { - annotation_convention = "xmldoc", - }, - }, - }, - }, - }, - - -- Multiple cursor/multiple visual selection support - { - "mg979/vim-visual-multi", - event = "VeryLazy", - config = function() - vim.cmd.VMTheme("codedark") - end, - }, - - -- Maintain last cursor position in files - { - "ethanholz/nvim-lastplace", - opts = { - lastplace_ignore_buftype = { "quickfix", "nofile", "help" }, - lastplace_ignore_filetype = { "gitcommit", "gitrebase", "svn", "hgcommit", "fugitive" }, - lastplace_open_folds = true, - }, - }, - - -- More codeactions - { - "ThePrimeagen/refactoring.nvim", - event = "VeryLazy", - dependencies = { - { "nvim-lua/plenary.nvim" }, - { "nvim-treesitter/nvim-treesitter" }, - }, - }, - - -- Http Request Support - { - "rest-nvim/rest.nvim", - dependencies = { - "nvim-lua/plenary.nvim", - }, - ft = "http", - opts = { - skip_ssl_verification = true, - }, - }, - - -- Allows repeating actions and more - { - "anuvyklack/hydra.nvim", - event = "VeryLazy", - dependencies = { - "anuvyklack/keymap-layer.nvim", - "lewis6991/gitsigns.nvim", - "jbyuki/venn.nvim", - "folke/which-key.nvim", - }, - config = function() - require("plugins.configs.hydra") - end, - }, - - -- Faster motions - { - "phaazon/hop.nvim", - cmd = { - "HopLineStart", - "HopPattern", - "HopWord", - "HopAnywhere", - "HopVertical", - }, - opts = { - keys = "etovxqpdygfblzhckisuran", - }, - }, - - -- Surround actions - { - "kylechui/nvim-surround", - event = "VeryLazy", - opts = {}, - }, - - -- Better list continuation - { - "gaoDean/autolist.nvim", - ft = { - "markdown", - "text", - "tex", - "plaintex", - "norg", - }, - opts = {}, - }, - - -- Tint inactive windows - { - "levouh/tint.nvim", - event = "VeryLazy", - opts = { - highlight_ignore_patterns = { - "WinSeparator", - }, - window_ignore_function = function(winid) - local bufid = vim.api.nvim_win_get_buf(winid) - - local ignoredFiletypes = { "DiffviewFiles", "DiffviewFileHistory", "neo-tree" } - local ignoredBuftypes = { "terminal" } - - local isDiff = vim.api.nvim_win_get_option(winid, "diff") - local isFloating = vim.api.nvim_win_get_config(winid).relative ~= "" - local isIgnoredBuftype = - vim.tbl_contains(ignoredBuftypes, vim.api.nvim_buf_get_option(bufid, "buftype")) - local isIgnoredFiletype = - vim.tbl_contains(ignoredFiletypes, vim.api.nvim_buf_get_option(bufid, "filetype")) - - return isDiff or isFloating or isIgnoredBuftype or isIgnoredFiletype - end, - tint = -30, - saturation = 0.8, - }, - }, - - -- Highlight argument definitions and usages - { - "m-demare/hlargs.nvim", - event = "VeryLazy", - dependencies = { "nvim-treesitter/nvim-treesitter" }, - opts = {}, - }, - - -- Vim Latex Support - { - "lervag/vimtex", - ft = "tex", - config = function() - vim.g.vimtext_view_method = "zathura" - vim.g.vimtex_view_general_viewer = "zathura" - end, - }, - - { - "akinsho/toggleterm.nvim", - opts = { - start_in_insert = false, - direction = "float", - autochdir = true, - winbar = { - enable = true, - name_formatter = function(term) -- term: Terminal - return term.name - end, - }, - }, - cmd = { - "ToggleTerm", - "ToggleTermSetName", - "ToggleTermToggleAll", - "ToggleTermSendCurrentLine", - "ToggleTermSendVisualLines", - "ToggleTermSendVisualSelection", - }, - }, - - -- Take a screenshot of code selected - { - "krivahtoo/silicon.nvim", - build = "./install.sh build", - dependencies = { - "nvim-tree/nvim-web-devicons", - }, - cmd = { - "Silicon", - }, - opts = { - font = "FiraCode Nerd Font=20", - theme = "Monokai Extended", - background = "#87F", - pad_vert = 60, - pad_horiz = 40, - line_number = true, - gobble = true, - window_title = function() - local devicons = require("nvim-web-devicons") - local icon = devicons.get_icon_by_filetype(vim.bo.filetype) - return icon .. " " .. vim.fn.fnamemodify(vim.fn.bufname(vim.fn.bufnr()), ":~:.") - end, - }, - }, - - -- Nice sidebar cursor goodies - { - "gen740/SmoothCursor.nvim", - event = "VeryLazy", - opts = { - priority = 8, - fancy = { - enable = true, - head = { cursor = "⯈", texthl = "SmoothCursorCursor", linehl = nil }, - body = { - { cursor = "", texthl = "SmoothCursorTrailBig1" }, - { cursor = "", texthl = "SmoothCursorTrailBig2" }, - { cursor = "󰝥", texthl = "SmoothCursorTrailMedium" }, - { cursor = "󰝥", texthl = "SmoothCursorTrailMedium" }, - { cursor = "•", texthl = "SmoothCursorTrailSmall" }, - { cursor = ".", texthl = "SmoothCursorTrailXSmall" }, - { cursor = ".", texthl = "SmoothCursorTrailXSmall" }, - }, - }, - disabled_filetypes = { "NeogitNotification" }, - }, - }, - - -- Color Picker - { - "uga-rosa/ccc.nvim", - config = function() - require("plugins.configs.ccc") - end, - }, - - -- Task runner & job management - { - "stevearc/overseer.nvim", - event = "VeryLazy", - opts = {}, - }, - - -- Better buffer deletion - { - "famiu/bufdelete.nvim", - lazy = true, - }, - - -- Convert numbers between binary, decimal, & hex - { - "skosulor/nibbler", - cmd = { - "NibblerToBin", - "NibblerToHex", - "NibblerToDec", - "NibblerToCArray", - "NibblerHexStringToCArray", - "NibblerToggle", - }, - opts = { - display_enabled = true, - }, - }, - - -- Preview Norm commands, global, macros - { - "smjonas/live-command.nvim", - event = "VeryLazy", - config = function() - require("live-command").setup({ - commands = { - Norm = { cmd = "norm" }, - Reg = { - cmd = "norm", - -- This will transform ":5Reg a" into ":norm 5@a" - args = function(opts) - return (opts.count == -1 and "" or opts.count) .. "@" .. opts.args - end, - range = "", - }, - }, - }) - end, - }, - - -- Better listing for diags, refs, quickfix, locs, etc. - { - "folke/trouble.nvim", - dependencies = { "nvim-tree/nvim-web-devicons" }, - config = function() - require("trouble").setup({ - auto_close = true, - position = "right", - }) - vim.api.nvim_create_autocmd("BufLeave", { - pattern = "*Trouble*", - callback = function() - vim.api.nvim_win_close(0, true) - end, - }) - end, - cmd = { - "Trouble", - "TroubleClose", - "TroubleToggle", - "TroubleRefresh", - }, - }, - - -- Github CLI integration - { - "ldelossa/gh.nvim", - dependencies = { "ldelossa/litee.nvim" }, - config = function() - require("litee.lib").setup() - require("litee.gh").setup({ - refresh_interval = 60000, - }) - end, - }, - - -- Nftables Syntax support - { - "nfnty/vim-nftables", - }, -}, { - checker = { - enabled = true, - concurrency = 20, - notify = false, - }, - lockfile = vim.fn.stdpath("config") .. "/lazy-lock.json", - dev = { - path = "~/Git/Neovim", - }, -}) diff --git a/dots/.config/nvim/lua/plugins/postload.lua b/dots/.config/nvim/lua/plugins/postload.lua old mode 100755 new mode 100644 index 99339a1c..e69de29b --- a/dots/.config/nvim/lua/plugins/postload.lua +++ b/dots/.config/nvim/lua/plugins/postload.lua @@ -1,4 +0,0 @@ --- Anything that needs to be loaded LAST --- needs to required here -require("plugins.mappings") -require("plugins.autocmds")