Op dinsdag 20-09-2011 om 23:40 uur [tijdzone +1200], schreef Mason James:
i added this to my .vimrc file, now F4 tidys a selected block of text :) fyi: i use this method many times a day
---------------------------------------- map <F4> <Esc>:%! perltidy<CR> ----------------------------------------
Nifty. I've improved on this slightly: " Allow easy running of perltidy, bound to F6 nnoremap <F6> <Esc>:%! perltidy -q<CR> vnoremap <F6> <Esc>:'<,'> ! perltidy -q<CR> this allows you to apply it to parts of the file using visual mode, or the whole thing if you're not in visual mode. -q is good to stop it doing syntax checks and outputting other things that may mess up your editor display (or maybe the content of the file itself when it goes through the filter, not sure.) -- Robin Sheat Catalyst IT Ltd. ✆ +64 4 803 2204 GPG: 5957 6D23 8B16 EFAB FEF8 7175 14D3 6485 A99C EB6D