:date: 2014-07-04 09:20 .. index:: tech, vim, puppet VIM and Puppet ============== Digging more and more into `Puppet `_ I find myself exploring several different editor to play with. After using Geppetto as the main editor, whenever I need to just quickly write a small manifest to "document" some stuff, I return to `VIM `_. By customization puppet syntax is supported and the `Puppetlabs Styleguide `_ implemented as well. I just wanted to have a quick look into this topic and get VIM basically supporting the syntax and aligning the code for me. During this I also learned about `pathogen.vim `_ for managing those extension and quickly install other stuff as well. So this is covered here as well. Pathogen -------- `Pathogen `_ takes over the handling of the variable 'runtimepath' in VIM. VIM searches a couple of paths for scripts and stuff that are defined in 'runtimepath'. Adding more scripts/plugins requires to edit or extend this path as well. *Pathogen* does this automatically (More information `here `_. Since the installation is described detailed enough `on the github project page `_ I will only list the commands for the setup for my personal documentation purpose. .. code:: bash # Installation of pathogen mkdir -p ~/.vim/autoload ~/.vim/bundle && \ curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim # Including it into the VIM configuration echo 'execute pathogen#infect()' >> ~/.vimrc Now any plugins you wish to install can be extracted to a sub-directory under `~/.vim/bundle`, and they will be added to the 'runtimepath'. Vim-Puppet ---------- Now with Pathogen.vim in place it is going very quick to install `vim-puppet `_. This will give you syntax highlighting and formatting based on the puppetlabs styleguide. .. code:: bash cd ~/.vim/bundle && \ git clone git://github.com/rodjek/vim-puppet.git Done. Tabular ------- Next step: automatic alignment of the tabs for the puppet manifests with `Tabular `_ Again using pathogen. .. code:: bash cd ~/.vim/bundle && \ git clone git://github.com/godlygeek/tabular.git Syntastic --------- Hell, since I am installing stuff anyway, I will just continue. `Syntastic `_ is a syntax checker for many different files and Puppet is just one of them. Just install it and it works: .. code:: bash cd ~/.vim/bundle && \ git clone https://github.com/scrooloose/syntastic.git Supported Checkers (the ones currently running) are listed in VIM with .. code:: :SyntasticInfo The syntax check executes when saving the file, not during entering the code.