Improving Vim's Puppet integration

October 15, 2020 – Samuli Seppänen

A recent package upgrade seemed to break Puppet syntax highlighting horribly on my Fedora 32 laptop. Not only did syntax highlighting not work, it was actually completely wrong and confusing. It seemed as if the Puppet file type detection was missing, so vim was probably using some a syntax highlighter for a wrong type. To see which file types are enabled I used :set filetype followed by a couple of tabs (more details on StackExchange).

Now, I really did not want to become a Vim expert, but something had to be done. So, I did some research and found out that there is a Puppet plugin for vim. The next question was "how do I enable the thing?". The official documentation for the plugin tells that you should use a thing called "pathogen". But pathogen's own documentation tells that if you're on Vim 8.x+ you consider using the built-in management in Vim. I opted for the "built-in plugin management" approach which was nicely documented in this article. Essentially all you need to do is this:

mkdir -p ~/.vim/pack/vendor/start
cd ~/.vim/pack/vendor/start
git clone https://github.com/rodjek/vim-puppet.git

Then launch Vim and your Puppet syntax highlighting should look great, plus you get some additional features like automatic "=>" indentation for free.

...

Want to talk to an expert?

If you want to reach us, just send us a message or book a free call!
menucross-circle