* atstake atstake [2006.11.26 20:45]:
[...]
> eg. if it's a .pl file it would do "perl
> filename", show the result and if there's any
> error it would take me to the line where the
> error is.
> 
> Is there any easy way to do this with functions?
> Any example would be greatly appreciated.

To change the compiler based on file extension,
you can use autocommands:

:au BufNewFile,BufReadPre *.pl set makeprg=perl\ -c\ %
:au BufNewFile,BufReadPre *.c  set makeprg=make
:au BufNewFile,BufReadPre *.py set makeprg=pychecker\ %
etc.

To jump to the errors found, you can use the
quickfix window. Depending on the compiler you
use, you may need to tweak the 'errorformat'
option. This tells vim how to parse the error
file.

:h :make
:h 'makeprg'
:h 'errorformat'
:h quickfix

-- 
JR

Reply via email to