Vim

From Koha Wiki

Jump to: navigation, search
Home > Development
Home > Documentation

Objectively, vim is the best editor to use for writing code in, except when it isn't. Here are some things to make it better:

Perltidy

This will make pressing F6 tidy the whole file. Alternately, you can use visual mode to select a block to tidy.

" Allow easy running of perltidy, bound to F6

nnoremap <F6> <Esc>:%! perltidy -q -npro<CR> vnoremap <F6> <Esc>:'<,'> ! perltidy -q -npro<CR>

With this, pressing F6 will tidy the whole file. However, using V to select a block, pressing F6 will only tidy that block. This is good for cleaning up the code around where you've been working if it's not adhering to a style.

Some info on Koha's offical perltidy style is here

Perl-support

Perl-support adds many Perl helper functions to your environment, giving you quick access to all sorts of useful things. There's also a handy printable key reference list there.