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 @@ -115,6 +115,7 @@ vim.filetype.add({ extension = { grlx = "grlx", mdx = "mdx" } }) local parser_config = require("nvim-treesitter.parsers").get_parser_configs() -- local ft_parser = require("nvim-treesitter.parsers").filetype_to_parsername +---@class gotmpl parser_config.gotmpl = { install_info = { url = "https://github.com/ngalaiko/tree-sitter-go-template", @@ -124,14 +125,6 @@ used_by = { "gohtmltmpl", "gotexttmpl", "gotmpl", "yaml", "grlx" }, } vim.treesitter.language.register("markdown", "mdx") --- local parser_config = require("nvim-treesitter.parsers").get_parser_configs() --- parser_config.grlx = { --- install_info = { --- url = "~/Documents/code/work-oss/tree-sitter-grlx", --- files = { "src/parser.c" }, --- }, --- filetype = "grlx", --- } require("treesitter-context").setup() local function LoadCoverageOnEnter() @@ -194,25 +187,21 @@ end, }) -vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { - group = vim.api.nvim_create_augroup("SlsSelect", { clear = true }), - pattern = { "*/salt/*" }, +vim.api.nvim_create_autocmd({ "FileType" }, { + group = vim.api.nvim_create_augroup("edit_text", { clear = true }), + pattern = { "gitcommit", "markdown", "txt" }, + desc = "Enable spell checking and text wrapping for certain filetypes", callback = function() - vim.cmd("set ft=sls") + -- vim.opt_local.wrap = true + vim.opt_local.spell = true end, }) +vim.opt.spell = false vim.api.nvim_create_autocmd({ "BufNewFile", "BufRead" }, { pattern = { "*.service" }, callback = function() vim.api.nvim_buf_set_option(0, "filetype", "systemd") - end, -}) - -vim.api.nvim_create_autocmd({ "TermOpen" }, { - pattern = { "term://*toggleterm*" }, - callback = function() - vim.opt_local.number = false 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,60 +1,55 @@ { - "ChatGPT.nvim": { "branch": "main", "commit": "48c59167beeb6ee0caa501c46cecc97b9be8571d" }, "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, "LuaSnip": { "branch": "master", "commit": "118263867197a111717b5f13d954cd1ab8124387" }, "ansible-vim": { "branch": "master", "commit": "afc739e505053a6143a1fc6cedac6fb4d7a1d4db" }, - "cmp-git": { "branch": "main", "commit": "f900a4cf117300fdc3ba31d26f8b6223ccd9c574" }, + "cmp-git": { "branch": "main", "commit": "b9603f18496bc3ca07e6bd474607081af709e750" }, "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, "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": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, + "conform.nvim": { "branch": "master", "commit": "a6965ac128eba75537ec2bc5ddd5d5e357062bdc" }, "copilot-cmp": { "branch": "master", "commit": "72fbaa03695779f8349be3ac54fa8bd77eed3ee3" }, - "copilot.lua": { "branch": "master", "commit": "dcaaed5b58e6c2d395bca18d25d34e6384856722" }, - "crates.nvim": { "branch": "main", "commit": "81c6325b7f8875857ec09e5d24f3b6d7986f29e2" }, - "dressing.nvim": { "branch": "master", "commit": "8b7ae53d7f04f33be3439a441db8071c96092d19" }, - "friendly-snippets": { "branch": "main", "commit": "53d3df271d031c405255e99410628c26a8f0d2b0" }, - "gitsigns.nvim": { "branch": "main", "commit": "d195f0c35ced5174d3ecce1c4c8ebb3b5bc23fa9" }, + "copilot.lua": { "branch": "master", "commit": "f7612f5af4a7d7615babf43ab1e67a2d790c13a6" }, + "crates.nvim": { "branch": "main", "commit": "786d12a70c9b91fa2d0d102bb07df02be0db31a1" }, + "dressing.nvim": { "branch": "master", "commit": "18e5beb3845f085b6a33c24112b37988f3f93c06" }, + "friendly-snippets": { "branch": "main", "commit": "ea068f1becd91bcd4591fceb6420d4335e2e14d3" }, + "gitsigns.nvim": { "branch": "main", "commit": "7e38f07cab0e5387f9f41e92474db174a63a4725" }, + "gleam.vim": { "branch": "main", "commit": "f9e82b70425dc0726ee173ecddf176ffa364e30d" }, "gopher.nvim": { "branch": "main", "commit": "ac27f4b6794c872140fb205313d79ab166892fe9" }, - "goto-preview": { "branch": "main", "commit": "16ec236fabb40b2cebfe283b1d701338886462db" }, - "harpoon": { "branch": "master", "commit": "867e212ac153e793f95b316d1731f3ca1894625e" }, - "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, + "harpoon": { "branch": "master", "commit": "ccae1b9bec717ae284906b0bf83d720e59d12b91" }, + "lazy.nvim": { "branch": "main", "commit": "31ddbea7c10b6920c9077b66c97951ca8682d5c8" }, "lsp-inlayhints.nvim": { "branch": "main", "commit": "d981f65c9ae0b6062176f0accb9c151daeda6f16" }, - "lsp-trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" }, - "lspkind-nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" }, - "lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" }, - "nightfox.nvim": { "branch": "main", "commit": "fcf699bef2b2731c840a5746113c3dd31a9cb813" }, - "noice.nvim": { "branch": "main", "commit": "92433164e2f7118d4122c7674c3834d9511722ba" }, - "nui.nvim": { "branch": "main", "commit": "c9b4de623d19a85b353ff70d2ae9c77143abe69c" }, + "lsp-trouble.nvim": { "branch": "main", "commit": "b9cf677f20bb2faa2dacfa870b084e568dca9572" }, + "lspkind-nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" }, + "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, + "mini.indentscope": { "branch": "main", "commit": "cf07f19e718ebb0bcc5b00999083ce11c37b8d40" }, + "nightfox.nvim": { "branch": "main", "commit": "ce0cdf8538c8c0b9c8fb2884d3d1090c8faf515d" }, + "noice.nvim": { "branch": "main", "commit": "0cbe3f88d038320bdbda3c4c5c95f43a13c3aa12" }, + "nui.nvim": { "branch": "main", "commit": "cbd2668414331c10039278f558630ed19b93e69b" }, "null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" }, - "nvim-autopairs": { "branch": "master", "commit": "9fd41181693dd4106b3e414a822bb6569924de81" }, - "nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" }, - "nvim-coverage": { "branch": "main", "commit": "cf4b5c61dfac977026a51a2bcad9173c272986ce" }, - "nvim-dap": { "branch": "master", "commit": "f0dca670fa059eb89dda8869a6310c804241345c" }, - "nvim-dap-go": { "branch": "main", "commit": "a5cc8dcad43f0732585d4793deb02a25c4afb766" }, - "nvim-dap-ui": { "branch": "master", "commit": "34160a7ce6072ef332f350ae1d4a6a501daf0159" }, + "nvim-autopairs": { "branch": "master", "commit": "4f41e5940bc0443fdbe5f995e2a596847215cd2a" }, + "nvim-cmp": { "branch": "main", "commit": "ce16de5665c766f39c271705b17fff06f7bcb84f" }, + "nvim-coverage": { "branch": "main", "commit": "aa4b4400588e2259e87e372b1e4e90ae13cf5a39" }, "nvim-lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" }, - "nvim-lint": { "branch": "master", "commit": "32f98300881f38f4e022391f240188fec42f74db" }, - "nvim-lspconfig": { "branch": "master", "commit": "9099871a7c7e1c16122e00d70208a2cd02078d80" }, - "nvim-treesitter": { "branch": "master", "commit": "454c3a9ba86f841dc3b5bb17d150a873a16b77b4" }, - "nvim-treesitter-context": { "branch": "master", "commit": "c9f2b429a1d63023f7a33b5404616f4cd2a109c5" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "ec1c5bdb3d87ac971749fa6c7dbc2b14884f1f6a" }, + "nvim-lspconfig": { "branch": "master", "commit": "ed8b8a15acc441aec669f97d75f2c1f2ac8c8aa5" }, + "nvim-treesitter": { "branch": "master", "commit": "bc808622986b0ba8eb64780b94d30cdfbd7c6a9f" }, + "nvim-treesitter-context": { "branch": "master", "commit": "ba4289ad345ececd335a9cdd7b9616fd0bb6be92" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "23b820146956b3b681c19e10d3a8bc0cbd9a1d4c" }, "nvim-ts-rainbow": { "branch": "master", "commit": "8312b513ce930e7669a1721befbe56f2e1853301" }, - "nvim-web-devicons": { "branch": "master", "commit": "aff5f50b34754335a312c9b3dc5b245f605ce437" }, - "oil.nvim": { "branch": "master", "commit": "24027ed8d7f3ee5c38cfd713915e2e16d89e79b3" }, - "op.nvim": { "branch": "master", "commit": "52f530bb0fc2c0feceae22e134a36cd342493d85" }, - "pest.vim": { "branch": "master", "commit": "78a65344a89804ec86a0d025a3799f47c2331389" }, + "nvim-web-devicons": { "branch": "master", "commit": "b3468391470034353f0e5110c70babb5c62967d3" }, + "oil.nvim": { "branch": "master", "commit": "c86e48407b8a45f9aa8acb2b4512b384ea1eec84" }, "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" }, - "plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" }, - "rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" }, + "plenary.nvim": { "branch": "master", "commit": "8aad4396840be7fc42896e3011751b7609ca4119" }, + "rose-pine": { "branch": "main", "commit": "17b466e79479758b332a3cac12544a3ad2be6241" }, + "rustaceanvim": { "branch": "master", "commit": "bc8c4b8f7606d5b7c067cd8369e25c1a7ff77bd0" }, "salt-vim": { "branch": "master", "commit": "6ca9e3500cc39dd417b411435d58a1b720b331cc" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, - "telescope.nvim": { "branch": "master", "commit": "f336f8cfab38a82f9f00df380d28f0c2a572f862" }, - "toggleterm.nvim": { "branch": "main", "commit": "cbd041d91b90cd3c02df03fe6133208888f8e008" }, - "tree-sitter-just": { "branch": "main", "commit": "4e5f5f3ff37b12a1bbf664eb3966b3019e924594" }, - "undotree": { "branch": "master", "commit": "36ff7abb6b60980338344982ad4cdf03f7961ecd" }, - "vim-fugitive": { "branch": "master", "commit": "59659093581aad2afacedc81f009ed6a4bfad275" }, - "vim-just": { "branch": "main", "commit": "61effac68ca42dbe515d488c4fef73035ce4f281" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" }, + "telescope.nvim": { "branch": "master", "commit": "d00d9df48c00d8682c14c2b5da78bda7ef06b939" }, + "tree-sitter-just": { "branch": "main", "commit": "6c2f018ab1d90946c0ce029bb2f7d57f56895dff" }, + "undotree": { "branch": "master", "commit": "56c684a805fe948936cda0d1b19505b84ad7e065" }, + "vim-fugitive": { "branch": "master", "commit": "dac8e5c2d85926df92672bf2afb4fc48656d96c7" }, + "vim-just": { "branch": "main", "commit": "a2777b4b113dafc639f541ad4f0f7da0adc640f4" }, "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }, "zig.vim": { "branch": "master", "commit": "54c216e5306a5c3878a60596aacb94dca8652ab9" } } \ 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 @@ -3,20 +3,6 @@ local wk = require("which-key") local v = { mode = "v", noremap = "true" } local t = { mode = "t", noremap = "true" } -local t_n - -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 -- Register LSP mappings vim.api.nvim_create_autocmd("LspAttach", { @@ -69,6 +55,7 @@ end, }) +-- local home_row = { "a", "s", "d", "f", "g", "h", "j", "k", "l" } local harpoon_table = {} for i = 1, 9 do harpoon_table["" .. tostring(i)] = { @@ -83,7 +70,8 @@ [""] = { f = { name = "Telescope", - f = { require("telescope.builtin").find_files, "Find File" }, + -- f = { require("telescope.builtin").find_files, "Find File" }, + f = { require("custom.telescope-project").project_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" }, @@ -100,14 +88,13 @@ b = { require("gitsigns").stage_buffer, "Stage Buffer" }, }, b = { require("gitsigns").blame_line, "Blame Line" }, - u = { gitui_toggle, "gitui toggle" }, }, 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" }, + z = { ":Freeze", "Freeze" }, }, ["g"] = { j = { vim.diagnostic.goto_next, "Go to Next Diagnostic" }, @@ -124,6 +111,25 @@ name = "Telescope", s = { require("telescope.builtin").grep_string, "Grep String" }, }, + g = { + name = "Git", + s = { + name = "Stage", + h = { + function() + require("gitsigns").stage_hunk({ vim.fn.line("."), vim.fn.line("v") }) + end, + "Stage Hunk", + }, + r = { + function() + require("gitsigns").reset_hunk({ vim.fn.line("."), vim.fn.line("v") }) + end, + "Reset Hunk", + }, + }, + }, + z = { ":Freeze", "Freeze" }, }, [""] = { ":m '>+gv=gv", "Move down selection" }, [""] = { ":m '<-2gv=gv", "Move up selection" }, diff --git a/nvim/.config/nvim/after/plugin/autoformat.lua b/nvim/.config/nvim/after/plugin/autoformat.lua deleted file mode 100644 --- a/nvim/.config/nvim/after/plugin/autoformat.lua +++ /dev/null @@ -1,69 +0,0 @@ -local enable_autoformat = true -if not enable_autoformat then - return -end - -local exclude_list = { "ccls", "tsserver", "astro", "lua_ls", "salt_ls" } -local has_value = function(name) - 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)) -end, {}) - --- Create an augroup that is used for managing our formatting autocmds. --- We need one augroup per client to make sure that multiple clients --- 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 - - return _augroups[client.id] -end - -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 - if vim.bo.ft == "sls" 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.lsp.buf.format({ async = false }) - end, - }) - end, -}) 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 @@ -6,278 +6,275 @@ local luasnip = require("luasnip") -- require("luasnip.loaders.from_vscode").lazy_load() cmp.setup({ - sorting = { - priority_weight = 2, - comparators = { - require("copilot_cmp.comparators").prioritize, - cmp.config.compare.offset, - cmp.config.compare.exact, - cmp.config.compare.score, - cmp.config.compare.kind, - cmp.config.compare.sort_text, - cmp.config.compare.length, - cmp.config.compare.order, - }, - }, - formatting = { - format = lspkind.cmp_format({ - symbol_map = { Copilot = "" }, - }), - }, - snippet = { - expand = function(args) - require("luasnip").lsp_expand(args.body) - end, - }, - mapping = { - [""] = cmp.mapping.select_prev_item(), - [""] = cmp.mapping.select_next_item(), - [""] = cmp.mapping({ - i = cmp.mapping.abort(), - c = cmp.mapping.close(), - }), - [""] = cmp.mapping.confirm({ select = true }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expandable() then - luasnip.expand() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end), - }, - sources = cmp.config.sources({ - { name = "copilot", group_index = 2 }, - { name = "nvim_lsp", group_index = 2 }, - { name = "nvim_lsp_signature_help", group_index = 2 }, - { name = "nvim_lsp_lua", group_index = 2 }, - { name = "luasnip", group_index = 2 }, - { name = "crates", group_index = 2 }, - { name = "buffer", group_index = 2 }, - { name = "path", group_index = 2 }, - }), - experimental = { - ghost_text = true, - }, + sorting = { + priority_weight = 2, + comparators = { + require("copilot_cmp.comparators").prioritize, + cmp.config.compare.offset, + cmp.config.compare.exact, + cmp.config.compare.score, + cmp.config.compare.kind, + cmp.config.compare.sort_text, + cmp.config.compare.length, + cmp.config.compare.order, + }, + }, + formatting = { + format = lspkind.cmp_format({ + symbol_map = { Copilot = "" }, + }), + }, + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + mapping = { + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping({ + i = cmp.mapping.abort(), + c = cmp.mapping.close(), + }), + [""] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expandable() then + luasnip.expand() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end), + }, + sources = cmp.config.sources({ + { name = "copilot", group_index = 2 }, + { name = "nvim_lsp", group_index = 2 }, + { name = "nvim_lsp_signature_help", group_index = 2 }, + { name = "nvim_lsp_lua", group_index = 2 }, + { name = "luasnip", group_index = 2 }, + { name = "crates", group_index = 2 }, + { name = "buffer", group_index = 2 }, + { name = "path", group_index = 2 }, + }), + experimental = { + ghost_text = true, + }, }) cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) - 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' } - }) +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", - "ocamllsp", - "bashls", - "marksman", - "pyright", - "solc", - "nixd", - "zls", - { - "grammarly", - exec = "grammarly-languageserver" - }, - { - "ansiblels", - exec = "ansible-language-server" - }, - { - "eslint", - exec = "vscode-eslint-language-server" - }, - { - "nil_ls", - exec = "nil", - settings = { - ['nil'] = { - formatting = { - command = { "nixpkgs-fmt" }, - } - } - } - }, - { - "ltex", - exec = "ltex-ls" - }, - { - "tsserver", - exec = "typescript-language-server" - }, - { - "astro", - exec = "astro-ls" - }, - { - "lua_ls", - exec = "lua-language-server", - settings = { - Lua = { - runtime = { - -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) - version = "LuaJIT", - }, - diagnostics = { - -- Get the language server to recognize the `vim` global and `awesome` - globals = { "vim", "use", "beautiful", "awful" }, - }, - workspace = { - -- Make the server aware of Neovim runtime files - library = vim.api.nvim_get_runtime_file("", true), - checkThirdParty = false - }, - hint = { - enable = true, - }, - telemetry = { - enable = false, - }, - }, - }, - }, - { "vimls", exec = "vim-language-server" }, - { "vuels", exec = "vls" }, - { "salt_ls", exec = "salt_lsp_server" }, - { "dockerls", exec = "docker-langserver" }, - { "arduino_langauge_server", exec = "arduino-langauge-server" }, - { - "gopls", - settings = { - gopls = { - gofumpt = true, - analyses = { - unusedparams = true, - shadow = true, - structtag = false - }, - staticcheck = true, - codelenses = { test = true }, - hints = { - assignVariableTypes = true, - composeLiteralFields = true, - constantValues = true, - functionTypeParameter = true, - parameterNames = true, - rangeVariableTypes = true, - }, - }, - }, - }, + "ccls", + "ocamllsp", + "bashls", + "gleam", + "marksman", + "pyright", + "solc", + "nixd", + "zls", + "pylyzer", + { + "terraformls", + exec = "terraform-ls", + }, + { + "ruff_lsp", + exec = "ruff-lsp", + }, + { + "grammarly", + exec = "grammarly-languageserver", + }, + { + "ansiblels", + exec = "ansible-language-server", + }, + { + "eslint", + exec = "vscode-eslint-language-server", + }, + { + "nil_ls", + exec = "nil", + settings = { + ["nil"] = { + formatting = { + command = { "nixpkgs-fmt" }, + }, + }, + }, + }, + { + "ltex", + exec = "ltex-ls", + }, + { + "tsserver", + exec = "typescript-language-server", + }, + { + "astro", + exec = "astro-ls", + }, + { + "lua_ls", + exec = "lua-language-server", + settings = { + Lua = { + runtime = { + -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) + version = "LuaJIT", + }, + diagnostics = { + -- Get the language server to recognize the `vim` global and `awesome` + globals = { "vim", "use", "beautiful", "awful" }, + }, + workspace = { + -- Make the server aware of Neovim runtime files + library = vim.api.nvim_get_runtime_file("", true), + checkThirdParty = false, + }, + hint = { + enable = true, + }, + telemetry = { + enable = false, + }, + }, + }, + }, + { "vimls", exec = "vim-language-server" }, + { "vuels", exec = "vls" }, + { "salt_ls", exec = "salt_lsp_server" }, + { "dockerls", exec = "docker-langserver" }, + { "arduino_langauge_server", exec = "arduino-langauge-server" }, + { + "gopls", + settings = { + gopls = { + gofumpt = true, + analyses = { + unusedparams = true, + shadow = true, + structtag = false, + }, + staticcheck = true, + codelenses = { test = true }, + hints = { + assignVariableTypes = true, + composeLiteralFields = true, + constantValues = true, + functionTypeParameter = true, + parameterNames = true, + rangeVariableTypes = true, + }, + }, + }, + }, } -- Only install servers that exist + use custom options for _, server in ipairs(servers) do - local exec = "" - local lsp = "" - local setup = { capabilities = capabilities } - if type(server) == "table" then - lsp = server[1] - if server.enable ~= nil and server.continue then - goto continue - end - if server.exec ~= nil then - exec = server.exec - else - exec = lsp - end - if server.settings ~= nil then - setup["settings"] = server.settings - end - if server.init_options ~= nil then - setup["init_options"] = server.init_options - end - else - lsp = server - exec = server - end + local exec = "" + local lsp = "" + local setup = { capabilities = capabilities } + if type(server) == "table" then + lsp = server[1] + if server.enable ~= nil and server.continue then + goto continue + end + if server.exec ~= nil then + exec = server.exec + else + exec = lsp + end + if server.settings ~= nil then + setup["settings"] = server.settings + end + if server.init_options ~= nil then + setup["init_options"] = server.init_options + end + else + lsp = server + exec = server + end - local result = tonumber(vim.api.nvim_exec([[echo executable("]] .. exec .. [[")]], true)) - if result ~= 0 then - nvim_lsp[lsp].setup(setup) - end - ::continue:: + local result = tonumber(vim.api.nvim_exec([[echo executable("]] .. exec .. [[")]], true)) + if result ~= 0 then + nvim_lsp[lsp].setup(setup) + end + ::continue:: end - -local rust_opts = { - server = { - capabilities = capabilities, - ["rust-analyzer"] = { - procMacro = { - enable = true, - }, - diagnostics = { - enable = true, - enable_experimental = true, - }, - }, - }, - tools = { - inlay_hints = { - auto = false - }, - } +vim.g.rustaceanvim = { + server = { + capabilities = capabilities, + ["rust-analyzer"] = { + -- procMacro = { + -- 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 + 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, + 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("rust-tools").setup(rust_opts) require("trouble").setup({}) local null_ls = require("null-ls") local formatting = null_ls.builtins.formatting -local code_actions = null_ls.builtins.code_actions -local diagnostics = null_ls.builtins.diagnostics null_ls.setup({ - -- you can reuse a shared lspconfig on_attach callback here - debug = true, - sources = { - -- formatting.rustfmt, - diagnostics.revive.with({ - args = { "-config", vim.fn.expand("~/.config/revive/revive.toml"), "-formatter", "json", "./..." } - }), - formatting.stylua, - -- formatting.black, - code_actions.gomodifytags, - diagnostics.saltlint - }, + -- you can reuse a shared lspconfig on_attach callback here + debug = true, + sources = { + formatting.stylua, + }, }) diff --git a/nvim/.config/nvim/lua/custom/plugins.lua b/nvim/.config/nvim/lua/custom/plugins.lua deleted file mode 100644 --- a/nvim/.config/nvim/lua/custom/plugins.lua +++ /dev/null diff --git a/nvim/.config/nvim/lua/custom/set.lua b/nvim/.config/nvim/lua/custom/set.lua --- a/nvim/.config/nvim/lua/custom/set.lua +++ b/nvim/.config/nvim/lua/custom/set.lua @@ -15,9 +15,9 @@ vim.opt.shiftwidth = tab_value vim.opt.expandtab = true -vim.opt.shell = "zsh" +vim.opt.shell = "fish" vim.opt.bg = "dark" -vim.opt.spell = true -- Enables treesitter comment spelling +vim.opt.spell = false -- Enables treesitter comment spelling vim.opt.termguicolors = true vim.opt.signcolumn = "yes" vim.opt.filetype = "on" diff --git a/nvim/.config/nvim/lua/custom/telescope-project.lua b/nvim/.config/nvim/lua/custom/telescope-project.lua new file mode 100644 --- /dev/null +++ b/nvim/.config/nvim/lua/custom/telescope-project.lua @@ -0,0 +1,31 @@ +local builtin = require("telescope.builtin") +-- telescope-config.lua +local M = {} + +-- We cache the results of "git rev-parse" +-- Process creation is expensive in Windows, so this reduces latency +local is_inside_work_tree = {} + +M.project_files = function() + local opts = {} -- define here if you want to define something + + local cwd = vim.fn.getcwd() + if is_inside_work_tree[cwd] == nil then + vim.fn.system("git rev-parse --is-inside-work-tree") + is_inside_work_tree[cwd] = vim.v.shell_error == 0 + end + + if is_inside_work_tree[cwd] then + builtin.git_files(opts) + else + builtin.find_files(opts) + end +end + +return M + +-- call via: +-- :lua require"telescope-config".project_files() + +-- example keymap: +-- vim.api.nvim_set_keymap("n", "", "lua require'telescope-config'.project_files()", {noremap = true, silent = true}) diff --git a/nvim/.config/nvim/lua/plugins/conform.lua b/nvim/.config/nvim/lua/plugins/conform.lua new file mode 100644 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/conform.lua @@ -0,0 +1,16 @@ +return { + { + "stevearc/conform.nvim", + opts = { + formatters_by_ft = { + lua = { "stylua" }, + python = { "ruff_format" }, + terraform = { "terraform_fmt" }, + }, + format_on_save = { + timeout_ms = 500, + lsp_fallback = true, + }, + }, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/dap.lua b/nvim/.config/nvim/lua/plugins/dap.lua deleted file mode 100644 --- a/nvim/.config/nvim/lua/plugins/dap.lua +++ /dev/null @@ -1,39 +0,0 @@ -return { - { - "mfussenegger/nvim-dap", - dependencies = { - "rcarriga/nvim-dap-ui", - "leoluz/nvim-dap-go", - "folke/which-key.nvim", - }, - ft = "go", - config = function() - require("dapui").setup() - require("dap-go").setup() - local wk = require("which-key") - wk.register({ - [""] = { - d = { - name = "Dap", - u = { require("dapui").toggle, "Toggle Dap UI" }, - b = { require("dap").toggle_breakpoint, "Toggle Breakpoint" }, - B = { - function() - require("dap").set_breakpoint(vim.fn.input("Breakpoint condition: ")) - end, - "Set Breakpoint with condition", - }, - t = { require("dap").terminate, "Terminate Dap" }, - }, - }, - [""] = { require("dap").continue, "Dap Continue" }, - - [""] = { require("dap").step_into, "Dap Step Into" }, - [""] = { require("dap").step_out, "Dap Step Out" }, - [""] = { require("dap").step_over, "Dap Step Over" }, - - [""] = { require("dap-go").debug_test, "Dap Go Test" }, - }) - end, - }, -} diff --git a/nvim/.config/nvim/lua/plugins/freeze.lua b/nvim/.config/nvim/lua/plugins/freeze.lua new file mode 100644 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/freeze.lua @@ -0,0 +1,10 @@ +return { + { + "ethanholz/freeze.nvim", + dir = "~/Documents/code/personal/freeze", + config = true, + opts = { + theme = "rose-pine-moon", + }, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/init.lua b/nvim/.config/nvim/lua/plugins/init.lua --- a/nvim/.config/nvim/lua/plugins/init.lua +++ b/nvim/.config/nvim/lua/plugins/init.lua @@ -1,12 +1,6 @@ return { { "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" }, @@ -17,7 +11,11 @@ config = true, on = { "LspAttach" }, }, - "simrat39/rust-tools.nvim", + { + "mrcjkb/rustaceanvim", + version = "^3", + ft = { "rust" }, + }, { "olexsmir/gopher.nvim", dependencies = { @@ -41,11 +39,6 @@ config = true, }, "ziglang/zig.vim", - { - "pest-parser/pest.vim", - ft = "pest", - config = true, - }, -- nvim-cmp { @@ -60,7 +53,6 @@ "nvim-lua/plenary.nvim", }, }, - -- Treesitter { "nvim-treesitter/nvim-treesitter", @@ -88,11 +80,20 @@ "EdenEast/nightfox.nvim", config = function() -- vim.cmd.colorscheme("carbonfox") - vim.cmd.colorscheme("terafox") + -- vim.cmd.colorscheme("terafox") + end, + }, + { + "rose-pine/neovim", + name = "rose-pine", + config = function() + require("rose-pine").setup({ + variant = "moon", + }) + vim.cmd.colorscheme("rose-pine") end, }, "stevearc/dressing.nvim", - -- Code help { "numToStr/Comment.nvim", @@ -113,28 +114,5 @@ config = true, }, "NoahTheDuke/vim-just", - { - "akinsho/toggleterm.nvim", - version = "*", - config = true, - }, - { - "jackMort/ChatGPT.nvim", - -- event = "VeryLazy", - cmd = { "ChatGPT", "ChatGPTActAs", "ChatGPTEditWithInstructions", "ChatpGPTRun" }, - opts = { - api_key_cmd = "op read op://personal-api-auth/ChatGPT/credential --no-newline", - }, - dependencies = { - "MunifTanjim/nui.nvim", - "nvim-lua/plenary.nvim", - "nvim-telescope/telescope.nvim", - }, - }, - "mfussenegger/nvim-lint", - { - "mrjones2014/op.nvim", - build = "make install", - config = true, - }, + "gleam-lang/gleam.vim", } diff --git a/nvim/.config/nvim/lua/plugins/mini.lua b/nvim/.config/nvim/lua/plugins/mini.lua new file mode 100644 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/mini.lua @@ -0,0 +1,14 @@ +return { + { + "echasnovski/mini.indentscope", + version = "*", + config = function() + local indent = require("mini.indentscope") + indent.setup({ + draw = { + animation = indent.gen_animation.none(), + }, + }) + end, + }, +}