wilder.nvim icon indicating copy to clipboard operation
wilder.nvim copied to clipboard

autochdir not working

Open cnfczn opened this issue 4 years ago • 7 comments

my vim configuration uses autochdir, but the current path is not changed when the wilder executes : e /path/of/ file

cnfczn avatar Aug 05 '21 03:08 cnfczn

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.

gelguy avatar Aug 05 '21 19:08 gelguy

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

cnfczn avatar Sep 23 '21 00:09 cnfczn

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.

gelguy avatar Sep 23 '21 18:09 gelguy

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.

cnfczn avatar Oct 01 '21 13:10 cnfczn

This is actually a bug of nvim_buf_set_name().

zeertzjq avatar Dec 20 '21 08:12 zeertzjq

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.

kontheocharis avatar Mar 16 '22 12:03 kontheocharis

This is blocked by the bug mentioned in https://github.com/neovim/neovim/issues/15280.

gelguy avatar Mar 16 '22 17:03 gelguy