tags:

views:

633

answers:

3

When I start GVim and start writing my little program I'd like to save the file to the Desktop but it seems that Vim is starting the command line in:

C:\Windows\System32

How would I go about changing that to:

C:\Users\Casey

so then I could just:

:w Desktop\my_program.py

Thank you :)

+9  A: 

Assuming you're starting gvim from an icon/shortcut in Windows (from the kind of paths you supply), you can change the starting directory (completely independent from the fact that it IS gvim: it would be the same from any other app!) by editing the "starting directory" property of that Windows icon/shortcut.

Alex Martelli
cool ... simple way :)
nightingale2k1
+3  A: 

Within vim, you can change the current directory with the :cd command:

:cd c:\users\casey
Greg Hewgill
+1  A: 

using :cd c:\users\casey after that save into session (in gvim there is button up and down in red, click on it and save as mySessionProject.vim) next time you need to go to that directory .. open that session (you can also using :source mySessionProject.vim)

for command line: :mksession! yourdir/yourVimConfName.vim

to load :source yourDir/yourVimConfName.vim

;)

nightingale2k1
If you always want to start in this directory it's probably easier to put the cd command into your .gvimrc. Using sessions is nice for having multiple different "configurations" - this could also be used with desktop shortcuts where each shortcut would call something like "gvim -S sessionX.vim"
Blixtor
yep .. you are right blixtor. .. but with session, you can have different directory for each project.like i store my project-1 in c:\project-1 and project-2 in c:\project-2 so when I need to edit files in first project i just need to open the session and I will be located to project-1 directory.
nightingale2k1