Vim for perl and python development

Long time since I’ve been here but it happens …

Due to my employment changes and new areas of expertise, I found myself with the need to learn Perl and Python.

I am currently searching for plugins to work with Python for syntax checking since there is already a plugin for Perl that does exactly this.

So let’s start with Perl. As many of you know, Perl is very well accepted across sysadmins worldwide and has a very big library to back it up. So, if you are developing in perl and you are using Vim as your “IDE” it is a good idea to install the plugin.

From this point on whenever you create a new file with .pl you will be presented with a template. This template can be changed to match your needs. But so far, what I found more interesting on this plugin is when you sequence \rpc, this will evaluate your code according to the book Perl Best Practices. It will point your errors and it will also indicate where in book you can find the information why it is incorrect. As an example:

  1|56 col 1| Always unpack @_ first.  See page 178 of PBP  (Severity: 4)$
  2|72 col 48| “die” used instead of “croak”.  See page 283 of PBP  (Severity: 3)$

Give it a try, it is worth fit, specially if you are learning how to code Perl.

As for Python, I found that it is pretty annoying the indent system where it has to match 4 spaces. But it is as simple as using some options in Vim to make it work for you. Configure your .vimrc to look like this:

set expandtab

set tabstop=4

set softtabstop=4

set shiftwidth=4

set autoindent

set number

set list

The most important are expandtab that converts your tab to spaces and the tabstop, python uses 4 spaces for ident.

Enjoy your coding!! 🙂