Monday, May 10, 2010

Re: Open command window to directory of open file

On 05/10/2010 12:54 PM, nakore wrote:
> A couple months ago, I was wandering around the help pages looking for
> something (no idea what now) and I stumbled upon something SOOO cool,
> that I really had wished I had known it for the last ten years.
>
> I, then, promptly forgot what it was (the exact command, not the
> functionality) and have not been able to re-find it to save my life!!
>
> It was (I think) some : thingy, that upon hitting enter a command/cmd/
> DOS window (I'm running gvim in XP) would pop open, already sitting in
> the directory in which the file open in the current buffer resides.
> In other words, if I had a file open like: c:/somedir/someotherdir/
> somefile.ext and I typed the :magic-word and hit enter, a command
> window would pop open to the directory: c:/somedir/someotherdir/
>
> Might anyone know the :magic-word?
>


You can do :lcd %:p:h<cr>:sh<cr> and map this to some key. To find
help about this, do :h filename-modifiers and :h lcd. -ak

No comments: