Skip to content

Commit c6ed816

Browse files
committed
runtime(yaml): do not re-indent when commenting out lines
It's a personal annoyance for me. I have to edit yaml files on a lot of customer environments and whenever you type '#' at the start of the line, the commented line will be indented by whatever indent the previous line had. I hate this seriously, because it makes un-commenting painful. So let's fix this. But instead of messing with the indent function, let's just remove the '0#' from cinkeys, so that Vim won't perform re-indenting when commenting out such a yaml file. closes: #15494 Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent 0a6e57b commit c6ed816

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

runtime/indent/yaml.vim

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
" Maintainer: Nikolai Pavlov <zyx.vim@gmail.com>
44
" Last Updates: Lukas Reineke, "lacygoill"
55
" Last Change: 2022 Jun 17
6-
" 2024 Feb 29 disable mulitline indent by default (The Vim project)
6+
" 2024 Feb 29 by Vim project: disable mulitline indent by default
7+
" 2024 Aug 14 by Vim project: fix re-indenting when commenting out lines
78

89
" Only load this indent file when no other was loaded.
910
if exists('b:did_indent')
@@ -13,7 +14,7 @@ endif
1314
let b:did_indent = 1
1415

1516
setlocal indentexpr=GetYAMLIndent(v:lnum)
16-
setlocal indentkeys=!^F,o,O,0#,0},0],<:>,0-
17+
setlocal indentkeys=!^F,o,O,0},0],<:>,0-
1718
setlocal nosmartindent
1819

1920
let b:undo_indent = 'setlocal indentexpr< indentkeys< smartindent<'

0 commit comments

Comments
 (0)