From 5d81720c3313fd590d4fe5057931aad96903974c Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Thu, 14 Sep 2023 23:50:45 +0200 Subject: Add format in visual mode instead of lsp mod format --- fnl/plugins/lsp/keymaps.fnl | 4 ++++ fnl/plugins/lsp/lspconfig.fnl | 19 ++----------------- lazy-lock.json | 11 +++++------ 3 files changed, 11 insertions(+), 23 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 @@ :e "lua vim.lsp.buf.format { async = true }" {:desc :Format}] + [:v + :e + "lua vim.lsp.buf.format { async = true }" + {:desc :Format}] [:n :i "lua vim.lsp.codelens.run()" 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))} diff --git a/lazy-lock.json b/lazy-lock.json index 9ab8fbf..4e498aa 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,8 +1,8 @@ { "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, "LuaSnip": { "branch": "master", "commit": "ea7d7ea510c641c4f15042becd27f35b3e5b3c2b" }, - "SchemaStore.nvim": { "branch": "main", "commit": "986e3cd9f1c378775b9aa122cd924db20a515105" }, - "alpha-nvim": { "branch": "main", "commit": "712dc1dccd4fd515ef8bd126b3718f79d3e23b0d" }, + "SchemaStore.nvim": { "branch": "main", "commit": "4cd0b5e4db74780f5a70cd0635f307efda58b890" }, + "alpha-nvim": { "branch": "main", "commit": "234822140b265ec4ba3203e3e0be0e0bb826dff5" }, "better-escape.nvim": { "branch": "master", "commit": "7031dc734add47bb71c010e0551829fa5799375f" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" }, @@ -20,16 +20,15 @@ "hotpot.nvim": { "branch": "master", "commit": "1dc11eb47ca15828df8ed3c7a014eeca9c564e55" }, "lazy.nvim": { "branch": "main", "commit": "2a9354c7d2368d78cbd5575a51a2af5bd8a6ad01" }, "leap.nvim": { "branch": "main", "commit": "5efe985cf68fac3b6a6dfe7a75fbfaca8db2af9c" }, - "lsp-format-modifications.nvim": { "branch": "main", "commit": "006d4cd88f4f09fdc4375fcb75dd5b7d981a723b" }, "lspkind-nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" }, "lualine-lsp-progress": { "branch": "master", "commit": "56842d097245a08d77912edf5f2a69ba29f275d7" }, "lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "01b4b6724ebcf5b43fc021486f6a260f1d09311e" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "f014db32437aa61c86fc0ef1067cd2bc6a37205c" }, "mason-null-ls.nvim": { "branch": "main", "commit": "ae0c5fa57468ac65617f1bf821ba0c3a1e251f0c" }, "mason.nvim": { "branch": "main", "commit": "d66c60e17dd6fd8165194b1d14d21f7eb2c1697a" }, "minibar.nvim": { "branch": "master", "commit": "353ca4efaf7fff1566bb02e0d7cb51133c41f660" }, "neo-tree.nvim": { "branch": "v2.x", "commit": "80dc74d081823649809f78370fa5b204aa9a853a" }, - "neogit": { "branch": "master", "commit": "50b3e1d9c600deb4027af117cca660bee88223a4" }, + "neogit": { "branch": "master", "commit": "8181099f5946724145cd27494bdaf84f354ba198" }, "no-clown-fiesta.nvim": { "branch": "master", "commit": "8ffba36ef1aafb2d8a8f81d45908d61e0703c3be" }, "nui.nvim": { "branch": "main", "commit": "c8de23342caf8d50b15d6b28368d36a56a69d76f" }, "null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" }, @@ -41,7 +40,7 @@ "nvim-lspconfig": { "branch": "master", "commit": "57139c690dc8d594b2f9de8d1e609f2854a4fe45" }, "nvim-spectre": { "branch": "master", "commit": "97cfd1b0f5a6ab35979ce1bee6c17f54745fd1e5" }, "nvim-surround": { "branch": "main", "commit": "1c2ef599abeeb98e40706830bcd27e90e259367a" }, - "nvim-treesitter": { "branch": "master", "commit": "25c591611ec39468cad334457abeac87748c74a9" }, + "nvim-treesitter": { "branch": "master", "commit": "5ec42175676bc4e6248b8ca9603acbc86497c68e" }, "nvim-web-devicons": { "branch": "master", "commit": "925e2aa30dc9fe9332060199c19f132ec0f3d493" }, "nvim-window-picker": { "branch": "main", "commit": "1b1bb834b0acb9eebb11a61664efc665757f1ba2" }, "orgmode": { "branch": "master", "commit": "d26d52bb47e8978adf4ec78e20930b8f312fa473" }, -- cgit v1.2.3-70-g09d2