Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim: Change start up directory?

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

like image 444
Nope Avatar asked Jul 25 '09 01:07

Nope


People also ask

How do I change the default directory in Vim?

Use e.g. From the docs: When on, Vim will change the current working directory whenever you open a file, switch buffers, delete a buffer or open/close a window. It will change to the directory containing the file which was opened or selected.

How do I go back to a folder in Vim?

You can go back to the last buffer using :b# . If you just opened a file, then it will bring you just back to the directory browsing.


1 Answers

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.

like image 185
Alex Martelli Avatar answered Sep 23 '22 10:09

Alex Martelli