summaryrefslogtreecommitdiffstats
path: root/runtime/indent
diff options
context:
space:
mode:
authorChristian Brabandt <cb@256bit.org>2024-02-29 17:23:51 +0100
committerChristian Brabandt <cb@256bit.org>2024-02-29 17:28:07 +0100
commitb4eb3f1e44896b12fdfa3885a78c6eaa181eaeff (patch)
treec24d7395e257c8afd453d55e65b0e15453426036 /runtime/indent
parent55f8bba73be5f9c3a5a4d0d6c5f56e65f2c7d3fc (diff)
runtime(yaml): disable multiline_scalar detection by default
There have been many complaints about Yaml indenting too much, because it considers values to be multi-line by default, which leads to unintended indenting for (apparently most) users. So let's hide this feature behind the new feature flag, keep it simple and prefer single line value key pairs by default. If you want the old behaviour, set the following value: > :let g:yaml_indent_multiline_scalar = 1 If not set, it will indent the same as the previous line. closes #13845 Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'runtime/indent')
-rw-r--r--runtime/indent/yaml.vim7
1 files changed, 5 insertions, 2 deletions
diff --git a/runtime/indent/yaml.vim b/runtime/indent/yaml.vim
index 93fd8ea6f6..e5daf9f219 100644
--- a/runtime/indent/yaml.vim
+++ b/runtime/indent/yaml.vim
@@ -3,6 +3,7 @@
" Maintainer: Nikolai Pavlov <zyx.vim@gmail.com>
" Last Updates: Lukas Reineke, "lacygoill"
" Last Change: 2022 Jun 17
+" 2024 Feb 29 disable mulitline indent by default (The Vim project)
" Only load this indent file when no other was loaded.
if exists('b:did_indent')
@@ -138,11 +139,13 @@ function GetYAMLIndent(lnum)
else
return indent(prevmapline)
endif
- elseif prevline =~# '^\s*- '
+ elseif get(g:, 'yaml_indent_multiline_scalar', 0) &&
+ \ prevline =~# '^\s*- '
" - List with
" multiline scalar
return previndent+2
- elseif prevline =~# s:mapkeyregex .. '\v\s*%(%(' .. s:c_ns_tag_property ..
+ elseif get(g:, 'yaml_indent_multiline_scalar', 0) &&
+ \ prevline =~# s:mapkeyregex .. '\v\s*%(%(' .. s:c_ns_tag_property ..
\ '\v|' .. s:c_ns_anchor_property ..
\ '\v|' .. s:block_scalar_header ..
\ '\v)%(\s+|\s*%(\#.*)?$))*'