diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:40:16 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:40:16 +0000 |
| commit | b94eefa6b58f274bb61db4e792105c3959cf2022 (patch) | |
| tree | 3d2896fb46ebc769e4fea8cf4f02ce3104e1f974 /nvim/after/plugin | |
Diffstat (limited to 'nvim/after/plugin')
| -rw-r--r-- | nvim/after/plugin/autopairs.lua | 1 | ||||
| -rw-r--r-- | nvim/after/plugin/fidget.lua | 83 | ||||
| -rw-r--r-- | nvim/after/plugin/fugitive.lua | 1 | ||||
| -rw-r--r-- | nvim/after/plugin/lsp.lua | 277 | ||||
| -rw-r--r-- | nvim/after/plugin/noice.lua | 30 | ||||
| -rw-r--r-- | nvim/after/plugin/origami.lua | 22 | ||||
| -rw-r--r-- | nvim/after/plugin/telescope.lua | 14 | ||||
| -rw-r--r-- | nvim/after/plugin/tree.lua | 35 | ||||
| -rw-r--r-- | nvim/after/plugin/treesitter.lua | 61 | ||||
| -rw-r--r-- | nvim/after/plugin/undotree.lua | 1 |
10 files changed, 525 insertions, 0 deletions
diff --git a/nvim/after/plugin/autopairs.lua b/nvim/after/plugin/autopairs.lua new file mode 100644 index 0000000..4de6add --- /dev/null +++ b/nvim/after/plugin/autopairs.lua @@ -0,0 +1 @@ +require("nvim-autopairs").setup() diff --git a/nvim/after/plugin/fidget.lua b/nvim/after/plugin/fidget.lua new file mode 100644 index 0000000..107d424 --- /dev/null +++ b/nvim/after/plugin/fidget.lua @@ -0,0 +1,83 @@ +require("fidget").setup { + progress = { + poll_rate = 0, -- How and when to poll for progress messages + suppress_on_insert = true, -- Suppress new messages while in insert mode + ignore_done_already = true, -- Ignore new tasks that are already complete + ignore_empty_message = true, -- Ignore new tasks that don't contain a message + clear_on_detach = -- Clear notification group when LSP server detaches + function(client_id) + local client = vim.lsp.get_client_by_id(client_id) + return client and client.name or nil + end, + notification_group = -- How to get a progress message's notification group key + function(msg) return msg.lsp_client.name end, + ignore = {}, -- List of LSP servers to ignore + + -- Options related to how LSP progress messages are displayed as notifications + display = { + render_limit = 3, -- How many LSP messages to show at once + done_ttl = 3, -- How long a message should persist after completion + done_icon = "✔", -- Icon shown when all LSP progress tasks are complete + done_style = "Constant", -- Highlight group for completed LSP tasks + progress_ttl = math.huge, -- How long a message should persist when in progress + progress_icon = -- Icon shown when LSP progress tasks are in progress + { pattern = "dots", period = 1 }, + progress_style = -- Highlight group for in-progress LSP tasks + "WarningMsg", + group_style = "Title", -- Highlight group for group name (LSP server name) + icon_style = "Question", -- Highlight group for group icons + priority = 30, -- Ordering priority for LSP notification group + skip_history = true, -- Whether progress notifications should be omitted from history + format_message = -- How to format a progress message + require("fidget.progress.display").default_format_message, + format_annote = -- How to format a progress annotation + function(msg) return msg.title end, + format_group_name = -- How to format a progress notification group's name + function(group) return tostring(group) end, + overrides = { -- Override options from the default notification config + rust_analyzer = { name = "rust-analyzer" }, + }, + }, + + -- Options related to Neovim's built-in LSP client + lsp = { + progress_ringbuf_size = 0, -- Configure the nvim's LSP progress ring buffer size + log_handler = false, -- Log `$/progress` handler invocations (for debugging) + }, + }, + + -- Options related to notification subsystem + notification = { + window = { + normal_hl = "Comment", -- Base highlight group in the notification window + winblend = 0, -- Background color opacity in the notification window + border = "none", -- Border around the notification window + zindex = 45, -- Stacking priority of the notification window + max_width = 0, -- Maximum width of the notification window + max_height = 0, -- Maximum height of the notification window + x_padding = 1, -- Padding from right edge of window boundary + y_padding = 0, -- Padding from bottom edge of window boundary + align = "bottom", -- How to align the notification window + relative = "editor", -- What the notification window position is relative to + }, + }, + + -- Options related to integrating with other plugins + integration = { + ["nvim-tree"] = { + enable = true, -- Integrate with nvim-tree/nvim-tree.lua (if installed) + }, + ["xcodebuild-nvim"] = { + enable = true, -- Integrate with wojciech-kulik/xcodebuild.nvim (if installed) + }, + }, + + -- Options related to logging + logger = { + level = vim.log.levels.WARN, -- Minimum logging level + max_size = 10000, -- Maximum log file size, in KB + float_precision = 0.01, -- Limit the number of decimals displayed for floats + path = -- Where Fidget writes its logs to + string.format("%s/fidget.nvim.log", vim.fn.stdpath("cache")), + }, +} diff --git a/nvim/after/plugin/fugitive.lua b/nvim/after/plugin/fugitive.lua new file mode 100644 index 0000000..80c9070 --- /dev/null +++ b/nvim/after/plugin/fugitive.lua @@ -0,0 +1 @@ +vim.keymap.set("n", "<leader>gs", vim.cmd.Git) diff --git a/nvim/after/plugin/lsp.lua b/nvim/after/plugin/lsp.lua new file mode 100644 index 0000000..6487a8e --- /dev/null +++ b/nvim/after/plugin/lsp.lua @@ -0,0 +1,277 @@ +local lspkind = require('lspkind') +local lspconfig = require("lspconfig") +local cmp = require('cmp') +local capabilities = require("cmp_nvim_lsp").default_capabilities() + +require("mason").setup({ + registries = { + "github:mason-org/mason-registry", + "github:Crashdummyy/mason-registry", + }, +}) + +require("mason-lspconfig").setup() + +cmp.setup({ + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + ['<C-b>'] = cmp.mapping.scroll_docs(-4), + ['<C-f>'] = cmp.mapping.scroll_docs(4), + ['<C-Space>'] = cmp.mapping.complete(), + ['<C-e>'] = cmp.mapping.abort(), + ['<C-x>'] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + { name = 'buffer' }, + { name = 'path' }, + }), + formatting = { + format = lspkind.cmp_format({ + mode = 'symbol_text', + maxwidth = 50, + ellipsis_char = '...', + show_labelDetails = true, + }) + }, + window = { + completion = { + winhighlight = "Normal:CmpNormal,FloatBorder:CmpBorder", + border = { + { "╭", "CmpBorder" }, + { "─", "CmpBorder" }, + { "╮", "CmpBorder" }, + { "│", "CmpBorder" }, + { "╯", "CmpBorder" }, + { "─", "CmpBorder" }, + { "╰", "CmpBorder" }, + { "│", "CmpBorder" }, + }, + scrollbar = false, + }, + documentation = { + winhighlight = "Normal:CmpDocNormal,FloatBorder:CmpDocBorder", + border = { + { "╭", "CmpDocBorder" }, + { "─", "CmpDocBorder" }, + { "╮", "CmpDocBorder" }, + { "│", "CmpDocBorder" }, + { "╯", "CmpDocBorder" }, + { "─", "CmpDocBorder" }, + { "╰", "CmpDocBorder" }, + { "│", "CmpDocBorder" }, + }, + }, + }, +}) + +-- vim.api.nvim_set_hl(0, "CmpNormal", { bg = "#E0E2EB", blend = 0 }) +-- vim.api.nvim_set_hl(0, "CmpBorder", { fg = "#E0E2EB", bg = "#E0E2EB", blend = 0 }) +-- vim.api.nvim_set_hl(0, "CmpDocNormal", { bg = "#E0E2EB", blend = 0 }) +-- vim.api.nvim_set_hl(0, "CmpDocBorder", { fg = "#E0E2EB", bg = "#E0E2EB", blend = 0 }) + +local options = { buffer = bufnr, remap = false } +local on_attach = function(client, bufnr) + -- if vim.bo.filetype == 'csharp' or vim.bo.filetype == 'cs' or vim.bo.filetype == "c" or vim.bo.filetype == "cpp" or vim.bo.filetype == "swift" or vim.bo.filetype == "swiftinterface" or vim.bo.filetype == 'zig' then + client.server_capabilities.semanticTokensProvider = nil + -- end + vim.keymap.set('n', 'gd', '<cmd>lua require"telescope.builtin".lsp_definitions({jump_type="vsplit"})<CR>', options) + -- vim.keymap.set('n', 'gd', function() vim.lsp.buf.definition() end, options) + vim.keymap.set("n", "gr", function() vim.lsp.buf.references() end, options) + vim.keymap.set("n", "bh", function() vim.lsp.buf.hover() end, options) + vim.keymap.set("n", "ca", function() vim.lsp.buf.code_action() end, options) + vim.keymap.set("n", "cr", function() vim.lsp.buf.rename() end, options) + vim.keymap.set("n", "gv", function() vim.lsp.buf.signature_help() end, options) + vim.keymap.set("n", "gl", function() vim.diagnostic.open_float() end, options) + vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, options) + vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, options) +end + +vim.lsp.config("roslyn", { + on_attach = on_attach, + capabilities = capabilities, + settings = { + ["csharp|inlay_hints"] = { + csharp_enable_inlay_hints_for_implicit_object_creation = true, + csharp_enable_inlay_hints_for_implicit_variable_types = true, + }, + ["csharp|code_lens"] = { + dotnet_enable_references_code_lens = true, + }, + }, +}) + +vim.api.nvim_create_autocmd('BufWritePre', { + callback = function() + vim.lsp.buf.format { + async = false, + } + end, +}) + +vim.api.nvim_create_autocmd('LspAttach', { + callback = function(args) + local client = vim.lsp.get_client_by_id(args.data.client_id) + client.server_capabilities.semanticTokensProvider = nil + end +}) + +vim.lsp.config("eslint_lsp", + { + experimental = { + useFlatConfig = true + }, + on_attach = function(_client, bufnr) + vim.api.nvim_create_autocmd("BufWritePre", { + buffer = bufnr, + command = "EslintFixAll", + }) + on_attach(_client, bufnr) + end, + filetypes = { + "javascript", + "javascriptreact", + "javascript.jsx", + "typescript", + "typescriptreact", + "typescript.tsx", + "vue", + "html", + "markdown", + "json", + "jsonc", + "yaml", + "toml", + "xml", + "gql", + "graphql", + "astro", + "svelte", + "css", + "less", + "scss", + "pcss", + "postcss" + }, + } +) + +vim.lsp.config('rust_analyzer', { + on_attach = on_attach, + capabilities = capabilities, + settings = { + ['rust-analyzer'] = { + diagnostics = { + enable = false; + } + } + } +}) + +vim.lsp.config('ocamllsp', { + on_attach = on_attach, + capabilities = capabilities, + cmd = { 'ocamllsp' }, + filetypes = { 'ocaml', 'reason' }, +}) + +vim.lsp.enable('ocamllsp') + +vim.lsp.config('alive', { + on_attach = on_attach, + capabilities = capabilities, + filetypes = { 'lisp' }, + cmd = { 'alive-lsp' }, +}) + +vim.lsp.enable('alive') + +vim.lsp.enable('rust_analyzer') + +vim.lsp.config("ols", { + on_attach = on_attach, + capabilities = capabilities, + init_options = { + checker_args = "-strict-style", + collections = { + { name = "shared", path = vim.fn.expand('$HOME/Odin/shared') } + }, + }, +}) + +vim.lsp.enable("ols") + +vim.lsp.config('hls', { + -- settings = { + -- haskell = { + -- cabalFormattingProvider = "cabal-fmt", + -- formattingProvider = "ormolu", + -- }, + -- }, + filetypes = { 'haskell', 'lhaskell', 'cabal' }, +}) + +vim.lsp.enable('hls') + +local servers = { + "elixir-ls", + "ada_ls", + "zls", + "bashls", + "gopls", + "clangd", + "lua_ls", + "fortls", + "prettier", + "rubyfmt", + "tailwindcss", + "cmake", + "dockerls", + "ts_ls", + "eslint", + "ruby_lsp", + "yamlls", + "yamlfix", + "yamlfmt", + "yamllint", + "erlangls", + "jsonls", +} + +for _, lsp in ipairs(servers) do + vim.lsp.config(lsp, { + on_attach = on_attach, + capabilities = capabilities + }) + vim.lsp.enable(lsp) +end + +vim.diagnostic.config({ + virtual_text = true +}) + +vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( + vim.lsp.diagnostic.on_publish_diagnostics, { + virtual_text = true + } +) + +vim.lsp.inlay_hint.enable(false) + +vim.lsp.commands["editor.action.showReferences"] = function(command, ctx) + local locations = command.arguments[3] + local client = vim.lsp.get_client_by_id(ctx.client_id) + if locations and #locations > 0 then + local items = vim.lsp.util.locations_to_items(locations, client.offset_encoding) + vim.fn.setloclist(0, {}, " ", { title = "References", items = items, context = ctx }) + vim.api.nvim_command("lopen") + end +end + + + diff --git a/nvim/after/plugin/noice.lua b/nvim/after/plugin/noice.lua new file mode 100644 index 0000000..25ae102 --- /dev/null +++ b/nvim/after/plugin/noice.lua @@ -0,0 +1,30 @@ +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, + }, + progress = { + enabled = false, + format = "lsp_progress", + format_done = "lsp_progress_done", + throttle = 1000 / 30, + view = "mini", + }, + }, + views = { + mini = { + win_options = { + winblend = 0 + } + }, + }, + presets = { + bottom_search = true, + command_palette = true, + long_message_to_split = true, + inc_rename = false, + lsp_doc_border = true, + }, +}) diff --git a/nvim/after/plugin/origami.lua b/nvim/after/plugin/origami.lua new file mode 100644 index 0000000..f18f9ca --- /dev/null +++ b/nvim/after/plugin/origami.lua @@ -0,0 +1,22 @@ +-- require("origami").setup { +-- useLspFoldsWithTreesitterFallback = true, -- required for `autoFold` +-- pauseFoldsOnSearch = true, +-- foldtext = { +-- enabled = true, +-- padding = 3, +-- lineCount = { +-- template = "%d lines", -- `%d` is replaced with the number of folded lines +-- hlgroup = "Comment", +-- }, +-- diagnosticsCount = true, -- uses hlgroups and icons from `vim.diagnostic.config().signs` +-- gitsignsCount = true, -- requires `gitsigns.nvim` +-- }, +-- autoFold = { +-- enabled = false, +-- kinds = { "comment" }, ---@type lsp.FoldingRangeKind[] +-- }, +-- foldKeymaps = { +-- setup = true, -- modifies `h` and `l` +-- hOnlyOpensOnFirstColumn = false, +-- }, +-- } diff --git a/nvim/after/plugin/telescope.lua b/nvim/after/plugin/telescope.lua new file mode 100644 index 0000000..0ceff37 --- /dev/null +++ b/nvim/after/plugin/telescope.lua @@ -0,0 +1,14 @@ +require("telescope").setup { + defaults = { + file_ignore_patterns = { "yarn.lock", "node_modules/*", "_build/*", "ios/*", "android/*" }, + preview = { + treesitter = true, + }, + } +} + +local builtin = require("telescope.builtin") + +vim.keymap.set('n', '<leader>pf', builtin.find_files, {}) +vim.keymap.set('n', '<C-p>', builtin.git_files, {}) +vim.keymap.set('n', '<C-f>', builtin.live_grep, {}) diff --git a/nvim/after/plugin/tree.lua b/nvim/after/plugin/tree.lua new file mode 100644 index 0000000..555e223 --- /dev/null +++ b/nvim/after/plugin/tree.lua @@ -0,0 +1,35 @@ +require 'nvim-web-devicons'.setup { + strict = true, + override_by_extension = { + ["re"] = { + icon = "", + color = "#DC4C39", + name = "ReasonML" + }, + ["rei"] = { + icon = "", + color = "#B8383C", + name = "ReasonMLInterface" + } + }, +} + +require 'nvim-tree'.setup { + git = { + ignore = false + }, + update_focused_file = { + enable = true, + }, + view = { + width = 24, + adaptive_size = true, + float = { + quit_on_focus_loss = true, + enable = true + } + } +} + +vim.keymap.set('n', '<C-n>', vim.cmd.NvimTreeToggle) +vim.keymap.set('n', '<leader>ff', vim.cmd.NvimTreeFindFile) diff --git a/nvim/after/plugin/treesitter.lua b/nvim/after/plugin/treesitter.lua new file mode 100644 index 0000000..817febf --- /dev/null +++ b/nvim/after/plugin/treesitter.lua @@ -0,0 +1,61 @@ +require('nvim-treesitter.configs').setup { + ensure_installed = { "typescript", "cpp", "javascript", "lua", "ocaml", "go", "dockerfile", "php", "perl", "json", "yaml", "toml", "html", "css", "bash", "tsx", "python", "rust", "haskell" }, + sync_install = false, + auto_install = true, + indent = { + enable = false, + }, + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, +} + +local parser_config = require "nvim-treesitter.parsers".get_parser_configs() +parser_config.crystal = { + install_info = { + url = "https://github.com/crystal-lang-tools/tree-sitter-crystal", + files = { "src/parser.c", "src/scanner.c" }, + branch = "main", + }, + filetype = "crystal", +} + +local list = require("nvim-treesitter.parsers").get_parser_configs() +list.reason = { + install_info = { + url = "https://github.com/reasonml-editor/tree-sitter-reason", + files = { "src/parser.c", "src/scanner.c" }, + branch = "master", + }, +} + +vim.filetype.add { + extension = { + re = "reason", + }, +} + +vim.treesitter.language.add("reason", { filetype = "reason" }) + +require('treesitter-context').setup { + enable = false +} + +local parser_config2 = require "nvim-treesitter.parsers".get_parser_configs() +parser_config2.haxe = { + install_info = { + url = "https://github.com/vantreeseba/tree-sitter-haxe", + files = { "src/parser.c", "src/scanner.c" }, + -- optional entries: + branch = "main", + }, + filetype = "haxe", +} + +vim.opt.foldmethod = "expr" +vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()" +vim.opt.foldcolumn = "0" +vim.opt.foldtext = "" +vim.opt.foldlevel = 99 +vim.opt.foldnestmax = 4 diff --git a/nvim/after/plugin/undotree.lua b/nvim/after/plugin/undotree.lua new file mode 100644 index 0000000..b6b9276 --- /dev/null +++ b/nvim/after/plugin/undotree.lua @@ -0,0 +1 @@ +vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle) |