Vim

Vim (http://www.vim.org) is, of course, still a mainstay for text file editing. It has a very long history in the Unix world, and it's a very lightweight command-line text editor. Vim is just about as raw a text editor as you can get. It can be used as a lightning fast and efficient IDE if you have the memory and patience to learn the myriad keyboard commands. My advice is to start out with a few basic commands, and make an effort to pick up a few more each time you use Vim.

You can pimp your Vim and make it better suited for editing Puppet manifests. Let's take a look at that, assuming you've just grabbed a fresh Vim installation, and you have Git installed.

Move to your home directory and clone the given repository with the following commands:

cd ~
git clone https://github.com/ricciocri/vimrc .vim
cd .vim
git pull && git submodule init && git submodule update && git submodule status
cd ~
ln -s .vim/.vimrc

Cloning the repository into your home directory's .vim directory will configure your Vim settings for you. The repository contains several submodules containing the following:

  • Pathogen (https://github.com/tpope/vim-pathogen) is Vim guru Tim Pope's general-purpose add-on that allows you to manage your Vim runtimepath with ease and install Vim plugins and runtime files each in their own private directories, rather than having file collisions.
  • Vim-puppet (https://github.com/rodjek/vim-puppet) is the original Vim plugin written by Tim Sharpe, making Vim much more Puppet-friendly.
  • snipmate.vim (https://github.com/msanders/snipmate.vim) is a Vim script that implements some of TextMate's snippet features for Vim.
  • Syntastic (https://github.com/vim-syntastic/syntastic) is a syntax-checking plugin that runs files through external syntax checkers and displays any resulting errors. This can be done from the command line with the pdk validate command, or automatically as files are saved.
  • Tabular (https://github.com/godlygeek/tabular) is used to line up your fat arrows (=>) according to the Puppet Style Guide, so that it will pass running the pdk validate command. (We will cover the pdk validate command in full later.)
  • vim-fugitive (https://github.com/tpope/vim-fugitive) provides deep Git integration for Vim.

I can't promise this will be a perfect Vim setup for your own personal Vim style, but it will certainly get you on the right path, and you will have Pathogen installed, so you can further tweak your Vim settings until you have it just how you like it.

 You might also want to fork this repository in GitHub, so you can keep all your settings and share them with your team.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.19.251