tags:

views:

281

answers:

2

Vim (actually, gvim is in question, but I believe it works both ways) upon starting has its current directory in its runtime directory.

I would like to upon starting, to have its cd in let's say, c:\pro
I know I can just do :cd c:\pro, but is there a way to change it upon starting it, with
something alike gvim c:\pro (only that doesn't work :-| ?

+1  A: 

Can't you put cd path in your .vimrc ?

Arkaitz Jimenez
what good would that do ?
ldigas
it would cd you in path on startup, isn't that what you want?
Arkaitz Jimenez
the given directory in question was just an example. i wish to start gvim each time with a different directory ...
ldigas
+2  A: 

You can use

gvim -c "cd C:/pro"

-c allows you to run commands just after Vim has finished loading.

Vim's working directory is initially set to the working directory of the process that invokes Vim.

If you're double-clicking on the .exe in Explorer, that's why it's the runtime directory.

If you're using the Start Menu shortcut, then it has the Start in path set to the runtime directory. You could change the Start in path of the shortcut.

If you use the run dialog, then vim's initial working directory is likely your Documents and Settings directcory.

jamessan
actually, i'm trying to get it to launch through launchy, with starting directory of my preference ...
ldigas
Ok, then the -c suggestion will work. I just also wanted to make sure the method behind Vim's behavior was clear. :)
jamessan
yeah ... except, i just noticed launchy doesn't take command line arguments ... rats :-(
ldigas
but your answer is correct, no dilemma there ..
ldigas
According to their docs, they do: Launchy allows you to enter command line options into your queries.Simply hit tab once you have found the application you are interestedin and then enter your command line options.
jamessan
just found that out too (by accident) .. in any case .. thanks jamessan, you're a well of info ... (not the same one from #vim of freenode, by any chance ?)
ldigas
One and the same.
jamessan