diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2024-07-29 00:03:58 +0200 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2024-07-29 00:03:58 +0200 |
commit | 7096adce11b93787170c09b79a6170d97b4a977c (patch) | |
tree | 1ccb3901136fc31728652e4db9595c1d7b1cccf5 /fnl/plugins/lsp | |
parent | beb3ed1effdc5dbd047c583598b83615075363b7 (diff) |
Replace fn with λ and how cmds are imported
Diffstat (limited to 'fnl/plugins/lsp')
-rw-r--r-- | fnl/plugins/lsp/diagnostics.fnl | 4 | ||||
-rw-r--r-- | fnl/plugins/lsp/keymaps.fnl | 2 | ||||
-rw-r--r-- | fnl/plugins/lsp/lspconfig.fnl | 10 | ||||
-rw-r--r-- | fnl/plugins/lsp/mason-lspconfig.fnl | 6 | ||||
-rw-r--r-- | fnl/plugins/lsp/servers.fnl | 2 |
5 files changed, 12 insertions, 12 deletions
diff --git a/fnl/plugins/lsp/diagnostics.fnl b/fnl/plugins/lsp/diagnostics.fnl index 9fbb627..5956e0e 100644 --- a/fnl/plugins/lsp/diagnostics.fnl +++ b/fnl/plugins/lsp/diagnostics.fnl @@ -7,7 +7,7 @@ {:name :DiagnosticSignHint :text (. icons :hint)} {:name :DiagnosticSignInfo :text (. icons :info)}]) -(fn configure-signs [] +(λ configure-signs [] (each [_ sign (ipairs signs)] (vim.fn.sign_define sign.name {:texthl sign.name :text sign.text :numhl ""}))) @@ -23,7 +23,7 @@ :header "" :prefix ""}}) -(fn setup [] +(λ setup [] (configure-signs) (vim.diagnostic.config config) (set vim.lsp.handlers.textDocument/hover false) diff --git a/fnl/plugins/lsp/keymaps.fnl b/fnl/plugins/lsp/keymaps.fnl index 2c01d15..72e03cd 100644 --- a/fnl/plugins/lsp/keymaps.fnl +++ b/fnl/plugins/lsp/keymaps.fnl @@ -40,7 +40,7 @@ [:n :K "<cmd>lua vim.lsp.hover()<cr>" {:desc "Hover documentation"}] [:n :<leader>li :<cmd>LspInfo<cr> {:desc "Lsp Info"}]]) -(fn on-attach [buffer] +(λ on-attach [buffer] (let [opts {:noremap true :silent true : buffer}] (each [_ mapping (ipairs mappings)] (match mapping diff --git a/fnl/plugins/lsp/lspconfig.fnl b/fnl/plugins/lsp/lspconfig.fnl index a778eb3..112973b 100644 --- a/fnl/plugins/lsp/lspconfig.fnl +++ b/fnl/plugins/lsp/lspconfig.fnl @@ -1,13 +1,13 @@ ;; Configuration for lsp clients. -(fn on-attach [] +(λ on-attach [] (vim.api.nvim_create_autocmd :LspAttach - {:callback (fn [args] - (let [keymaps (require :plugins.lsp.keymaps) + {:callback (λ [args] + (let [{: on-attach} (require :plugins.lsp.keymaps) buffer (. args :buf)] - (keymaps.on-attach buffer)))})) + (on-attach buffer)))})) -(fn config [] +(λ config [] (on-attach) (let [diagnostics (require :plugins.lsp.diagnostics) mason-lspconfig (require :plugins.lsp.mason-lspconfig) diff --git a/fnl/plugins/lsp/mason-lspconfig.fnl b/fnl/plugins/lsp/mason-lspconfig.fnl index 21a07ad..105693e 100644 --- a/fnl/plugins/lsp/mason-lspconfig.fnl +++ b/fnl/plugins/lsp/mason-lspconfig.fnl @@ -1,11 +1,11 @@ ;; A bridge plugin between mason and lspconfig, handles installation of lsp and ;; setup hooks for client configurations. -(fn capabilities [] +(λ capabilities [] (let [cmp-lsp (require :cmp_nvim_lsp)] (cmp-lsp.default_capabilities (vim.lsp.protocol.make_client_capabilities)))) -(fn handlers [server] +(λ handlers [server] (let [servers (require :plugins.lsp.servers) lspconfig (require :lspconfig)] (let [config (. lspconfig server) @@ -13,7 +13,7 @@ (tset opts :capabilities (capabilities)) (config.setup opts)))) -(fn setup [] +(λ setup [] (let [mason-lspconfig (require :mason-lspconfig) servers (require :plugins.lsp.servers)] (mason-lspconfig.setup {:ensure_installed (vim.tbl_keys servers) diff --git a/fnl/plugins/lsp/servers.fnl b/fnl/plugins/lsp/servers.fnl index ab8cad6..0dbb16f 100644 --- a/fnl/plugins/lsp/servers.fnl +++ b/fnl/plugins/lsp/servers.fnl @@ -10,7 +10,7 @@ :settings {:json {:schemas (let [schemastore (require :schemastore)] (schemastore.json.schemas)) :validate {:enable true}}} - :setup {:commands {:Format [(fn [] + :setup {:commands {:Format [(λ [] (vim.lsp.buf.range_formatting [] [0 0] [(vim.fn.line "$" 0)]))]}}} |