diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2023-09-14 23:50:45 +0200 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2023-09-14 23:50:45 +0200 |
commit | 5d81720c3313fd590d4fe5057931aad96903974c (patch) | |
tree | 57d721397aa11cfce3e6a68784321629b61920e9 /fnl/plugins | |
parent | 2ea97661a3564c02ac984c3e1280c4b8070dffb2 (diff) |
Add format in visual mode instead of lsp mod format
Diffstat (limited to 'fnl/plugins')
-rw-r--r-- | fnl/plugins/lsp/keymaps.fnl | 4 | ||||
-rw-r--r-- | fnl/plugins/lsp/lspconfig.fnl | 19 |
2 files changed, 6 insertions, 17 deletions
diff --git a/fnl/plugins/lsp/keymaps.fnl b/fnl/plugins/lsp/keymaps.fnl index 5ab4f49..6a3544a 100644 --- a/fnl/plugins/lsp/keymaps.fnl +++ b/fnl/plugins/lsp/keymaps.fnl @@ -24,6 +24,10 @@ :<leader>e "<cmd>lua vim.lsp.buf.format { async = true }<cr>" {:desc :Format}] + [:v + :<leader>e + "<cmd>lua vim.lsp.buf.format { async = true }<cr>" + {:desc :Format}] [:n :<leader>i "<cmd>lua vim.lsp.codelens.run()<cr>" diff --git a/fnl/plugins/lsp/lspconfig.fnl b/fnl/plugins/lsp/lspconfig.fnl index d4f8790..0b6ad79 100644 --- a/fnl/plugins/lsp/lspconfig.fnl +++ b/fnl/plugins/lsp/lspconfig.fnl @@ -1,26 +1,12 @@ ;; Setup of lsps. -(fn get-client-by-id [args] - (let [client-id (. (. args :data) :client_id)] - (vim.lsp.get_client_by_id client-id))) - -(fn format-modifications [client buffer] - (let [lsp-format-modifications (require :lsp-format-modifications)] - (vim.api.nvim_buf_create_user_command buffer :FormatModifications - (fn [] - (lsp-format-modifications.format_modifications client - buffer)) - {}))) - (fn on-attach [] (vim.api.nvim_create_autocmd :LspAttach {:callback (fn [args] (let [keymaps (require :plugins.lsp.keymaps) buffer (. args :buf) - client (get-client-by-id args)] - (keymaps.on-attach buffer) - (format-modifications client - buffer)))})) + ] + (keymaps.on-attach buffer)))})) (fn capabilities [] (let [cmp-lsp (require :cmp_nvim_lsp)] @@ -53,7 +39,6 @@ :dependencies [:mason.nvim :williamboman/mason-lspconfig.nvim :b0o/SchemaStore.nvim - :joechrisellis/lsp-format-modifications.nvim :hrsh7th/cmp-nvim-lsp] :config (fn [] (setup))} |