Vim and puppet

User documentation
03/13/2013

Using vim and Debian to do puppet development

Some things are packaged in Debian, but a lot isn't ( #701509 ). Try to get things from Debian if they exist, but if not we can use pathogen to get the rest.

Setup pathogen

$ mkdir ~/.vim/bundle
$ mkdir ~/.vim/autoload
$ cd ~/.vim/autoload
$ curl https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim -o pathogen.vim

edit your .vimrc and add
call pathogen#infect()

Now if we want to grab a particular vim tool, we can just put it's source tree in the bundle dir
cd ~/.vim/bundle
git clone git://github.com/foo/bar.git

Here are the things we need.

  • puppet-lint - puppet style guidelines checker. Current (2013-03) version in wheezy/sid is 0.1.13-2, experimental has 0.3.2-1, upstream is 0.3.2. Install the experimental version.
  • vim-puppet - Adds puppet syntax highlighting and some other nice features to vim. Debian package provided by the puppet source package. Current (2013-03) version in wheezy/sid is 2.7.18-2, experimental has 3.1.1-1, upstream is 3.1.1. Either install the experimental version or
    cd ~/.vim/bundle
    git clone git://github.com/rodjek/vim-puppet.git
    
  • syntastic - vim tool for calling external syntax checkers and integrating the results into vim. It has support for calling puppet-lint.
    cd ~/.vim/bundle
    git clone https://github.com/scrooloose/syntastic.git
    

    To use, ensure that syntax highlighting is on
    :syntax on
    (or have your .vimrc do it and then when you save a file it will be automatically run. Use
    :Errors
    to get a buffer with all the errors.
    :help syntastic
    for more info.
  • tabular - vim tool to help with formatting things, particularly blocks of things where you want stuff aligned in certain ways (like say '=>' in puppet).
    cd ~/.vim/bundle
    git clone git://github.com/godlygeek/tabular.git
    

    Here's a howto.
  • snipmate - vim tool for automatically inserting common snippets of code.
    cd ~/.vim/bundle
    git clone git://github.com/msanders/snipmate.vim.git
    

    Here's a good screencast.

Files