On 15/03/09 20:05, adam99 wrote:
>
>
> I tried bang(!) but it runs in the place that I started the gvim, not in the
> directory of the file...
>
> adam99 wrote:
>>
>> I am working with several files at the same time. I would like to compile
>> files in the directory of the file I make a change.
>>
>> Is there way to run a shell command in the directory of the file?
>>
>> Thanks
>> Adam
>>
>

It may depend on your shell and/or on your OS

On any platform, you could do

        :lcd %:p:h
        :!somecommand arg1 arg2

On Linux or Cygwin, where I use bash, I could also do

        :!(cd %:p:h ; somecommand arg1 arg2)

to avoid changing the "current directory" seen inside Vim. (Vim replaces 
%:p:h by the full directory of the current editfile.) I don't know 
whether other Unix shells accept the same () construct.


Best regards,
Tony.
-- 
SOLDIER: Where did you get the coconuts?
ARTHUR:  Through ... We found them.
SOLDIER: Found them?  In Mercea.  The coconut's tropical!
                  "Monty Python and the Holy Grail" PYTHON (MONTY) 
PICTURES LTD

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to