On 08/10/08 09:05, bgold12 wrote:
> Hey, is there way to test if vim was just started with no file?
> Actually, I should start from the beginning:
>
> I usually like to start vim by clicking on a shortcut on my Windows
> taskbar, which means it'll start with an empty [No Name] buffer. In
> this case, I would like my vimrc file to automatically set the
> directory to a preferred start-up directory. But obviously when I
> start vim with a file specified, either from the command line or from
> double-clicking on a vim-associated file, I want the current directory
> to be the directory the opened file is in, so I don't want my vimrc to
> set the directory in that case. Any suggestions?
>
> Thanks.

Method 1. Change the properties of your desktop shortcut so that it loads

        gvim --cmd "cd C:\my\preferred\startup\dir"

Method 2. There's nothing obvious in wanting Vim to always set the 
current directory to the directory of the current file: 'autochdir' 
(q.v.) defaults to off, and as a matter of fact I don't set it on. 
However if you do, I think it doesn't matter which directory you :cd to 
in your vimrc, whenever you enter a file (including the first file on 
the command-line) Vim should change to the file's directory. So in that 
case I think you could just write the following into your vimrc:

        set autochdir
        cd C:\my\preferred\startup\dir


Best regards,
Tony.
-- 
People need good lies.  There are too many bad ones.
                -- Bokonon, "Cat's Cradle" by Kurt Vonnegut, Jr.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to