diff options
| author | 2025-04-02 13:55:07 +0200 | |
|---|---|---|
| committer | 2025-04-02 13:55:07 +0200 | |
| commit | d2f4d5dec7eededffc956fe6745139d98d695509 (patch) | |
| tree | acd79555cdd16ae02794ce8b36bd0f153ee9d6b9 | |
| parent | nvim/conjure: move fennel support to nfnl (diff) | |
nvim: upgrade configs for v0.11
Bunch of stuff bundled with it.
`lsp/` subject to changes.
36 files changed, 171 insertions, 122 deletions
diff --git a/dot_config/nvim/.chezmoiremove b/dot_config/nvim/.chezmoiremove index adfaaf8..d4a6cf2 100644 --- a/dot_config/nvim/.chezmoiremove +++ b/dot_config/nvim/.chezmoiremove @@ -9,6 +9,8 @@ lua/plugins/lsp/capabilities.lua fnl/plugins/lsp/ lua/plugins/lsp/ +fnl/plugins/lsp.fnl +lua/plugins/lsp.lua fnl/plugins/mini lua/plugins/mini diff --git a/dot_config/nvim/fnl/plugins/flash.fnl b/dot_config/nvim/fnl/plugins/flash.fnl index 25ff6c7..92de38b 100644 --- a/dot_config/nvim/fnl/plugins/flash.fnl +++ b/dot_config/nvim/fnl/plugins/flash.fnl @@ -2,9 +2,12 @@ [(· :folke/flash.nvim & :opts {:modes {:search {:enabled false}}} :event :VeryLazy - :keys [(· :s #(recc :flash :jump) & - :mode [:n :x :o] - :desc :Flash) + :keys [(· :<cr> #(recc :flash :jump) & + :mode [:n :x :o] + :desc :Flash) + (· :s #(recc :flash :jump) & + :mode [:n :x :o] + :desc :Flash) (· :S #(recc :flash :treesitter) & :mode [:n :x :o] :desc "Flash Treesitter") diff --git a/dot_config/nvim/fnl/plugins/init.fnl b/dot_config/nvim/fnl/plugins/init.fnl index f0bae51..876d473 100644 --- a/dot_config/nvim/fnl/plugins/init.fnl +++ b/dot_config/nvim/fnl/plugins/init.fnl @@ -11,9 +11,13 @@ ; simple stuff that doesn't need any handling ; and doesn't fit in elsewhere [(· :folke/lazy.nvim & :version false) + (· :folke/snacks.nvim & + :priority 1000 :lazy false + :opts {:indent {:enabled true + :scope {:enabled false}} + :input {:enabled true} + :quickfile {:enabled true}}) (· :Olical/nfnl & :ft :fennel) - (· :stevearc/dressing.nvim & - :opts {}) (· :Olical/conjure & :branch :main :config (fn [_ opts] diff --git a/dot_config/nvim/fnl/plugins/lsp.fnl b/dot_config/nvim/fnl/plugins/lsp.fnl deleted file mode 100644 index acfce7e..0000000 --- a/dot_config/nvim/fnl/plugins/lsp.fnl +++ /dev/null @@ -1,54 +0,0 @@ -(import-macros {:mixed-table · : recc} :toast.macros) -(local {: assoc : map} (require :toast.core)) -(local {: insert} (require :toast.table)) -(local {: executable?} (require :toast.nvim)) - -(fn gopts [plist] - {:basedpyright {} - :clangd {} - :clojure_lsp {:root_dir (plist :project.clj :deps.edn :bb.edn :build.boot :shadow-cljs.edn :.git)} - :denols {:autostart false - :root_dir (plist :deno.json :deno.jsonc)} - :gopls {} - :ltex {} - :lua_ls {} - :ruff {:cmd [:ruff :server :--preview]} - :texlab {:filetypes [:tex :plaintex :bib :latex]} - :ts_ls {:autostart false - :root_dir (plist :tsconfig.json :jsconfig.json :package.json)} - :zls {}}) - -; default on-attach -(fn attach [c b] - (let [lsp vim.lsp - lbf lsp.buf - ll [;groups - (· "" & :group :+lsp) - (· :w & :group :+workspace) - ; actions - (· :D lbf.declaration & :desc "goto declaration") - (· :d lbf.definition & :desc "goto definition") - (· :k lbf.hover & :desc "hover") - (· :K lbf.signature_help & :desc "signature help") - (· :i lbf.implementation & :desc "goto implementation") - (· :t lbf.type_definition & :desc "goto type definition") - (· :r lbf.rename & :desc "rename") - (· :c lbf.code_action & :desc "code action") - (· :R lbf.reference & :desc "list references")] - ll (map #(assoc $ 1 (.. :<localleader><localleader> (. $ 1))) ll)] - (vim.api.nvim_buf_set_option b :omnifunc :v:lua.vim.lsp.omnifunc) - (recc :which-key :add - (· (insert ll - (· :<leader>F #(vim.lsp.buf.format {:async true}) & - :desc "run format")) & - :buffer b)))) - -[(· :neovim/nvim-lspconfig & - :config (fn [_ opts] - (each [k v (pairs opts)] - (let [s (. (require :lspconfig) k) - c (or v.cmd s.document_config.default_config.cmd) - att (or v.on_attach attach)] - (when (executable? (. c 1)) - (s.setup (assoc v :on_attach att)))))) - :opts #(gopts (partial recc :lspconfig.util :root_pattern)))] diff --git a/dot_config/nvim/fnl/plugins/mini.fnl b/dot_config/nvim/fnl/plugins/mini.fnl index e339ce7..c66eedf 100644 --- a/dot_config/nvim/fnl/plugins/mini.fnl +++ b/dot_config/nvim/fnl/plugins/mini.fnl @@ -11,7 +11,6 @@ :comment {} :completion {} :cursorword {} - :indentscope {} :move {} :splitjoin {} :statusline {} diff --git a/dot_config/nvim/lsp/clangd.fnl b/dot_config/nvim/lsp/clangd.fnl new file mode 100644 index 0000000..c41824e --- /dev/null +++ b/dot_config/nvim/lsp/clangd.fnl @@ -0,0 +1,8 @@ +{:cmd [:clangd :--background-index] + :filetypes [:c :cpp] + :root_markers [:.clangd + :.clang-format + :compile_commands.json :compile_flags.txt] + :flags {:debounce_text_changes 20} + :capabilities {:textDocument {:completion {:editsNearCursor true}} + :offsetEncoding [:utf-8 :utf-16]}} diff --git a/dot_config/nvim/lsp/clangd.lua b/dot_config/nvim/lsp/clangd.lua new file mode 100644 index 0000000..0a4f4e5 --- /dev/null +++ b/dot_config/nvim/lsp/clangd.lua @@ -0,0 +1,2 @@ +-- [nfnl] Compiled from lsp/clangd.fnl by https://github.com/Olical/nfnl, do not edit. +return {cmd = {"clangd", "--background-index"}, filetypes = {"c", "cpp"}, root_markers = {".clangd", ".clang-format", "compile_commands.json", "compile_flags.txt"}, flags = {debounce_text_changes = 20}, capabilities = {textDocument = {completion = {editsNearCursor = true}}, offsetEncoding = {"utf-8", "utf-16"}}} diff --git a/dot_config/nvim/lsp/clojure_lsp.fnl b/dot_config/nvim/lsp/clojure_lsp.fnl new file mode 100644 index 0000000..b618d35 --- /dev/null +++ b/dot_config/nvim/lsp/clojure_lsp.fnl @@ -0,0 +1,5 @@ +{:cmd [:clojure-lsp :listen] + :filetypes [:clojure] + :root_markers [:project.clj + :deps.edn :bb.edn + :build.boot :shadow-cljs.edn]} diff --git a/dot_config/nvim/lsp/clojure_lsp.lua b/dot_config/nvim/lsp/clojure_lsp.lua new file mode 100644 index 0000000..1c9ded1 --- /dev/null +++ b/dot_config/nvim/lsp/clojure_lsp.lua @@ -0,0 +1,2 @@ +-- [nfnl] Compiled from lsp/clojure_lsp.fnl by https://github.com/Olical/nfnl, do not edit. +return {cmd = {"clojure-lsp", "listen"}, filetypes = {"clojure"}, root_markers = {"project.clj", "deps.edn", "bb.edn", "build.boot", "shadow-cljs.edn"}} diff --git a/dot_config/nvim/lsp/denols.fnl b/dot_config/nvim/lsp/denols.fnl new file mode 100644 index 0000000..785c69a --- /dev/null +++ b/dot_config/nvim/lsp/denols.fnl @@ -0,0 +1,3 @@ +{:cmd [:deno :lsp] + :filetypes [:javascript :typescript] + :root_markers [:deno.json :deno.jsonc]} diff --git a/dot_config/nvim/lsp/denols.lua b/dot_config/nvim/lsp/denols.lua new file mode 100644 index 0000000..56b64b4 --- /dev/null +++ b/dot_config/nvim/lsp/denols.lua @@ -0,0 +1,2 @@ +-- [nfnl] Compiled from lsp/denols.fnl by https://github.com/Olical/nfnl, do not edit. +return {cmd = {"deno", "lsp"}, filetypes = {"javascript", "typescript"}, root_markers = {"deno.json", "deno.jsonc"}} diff --git a/dot_config/nvim/lsp/gopls.fnl b/dot_config/nvim/lsp/gopls.fnl new file mode 100644 index 0000000..8a7fdd7 --- /dev/null +++ b/dot_config/nvim/lsp/gopls.fnl @@ -0,0 +1,13 @@ +{:cmd [:gopls] + :filetypes [:go :gomod :gowork :gosum] + :root_dir (fn [buf cb] + (cb (let [modr (vim.fs.root buf :go.mod)] + (or (when modr (vim.fs.root modr :go.work)) + modr)))) + :settings {:autoformat true + :gopls {:analyses {:unusedparams true + :unusedwrite true + :nilness true} + :gofumpt true + :semanticTokens true + :staticcheck true}}} diff --git a/dot_config/nvim/lsp/gopls.lua b/dot_config/nvim/lsp/gopls.lua new file mode 100644 index 0000000..dd32055 --- /dev/null +++ b/dot_config/nvim/lsp/gopls.lua @@ -0,0 +1,15 @@ +-- [nfnl] Compiled from lsp/gopls.fnl by https://github.com/Olical/nfnl, do not edit. +local function _1_(buf, cb) + local function _2_() + local modr = vim.fs.root(buf, "go.mod") + local _3_ + if modr then + _3_ = vim.fs.root(modr, "go.work") + else + _3_ = nil + end + return (_3_ or modr) + end + return cb(_2_()) +end +return {cmd = {"gopls"}, filetypes = {"go", "gomod", "gowork", "gosum"}, root_dir = _1_, settings = {autoformat = true, gopls = {analyses = {unusedparams = true, unusedwrite = true, nilness = true}, gofumpt = true, semanticTokens = true, staticcheck = true}}} diff --git a/dot_config/nvim/lsp/lua_ls.fnl b/dot_config/nvim/lsp/lua_ls.fnl new file mode 100644 index 0000000..6f6af08 --- /dev/null +++ b/dot_config/nvim/lsp/lua_ls.fnl @@ -0,0 +1,4 @@ +{:cmd [:lua-language-server] + :filetypes [:lua] + :root_markers [:.luarc.json] + :settings {:Lua {:telemetry {:enable false}}}} diff --git a/dot_config/nvim/lsp/lua_ls.lua b/dot_config/nvim/lsp/lua_ls.lua new file mode 100644 index 0000000..5032430 --- /dev/null +++ b/dot_config/nvim/lsp/lua_ls.lua @@ -0,0 +1,2 @@ +-- [nfnl] Compiled from lsp/lua_ls.fnl by https://github.com/Olical/nfnl, do not edit. +return {cmd = {"lua-language-server"}, filetypes = {"lua"}, root_markers = {".luarc.json"}, settings = {Lua = {telemetry = {enable = false}}}} diff --git a/dot_config/nvim/lsp/pyright.fnl b/dot_config/nvim/lsp/pyright.fnl new file mode 100644 index 0000000..4209625 --- /dev/null +++ b/dot_config/nvim/lsp/pyright.fnl @@ -0,0 +1,5 @@ +{:cmd [:basedpyright-langserver :--stdio] + :filetypes [:python] + :root_markers vim.lsp.config.ruff.root_markers + :settings {:python {:analysis {:diagnosticMode :openFilesonly} + :logLevel :Warning}}} diff --git a/dot_config/nvim/lsp/pyright.lua b/dot_config/nvim/lsp/pyright.lua new file mode 100644 index 0000000..e491965 --- /dev/null +++ b/dot_config/nvim/lsp/pyright.lua @@ -0,0 +1,2 @@ +-- [nfnl] Compiled from lsp/pyright.fnl by https://github.com/Olical/nfnl, do not edit. +return {cmd = {"basedpyright-langserver", "--stdio"}, filetypes = {"python"}, root_markers = vim.lsp.config.ruff.root_markers, settings = {python = {analysis = {diagnosticMode = "openFilesonly"}, logLevel = "Warning"}}} diff --git a/dot_config/nvim/lsp/ruff.fnl b/dot_config/nvim/lsp/ruff.fnl new file mode 100644 index 0000000..1de206a --- /dev/null +++ b/dot_config/nvim/lsp/ruff.fnl @@ -0,0 +1,6 @@ +{:cmd [:ruff :server :--preview] + :filetypes [:python] + :root_markers [:pyproject.toml + :setup.cfg :setup.py + :pyrightconfig.json + :requirements.txt]} diff --git a/dot_config/nvim/lsp/ruff.lua b/dot_config/nvim/lsp/ruff.lua new file mode 100644 index 0000000..9e6640d --- /dev/null +++ b/dot_config/nvim/lsp/ruff.lua @@ -0,0 +1,2 @@ +-- [nfnl] Compiled from lsp/ruff.fnl by https://github.com/Olical/nfnl, do not edit. +return {cmd = {"ruff", "server", "--preview"}, filetypes = {"python"}, root_markers = {"pyproject.toml", "setup.cfg", "setup.py", "pyrightconfig.json", "requirements.txt"}} diff --git a/dot_config/nvim/lsp/texlab.fnl b/dot_config/nvim/lsp/texlab.fnl new file mode 100644 index 0000000..2a7e08a --- /dev/null +++ b/dot_config/nvim/lsp/texlab.fnl @@ -0,0 +1,5 @@ +{:cmd [:texlab :run] + :filetypes [:plaintex :tex :bib :latex] + ; if there's no main then it's probably an external project + ; realistically, I have a tendency to use a different editor for these anyway + :root_markers [:main.latex :main.tex]} diff --git a/dot_config/nvim/lsp/texlab.lua b/dot_config/nvim/lsp/texlab.lua new file mode 100644 index 0000000..8ba65cf --- /dev/null +++ b/dot_config/nvim/lsp/texlab.lua @@ -0,0 +1,2 @@ +-- [nfnl] Compiled from lsp/texlab.fnl by https://github.com/Olical/nfnl, do not edit. +return {cmd = {"texlab", "run"}, filetypes = {"plaintex", "tex", "bib", "latex"}, root_markers = {"main.latex", "main.tex"}} diff --git a/dot_config/nvim/lsp/tinymist.fnl b/dot_config/nvim/lsp/tinymist.fnl new file mode 100644 index 0000000..4781bdf --- /dev/null +++ b/dot_config/nvim/lsp/tinymist.fnl @@ -0,0 +1,4 @@ +{:cmd [:tinymist :lsp] + :filetypes [:typst] + ; if there's no main.typ, it's probably not a project anyway + :root_markers [:main.typ]} diff --git a/dot_config/nvim/lsp/tinymist.lua b/dot_config/nvim/lsp/tinymist.lua new file mode 100644 index 0000000..aa043a3 --- /dev/null +++ b/dot_config/nvim/lsp/tinymist.lua @@ -0,0 +1,2 @@ +-- [nfnl] Compiled from lsp/tinymist.fnl by https://github.com/Olical/nfnl, do not edit. +return {cmd = {"tinymist", "lsp"}, filetypes = {"typst"}, root_markers = {"main.typ"}} diff --git a/dot_config/nvim/lsp/ts_ls.fnl b/dot_config/nvim/lsp/ts_ls.fnl new file mode 100644 index 0000000..89ebb68 --- /dev/null +++ b/dot_config/nvim/lsp/ts_ls.fnl @@ -0,0 +1,3 @@ +{:cmd [:typescript-language-server :--stdio] + :filetypes [:javascript :typescript :typescriptreact] + :root_markers [:tsconfig.json :jsconfig.json :package.json]} diff --git a/dot_config/nvim/lsp/ts_ls.lua b/dot_config/nvim/lsp/ts_ls.lua new file mode 100644 index 0000000..f228f8f --- /dev/null +++ b/dot_config/nvim/lsp/ts_ls.lua @@ -0,0 +1,2 @@ +-- [nfnl] Compiled from lsp/ts_ls.fnl by https://github.com/Olical/nfnl, do not edit. +return {cmd = {"typescript-language-server", "--stdio"}, filetypes = {"javascript", "typescript", "typescriptreact"}, root_markers = {"tsconfig.json", "jsconfig.json", "package.json"}} diff --git a/dot_config/nvim/lsp/uiua.fnl b/dot_config/nvim/lsp/uiua.fnl new file mode 100644 index 0000000..217096f --- /dev/null +++ b/dot_config/nvim/lsp/uiua.fnl @@ -0,0 +1,4 @@ +{:cmd [:uiua :lsp] + :filetypes [:uiua] + ; no marker but I don't tend to have subdirs + :root_markers [:*.uiua]} diff --git a/dot_config/nvim/lsp/uiua.lua b/dot_config/nvim/lsp/uiua.lua new file mode 100644 index 0000000..c6ba460 --- /dev/null +++ b/dot_config/nvim/lsp/uiua.lua @@ -0,0 +1,2 @@ +-- [nfnl] Compiled from lsp/uiua.fnl by https://github.com/Olical/nfnl, do not edit. +return {cmd = {"uiua", "lsp"}, filetypes = {"uiua"}, root_markers = {"*.uiua"}} diff --git a/dot_config/nvim/lsp/zls.fnl b/dot_config/nvim/lsp/zls.fnl new file mode 100644 index 0000000..221e86e --- /dev/null +++ b/dot_config/nvim/lsp/zls.fnl @@ -0,0 +1,4 @@ +{:cmd [:zls] + :filetypes [:zig] + :root_markers [:zls.json :build.zig] + :settings {:autoformat true}} diff --git a/dot_config/nvim/lsp/zls.lua b/dot_config/nvim/lsp/zls.lua new file mode 100644 index 0000000..69fbd6a --- /dev/null +++ b/dot_config/nvim/lsp/zls.lua @@ -0,0 +1,2 @@ +-- [nfnl] Compiled from lsp/zls.fnl by https://github.com/Olical/nfnl, do not edit. +return {cmd = {"zls"}, filetypes = {"zig"}, root_markers = {"zls.json", "build.zig"}, settings = {autoformat = true}} diff --git a/dot_config/nvim/lua/plugins/flash.lua b/dot_config/nvim/lua/plugins/flash.lua index 3a8feea..674dfe6 100644 --- a/dot_config/nvim/lua/plugins/flash.lua +++ b/dot_config/nvim/lua/plugins/flash.lua @@ -3,15 +3,18 @@ local function _1_() return require("flash").jump() end local function _2_() - return require("flash").treesitter() + return require("flash").jump() end local function _3_() - return require("flash").remote() + return require("flash").treesitter() end local function _4_() - return require("flash").treesitter_search() + return require("flash").remote() end local function _5_() + return require("flash").treesitter_search() +end +local function _6_() return require("flash").toggle() end -return {{"folke/flash.nvim", event = "VeryLazy", keys = {{"s", _1_, desc = "Flash", mode = {"n", "x", "o"}}, {"S", _2_, desc = "Flash Treesitter", mode = {"n", "x", "o"}}, {"r", _3_, desc = "Remote Flash", mode = "o"}, {"R", _4_, desc = "Flash Treesitter Search", mode = {"o", "x"}}, {"<c-s>", _5_, desc = "Toggle Flash Search", mode = "c"}}, opts = {modes = {search = {enabled = false}}}}} +return {{"folke/flash.nvim", event = "VeryLazy", keys = {{"<cr>", _1_, desc = "Flash", mode = {"n", "x", "o"}}, {"s", _2_, desc = "Flash", mode = {"n", "x", "o"}}, {"S", _3_, desc = "Flash Treesitter", mode = {"n", "x", "o"}}, {"r", _4_, desc = "Remote Flash", mode = "o"}, {"R", _5_, desc = "Flash Treesitter Search", mode = {"o", "x"}}, {"<c-s>", _6_, desc = "Toggle Flash Search", mode = "c"}}, opts = {modes = {search = {enabled = false}}}}} diff --git a/dot_config/nvim/lua/plugins/init.lua b/dot_config/nvim/lua/plugins/init.lua index 654e7c3..7b014e4 100644 --- a/dot_config/nvim/lua/plugins/init.lua +++ b/dot_config/nvim/lua/plugins/init.lua @@ -6,4 +6,4 @@ local function _1_(_, opts) end return nil end -return {{"folke/lazy.nvim", version = false}, {"Olical/nfnl", ft = "fennel"}, {"stevearc/dressing.nvim", opts = {}}, {"Olical/conjure", branch = "main", config = _1_, ft = conjureft, opts = {["mapping#prefix"] = "<localleader>e", ["extract#tree_sitter#enabled"] = true, filetypes = conjureft, ["filetype#janet"] = "conjure.client.janet.stdio"}}, {"tpope/vim-repeat"}} +return {{"folke/lazy.nvim", version = false}, {"folke/snacks.nvim", lazy = false, opts = {indent = {enabled = true, scope = {enabled = false}}, input = {enabled = true}, quickfile = {enabled = true}}, priority = 1000}, {"Olical/nfnl", ft = "fennel"}, {"Olical/conjure", branch = "main", config = _1_, ft = conjureft, opts = {["mapping#prefix"] = "<localleader>e", ["extract#tree_sitter#enabled"] = true, filetypes = conjureft, ["filetype#janet"] = "conjure.client.janet.stdio"}}, {"tpope/vim-repeat"}} diff --git a/dot_config/nvim/lua/plugins/langs.lua b/dot_config/nvim/lua/plugins/langs.lua index 84dea21..981113b 100644 --- a/dot_config/nvim/lua/plugins/langs.lua +++ b/dot_config/nvim/lua/plugins/langs.lua @@ -1,3 +1,3 @@ -- [nfnl] Compiled from fnl/plugins/langs.fnl by https://github.com/Olical/nfnl, do not edit. local lisps = {"clojure", "fennel", "janet", "scm"} -return {{"nvim-treesitter/nvim-treesitter", build = ":TSUpdate", dependnecies = {"nvim-treesitter/nvim-treesitter-textobjects"}, main = "nvim-treesitter.configs", opts = {ensure_installed = "all", ignore_install = {"norg"}, sync_install = "true", highlight = {enable = true, disable = {"markdown"}, additional_vim_regex_highlighting = {"markdown"}}}, version = false}, {"janet-lang/janet.vim", ft = "janet"}, {"preservim/vim-markdown", dependencies = {"godlygeek/tabular"}, ft = "markdown", version = false}, {"gpanders/nvim-parinfer", ft = lisps}, {"julienvincent/nvim-paredit", config = {indent = {enabled = true}}, ft = lisps}} +return {{"nvim-treesitter/nvim-treesitter", build = ":TSUpdate", dependnecies = {"nvim-treesitter/nvim-treesitter-textobjects"}, main = "nvim-treesitter.configs", opts = {ensure_installed = "all", ignore_install = {"norg"}, sync_install = "true", highlight = {enable = true, disable = {"markdown"}, additional_vim_regex_highlighting = {"markdown"}}}, version = false}, {"janet-lang/janet.vim", ft = "janet"}, {"preservim/vim-markdown", dependencies = {"godlygeek/tabular"}, ft = "markdown", version = false}, {"Apeiros-46B/uiua.vim", ft = "uiua"}, {"gpanders/nvim-parinfer", ft = lisps}, {"julienvincent/nvim-paredit", config = {indent = {enabled = true}}, ft = lisps}} diff --git a/dot_config/nvim/lua/plugins/lsp.lua b/dot_config/nvim/lua/plugins/lsp.lua deleted file mode 100644 index 1b32180..0000000 --- a/dot_config/nvim/lua/plugins/lsp.lua +++ /dev/null @@ -1,45 +0,0 @@ --- [nfnl] Compiled from fnl/plugins/lsp.fnl by https://github.com/Olical/nfnl, do not edit. -local _local_1_ = require("toast.core") -local assoc = _local_1_["assoc"] -local map = _local_1_["map"] -local _local_2_ = require("toast.table") -local insert = _local_2_["insert"] -local _local_3_ = require("toast.nvim") -local executable_3f = _local_3_["executable?"] -local function gopts(plist) - return {basedpyright = {}, clangd = {}, clojure_lsp = {root_dir = plist("project.clj", "deps.edn", "bb.edn", "build.boot", "shadow-cljs.edn", ".git")}, denols = {root_dir = plist("deno.json", "deno.jsonc"), autostart = false}, gopls = {}, ltex = {}, lua_ls = {}, ruff = {cmd = {"ruff", "server", "--preview"}}, texlab = {filetypes = {"tex", "plaintex", "bib", "latex"}}, ts_ls = {root_dir = plist("tsconfig.json", "jsconfig.json", "package.json"), autostart = false}, zls = {}} -end -local function attach(c, b) - local lsp = vim.lsp - local lbf = lsp.buf - local ll = {{"", group = "+lsp"}, {"w", group = "+workspace"}, {"D", lbf.declaration, desc = "goto declaration"}, {"d", lbf.definition, desc = "goto definition"}, {"k", lbf.hover, desc = "hover"}, {"K", lbf.signature_help, desc = "signature help"}, {"i", lbf.implementation, desc = "goto implementation"}, {"t", lbf.type_definition, desc = "goto type definition"}, {"r", lbf.rename, desc = "rename"}, {"c", lbf.code_action, desc = "code action"}, {"R", lbf.reference, desc = "list references"}} - local ll0 - local function _4_(_241) - return assoc(_241, 1, ("<localleader><localleader>" .. _241[1])) - end - ll0 = map(_4_, ll) - vim.api.nvim_buf_set_option(b, "omnifunc", "v:lua.vim.lsp.omnifunc") - local function _5_() - return vim.lsp.buf.format({async = true}) - end - return require("which-key").add({insert(ll0, {"<leader>F", _5_, desc = "run format"}), buffer = b}) -end -local function _6_(_, opts) - for k, v in pairs(opts) do - local s = require("lspconfig")[k] - local c = (v.cmd or s.document_config.default_config.cmd) - local att = (v.on_attach or attach) - if executable_3f(c[1]) then - s.setup(assoc(v, "on_attach", att)) - else - end - end - return nil -end -local function _8_() - local function _9_(...) - return require("lspconfig.util").root_pattern(...) - end - return gopts(_9_) -end -return {{"neovim/nvim-lspconfig", config = _6_, opts = _8_}} diff --git a/dot_config/nvim/lua/plugins/mini.lua b/dot_config/nvim/lua/plugins/mini.lua index cc358db..5c5430d 100644 --- a/dot_config/nvim/lua/plugins/mini.lua +++ b/dot_config/nvim/lua/plugins/mini.lua @@ -5,4 +5,4 @@ local function _1_(_, opts) end return nil end -return {{"echasnovski/mini.nvim", config = _1_, opts = {ai = {}, align = {}, basics = {}, bracketed = {indent = {options = {change_type = "diff"}}}, comment = {}, completion = {}, cursorword = {}, indentscope = {}, move = {}, splitjoin = {}, statusline = {}, tabline = {}, trailspace = {}}, version = false}} +return {{"echasnovski/mini.nvim", config = _1_, opts = {ai = {}, align = {}, basics = {}, bracketed = {indent = {options = {change_type = "diff"}}}, comment = {}, completion = {}, cursorword = {}, move = {}, splitjoin = {}, statusline = {}, tabline = {}, trailspace = {}}, version = false}} diff --git a/dot_config/nvim/pre.fnl b/dot_config/nvim/pre.fnl index a22a233..264da6c 100644 --- a/dot_config/nvim/pre.fnl +++ b/dot_config/nvim/pre.fnl @@ -22,11 +22,15 @@ :foldmethod :expr :foldexpr "nvim_treesitter#foldexpr()" :foldlevelstart 99 - :wrap true}) + :wrap true + :winborder :rounded}) (each [k v (pairs options)] (tset vim.opt k v)) +; diagnostics +(vim.diagnostic.config {:virtual_lines true}) + ; OSC 52 on nvim >= 0.10.0 (let [{: major : minor} (vim.version)] (when (or (> major 0) (>= minor 10)) @@ -45,3 +49,23 @@ (set bo.filetype val) ; otherwise the change in ft will override editorconfig settings (ec.config bufnr)))))) + +; lsp +(vim.api.nvim_create_autocmd + :LspAttach + {:callback + (fn [ev] + (let [client (vim.lsp.get_client_by_id ev.data.client_id)] + (when (client:supports_method :textDocument/completion) + (vim.lsp.completion.enable true client.id ev.buf + {:autotrigger true}))))}) + +(vim.lsp.enable [:clangd + :clojure_lsp + :gopls + :lua_ls + :ruff + :pyright + :texlab + :ts_ls + :zls]) diff --git a/dot_config/nvim/pre.lua b/dot_config/nvim/pre.lua index 15dc641..1279d2b 100644 --- a/dot_config/nvim/pre.lua +++ b/dot_config/nvim/pre.lua @@ -1,10 +1,11 @@ -- [nfnl] Compiled from pre.fnl by https://github.com/Olical/nfnl, do not edit. vim.g.mapleader = " " vim.g.maplocalleader = "\\" -local options = {timeoutlen = 300, clipboard = "unnamedplus", completeopt = "menu,menuone,noselect", mouse = "a", smartcase = true, smartindent = true, termguicolors = true, shiftwidth = 4, tabstop = 4, number = true, numberwidth = 2, scrolloff = 4, sidescrolloff = 4, foldmethod = "expr", foldexpr = "nvim_treesitter#foldexpr()", foldlevelstart = 99, wrap = true, backup = false, expandtab = false, swapfile = false} +local options = {timeoutlen = 300, clipboard = "unnamedplus", completeopt = "menu,menuone,noselect", mouse = "a", smartcase = true, smartindent = true, termguicolors = true, shiftwidth = 4, tabstop = 4, number = true, numberwidth = 2, scrolloff = 4, sidescrolloff = 4, foldmethod = "expr", foldexpr = "nvim_treesitter#foldexpr()", foldlevelstart = 99, wrap = true, winborder = "rounded", backup = false, expandtab = false, swapfile = false} for k, v in pairs(options) do vim.opt[k] = v end +vim.diagnostic.config({virtual_lines = true}) do local _let_1_ = vim.version() local major = _let_1_["major"] @@ -14,15 +15,26 @@ do else end end -local ec = require("editorconfig") -local function _3_(bufnr, val, opts) - local bo = vim.bo[bufnr] - if (bo.filetype ~= val) then - bo.filetype = val - return ec.config(bufnr) +do + local ec = require("editorconfig") + local function _3_(bufnr, val, opts) + local bo = vim.bo[bufnr] + if (bo.filetype ~= val) then + bo.filetype = val + return ec.config(bufnr) + else + return nil + end + end + ec.properties.filetype = _3_ +end +local function _5_(ev) + local client = vim.lsp.get_client_by_id(ev.data.client_id) + if client:supports_method("textDocument/completion") then + return vim.lsp.completion.enable(true, client.id, ev.buf, {autotrigger = true}) else return nil end end -ec.properties.filetype = _3_ -return nil +vim.api.nvim_create_autocmd("LspAttach", {callback = _5_}) +return vim.lsp.enable({"clangd", "clojure_lsp", "gopls", "lua_ls", "ruff", "pyright", "texlab", "ts_ls", "zls"}) |
