On Oct 8, 8:47 am, bgold12 <[EMAIL PROTECTED]> wrote:
> Hey, thanks for your suggestions.
>
> I'd rather not change the properties of the shortcut, because that
> would mean I'd have to make sure each vim shortcut has the right
> properties, so using gvim --cmd or changing the 'Start in' property is
> not what I want. I also tried using autochdir, but that didn't work;
> vim still executed the cd C:\... line in my vimrc and I always started
> in that same directory.
>
> But I've found a pretty good solution; I know that when vim opens
> without a file, it defaults to the installation directory, which in my
> case is "C:\Program Files\Vim\vim72" at the moment. So in my vimrc I
> just added a test:
>
> if (getcwd() == "C:\\Program Files\\Vim\\vim72")
> cd C:\my\preferred\directory
> endif
>
> So now whenever I open vim with a file, it stays in the file's
> directory, but when I open vim without a file, it starts in whatever
> directory I want.
>
> There are 2 problems with this solution: (1) If I ever change the
> installation directory (say if I install a new version of vim, which I
> obviously will at some point), then I'd have to change the if
> statement to match the new installation directory. Actually, if
> someone knows a way of testing the installation/default start-up
> directory from vim, then that would solve this problem. (2) If I ever
> for some reason want to edit a file in the installation directory, vim
> would cd to my preferred directory instead of staying in the file's
> directory. But I don't see why I would want to do that.
>
For problem 1, you want the $VIMRUNTIME variable.
For problem 2...if you set autochdir, you can just do :e to re-edit
the file and it will change back where it needs to go.
Autochdir seems to be a little flakey...I need to :e every now and
then to get it to work, but I haven't been able to determine a
reliable way to make it fail.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---