[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

vimrc for perl programming



Can people make some suggestions on vimrc entries for programming,
syntax highlighting, automatic indenting etc.  My current entries work
OK for C, C++, Java etc. but not perl.  I guess I only need to add the
.pl and .cgi extensions to the autocommand sections to get this to work.
However, I am interested in what others use.  Particularly, there is
some autodetection ability I think, so that if I don't give the files
.pl or .cgi extensions, it still performs OK.

I have the following entries in my vimrc for programming stuff:
--- snip ---
augroup programming
  " Remove all programming autocommands
  au!

  syntax on               "syntax highlighting
  set softtabstop=4       "default character indentation
  set shiftwidth=4        "default character indentation
  set expandtab           "use spaces instead of tabs for indentation
  set showmatch           "show matching parenthesis / brackets
  set pastetoggle=<F4>    "press <F4> before pasting to stop auto-indenting

  " When starting to edit a file:
  "   For *.c, *.h, *.cc, *.java files
  "   set formatting of comments and set C-indenting on.
  "   For other files switch it off.
  "   Don't change the order, it's important that the line with * comes first.
  autocmd BufRead *       set formatoptions=tcql nocindent comments&
  autocmd BufRead *.java,*.c,*.h,*.cc set formatoptions=croql cindent comments=s
  " Run the java compiler using ":make".
  autocmd BufRead *.java set makeprg=javac\ -d\ .\ %
  autocmd BufRead *.java set errorformat=%f:%l:%c:%*\d:%*\d:%*\s%m
augroup END
--- snip ---

Suggestions welcome.

Cheers.
Mark.

Attachment: pgpUyhbgwHcF8.pgp
Description: PGP signature


Reply to: