vim doesn't open some directories

486 views
Skip to first unread message

Yuri Vic

unread,
Feb 26, 2014, 4:31:43 AM2/26/14
to vim...@googlegroups.com
Beginning few months ago, vim behavior changed for this command: 'vim /some/dir/'
It opens some directories with "Netrw", and it doesn't open some other directories.
But it always prints in the bottom: "/some/dir/" Illegal file name.
Directories it opens successfully tend to be descendants of the current directory.

Maybe somebody knows what might be a problem? I couldn't identify so far why some directories fail.

FreeBSD-9.2
vim-7.4.182

Yuri

Charles E Campbell

unread,
Feb 26, 2014, 11:53:47 AM2/26/14
to vim...@googlegroups.com
I suggest that you try things out with the latest netrw, which you can
get from my website:

http://www.drchip.org/astronaut/vim/index.html#NETRW

You'll always get that "Illegal file name" message; vim emits it and
there's no way to avoid it AFAIK.

Regards,
C Campbell

Yuri

unread,
Feb 27, 2014, 5:34:38 AM2/27/14
to vim...@googlegroups.com
On 02/26/2014 08:53, Charles E Campbell wrote:
>>
> I suggest that you try things out with the latest netrw, which you can
> get from my website:
>

Yes, this fixed the problem.
Since you are the maintainer, I would like to ask if it is possible to
not change directory to the folder that is opened with ":new mydir/"?
Currently, it changes the current directory to mydir/ once some file
from there is opened. I don't this this is generally a desired behavior.
Opening a file is what users usually want.

Yuri

Charles Campbell

unread,
Feb 27, 2014, 10:29:47 AM2/27/14
to vim...@googlegroups.com
Hello!

With g:netrw_keepdir= 0, :new somedir/ (where somedir previously
existed) started up a netrw browsing window with .../somedir as the
current directory. This behavior is correct.
With g:netrw_keepdir= 1, :new somedir/ (where somedir previously
existed) started up a netrw browsing window without having changed the
currrent directory. This behavior is correct.
When somedir did not previously exist, :new somedir/ did not create a
new directory.

Opening some file from that directory did not affect the current
directory (leaving it as .../somedir when g:netrw_keepdir=0 and ... when
g:netrw_keepdir=1).

I'm not sure what you're asking for here; please elucidate!

Thank you,
C Campbell

Yuri

unread,
Feb 27, 2014, 3:00:10 PM2/27/14
to vim...@googlegroups.com
On 02/27/2014 07:29, Charles Campbell wrote:
>
> I'm not sure what you're asking for here; please elucidate!

I think the default is wrong here. It shouldn't change the directory by
default, because most users don't know about Netrw and its options.
When someone works on the project, and, for ex., needs to check what
/etc/make.conf says, :new /etc/make.conf isn't expected to change the
current directory to /etc.

So majority of users don't know about Netrw and don't need to. They just
open the directory or file, not expecting the directory change. And your
default shold reflect this major use case.

Yuri

James McCoy

unread,
Feb 27, 2014, 3:09:26 PM2/27/14
to vim_dev

On Feb 27, 2014 3:00 PM, "Yuri" <yu...@rawbw.com> wrote:
>
> On 02/27/2014 07:29, Charles Campbell wrote:
>>
>>
>> I'm not sure what you're asking for here; please elucidate!
>
>
> I think the default is wrong here. It shouldn't change the directory by default,

It doesn't. One has to change the value of g:netrw_keepdir (default is 1) to cause NetRW to automatically change directories.  See ":help g:netrw_keepdir" and ":help netrw-c".

Yuri

unread,
Feb 27, 2014, 3:41:26 PM2/27/14
to vim...@googlegroups.com
On 02/27/2014 12:09, James McCoy wrote:
> It doesn't. One has to change the value of g:netrw_keepdir (default is 1)
> to cause NetRW to automatically change directories. See ":help
> g:netrw_keepdir" and ":help netrw-c".

I see, I had this stray line in ~/.vimrc. Never mind.

Yuri
Reply all
Reply to author
Forward
0 new messages