GVIM: Set working directory the same of the current file

13 views
Skip to first unread message

Francisco M. Marzoa Alonso

unread,
Dec 13, 2011, 12:13:59 PM12/13/11
to vim...@googlegroups.com
Hello,

Is there any manner to do that GVIM's current directory will be the same
of the file being edited?

I mean that if I'm editing /var/www/myhost/web/index.php and if I try to
open a new file, it should shows /var/www/myhost/web instead of my
user's directory.

Thanks a lot in advance,

Ivan Krasilnikov

unread,
Dec 13, 2011, 12:28:59 PM12/13/11
to vim...@googlegroups.com
On Tue, Dec 13, 2011 at 18:13, Francisco M. Marzoa Alonso
<fmma...@gmail.com> wrote:
> I mean that if I'm editing /var/www/myhost/web/index.php and if I try to
> open a new file, it should shows /var/www/myhost/web instead of my
> user's directory.

This page describes one way to quickly open files in the same
directory as the current file:
http://vim.wikia.com/wiki/Easy_edit_of_files_in_the_same_directory

sc

unread,
Dec 13, 2011, 12:42:19 PM12/13/11
to vim...@googlegroups.com

the most common way to do this is to set autochdir in your
.vimrc -- see

:h 'autochdir'

sc

Ben Fritz

unread,
Dec 13, 2011, 2:03:04 PM12/13/11
to vim_use

On Dec 13, 11:28 am, Ivan Krasilnikov <inf...@gmail.com> wrote:
> On Tue, Dec 13, 2011 at 18:13, Francisco M. Marzoa Alonso
>

> <fmmar...@gmail.com> wrote:
> > I mean that if I'm editing /var/www/myhost/web/index.php and if I try to
> > open a new file, it should shows /var/www/myhost/web instead of my
> > user's directory.
>
> This page describes one way to quickly open files in the same
> directory as the current file:http://vim.wikia.com/wiki/Easy_edit_of_files_in_the_same_directory

Or this, more to the point:

http://vim.wikia.com/wiki/Set_working_directory_to_the_current_file

Reply all
Reply to author
Forward
0 new messages