diff options
| author | Cesar Saez <2292742+csaez@users.noreply.github.com> | 2021-04-09 15:09:40 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-09 15:09:40 +0100 |
| commit | 38ddab01a73c2e5584b91e7fe529e9f902dc59de (patch) | |
| tree | 19a1d49b2fecf0710db47478f53f5fac2af64aeb /README.md | |
| parent | [docgen] Update CONFIG.md (diff) | |
| download | nvim-lspconfig-38ddab01a73c2e5584b91e7fe529e9f902dc59de.tar nvim-lspconfig-38ddab01a73c2e5584b91e7fe529e9f902dc59de.tar.gz nvim-lspconfig-38ddab01a73c2e5584b91e7fe529e9f902dc59de.tar.bz2 nvim-lspconfig-38ddab01a73c2e5584b91e7fe529e9f902dc59de.tar.lz nvim-lspconfig-38ddab01a73c2e5584b91e7fe529e9f902dc59de.tar.xz nvim-lspconfig-38ddab01a73c2e5584b91e7fe529e9f902dc59de.tar.zst nvim-lspconfig-38ddab01a73c2e5584b91e7fe529e9f902dc59de.zip | |
Fix conditional keymap
The recommended configuration in the `README.md` doesn't setup the keymap for range formatting correctly: this needs to be done independent from the full document formatting and making sure the keymap is set in visual mode as it's meant to work in the selection.
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -186,8 +186,9 @@ local on_attach = function(client, bufnr) -- Set some keybinds conditional on server capabilities if client.resolved_capabilities.document_formatting then buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts) - elseif client.resolved_capabilities.document_range_formatting then - buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts) + end + if client.resolved_capabilities.document_range_formatting then + buf_set_keymap("v", "<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts) end -- Set autocommands conditional on server_capabilities |
