]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(yaml): fix indentation script
authorBjoern Foersterling <bjoern.foersterling@gmail.com>
Thu, 15 Jan 2026 20:05:58 +0000 (20:05 +0000)
committerChristian Brabandt <cb@256bit.org>
Thu, 15 Jan 2026 20:05:58 +0000 (20:05 +0000)
Problem:  The indentation of Ansible Playbooks gets messed up after
          gg=G (after 9179ddc0608813e)
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>
runtime/indent/testdir/yaml.in
runtime/indent/testdir/yaml.ok
runtime/indent/yaml.vim

index 32b56a73f8cb7e3294defd8bc7d3025403a6236b..8500b0d8c10f42d190e6ab28c70af201a5a77677 100644 (file)
@@ -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
index 0bfabfc1665e892b809afe264cb569397c2d12c9..86a3ce481036600cf2c4b5f882e641cbf2f27e70 100644 (file)
@@ -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
index fb0f055dce055b1e04710d8c4a4917a23770cda3..1b0110e8ff5977a43bd9389168232f918ac395e3 100644 (file)
@@ -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