From 7096adce11b93787170c09b79a6170d97b4a977c Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Mon, 29 Jul 2024 00:03:58 +0200 Subject: Replace fn with λ and how cmds are imported MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fnl/plugins/lsp/diagnostics.fnl | 4 ++-- fnl/plugins/lsp/keymaps.fnl | 2 +- fnl/plugins/lsp/lspconfig.fnl | 10 +++++----- fnl/plugins/lsp/mason-lspconfig.fnl | 6 +++--- fnl/plugins/lsp/servers.fnl | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) (limited to 'fnl/plugins/lsp') 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 "lua vim.lsp.hover()" {:desc "Hover documentation"}] [:n :li :LspInfo {: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)]))]}}} -- cgit v1.2.3-70-g09d2