Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are your suggestions for an ideal Vim configuration for Perl development?

From chromatic's blog (slightly adapted to be able to use the same mapping from all modes).

vmap ,pt :!perltidy<CR> 
nmap ,pt :%! perltidy<CR>

hit ,pt in normal mode to clean up the whole file, or in visual mode to clean up the selection. You could also add:

imap ,pt <ESC>:%! perltidy<CR>

But using commands from input mode is not recommended.


" Create a command :Tidy to invoke perltidy.
" By default it operates on the whole file, but you can give it a
" range or visual range as well if you know what you're doing.
command -range=% -nargs=* Tidy <line1>,<line2>!
    \perltidy -your -preferred -default -options <args>

Look also at perl-support.vim (a Perl IDE for Vim/gVim). Comes with suggestions for customizing Vim (.vimrc), gVim (.gvimrc), ctags, perltidy, and Devel:SmallProf beside many other things.


Perl Best Practices has an appendix on Editor Configurations. vim is the first editor listed.