On 26/10/08 19:07, Martin dum8d0g Kopta wrote:
> Hi,
>
> I have in my $HOME/.vimrc those lines:
>
> set makeprg=make
> map<F9> :w<CR>:make<CR>
> imap<F9> <ESC>:w<CR>:make<CR>
>
> And it works just fine. When I'm writting something AND have Makefile
> a can just press F9 to see result (mostly errors..) of my work (I'm
> using it succesfully on C,C++,LaTeX,Graphviz,.html,.php,uploading blog
> to server and so on..). But - It has that ugly feature - Makefile must
> exist. That's ok for compiled things or complicated processing where I
> muss to tell what to do, but when I'm writing a script (bash, tcl,
> perl, python, ...) I just want to do :!./% (<-- too much typing) but
> I'm addicted to F9 right now. So..
>
> Is there any possibility to tell vim to:
>
> If (presed F9)
> {
> if (Makefile exists){execute make}
> else { do :!./% }
> }
>
> Thanks a lot for all usefull comments!
Well, what about
:map <F9> :w <Bar> if filereadable('Makefile') <Bar> make <Bar> else
<Bar> !./% <Bar> endif <CR>
(all on one line)?
Best regards,
Tony.
--
Any clod can have the facts, but having an opinion is an art.
-- Charles McCabe
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---