aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorCesar Saez <2292742+csaez@users.noreply.github.com>2021-04-09 15:09:40 +0100
committerGitHub <noreply@github.com>2021-04-09 15:09:40 +0100
commit38ddab01a73c2e5584b91e7fe529e9f902dc59de (patch)
tree19a1d49b2fecf0710db47478f53f5fac2af64aeb /README.md
parent[docgen] Update CONFIG.md (diff)
downloadnvim-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.md5
1 files changed, 3 insertions, 2 deletions
diff --git a/README.md b/README.md
index 6b6141ed..259f304b 100644
--- a/README.md
+++ b/README.md
@@ -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