You are not logged in.
Pages: 1
So at the moment I've got this in my vimrc
" C Options
"set makeprg=gcc -o %< %
" Java Options
set makeprg=javac %
set errorformat=%A%f:%l: %m,%-Z%p^,%-C%.%#
" PHP Options
"set makeprg=php -l %
"set errorformat=%m in %f on line %l
and I uncomment and recomment to get the compiler and error format correct depending on the language I'm using.
Can someone show me how to do an automatic syntax test on the file I'm currently editing so that vim will select the correct compiler itself?
.oO Komodo Dave Oo.
Offline
You could try it like this:
au FileType ada set makeprg=gnatmake %
au FileType java set makeprg=javac %
au FileType c set makeprg=gcc -o %< %
etc.
Offline
That should work, but it would be better to use <code>setlocal</code> instead of just <code>set</code> so it will only change the editor settings for the one particular file you're working on...otherwise it will adjust the global options, which can be confusing if you're working on multiple file types at once.
Offline
I would probably be best to use ~/.vim/ftplugins/*
add the java stuff to "java.vim" in that dir, c=c.vim, ada=ada.vim.
Offline
Hot diggity phrakture! I know who I'm coming to next time I have vim problems...I think you've answered about the last 15 that have come up
Offline
great info guys, thanks a lot!
.oO Komodo Dave Oo.
Offline
Pages: 1