aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZoltán Reegn <zoltan.reegn@gmail.com>2023-03-14 11:42:27 +0100
committerGitHub <noreply@github.com>2023-03-14 03:42:27 -0700
commit06e3ff6671b45ffde8cbfa98ce2743fb9d46319d (patch)
tree8e02c2a61abe6ff8dcfd07431d4ae4eb64c019e7
parent4395b5f93aafce2660a3ecead3917ac2a28ef0b6 (diff)
downloadrneovim-06e3ff6671b45ffde8cbfa98ce2743fb9d46319d.tar.gz
rneovim-06e3ff6671b45ffde8cbfa98ce2743fb9d46319d.tar.bz2
rneovim-06e3ff6671b45ffde8cbfa98ce2743fb9d46319d.zip
docs(lsp): opt-out of default LSP "gq" #22615
close #22611
-rw-r--r--runtime/doc/lsp.txt12
1 files changed, 12 insertions, 0 deletions
diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt
index ca65251a9f..25293eb9b2 100644
--- a/runtime/doc/lsp.txt
+++ b/runtime/doc/lsp.txt
@@ -137,7 +137,19 @@ FAQ *lsp-faq*
" Auto-format *.rs (rust) files prior to saving them
" (async = false is the default for format)
autocmd BufWritePre *.rs lua vim.lsp.buf.format({ async = false })
+<
+- Q: How can I disable LSP formatting when using the |gq| command?
+ A: To use the default internal formatting method and bypass the LSP client's
+ 'formatexpr', use |gw| instead.
+ Alternatively you can completely disable LSP formatting with gq by
+ unsetting 'formatexpr':
+>lua
+ vim.api.nvim_create_autocmd('LspAttach', {
+ callback = function(args)
+ vim.bo[args.buf].formatexpr = nil
+ end,
+ })
<
*lsp-vs-treesitter*
- Q: How do LSP and Treesitter compare?