diff --git a/plugin/autoformat.vim b/plugin/autoformat.vim index e33a419..ed2ec47 100644 --- a/plugin/autoformat.vim +++ b/plugin/autoformat.vim @@ -13,7 +13,7 @@ function! s:find_formatters(...) let ftype = a:0 ? a:1 : &filetype " Support composite filetypes by replacing dots with underscores let compoundtype = substitute(ftype, "[.]", "_", "g") - if ftype =~ "[.]" + if ftype =~? "[.]" " Try all super filetypes in search for formatters in a sane order let ftypes = [compoundtype] + split(ftype, "[.]") else @@ -37,11 +37,11 @@ function! s:find_formatters(...) if !exists(formatters_var) " No formatters defined if verbose - echoerr "No formatters defined for supertype '".supertype + echoerr "No formatters defined for supertype ".supertype endif else let formatters = eval(formatters_var) - if type(formatters) != 3 + if type(formatters) != type([]) echoerr formatter_var." is not a list" else let b:formatters = b:formatters + formatters diff --git a/plugin/defaults.vim b/plugin/defaults.vim index b8f0bb0..bef4dd9 100644 --- a/plugin/defaults.vim +++ b/plugin/defaults.vim @@ -230,17 +230,22 @@ endif " Perl if !exists('g:formatdef_perltidy') - " use perltidyrc file if readable - if (has("win32") && (filereadable("perltidy.ini") || filereadable($HOMEPATH."/perltidy.ini"))) || - \ ((has("unix") || has("mac")) && (filereadable(".perltidyrc") || filereadable("~/.perltidyrc") || filereadable("/usr/local/etc/perltidyrc") || filereadable("/etc/perltidyrc"))) - let g:formatdef_perltidy = '"perltidy -q -st"' - else - let g:formatdef_perltidy = '"perltidy --perl-best-practices --format-skipping -q "' - endif + " use perltidyrc file if readable + if (has("win32") && (filereadable("perltidy.ini") || + \ filereadable($HOMEPATH."/perltidy.ini"))) || + \ ((has("unix") || + \ has("mac")) && (filereadable(".perltidyrc") || + \ filereadable("~/.perltidyrc") || + \ filereadable("/usr/local/etc/perltidyrc") || + \ filereadable("/etc/perltidyrc"))) + let g:formatdef_perltidy = '"perltidy -q -st"' + else + let g:formatdef_perltidy = '"perltidy --perl-best-practices --format-skipping -q "' + endif endif if !exists('g:formatters_perl') - let g:formatters_perl = ['perltidy'] + let g:formatters_perl = ['perltidy'] endif " Haskell