autochdir not working
my vim configuration uses autochdir, but the current path is not changed when the wilder executes : e /path/of/ file
I can reproduce this. Renderer has to be using a floating window (e.g. wildmenu_renderer with mode: 'float' or popupmenu_renderer).
This is a Neovim bug, see https://github.com/neovim/neovim/issues/15280.
A workaround is to use an autocmd instead of autochdir.
autocmd BufEnter * call Chdir()
function! Chdir()
let l:dir = expand('%:p:h')
if isdirectory(l:dir)
execute 'cd ' . l:dir
endif
endfunction
But I'm not sure if this fully replaces what autochdir does.
There seems to be a problem with the chdir function. For example, I open three files in turn: /home/user1/file1 /home/user1/dir1/file2 /home/user1/file3 Then, file3 is turned off, the active buffer is file2, and the current path will stay at /home/user1 instead of /home/user1/dir1
I can't reproduce this.
Could you elaborate on what it means to turn off file3? Or list the steps in terms of :e file1, :bdelete file1, etc.
I tried again today, and I couldn't reproduce the problem. thank you for your reply. Looking forward to neovim fixing the float window bug.
This is actually a bug of nvim_buf_set_name().
Has there been any progress with this? The workaround proposed by @gelguy works about 90% of the time but sometimes it does not change the directory.
This is blocked by the bug mentioned in https://github.com/neovim/neovim/issues/15280.