From 01586921b3d5f2ac1ccf8196d3ad9b4b3ddd31f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Vulquin?= Date: Wed, 24 Jul 2024 19:19:26 +0200 Subject: nvim: rewrite config in fennel One file isn't done, and there's also the question of ftplugin and co. One step at a time though, eh? --- dot_config/nvim/fnl/plugins/lsp/init.fnl | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 dot_config/nvim/fnl/plugins/lsp/init.fnl (limited to 'dot_config/nvim/fnl/plugins/lsp/init.fnl') diff --git a/dot_config/nvim/fnl/plugins/lsp/init.fnl b/dot_config/nvim/fnl/plugins/lsp/init.fnl new file mode 100644 index 0000000..10685d2 --- /dev/null +++ b/dot_config/nvim/fnl/plugins/lsp/init.fnl @@ -0,0 +1,33 @@ +(import-macros {: tbl : recc} :toast.macros) + +(fn gopts [plist] + {: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 {} + :texlab {:filetypes [:tex :plaintex :bib :latex]} + :tsserver {:autostart false + :root_dir (plist :tsconfig.json :package.json)} + :zls {}}) + +(local attach (require :plugins.lsp.attach)) +(local caps (require :plugins.lsp.capabilities)) + +[(tbl :neovim/nvim-lspconfig & + :config (fn [_ opts] + (each [k v (pairs opts)] + (set v.on_attach (or attach v.on_attach)) + (when (= :table (type caps)) + (set v.capabilities (or v.capabilities caps))) + (let [s (. (require :lspconfig) k) + c (or v.cmd s.document_config.default_config.cmd)] + (when (not= 0 (vim.fn.executable (. c 1))) + (s.setup v))))) + :opts (fn [] + (let [plist (fn [...] + (local p (recc :lspconfig.util :root_pattern ...)) + #(p $))] + (gopts plist))))] -- cgit v1.2.3