vim

Summary

This is quick post about how to configure the vim for puppet. As we all know puppet is one of the widely used automation tool in IT industry. While working on puppet manifests, module etc. Automation engineer has to be very careful with syntax,indentation and spaces.

We will configure vim as puppet ide. Kindly make a attention here, we are talking about vim not vi.

Configure Vim For Puppet

Step 1: We believe you have already installed vim on your system. In case you haven’t, given below are commands which you can run on respected Operating System.

## In CentOS/RHEL
yum install vim

## In Debian/Ubuntu
sudo apt-get update
sudo apt-get install vim

Step 2: Install git client on your system to clone the git repo.

## In CentOS/RHEL
yum install git

## In Debian/Ubuntu
sudo apt-get update
sudo apt-get install git

Step 3: Create directory called .vim in user’s home directory . It is a hidden directory.

mkdir ~/.vim

Step 4: Clone the puppet-syntax-vim (from puppetlabs) inside .vim directory.

cd ~/.vim
git clone https://github.com/puppetlabs/puppet-syntax-vim.git

Step 5: Create hidden file called .vimrc in user’s home directory.

vim ~/.vimrc

And add below given contents in .vimrc file.

set nocompatible
syntax on
filetype indent plugin on
set expandtab
set smarttab
set autoindent
au FileType puppet setlocal tabstop=8 expandtab shiftwidth=2 softtabstop=2

Save and exit from .vimrc file.

Step 6: Re-login and try editing the puppet files by using vim command.

Attention: Generally while checking this setting many people use vi command. These settings only work when you use vim command for file editing.

Read Some More Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.