From 14b38de2f384cb8fbbfb9536efe48c9820a244c1 Mon Sep 17 00:00:00 2001 From: Ethan Holz Date: Sat, 22 Jul 2023 19:17:09 +0000 Subject: [PATCH] feat: lots of overdue neovim changes --- nvim/.config/nvim/init.lua | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------- nvim/.config/nvim/lazy-lock.json | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------- nvim/.config/nvim/lua/.luarc.json | 3 +++ nvim/.config/nvim/lua/mappings.lua | 199 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------- nvim/.config/nvim/lua/snips.lua | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------- nvim/.config/nvim/after/plugin/autoformat.lua | 82 ++++++++++++++++++++++++++++++++++++++++++---------------------------------------- nvim/.config/nvim/lua/custom/diagnostics.lua | 8 ++++++++ nvim/.config/nvim/lua/custom/helper.lua | 11 +++++------ nvim/.config/nvim/lua/custom/init.lua | 3 +++ nvim/.config/nvim/lua/custom/lsp.lua | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------- nvim/.config/nvim/lua/custom/plugins.lua | 452 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- nvim/.config/nvim/lua/custom/ui.lua | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------- 12 file(s) changed, 739 insertion(s)(+), 496 deletion(s)(-) diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua --- a/nvim/.config/nvim/init.lua +++ b/nvim/.config/nvim/init.lua @@ -4,56 +4,66 @@ -- Treesitter Consistent Syntax Highlighting and indent require("nvim-treesitter.configs").setup({ - ensure_installed = { "lua", "rust", "go", "c", - "bash", "dockerfile", "gomod", - "gitcommit", "query", "toml", "yaml" - }, - highlight = { - enable = true, - }, - rainbow = { - enable = true, - extended_mode = true, - }, - playground = { - enable = true, - }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = "", - node_incremental = "", - scope_incremental = "", - node_decremental = "", - }, - }, - textobjects = { - swap = { - enable = true, - swap_next = { - ["a"] = "@parameter.inner", - }, - swap_previous = { - ["A"] = "@parameter.inner", - }, - }, - lsp_interop = { - enable = true, - border = 'none', - floating_preview_opts = {}, - peek_definition_code = { - ["df"] = "@function.outer", - ["dF"] = "@class.outer" - } - } - }, + ensure_installed = { + "lua", + "rust", + "go", + "c", + "bash", + "dockerfile", + "gomod", + "gitcommit", + "query", + "toml", + "yaml", + "hurl", + }, + highlight = { + enable = true, + }, + rainbow = { + enable = true, + extended_mode = true, + }, + playground = { + enable = true, + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "", + node_incremental = "", + scope_incremental = "", + node_decremental = "", + }, + }, + textobjects = { + swap = { + enable = true, + swap_next = { + ["a"] = "@parameter.inner", + }, + swap_previous = { + ["A"] = "@parameter.inner", + }, + }, + lsp_interop = { + enable = true, + border = "none", + floating_preview_opts = {}, + peek_definition_code = { + ["df"] = "@function.outer", + ["dF"] = "@class.outer", + }, + }, + }, }) require("treesitter-context").setup() local function LoadCoverageOnEnter() - if vim.fn.globpath(".", "coverage.out") ~= "" then - require("coverage").load(true) - end + if vim.fn.globpath(".", "coverage.out") ~= "" then + require("coverage").load(true) + end end -- @@ -76,8 +86,8 @@ -- end, -- }) vim.api.nvim_create_autocmd({ "BufNewFile", "BufRead" }, { - pattern = { "*.service" }, - callback = function() - vim.api.nvim_buf_set_option(0, "filetype", "systemd") - end, + pattern = { "*.service" }, + callback = function() + vim.api.nvim_buf_set_option(0, "filetype", "systemd") + end, }) diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -1,48 +1,62 @@ { - "Comment.nvim": { "branch": "master", "commit": "38d3b7eb553872d8866f14a0dd4fe84126068fce" }, - "LuaSnip": { "branch": "master", "commit": "e77fa9ad0b1f4fc6cddf54e51047e17e90c7d7ed" }, + "ChatGPT.nvim": { "branch": "main", "commit": "ef0cf1f28a22bbf2e9be531f4856d2cace57e4b2" }, + "Comment.nvim": { "branch": "master", "commit": "176e85eeb63f1a5970d6b88f1725039d85ca0055" }, + "LuaSnip": { "branch": "master", "commit": "45a4e899ca8f54936fe32ead6bba65f2a8d42e12" }, "ansible-vim": { "branch": "master", "commit": "93798e8c89c441d29d4678da0c0d5e1429eb43b0" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" }, + "cmp-git": { "branch": "main", "commit": "f900a4cf117300fdc3ba31d26f8b6223ccd9c574" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "3d8912ebeb56e5ae08ef0906e3a54de1c66b92f1" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, - "crates.nvim": { "branch": "main", "commit": "5a529df8fe3504ccf1ca9526e196f48b2f723c72" }, - "dressing.nvim": { "branch": "master", "commit": "f5d7fa1fa5ce6bcebc8f07922f39b1eda4d01e37" }, - "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, - "friendly-snippets": { "branch": "main", "commit": "631f79e346b0b3203d2ce3eae619ca8d612e5463" }, - "gitsigns.nvim": { "branch": "main", "commit": "e5edefd9976039f5352e0c900f35206770b33a2d" }, - "harpoon": { "branch": "master", "commit": "f7040fd0c44e7a4010369136547de5604b9c22a1" }, - "lazy.nvim": { "branch": "main", "commit": "bb5cc9ef3bbb17541929b745f74551c900188099" }, + "copilot-cmp": { "branch": "master", "commit": "c2cdb3c0f5078b0619055af192295830a7987790" }, + "copilot.lua": { "branch": "master", "commit": "e48bd7020a98be217d85c006a298656294fd6210" }, + "crates.nvim": { "branch": "main", "commit": "4ce7c51b881e58f1e2f8f437f30e4e583cbac319" }, + "dressing.nvim": { "branch": "master", "commit": "e6eff7a5a950a853c3903d906dbcea03f778db5f" }, + "friendly-snippets": { "branch": "main", "commit": "8f5db6c5b691a6bbaa5dabd9afeb164ef8a06d04" }, + "fzf-lua": { "branch": "main", "commit": "19732fdf9b8b038b6a5813b077b382ab2b48e094" }, + "gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" }, + "gitsigns.nvim": { "branch": "main", "commit": "5a04466685008f29c71fa5ec25d421deb1c83fea" }, + "gopher.nvim": { "branch": "main", "commit": "03cabf675ce129c28bd855969a3e569edcf63366" }, + "goto-preview": { "branch": "main", "commit": "c5fd9d8d90aef85a97f6abae6f9fe51d445e62b4" }, + "harpoon": { "branch": "master", "commit": "21f4c47c6803d64ddb934a5b314dcb1b8e7365dc" }, + "lazy.nvim": { "branch": "main", "commit": "25beed5e2e935ebc00d7e3eed1dc502df3c40e39" }, + "lsp-inlayhints.nvim": { "branch": "main", "commit": "d981f65c9ae0b6062176f0accb9c151daeda6f16" }, "lsp-status.nvim": { "branch": "master", "commit": "54f48eb5017632d81d0fd40112065f1d062d0629" }, - "lsp-trouble.nvim": { "branch": "main", "commit": "d56bfc0c501ced4002a57cb60433362fb2ce9c4d" }, - "lspkind-nvim": { "branch": "master", "commit": "c68b3a003483cf382428a43035079f78474cd11e" }, - "lualine.nvim": { "branch": "master", "commit": "84ffb80e452d95e2c46fa29a98ea11a240f7843e" }, - "neogen": { "branch": "main", "commit": "353c5ef8e51c14445cc85666d4d09e4cf98598b2" }, - "nightfox.nvim": { "branch": "main", "commit": "e76fd413c02850d1c086afcd77a0dfd9bbf0c427" }, - "nvim-autopairs": { "branch": "master", "commit": "7566a86f44bb72ba2b1a609f528a27d93241502d" }, - "nvim-cmp": { "branch": "main", "commit": "11102d3db12c7f8b35265ad0e17a21511e5b1e68" }, - "nvim-coverage": { "branch": "main", "commit": "e542b6afbc7d92acd6502e15124ca2f376964b76" }, - "nvim-dap": { "branch": "master", "commit": "6cedcb527e264c8f25e86afa8dae74c6692dee51" }, - "nvim-dap-go": { "branch": "main", "commit": "b4ded7de579b4e2a85c203388233b54bf1028816" }, - "nvim-dap-ui": { "branch": "master", "commit": "286f682f366fbc652b38dff893569374e9433dd3" }, - "nvim-lastplace": { "branch": "main", "commit": "75a2b78bdbbd20467d499defceb5b20c0967a1ca" }, - "nvim-lspconfig": { "branch": "master", "commit": "427378a03ffc1e1bc023275583a49b1993e524d0" }, - "nvim-treesitter": { "branch": "master", "commit": "b8a0791eb435efc790755883cad166a91a4fe864" }, - "nvim-treesitter-context": { "branch": "master", "commit": "6a59812bd79764052fabb37085b6e30b4dd71f86" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "8673926519ea61069f9c1366d1ad1949316d250e" }, - "nvim-ts-rainbow": { "branch": "master", "commit": "840039440e012ad798ef31349b93a5d4365023ff" }, - "nvim-web-devicons": { "branch": "master", "commit": "4ec26d67d419c12a4abaea02f1b6c57b40c08d7e" }, + "lsp-trouble.nvim": { "branch": "main", "commit": "20d1b30d6925213abece21d35858a16e11d1e9fc" }, + "lspkind-nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" }, + "lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" }, + "neogen": { "branch": "main", "commit": "cb1f384df804c1bf729332c4f728253fe17962d4" }, + "nightfox.nvim": { "branch": "main", "commit": "77aa7458d2b725c2d9ff55a18befe1b891ac473e" }, + "noice.nvim": { "branch": "main", "commit": "6c87c1d11c38180fb72bf8f45518a0a3e081afc1" }, + "nui.nvim": { "branch": "main", "commit": "d146966a423e60699b084eeb28489fe3b6427599" }, + "null-ls.nvim": { "branch": "main", "commit": "db09b6c691def0038c456551e4e2772186449f35" }, + "nvim-autopairs": { "branch": "master", "commit": "ae5b41ce880a6d850055e262d6dfebd362bb276e" }, + "nvim-cmp": { "branch": "main", "commit": "c4e491a87eeacf0408902c32f031d802c7eafce8" }, + "nvim-coverage": { "branch": "main", "commit": "55f2ed78a2f6b5a93faed18ff2bc1bd707ef336c" }, + "nvim-dap": { "branch": "master", "commit": "3bde6f786057fa29d8356559b2ae3a52d9317fba" }, + "nvim-dap-go": { "branch": "main", "commit": "cdf604a5703838f65fdee7c198f6cb59b563ef6f" }, + "nvim-dap-ui": { "branch": "master", "commit": "85b16ac2309d85c88577cd8ee1733ce52be8227e" }, + "nvim-lspconfig": { "branch": "master", "commit": "4b26897a80c41eb2f116b271cbdcd4686fb52dd6" }, + "nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" }, + "nvim-treesitter": { "branch": "master", "commit": "51ea343f705a89326cff8dd7a0542d7fe0e6699a" }, + "nvim-treesitter-context": { "branch": "master", "commit": "6f8f788738b968f24a108ee599c5be0031f94f06" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "52f1f3280d9092bfaee5c45be5962fabee3d9654" }, + "nvim-ts-rainbow": { "branch": "master", "commit": "8312b513ce930e7669a1721befbe56f2e1853301" }, + "nvim-web-devicons": { "branch": "master", "commit": "efbfed0567ef4bfac3ce630524a0f6c8451c5534" }, "playground": { "branch": "master", "commit": "2b81a018a49f8e476341dfcb228b7b808baba68b" }, - "plenary.nvim": { "branch": "master", "commit": "9ac3e9541bbabd9d73663d757e4fe48a675bb054" }, - "rust-tools.nvim": { "branch": "master", "commit": "71d2cf67b5ed120a0e31b2c8adb210dd2834242f" }, + "plenary.nvim": { "branch": "master", "commit": "1a6a7c929628566cf406aa7da1d048a1ddc7e9a8" }, + "rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" }, "salt-vim": { "branch": "master", "commit": "6ca9e3500cc39dd417b411435d58a1b720b331cc" }, - "telescope-file-browser.nvim": { "branch": "master", "commit": "e0fcb12702ad0d2873544a31730f9aaef04fd032" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "580b6c48651cabb63455e97d7e131ed557b8c7e2" }, + "telescope-file-browser.nvim": { "branch": "master", "commit": "e03ff55962417b69c85ef41424079bb0580546ba" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "9bc8237565ded606e6c366a71c64c0af25cd7a50" }, "telescope-luasnip.nvim": { "branch": "master", "commit": "849c4ee1951f34041a26744d2a88284545564ff0" }, - "telescope.nvim": { "branch": "master", "commit": "713d26b98583b160b50fb827adb751f768238ed3" }, - "todo-comments.nvim": { "branch": "main", "commit": "8febc60a76feefd8203077ef78b6a262ea1a41f9" }, - "undotree": { "branch": "master", "commit": "485f01efde4e22cb1ce547b9e8c9238f36566f21" }, - "vim-fugitive": { "branch": "master", "commit": "e6651a79facf5cc2b7c554fdc19eb8a9fe89602c" }, - "which-key.nvim": { "branch": "main", "commit": "4acffc92953a90a790603bfdab7c92319ab167b1" } + "telescope.nvim": { "branch": "master", "commit": "2ea8dcd17b4f9b7714354965a28ae4fef4139c71" }, + "todo-comments.nvim": { "branch": "main", "commit": "09b0b17d824d2d56f02ff15967e8a2499a89c731" }, + "toggleterm.nvim": { "branch": "main", "commit": "b90a1381e9b5b8596f49070ee86c71db267ac868" }, + "tree-sitter-just": { "branch": "main", "commit": "4e5f5f3ff37b12a1bbf664eb3966b3019e924594" }, + "undotree": { "branch": "master", "commit": "0e11ba7325efbbb3f3bebe06213afa3e7ec75131" }, + "vim-fugitive": { "branch": "master", "commit": "43f18ab9155c853a84ded560c6104e6300ad41da" }, + "vim-just": { "branch": "main", "commit": "f678f5ef3d6bc589e88b7f1da6e969a5f67a99dc" }, + "which-key.nvim": { "branch": "main", "commit": "38b990f6eabf62014018b4aae70a97d7a6c2eb88" } } \ No newline at end of file diff --git a/nvim/.config/nvim/lua/.luarc.json b/nvim/.config/nvim/lua/.luarc.json new file mode 100644 --- /dev/null +++ b/nvim/.config/nvim/lua/.luarc.json @@ -0,0 +1,3 @@ +{ + "workspace.checkThirdParty": false +} \ No newline at end of file diff --git a/nvim/.config/nvim/lua/mappings.lua b/nvim/.config/nvim/lua/mappings.lua --- a/nvim/.config/nvim/lua/mappings.lua +++ b/nvim/.config/nvim/lua/mappings.lua @@ -7,91 +7,132 @@ local v = { mode = "v", noremap = "true" } local t = { mode = "t", noremap = "true" } +local Terminal = require("toggleterm.terminal").Terminal +local gitui = Terminal:new({ + cmd = "gitui", + hidden = true, + direction = "float", + on_open = function() + vim.cmd("startinsert!") + end, +}) +local function gitui_toggle() + gitui:toggle() +end + +local function toggle_jq() + local bufnr = vim.api.nvim_get_current_buf() + local start_line, start_col, end_line, end_col = unpack(vim.fn.getpos("'<")) + local lines = vim.api.nvim_buf_get_lines(bufnr, start_line - 1, end_line, false) + -- io.popen("jq --argjson in '" .. selection .. "'", "w"):close() +end + +local function gitlinker_callback() + require("gitlinker").get_repo_url({ action_callback = require("gitlinker.actions").open_in_browser }) +end + wk.register({ - [""] = { - c = { - name = "LSP Code Changes", - a = { vim.lsp.buf.code_action, "Code Action" }, - R = { vim.lsp.buf.rename, "Rename" }, - }, - f = { - name = "Telescope", - f = { require("telescope.builtin").find_files, "Find File" }, - g = { require("telescope.builtin").live_grep, "Live Grep" }, - b = { require("telescope.builtin").buffers, "Buffer List" }, - h = { require("telescope.builtin").help_tags, "Help Tags" }, - c = { require("telescope.builtin").colorscheme, "Colorschme" }, - l = { require("telescope.builtin").lsp_document_symbols, "LSP Document Symbols" }, - q = { require("telescope").extensions.harpoon.marks, "Harpoon Marks" }, - }, - g = { - name = "Git", - g = { vim.cmd.Git, "Open vim-fugitive" }, - s = { - name = "Stage", - h = { require("gitsigns").stage_hunk, "Stage Hunk" }, - b = { require("gitsigns").stage_buffer, "Stage Buffer" }, - }, - b = { require("gitsigns").blame_line, "Blame Line" }, - }, - m = { require("harpoon.mark").add_file, "Harpoon Mark" }, - p = { '"+p', "Paste from clipboard" }, - q = { require("harpoon.ui").toggle_quick_menu, "Harpoon Quick Menu" }, - u = { "UndotreeToggle", "UndoTreeToggle" }, - i = { "TroubleToggle", "Trouble Toggle" }, - s = { require("telescope.builtin").spell_suggest, "Spell suggest" }, - t = { "TodoTelescope", "TodoTelescope" } - }, - ["1"] = { - function() - require("harpoon.ui").nav_file(1) - end, - "Harpoon 1", - }, - ["2"] = { - function() - require("harpoon.ui").nav_file(2) - end, - "Harpoon 2", - }, - ["3"] = { - function() - require("harpoon.ui").nav_file(3) - end, - "Harpoon 3", - }, - ["4"] = { - function() - require("harpoon.ui").nav_file(4) - end, - "Harpoon 4", - }, - ["g"] = { - d = { vim.lsp.buf.definition, "Goto Definition" }, - j = { vim.diagnostic.goto_next, "Go to Next Diagnostic" }, - k = { vim.diagnostic.goto_prev, "Go to Prev Diagnostic" }, - r = { require("telescope.builtin").lsp_references, "References" }, - i = { require("telescope.builtin").lsp_implementations, "Implementations" }, - }, - ["space"] = { - c = { vim.cmd.cclose, "Close qf list" }, - }, - ["K"] = { vim.lsp.buf.hover, "Hover (LSP)" }, - [""] = { require("telescope").extensions.file_browser.file_browser, "Open file picker" }, + [""] = { + c = { + name = "LSP Code Changes", + a = { vim.lsp.buf.code_action, "Code Action" }, + R = { vim.lsp.buf.rename, "Rename" }, + }, + f = { + name = "Telescope", + f = { require("telescope.builtin").find_files, "Find File" }, + g = { require("telescope.builtin").live_grep, "Live Grep" }, + b = { require("telescope.builtin").buffers, "Buffer List" }, + h = { require("telescope.builtin").help_tags, "Help Tags" }, + c = { require("telescope.builtin").colorscheme, "Colorschme" }, + l = { require("telescope.builtin").lsp_document_symbols, "LSP Document Symbols" }, + q = { require("telescope").extensions.harpoon.marks, "Harpoon Marks" }, + s = { require("telescope.builtin").grep_string, "Grep String" }, + }, + g = { + name = "Git", + g = { vim.cmd.Git, "Open vim-fugitive" }, + s = { + name = "Stage", + h = { require("gitsigns").stage_hunk, "Stage Hunk" }, + b = { require("gitsigns").stage_buffer, "Stage Buffer" }, + }, + b = { require("gitsigns").blame_line, "Blame Line" }, + u = { gitui_toggle, "gitui toggle" }, + o = { gitlinker_callback, "gitinker" }, + }, + j = { toggle_jq, "jq" }, + m = { require("harpoon.mark").add_file, "Harpoon Mark" }, + p = { '"+p', "Paste from clipboard" }, + q = { require("harpoon.ui").toggle_quick_menu, "Harpoon Quick Menu" }, + u = { "UndotreeToggle", "UndoTreeToggle" }, + i = { "TroubleToggle", "Trouble Toggle" }, + s = { require("telescope.builtin").spell_suggest, "Spell suggest" }, + t = { "ToggleTerm direction=horizontal", "New Terminal" }, + }, + ["1"] = { + function() + require("harpoon.ui").nav_file(1) + end, + "Harpoon 1", + }, + ["2"] = { + function() + require("harpoon.ui").nav_file(2) + end, + "Harpoon 2", + }, + ["3"] = { + function() + require("harpoon.ui").nav_file(3) + end, + "Harpoon 3", + }, + ["4"] = { + function() + require("harpoon.ui").nav_file(4) + end, + "Harpoon 4", + }, + ["g"] = { + d = { vim.lsp.buf.definition, "Goto Definition" }, + j = { vim.diagnostic.goto_next, "Go to Next Diagnostic" }, + k = { vim.diagnostic.goto_prev, "Go to Prev Diagnostic" }, + r = { require("telescope.builtin").lsp_references, "References" }, + i = { require("telescope.builtin").lsp_implementations, "Implementations" }, + t = { + name = "Go Tags", + a = { + name = "Add Tags", + j = { ":GoTagAdd json ", "JSON" }, + y = { ":GoTagAdd yaml ", "YAML" }, + }, + r = { + name = "Remove Tags", + j = { ":GoTagRm json ", "JSON" }, + y = { ":GoTagRm yaml ", "YAML" }, + }, + f = { ":GoIfErr", "iferr" }, + }, + }, + ["space"] = { + c = { vim.cmd.cclose, "Close qf list" }, + }, + ["K"] = { vim.lsp.buf.hover, "Hover (LSP)" }, + [""] = { require("telescope").extensions.file_browser.file_browser, "Open file picker" }, }) wk.register({ - [""] = { - y = { '"+y', "Yank to clipboard" }, - }, + [""] = { + y = { '"+y', "Yank to clipboard" }, + f = { + name = "Telescope", + s = { require("telescope.builtin").grep_string, "Grep String" }, + }, + }, }, v) wk.register({ - [""] = { "", "Exit terminal" } + [""] = { "", "Exit terminal" }, }, t) --- -- BarBar Keymaps --- map("n", "[", ":BufferPrevious", opts) --- map("n", "]", ":BufferNext", opts) --- -- LSP --- map("n", "i", ":TroubleToggle", opts) -- -- Debugs -- map("n", "dt", require("dapui").toggle, opts) -- map("n", "tt", require("dap").toggle_breakpoint, opts) diff --git a/nvim/.config/nvim/lua/snips.lua b/nvim/.config/nvim/lua/snips.lua --- a/nvim/.config/nvim/lua/snips.lua +++ b/nvim/.config/nvim/lua/snips.lua @@ -9,120 +9,117 @@ -- This is a temporary function to handle conversion local json_convert = function(index) - return f(function(arg) - if arg[1][1] == "" then - return "" - end - local stringVal = helper.convert_case(arg[1][1]) - return { stringVal } - end, { index }) + return f(function(arg) + if arg[1][1] == "" then + return "" + end + local stringVal = helper.convert_case(arg[1][1]) + return { stringVal } + end, { index }) end -- Get filename excluding extension local filename = function() - return f(function() - local name = vim.fn.expand("%:r") - return name - end) + return f(function() + local name = vim.fn.expand("%:r") + return name + end) end - --- Generates a filepath based name following basedir ---@param basedir string file after this point ---@return string path ---@return function filepath function local filepath = function(basedir) - return f(function() - local path = vim.api.nvim_buf_get_name(0) - local name = "/" .. vim.fs.basename(path) - local normalized_base = vim.fs.normalize(basedir) - local match = {} - -- get everything following k3s and put into a string - for element in string.gmatch(path, normalized_base .. "/(.*)$") do - match[0] = element - end - -- remove the name from the - local path2 = match[0]:gsub(name, "") - -- replace '/' with '-' - return path2:gsub("/", "-") - end) + return f(function() + local path = vim.api.nvim_buf_get_name(0) + local name = "/" .. vim.fs.basename(path) + local normalized_base = vim.fs.normalize(basedir) + local match = {} + -- get everything following k3s and put into a string + for element in string.gmatch(path, normalized_base .. "/(.*)$") do + match[0] = element + end + -- remove the name from the + local path2 = match[0]:gsub(name, "") + -- replace '/' with '-' + return path2:gsub("/", "-") + end) end local k3s_filepath = function() - return filepath("k3s") + return filepath("k3s") end - ls.config.set_config({ - updateevents = "TextChanged,TextChangedI", - history = true, - enable_autosnippets = true, + updateevents = "TextChanged,TextChangedI", + history = true, + enable_autosnippets = true, }) -- ls.add_snippets("markdown", { - s("title", fmt([[# {}]], { filename() })), + s("title", fmt([[# {}]], { filename() })), }) - ls.add_snippets("sls", { - s( - "k3s-ree", - fmt( - [[{}-reload: + s( + "k3s-ree", + fmt( + [[{}-reload: cmd.run: - name: k3s kubectl delete -f {{{{ filepath }}}} && k3s kubectl apply -f {{{{ filepath }}}} - onchanges: - file: {}-yaml]], - { k3s_filepath(), k3s_filepath() } - ) - ), - s("fp", fmt([[{{% set filepath = '{}' %}}]], { i(1) })), - s( - "service-ree", - fmt( - [[{}-reenabled: + { k3s_filepath(), k3s_filepath() } + ) + ), + s("fp", fmt([[{{% set filepath = '{}' %}}]], { i(1) })), + s( + "service-ree", + fmt( + [[{}-reenabled: cmd.run: - name: "systemctl reenable {}" - onchanges: - file: {}-service - require: - file: {}-service]], - { filename(), filename(), filename(), filename() } - ) - ), - s( - "rel", - fmt( - [[{}-reloading: + { filename(), filename(), filename(), filename() } + ) + ), + s( + "rel", + fmt( + [[{}-reloading: cmd.run: - name: "systemctl restart {}" - onchanges: - file: {}-symlink - require: - service: {}-running]], - { filename(), filename(), filename(), filename() } - ) - ), + { filename(), filename(), filename(), filename() } + ) + ), }) ls.add_snippets("go", { - s("jsc", fmt([[{} {} `json:"{}"`]], { i(1), i(2), json_convert(1) })), + s("jsc", fmt([[{} {} `json:"{}"`]], { i(1), i(2), json_convert(1) })), }) ls.add_snippets("c", { - s("bis", fmt([[(Bi_Status_Fn({}) << {})]], { i(1), i(2) })), + s("bis", fmt([[(Bi_Status_Fn({}) << {})]], { i(1), i(2) })), }) ls.add_snippets("rust", { - s( - "aoc", - fmt( - [[let file = File::open("{}").expect("File not found"); + s( + "aoc", + fmt( + [[let file = File::open("{}").expect("File not found"); let reader = io::BufReader::new(file).lines(); for line in reader {{ {} }}]], - { i(1), i(2) } - ) - ), + { i(1), i(2) } + ) + ), }) diff --git a/nvim/.config/nvim/after/plugin/autoformat.lua b/nvim/.config/nvim/after/plugin/autoformat.lua --- a/nvim/.config/nvim/after/plugin/autoformat.lua +++ b/nvim/.config/nvim/after/plugin/autoformat.lua @@ -1,24 +1,24 @@ local enable_autoformat = true if not enable_autoformat then - return + return end -local exclude_list = { "ccls", "tsserver", "astro" } +local exclude_list = { "ccls", "tsserver", "astro", "lua_ls" } local has_value = function(name) - for _, value in ipairs(exclude_list) do - if value == name then - return true - end - end - return false + for _, value in ipairs(exclude_list) do + if value == name then + return true + end + end + return false end -- Switch for controlling whether you want autoformatting. -- Use :KickstartFormatToggle to toggle autoformatting on or off local enabled = true -vim.api.nvim_create_user_command('KickstartFormatToggle', function() - enabled = not enabled - print('Setting autoformatting to: ' .. tostring(enabled)) +vim.api.nvim_create_user_command("KickstartFormatToggle", function() + enabled = not enabled + print("Setting autoformatting to: " .. tostring(enabled)) end, {}) -- Create an augroup that is used for managing our formatting autocmds. @@ -26,39 +26,41 @@ -- can attach to the same buffer without interfering with each other. local _augroups = {} local get_augroup = function(client) - if not _augroups[client.id] then - local group_name = 'kickstart-lsp-format-' .. client.name - local id = vim.api.nvim_create_augroup(group_name, { clear = true }) - _augroups[client.id] = id - end + if not _augroups[client.id] then + local group_name = "kickstart-lsp-format-" .. client.name + local id = vim.api.nvim_create_augroup(group_name, { clear = true }) + _augroups[client.id] = id + end - return _augroups[client.id] + return _augroups[client.id] end -vim.api.nvim_create_autocmd('LspAttach', { - group = vim.api.nvim_create_augroup('kickstart-lsp-attach-format', { clear = true }), +vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("kickstart-lsp-attach-format", { clear = true }), + -- This is where we attach the autoformatting for reasonable clients + callback = function(args) + local client_id = args.data.client_id + local client = vim.lsp.get_client_by_id(client_id) + local bufnr = args.buf - -- This is where we attach the autoformatting for reasonable clients - callback = function(args) - local client_id = args.data.client_id - local client = vim.lsp.get_client_by_id(client_id) - local bufnr = args.buf + -- Only attach to clients that support document formatting + if not client.server_capabilities.documentFormattingProvider or has_value(client.name) then + return + end - -- Only attach to clients that support document formatting - if not client.server_capabilities.documentFormattingProvider or has_value(client.name) then - return - end + vim.api.nvim_create_autocmd("BufWritePre", { + group = get_augroup(client), + buffer = bufnr, + callback = function() + if not enabled then + return + end + -- if not vim.api.nvim_buf_get_option(bufnr, "modified") then + -- return + -- end - vim.api.nvim_create_autocmd('BufWritePre', { - group = get_augroup(client), - buffer = bufnr, - callback = function() - if not enabled then - return - end - - vim.lsp.buf.format { async = false } - end, - }) - end, + vim.lsp.buf.format({ async = false }) + end, + }) + end, }) diff --git a/nvim/.config/nvim/lua/custom/diagnostics.lua b/nvim/.config/nvim/lua/custom/diagnostics.lua new file mode 100644 --- /dev/null +++ b/nvim/.config/nvim/lua/custom/diagnostics.lua @@ -0,0 +1,8 @@ +local item = vim.api.nvim_create_user_command("SaltLintVersion", function() + local handle = io.popen("salt-lint --version") + local result = handle:read("*a") + if handle ~= nil then + handle:close() + end + print(result) +end, {}) diff --git a/nvim/.config/nvim/lua/custom/helper.lua b/nvim/.config/nvim/lua/custom/helper.lua --- a/nvim/.config/nvim/lua/custom/helper.lua +++ b/nvim/.config/nvim/lua/custom/helper.lua @@ -1,16 +1,15 @@ local helper = {} - function helper.convert_case(text) - local tmp = text:gsub(".%f[%l]", " %1"):gsub("%l%f[%u]", "%1 "):gsub("^.", string.upper) - local standard = vim.split(tmp, " ", { trimempty = true }) + local tmp = text:gsub(".%f[%l]", " %1"):gsub("%l%f[%u]", "%1 "):gsub("^.", string.upper) + local standard = vim.split(tmp, " ", { trimempty = true }) - return string.lower(table.concat(standard, "_")) + return string.lower(table.concat(standard, "_")) end function helper.is_wsl() - local output = vim.fn.systemlist("uname -r") - return not not string.find(output[1] or "", "WSL") + local output = vim.fn.systemlist("uname -r") + return not not string.find(output[1] or "", "WSL") end return helper diff --git a/nvim/.config/nvim/lua/custom/init.lua b/nvim/.config/nvim/lua/custom/init.lua --- a/nvim/.config/nvim/lua/custom/init.lua +++ b/nvim/.config/nvim/lua/custom/init.lua @@ -9,3 +9,6 @@ -- Set LSP vars require("custom.lsp") + +-- Set diagnostics vars +require("custom.diagnostics") diff --git a/nvim/.config/nvim/lua/custom/lsp.lua b/nvim/.config/nvim/lua/custom/lsp.lua --- a/nvim/.config/nvim/lua/custom/lsp.lua +++ b/nvim/.config/nvim/lua/custom/lsp.lua @@ -49,25 +49,28 @@ { name = "nvim_lsp" }, { name = "nvim_lsp_signature_help" }, { name = "nvim_lsp_lua" }, + { name = "copilot" }, { name = "luasnip" }, { name = "crates" }, { name = "buffer" }, { name = "path" }, }), - -- ghost_text = true, + experimental = { + ghost_text = true, + }, }) cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) -local lsp_formatting = function(bufnr) - vim.lsp.buf.format({ - filter = function(client) - return client.name == "null-ls" - end, - bufnr = bufnr, - }) -end local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()) + +cmp.setup.filetype('gitcommit', { + sources = cmp.config.sources({ + { name = 'git' }, + { name = 'buffer' } + }) +}) +require("cmp_git").setup() -- A table of servers used for setting up LSP local servers = { "ccls", @@ -75,9 +78,21 @@ "marksman", "pyright", "solc", + "nixd", { "eslint", exec = "vscode-eslint-language-server" + }, + { + "nil_ls", + exec = "nil", + settings = { + ['nil'] = { + formatting = { + command = { "nixpkgs-fmt" }, + } + } + } }, { "ltex", @@ -107,6 +122,7 @@ workspace = { -- Make the server aware of Neovim runtime files library = vim.api.nvim_get_runtime_file("", true), + checkThirdParty = false }, hint = { enable = true, @@ -129,9 +145,18 @@ gofumpt = true, analyses = { unusedparams = true, + shadow = true, }, staticcheck = true, codelenses = { test = true }, + hints = { + assignVariableTypes = true, + composeLiteralFields = true, + constantValues = true, + functionTypeParameter = true, + parameterNames = true, + rangeVariableTypes = true, + }, }, }, }, @@ -170,16 +195,44 @@ ::continue:: end + local rust_opts = { server = { capabilities = capabilities, ["rust-analyzer"] = { procMacro = { - enable = false, + enable = true, + }, + diagnostics = { + enable = true, + enable_experimental = true, }, }, }, + tools = { + inlay_hints = { + auto = false + }, + } } + +vim.api.nvim_create_augroup("LspAttach_inlayhints", {}) +vim.api.nvim_create_autocmd("LspAttach", { + group = "LspAttach_inlayhints", + callback = function(args) + if not (args.data and args.data.client_id) then + return + end + + local bufnr = args.buf + local client = vim.lsp.get_client_by_id(args.data.client_id) + local palette = require("nightfox.palette").load("carbonfox") + local bg = palette.bg1 + vim.cmd([[hi LSPInlayHint guibg=]] .. bg .. [[gui=bold]]) + require("lsp-inlayhints").on_attach(client, bufnr) + end, +}) + require("rust-tools").setup(rust_opts) require("trouble").setup({}) @@ -199,6 +252,7 @@ diagnostics.revive.with({ args = { "-config", vim.fn.expand("~/.config/revive/revive.toml"), "-formatter", "json", "./..." } }), + formatting.stylua, formatting.black, code_actions.gomodifytags, diagnostics.saltlint diff --git a/nvim/.config/nvim/lua/custom/plugins.lua b/nvim/.config/nvim/lua/custom/plugins.lua --- a/nvim/.config/nvim/lua/custom/plugins.lua +++ b/nvim/.config/nvim/lua/custom/plugins.lua @@ -1,198 +1,284 @@ local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then - vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "--single-branch", - "https://github.com/folke/lazy.nvim.git", - lazypath, - }) + 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 plugins = { - "neovim/nvim-lspconfig", - { - "folke/lsp-trouble.nvim", - config = true, - dependencies = { "nvim-tree/nvim-web-devicons" } - }, - "nvim-lua/lsp-status.nvim", - { - "ethanholz/null-ls.nvim", - dir = "~/Documents/github/null-ls.nvim" - }, - "simrat39/rust-tools.nvim", - "onsails/lspkind-nvim", - { - "j-hui/fidget.nvim", - config = true, - }, - { - "windwp/nvim-autopairs", - config = true, - }, - -- Debugging - "mfussenegger/nvim-dap", - { - "leoluz/nvim-dap-go", - dependencies = { - "mfussenegger/nvim-dap", - }, - }, - { - "rcarriga/nvim-dap-ui", - dependencies = { "mfussenegger/nvim-dap" }, - }, - -- Filetype plugins - { - "pearofducks/ansible-vim", - ft = "ansible.yaml", - }, - { - "saltstack/salt-vim", - }, - { - "Saecki/crates.nvim", - event = "BufRead Cargo.toml", - dependencies = { "nvim-lua/plenary.nvim" }, - config = true, - }, + "neovim/nvim-lspconfig", + { + "rmagatti/goto-preview", + config = function() + require("goto-preview").setup({ default_mappings = true }) + end, + }, + { + "folke/lsp-trouble.nvim", + config = true, + dependencies = { "nvim-tree/nvim-web-devicons" }, + }, + "jose-elias-alvarez/null-ls.nvim", + "nvim-lua/lsp-status.nvim", + { + "lvimuser/lsp-inlayhints.nvim", + config = true, + on = { "LspAttach" }, + }, + "simrat39/rust-tools.nvim", + { + "olexsmir/gopher.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-treesitter/nvim-treesitter", + }, + build = function() + if not require("nvim-treesitter.parsers").has_parser("go") then + vim.cmd("TSInstall go") + end + end, + config = true, + }, + "onsails/lspkind-nvim", + { + "windwp/nvim-autopairs", + config = true, + }, + -- Debugging + "mfussenegger/nvim-dap", + { + "leoluz/nvim-dap-go", + dependencies = { + "mfussenegger/nvim-dap", + }, + }, + { + "rcarriga/nvim-dap-ui", + dependencies = { "mfussenegger/nvim-dap" }, + }, + -- Filetype plugins + { + "pearofducks/ansible-vim", + ft = "ansible.yaml", + }, + { + "saltstack/salt-vim", + }, + { + "Saecki/crates.nvim", + event = "BufRead Cargo.toml", + dependencies = { "nvim-lua/plenary.nvim" }, + config = true, + }, - -- nvim-cmp - { - "hrsh7th/nvim-cmp", - dependencies = { - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-nvim-lua", - "hrsh7th/cmp-nvim-lsp-signature-help", - "hrsh7th/cmp-path", - "saadparwaiz1/cmp_luasnip", - }, - }, + -- nvim-cmp + { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-nvim-lua", + "hrsh7th/cmp-nvim-lsp-signature-help", + "hrsh7th/cmp-path", + "saadparwaiz1/cmp_luasnip", + "petertriho/cmp-git", + "nvim-lua/plenary.nvim", + }, + }, + { + "zbirenbaum/copilot.lua", + cmd = "Copilot", + event = "InsertEnter", + config = true, + }, + { + "zbirenbaum/copilot-cmp", + config = true, + }, - -- Treesitter - { - "nvim-treesitter/nvim-treesitter", - build = ":TSUpdate", - }, - "nvim-treesitter/nvim-treesitter-textobjects", - "mrjones2014/nvim-ts-rainbow", - { - "nvim-treesitter/playground", - dependencies = { "nvim-treesitter/nvim-treesitter" }, - build = ":TSInstall query", - }, - "nvim-treesitter/nvim-treesitter-context", - { - "danymat/neogen", - dependencies = { "nvim-treesitter/nvim-treesitter" }, - version = "*", - }, + -- Treesitter + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + }, + "nvim-treesitter/nvim-treesitter-textobjects", + "mrjones2014/nvim-ts-rainbow", + { + "nvim-treesitter/playground", + dependencies = { "nvim-treesitter/nvim-treesitter" }, + build = ":TSInstall query", + }, + "nvim-treesitter/nvim-treesitter-context", + { + "danymat/neogen", + dependencies = { "nvim-treesitter/nvim-treesitter" }, + version = "*", + }, - -- Snippets - { - "L3MON4D3/LuaSnip", - dependencies = { - "rafamadriz/friendly-snippets", - }, - config = function() - require("luasnip.loaders.from_vscode").lazy_load() - end, - }, + -- Snippets + { + "L3MON4D3/LuaSnip", + dependencies = { + "rafamadriz/friendly-snippets", + }, + config = function() + require("luasnip.loaders.from_vscode").lazy_load() + end, + }, - -- Git - "tpope/vim-fugitive", - { - "lewis6991/gitsigns.nvim", - event = "BufReadPre", - config = true, - }, + -- Git + "tpope/vim-fugitive", + -- { + -- "NeogitOrg/neogit", + -- dependencies = { + -- "nvim-lua/plenary.nvim", + -- }, + -- config = true, + -- }, + { + "lewis6991/gitsigns.nvim", + event = "BufReadPre", + config = true, + }, - -- UI - { - "EdenEast/nightfox.nvim", - config = function() - vim.cmd.colorscheme("carbonfox") - end, - }, - "nvim-lualine/lualine.nvim", - "stevearc/dressing.nvim", + -- UI + { + "EdenEast/nightfox.nvim", + config = function() + vim.cmd.colorscheme("carbonfox") + end, + }, + "nvim-lualine/lualine.nvim", + "stevearc/dressing.nvim", - -- Code help - { - "numToStr/Comment.nvim", - config = true, - }, - { - "ThePrimeagen/harpoon", - dependencies = { - { "nvim-lua/plenary.nvim" }, - }, - }, + -- Code help + { + "numToStr/Comment.nvim", + config = true, + }, + { + "ThePrimeagen/harpoon", + dependencies = { + { "nvim-lua/plenary.nvim" }, + }, + }, - -- Telescope - { - "nvim-telescope/telescope.nvim", - cmd = "Telescope", - dependencies = { - "nvim-lua/plenary.nvim", - }, - init = function() - require("telescope").setup({ - extensions = { - file_browser = { - hijack_netrw = true - } - } - }) - require("telescope").load_extension("fzf") - require("telescope").load_extension("harpoon") - require("telescope").load_extension("luasnip") - require("telescope").load_extension("file_browser") - end, - lazy = true, - }, - { - "nvim-telescope/telescope-fzf-native.nvim", - dependencies = { - { "nvim-telescope/telescope.nvim" }, - }, - build = "make", - }, - { - "nvim-telescope/telescope-file-browser.nvim", - dependencies = { - "nvim-telescope/telescope.nvim", - }, - lazy = true - }, - { - "benfowler/telescope-luasnip.nvim", - dependencies = { - "nvim-telescope/telescope.nvim", - }, - lazy = true, - }, - { - "ethanholz/nvim-lastplace", - config = true - }, - "mbbill/undotree", - { - "folke/which-key.nvim", - config = true, - }, - { - "andythigpen/nvim-coverage", - dependencies = "nvim-lua/plenary.nvim", - config = true, - }, - { - "folke/todo-comments.nvim", - dependencies = "nvim-lua/plenary.nvim", - config = true, - } + -- Telescope + { + "nvim-telescope/telescope.nvim", + cmd = "Telescope", + dependencies = { + "nvim-lua/plenary.nvim", + }, + init = function() + require("telescope").setup({ + extensions = { + file_browser = { + hijack_netrw = true, + }, + }, + }) + require("telescope").load_extension("fzf") + require("telescope").load_extension("harpoon") + require("telescope").load_extension("luasnip") + require("telescope").load_extension("file_browser") + end, + lazy = true, + }, + { + "nvim-telescope/telescope-fzf-native.nvim", + dependencies = { + { "nvim-telescope/telescope.nvim" }, + }, + build = "make", + }, + { + "nvim-telescope/telescope-file-browser.nvim", + dependencies = { + "nvim-telescope/telescope.nvim", + }, + lazy = true, + }, + { + "benfowler/telescope-luasnip.nvim", + dependencies = { + "nvim-telescope/telescope.nvim", + }, + lazy = true, + }, + { + "ethanholz/nvim-lastplace", + config = true, + dir = "/home/ethan/Documents/github/nvim-lastplace", + }, + { + "farmergreg/vim-lastplace", + lazy = false, + enabled = false, + }, + "mbbill/undotree", + { + "folke/which-key.nvim", + config = true, + }, + { + "andythigpen/nvim-coverage", + dependencies = "nvim-lua/plenary.nvim", + config = true, + }, + { + "folke/todo-comments.nvim", + dependencies = "nvim-lua/plenary.nvim", + config = true, + }, + { + "ibhagwan/fzf-lua", + dependencies = "nvim-tree/nvim-web-devicons", + }, + { + "IndianBoy42/tree-sitter-just", + config = true, + }, + "NoahTheDuke/vim-just", + { + "akinsho/toggleterm.nvim", + version = "*", + config = true, + }, + { + "jackMort/ChatGPT.nvim", + -- event = "VeryLazy", + cmd = { "ChatGPT", "ChatGPTActAs", "ChatGPTEditWithInstructions", "ChatpGPTRun" }, + config = function() + require("chatgpt").setup({ + api_key_cmd = "op read op://personal-api-auth/ChatGPT/credential --no-newline", + }) + end, + dependencies = { + "MunifTanjim/nui.nvim", + "nvim-lua/plenary.nvim", + "nvim-telescope/telescope.nvim", + }, + }, + { + "folke/noice.nvim", + event = "VeryLazy", + dependencies = { + "MunifTanjim/nui.nvim", + "rcarriga/nvim-notify", + }, + }, + { + "ruifm/gitlinker.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + }, + config = true, + }, } require("lazy").setup(plugins) diff --git a/nvim/.config/nvim/lua/custom/ui.lua b/nvim/.config/nvim/lua/custom/ui.lua --- a/nvim/.config/nvim/lua/custom/ui.lua +++ b/nvim/.config/nvim/lua/custom/ui.lua @@ -1,34 +1,60 @@ local ok, lualine = pcall(require, "lualine") if ok then - local ho, harpoon_mark = pcall(require, "harpoon.mark") - local lualine_config = {} - if ho then - local function hook() - local harpoon_number = harpoon_mark.get_index_of(vim.fn.bufname()) - if harpoon_number then - return "ﯠ " .. harpoon_number - else - return "ﯡ " - end - end + local ho, harpoon_mark = pcall(require, "harpoon.mark") + local lualine_config = {} + if ho then + local function hook() + local harpoon_number = harpoon_mark.get_index_of(vim.fn.bufname()) + if harpoon_number then + return "ﯠ " .. harpoon_number + else + return "ﯡ " + end + end - lualine_config["sections"] = { - lualine_y = { - hook - } - } + lualine_config["sections"] = { + lualine_y = { + hook, + }, + } - -- local lualine_config = { - -- sections = { - -- lualine_y = { - -- hook, - -- }, - -- }, - -- } - end + -- local lualine_config = { + -- sections = { + -- lualine_y = { + -- hook, + -- }, + -- }, + -- } + end - lualine.setup(lualine_config) + lualine.setup(lualine_config) - vim.opt.cmdheight = 0 - vim.opt.laststatus = 3 + vim.opt.cmdheight = 0 + vim.opt.laststatus = 3 end + +local noice_config = { + lsp = { + -- override markdown rendering so that **cmp** and other plugins use **Treesitter** + override = { + ["vim.lsp.util.convert_input_to_markdown_lines"] = true, + ["vim.lsp.util.stylize_markdown"] = true, + ["cmp.entry.get_documentation"] = true, + }, + }, + -- you can enable a preset for easier configuration + presets = { + bottom_search = true, -- use a classic bottom cmdline for search + command_palette = true, -- position the cmdline and popupmenu together + long_message_to_split = true, -- long messages will be sent to a split + inc_rename = false, -- enables an input dialog for inc-rename.nvim + lsp_doc_border = false, -- add a border to hover docs and signature help + }, + require("notify").setup({ + background_colour = "#1e222a", + render = "minimal", + stages = "static", + timeout = 5000, + }), +} +require("noice").setup(noice_config) -- tangled.sh