Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autochdir not working #62

Open
cnfczn opened this issue Aug 5, 2021 · 7 comments
Open

autochdir not working #62

cnfczn opened this issue Aug 5, 2021 · 7 comments
Labels
bug Something isn't working neovim

Comments

@cnfczn
Copy link

cnfczn commented Aug 5, 2021

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

@gelguy
Copy link
Owner

gelguy commented Aug 5, 2021

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 neovim/neovim#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 gelguy added bug Something isn't working neovim labels Aug 6, 2021
@cnfczn
Copy link
Author

cnfczn commented Sep 23, 2021

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

@gelguy
Copy link
Owner

gelguy commented Sep 23, 2021

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.

@cnfczn
Copy link
Author

cnfczn commented Oct 1, 2021

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.

@zeertzjq
Copy link

This is actually a bug of nvim_buf_set_name().

@kontheocharis
Copy link

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.

@gelguy
Copy link
Owner

gelguy commented Mar 16, 2022

This is blocked by the bug mentioned in neovim/neovim#15280.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working neovim
Projects
None yet
Development

No branches or pull requests

4 participants