function! Perl() " autoindent set autoindent set smartindent " 4 space tabs set tabstop=4 set shiftwidth=4 set expandtab set softtabstop=4 " show matching brackets set showmatch " show line numbers set number " check perl code with :make set makeprg=perl\ -c\ %\ $* set errorformat=%f:%l:%m set autowrite endfunction " Call Perl() when you open a Perl file autocmd FileType perl call Perl()