From 0c828415dd5ad27b2c75eaa5050eff85db78f54d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 29 Jun 2026 07:40:28 +0800 Subject: [PATCH] vim-patch:e99b4d0: runtime(doc): Document ft_recommended_style related: vim/vim#20036 https://github.com/vim/vim/commit/e99b4d021486f61ebb880bdb4e1bb6c5a58755c8 Co-authored-by: Christian Brabandt --- runtime/doc/usr_41.txt | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index d3283cea26..e386f383b7 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -2473,6 +2473,39 @@ continuation, as mentioned above |use-cpo-save|. For undoing the effect of an indent script, the b:undo_indent variable should be set accordingly. +RECOMMENDED STYLE *ft_recommended_style* + +A filetype plugin or indent script may set options that reflect a +recommended or commonly used style for that filetype, rather than a strict +requirement of the language. Since not every user wants these stylistic +settings, guard them so they can be disabled. + +Check two variables, the filetype-specific one first, then the general one, +defaulting to enabled (1): > + + if get(g:, '_recommended_style', + \ get(g:, 'filetype_recommended_style', 1)) + " set the recommended style options here + endif + +Replace with the actual filetype name, e.g. "python" gives +g:python_recommended_style. + +This lets the user turn recommended style settings off for all filetypes: > + + let g:filetype_recommended_style = 0 + +or for one filetype while leaving the rest enabled: > + + let g:python_recommended_style = 0 + +The filetype-specific variable takes precedence over the general one, so a +user can disable styling everywhere with g:filetype_recommended_style and +re-enable it for a single filetype by setting g:_recommended_style +to 1 (or vice versa). + +Settings that are required for the language to work correctly (not merely +stylistic) should not be placed behind this guard. FILE NAME