From 408e4d3e4c4676779859459af5b742a8826a47f0 Mon Sep 17 00:00:00 2001 From: steven-na Date: Thu, 30 Apr 2026 02:34:06 -0700 Subject: Odin setup. using built from source --- arch/nvim/.config/nvim/lazy-lock.json | 8 ++-- arch/nvim/.config/nvim/lua/plugins/formatting.lua | 1 + arch/nvim/.config/nvim/lua/plugins/lsp.lua | 57 +++++++++++++---------- arch/nvim/.config/nvim/lua/plugins/treesitter.lua | 1 + 4 files changed, 39 insertions(+), 28 deletions(-) (limited to 'arch/nvim/.config') diff --git a/arch/nvim/.config/nvim/lazy-lock.json b/arch/nvim/.config/nvim/lazy-lock.json index 435605d..f69f91a 100644 --- a/arch/nvim/.config/nvim/lazy-lock.json +++ b/arch/nvim/.config/nvim/lazy-lock.json @@ -5,19 +5,19 @@ "conform.nvim": { "branch": "master", "commit": "dca1a190aa85f9065979ef35802fb77131911106" }, "fidget.nvim": { "branch": "main", "commit": "889e2e96edef4e144965571d46f7a77bcc4d0ddf" }, "friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" }, - "fzf-lua": { "branch": "main", "commit": "1ae863c83e0823225b4e041845f10c918d5fb882" }, + "fzf-lua": { "branch": "main", "commit": "b437bafc981a180d609bb4092c56ce8999f7a2c4" }, "gitsigns.nvim": { "branch": "main", "commit": "6d808f99bd63303646794406e270bd553ad7792e" }, "go-up.nvim": { "branch": "main", "commit": "0151656d66cdad1a696ac10169b2400628c7b451" }, "hardtime.nvim": { "branch": "main", "commit": "b4e431934af1fe224a3a801f632c008278cb7628" }, "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, "lazydev.nvim": { "branch": "main", "commit": "ff2cbcba459b637ec3fd165a2be59b7bbaeedf0d" }, - "leap.nvim": { "branch": "main", "commit": "ebecd4c7957770e21abe71f8b2dd34952850033d" }, - "lualine.nvim": { "branch": "master", "commit": "a905eeebc4e63fdc48b5135d3bf8aea5618fb21c" }, + "leap.nvim": { "branch": "main", "commit": "156c71aabb68d520c6269db4103c8e5580e3ea67" }, + "lualine.nvim": { "branch": "master", "commit": "131a558e13f9f28b15cd235557150ccb23f89286" }, "mini.base16": { "branch": "main", "commit": "800f107b27a00978b0dadd672d6da21a5b12fa9a" }, "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, "nvim-autopairs": { "branch": "master", "commit": "59bce2eef357189c3305e25bc6dd2d138c1683f5" }, "nvim-lint": { "branch": "master", "commit": "eab58b48eb11d7745c11c505e0f3057165902461" }, - "nvim-lspconfig": { "branch": "master", "commit": "8fde495949782bb61c2605174e231d145a048d8c" }, + "nvim-lspconfig": { "branch": "master", "commit": "f7e89f3d19fb436e1fbeff3bf4291eef35da94e3" }, "nvim-surround": { "branch": "main", "commit": "61319d4bd1c5e336e197defa15bd104c51f0fb29" }, "nvim-treesitter": { "branch": "main", "commit": "4916d6592ede8c07973490d9322f187e07dfefac" }, "nvim-ufo": { "branch": "main", "commit": "ab3eb124062422d276fae49e0dd63b3ad1062cfc" }, diff --git a/arch/nvim/.config/nvim/lua/plugins/formatting.lua b/arch/nvim/.config/nvim/lua/plugins/formatting.lua index 39e02d9..67143d5 100644 --- a/arch/nvim/.config/nvim/lua/plugins/formatting.lua +++ b/arch/nvim/.config/nvim/lua/plugins/formatting.lua @@ -33,6 +33,7 @@ return { python = { "isort", "black" }, lua = { "stylua" }, haskell = { "ormolu" }, + odin = { "odinfmt" }, }, format_on_save = function(bufnr) diff --git a/arch/nvim/.config/nvim/lua/plugins/lsp.lua b/arch/nvim/.config/nvim/lua/plugins/lsp.lua index 17c5c64..e28a77a 100644 --- a/arch/nvim/.config/nvim/lua/plugins/lsp.lua +++ b/arch/nvim/.config/nvim/lua/plugins/lsp.lua @@ -11,26 +11,35 @@ return { }, }, config = function() - -- nvim 0.11+ API: vim.lsp.config / vim.lsp.enable - -- nvim-lspconfig provides default server configs in its runtime lsp/*.lua files - - local caps = require("blink.cmp").get_lsp_capabilities() - - -- Apply capabilities to all servers - vim.lsp.config("*", { capabilities = caps }) + vim.lsp.config("*", { + capabilities = require("blink.cmp").get_lsp_capabilities(), + }) -- Server-specific overrides vim.lsp.config("lua_ls", { settings = { Lua = { diagnostics = { globals = { "vim" } }, - workspace = { checkThirdParty = false }, + workspace = { checkThirdParty = false }, + }, + }, + }) + + vim.lsp.config("ols", { + cmd = { "ols" }, + filetypes = { "odin" }, + root_markers = { "ols.json", ".git" }, + init_options = { + odin_command = "odin", + checker_args = "-strict-style", + collections = { + { name = "shared", path = vim.fn.expand("$HOME/code/odin/shared/") }, }, }, }) -- Enable servers (default configs come from nvim-lspconfig runtime) - vim.lsp.enable({ "clangd", "pyright", "lua_ls", "hls" }) + vim.lsp.enable({ "clangd", "pyright", "lua_ls", "hls", "ols" }) -- Keymaps on attach vim.api.nvim_create_autocmd("LspAttach", { @@ -38,16 +47,16 @@ return { local map = function(keys, func, desc) vim.keymap.set("n", keys, func, { buffer = ev.buf, desc = "LSP: " .. desc }) end - map("gd", vim.lsp.buf.definition, "Goto definition") - map("gD", vim.lsp.buf.declaration, "Goto declaration") - map("gr", vim.lsp.buf.references, "Goto references") - map("gI", vim.lsp.buf.implementation,"Goto implementation") - map("K", vim.lsp.buf.hover, "Hover docs") - map("rn", vim.lsp.buf.rename, "Rename") - map("ca", vim.lsp.buf.code_action, "Code action") - map("[d", vim.diagnostic.goto_prev, "Prev diagnostic") - map("]d", vim.diagnostic.goto_next, "Next diagnostic") - map("e", vim.diagnostic.open_float, "Show diagnostic") + map("gd", vim.lsp.buf.definition, "Goto definition") + map("gD", vim.lsp.buf.declaration, "Goto declaration") + map("gr", vim.lsp.buf.references, "Goto references") + map("gI", vim.lsp.buf.implementation, "Goto implementation") + map("K", vim.lsp.buf.hover, "Hover docs") + map("rn", vim.lsp.buf.rename, "Rename") + map("ca", vim.lsp.buf.code_action, "Code action") + map("[d", vim.diagnostic.goto_prev, "Prev diagnostic") + map("]d", vim.diagnostic.goto_next, "Next diagnostic") + map("e", vim.diagnostic.open_float, "Show diagnostic") end, }) @@ -56,12 +65,12 @@ return { signs = { text = { [vim.diagnostic.severity.ERROR] = " ", - [vim.diagnostic.severity.WARN] = " ", - [vim.diagnostic.severity.INFO] = " ", - [vim.diagnostic.severity.HINT] = " ", + [vim.diagnostic.severity.WARN] = " ", + [vim.diagnostic.severity.INFO] = " ", + [vim.diagnostic.severity.HINT] = " ", }, }, - float = { border = "single" }, + float = { border = "single" }, underline = true, update_in_insert = false, }) @@ -70,6 +79,6 @@ return { { "j-hui/fidget.nvim", event = "LspAttach", - opts = { notification = { window = { winblend = 0 } } }, + opts = { notification = { window = { winblend = 0 } } }, }, } diff --git a/arch/nvim/.config/nvim/lua/plugins/treesitter.lua b/arch/nvim/.config/nvim/lua/plugins/treesitter.lua index b31fd1c..679d3d9 100644 --- a/arch/nvim/.config/nvim/lua/plugins/treesitter.lua +++ b/arch/nvim/.config/nvim/lua/plugins/treesitter.lua @@ -18,6 +18,7 @@ return { "json", "toml", "yaml", + "odin", }, highlight = { enable = true }, indent = { enable = true }, -- cgit v1.2.3