runtime(yaml): disable multiline_scalar detection by default
Commit:
https://github.com/vim/vim/commit/b4eb3f1e44896b12fdfa3885a78c6eaa181eaeff
Author: Christian Brabandt <[email protected]>
Date: Thu Feb 29 17:23:51 2024 +0100
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 <[email protected]>
diff --git a/runtime/doc/indent.txt b/runtime/doc/indent.txt
index 7865bb689..9fb6dd9f2 100644
--- a/runtime/doc/indent.txt
+++ b/runtime/doc/indent.txt
@@ -1255,5 +1255,11 @@ Example of configuration: >
This variable is equivalent to `g:vim_indent.line_continuation`.
It's supported for backward compatibility.
+YAML *ft-yaml-indent*
+
+By default, the yaml indent script does not try to detect multiline scalars.
+If you want to enable this, set the following variable: >
+
+ let g:yaml_indent_multiline_scalar = 1
vim:tw=78:ts=8:noet:ft=help:norl:
diff --git a/runtime/doc/tags b/runtime/doc/tags
index fb0b54053..8af0b573a 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -7364,6 +7364,7 @@ ft-xhtml-omni insert.txt /*ft-xhtml-omni*
ft-xml-omni insert.txt /*ft-xml-omni*
ft-xml-syntax syntax.txt /*ft-xml-syntax*
ft-xpm-syntax syntax.txt /*ft-xpm-syntax*
+ft-yaml-indent indent.txt /*ft-yaml-indent*
ft-yaml-syntax syntax.txt /*ft-yaml-syntax*
ft-zimbu-plugin filetype.txt /*ft-zimbu-plugin*
ft-zsh-syntax syntax.txt /*ft-zsh-syntax*
diff --git a/runtime/indent/yaml.vim b/runtime/indent/yaml.vim
index 93fd8ea6f..e5daf9f21 100644
--- a/runtime/indent/yaml.vim
+++ b/runtime/indent/yaml.vim
@@ -3,6 +3,7 @@
" Maintainer: Nikolai Pavlov <[email protected]>
" 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 .. ' \s*%(%(' .. s:c_ns_tag_property ..
+ elseif get(g:, 'yaml_indent_multiline_scalar', 0) &&
+ \ prevline =~# s:mapkeyregex .. ' \s*%(%(' .. s:c_ns_tag_property ..
\ ' |' .. s:c_ns_anchor_property
..
\ ' |' .. s:block_scalar_header ..
\ ' )%(\s+|\s*%(\#.*)?$))*'
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/E1rfjIR-0092fC-7I%40256bit.org.