0

YAML / YML unwanted auto-formatting

The last days I made some configuration improvements of my vim environment, e.g. I installed vim-polyglot and coc and removed duplicated plugins within my vim-plug plugin manager.

However some very annoying effect occurs which I don't know how to handle, or respectively which plug or setting is responsible for it.

When I start editing for instance the aptitude configuration file config all the keys get extracted as demonstrated below:

  • before

    Aptitude::UI::Styles {
      MenuBorder {fg black; bg blue; set bold};
    
  • after writing vim formats it this way

    aptitude::UI "";
    aptitude::UI::Styles "";
    aptitude::UI::Styles::MenuBorder "";
    aptitude::UI::Styles::MenuBorder::fg "black";
    aptitude::UI::Styles::MenuBorder::bg "blue";
    aptitude::UI::Styles::MenuBorder::set "bold";
    

This file is a yaml / yml format.

I appreciate every hint for solving this issue.

5
  • Have you checked the active autocommands with :au to see if you could find the culprit and work your way backwards to the responsible plugin (or other origin)?
    – frippe
    May 26, 2022 at 19:43
  • Thank you for the hint. Tried to watch the output of :au, but the list is so long. Maybe I have to make a trial and error configuration on a virtual machine. I set up to many plugins at once.
    – abu_bua
    May 29, 2022 at 14:52
  • 1
    It probably hooks in to the BufWritePre event; :au BufWritePre should narrow it down. Could also be BufWriteCmd. Either way: this is definitely some plugin you've added; maybe ALE or something similar? Remove half of your plugins: if that fixes it add half back, and trial-and-error until you've narrowed it down. You can then look at the plugin where you can probably configure this behaviour. May 29, 2022 at 23:55
  • 1
    Try some of the tips in How to debug my vimrc
    – D. Ben Knoble
    Jun 2, 2022 at 18:00
  • I had less time to make any progress. What I found out that this is an apt config file and maybe it is treaten that way (vim recognize that this is the aptitutde config file. However the settings for yaml are very suspicious.
    – abu_bua
    Jun 2, 2022 at 21:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.