[vim/vim] autochdir does not respect `No Name` buffers (Issue #10923)

37 views
Skip to first unread message

ad_chaos

unread,
Aug 16, 2022, 2:31:43 AM8/16/22
to vim/vim, Subscribed

Steps to reproduce

vim --clean
:set autochdir
:h h
:pwd (should say the runtime path)
<C-w>j
:pwd (also says the runtime path)

Expected behaviour

When switching windows (from the help window to the No Name buffer) the cwd should also be changed

I am not sure if this is a bug or a feature request, because the doc says

			*'autochdir'* *'acd'* *'noautochdir'* *'noacd'*
'autochdir' 'acd'	boolean (default off)
			global
	When on, Vim will change the current working directory whenever you
	open a file, switch buffers, delete a buffer or open/close a window.
	It will change to the directory containing the file which was opened
	or selected.
	Note: When this option is on some plugins may not work.

Which mentions:-

It will change to the directory containing the file which was opened or selected.

but then also says:-

When on, Vim will change the current working directory whenever you open a file, switch buffers

So maybe either the docs need updating to be more clear or maybe make the No Name buffer also have a cwd attached to it :)

Version of Vim

VIM - Vi IMproved 9.0 (Included patches: 1-200)

Environment

Operating System: macOs
Terminal: Kitty
$TERM: xterm-kitty
Shell: zsh

Logs and stack traces

No response


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/10923@github.com>

zeertzjq

unread,
Aug 16, 2022, 2:34:34 AM8/16/22
to vim/vim, Subscribed

What do you expect the cwd to be changed to?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/10923/1216204803@github.com>

ad_chaos

unread,
Aug 16, 2022, 2:35:28 AM8/16/22
to vim/vim, Subscribed

To the one from which I started nvim from


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/10923/1216205432@github.com>

Bram Moolenaar

unread,
Aug 16, 2022, 7:27:55 AM8/16/22
to vim/vim, Subscribed

A buffer without a name is not associated with any directory. Thus 'autochdir' doesn't do anything when making such a buffer the current one. Since when using 'autochdir' you constantly change directory, using the current directory of when the buffer was created, e.g. with ":new", is likely more confusing than helpful. I'll add a remark in the help about this.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/10923/1216506253@github.com>

Bram Moolenaar

unread,
Aug 16, 2022, 7:27:58 AM8/16/22
to vim/vim, Subscribed

Closed #10923 as completed.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/10923/issue_event/7196363397@github.com>

Reply all
Reply to author
Forward
0 new messages