Thanks Gary, au VimEnter * cd %:h is the exact resolution to my problem.

2010/1/23 Gary Johnson <[email protected]>

> On 2010-01-23, Lenin Lee wrote:
> > On Windows, when I double click a file and open it using gvim, the path
> of the
> > file will be set as the current directory of gvim.
> >
> > But when I do the same thing on linux, the current directory of gvim
> always is
> > my home directory.
> >
> > I searched for the question with google, but there is no resolution.
> >
> > So I wonder if anyone may help.
>
> You didn't say what the problem was for which you are seeking a
> resolution, but I assume that you want gvim on Linux to behave as it
> does on Windows.  If that's the case, then one solution may be found
> here:
>
>    :help autochdir
>
> That will, however, change the current working directory whenever
> you open a new file, not just when gvim starts.  You may instead
> want to put something like this in your ~/.vimrc:
>
>    au VimEnter * cd %:h
>
> See
>
>    :help autocommand
>    :help VimEnter
>    :help :cd
>    :help filename-modifiers
>
> HTH,
> Gary
>
>
> --
> You received this message from the "vim_use" maillist.
> For more information, visit http://www.vim.org/maillist.php




-- 
初从文,三年不第。遂习武,校场发一矢,中鼓吏,逐之出。后学医,有所成,自撰一良方,服之,卒。

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

Reply via email to