mirror of
https://github.com/vim/vim.git
synced 2026-05-06 12:26:58 -04:00
runtime(yaml): fix indentation script
Problem: The indentation of Ansible Playbooks gets messed up after
gg=G (after 9179ddc060)
Solution: Remove one shiftwidth() that seems to be misplaced.
closes: #19180
Signed-off-by: Bjoern Foersterling <bjoern.foersterling@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
ead1dda74a
commit
af973d4018
@@ -26,3 +26,14 @@ list:
|
||||
- element2:
|
||||
foo: bar
|
||||
# END_INDENT
|
||||
|
||||
# START_INDENT
|
||||
- name: test playbook
|
||||
hosts: localhost
|
||||
gather_facts: false
|
||||
|
||||
tasks:
|
||||
- name: hello world
|
||||
ansible.builtin.debug:
|
||||
msg: "hello world"
|
||||
# END_INDENT
|
||||
|
||||
@@ -26,3 +26,14 @@ list:
|
||||
- element2:
|
||||
foo: bar
|
||||
# END_INDENT
|
||||
|
||||
# START_INDENT
|
||||
- name: test playbook
|
||||
hosts: localhost
|
||||
gather_facts: false
|
||||
|
||||
tasks:
|
||||
- name: hello world
|
||||
ansible.builtin.debug:
|
||||
msg: "hello world"
|
||||
# END_INDENT
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
" 2024 Feb 29 by Vim project: disable mulitline indent by default
|
||||
" 2024 Aug 14 by Vim project: fix re-indenting when commenting out lines
|
||||
" 2026 Jan 08 by Vim project: fix object indentation in array
|
||||
" 2026 Jan 15 by Vim project: fix double shiftwidth from previous change
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
if exists('b:did_indent')
|
||||
@@ -146,7 +147,7 @@ function GetYAMLIndent(lnum)
|
||||
" Previous mapping key is in a list item (- key:)
|
||||
" The key effectively starts at indent + 2 (after "- ")
|
||||
" Content under it should be indented relative to the key position
|
||||
return indent(prevmapline) + 2 + shiftwidth()
|
||||
return indent(prevmapline) + 2
|
||||
else
|
||||
return indent(prevmapline)
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user