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 :-| ?
The cd command, also known as chdir (change directory), is a command-line shell command used to change the current working directory in various operating systems. It can be used in shell scripts and batch files.
txt The ":cd" command changes the current directory. You can see what the current directory is with the ":pwd" command: :pwd /home/Bram/VeryLongFileName Vim remembers the last directory that you used. Use "cd -" to go back to it.
To change this current working directory, you can use the "cd" command (where "cd" stands for "change directory"). For example, to move one directory upwards (into the current folder's parent folder), you can just call: $ cd ..
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With