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

DirChanged should fire whenever the result of getcwd() changes #6054

Closed
justinmk opened this issue Feb 3, 2017 · 3 comments
Closed

DirChanged should fire whenever the result of getcwd() changes #6054

justinmk opened this issue Feb 3, 2017 · 3 comments
Labels
bug issues reporting wrong behavior
Milestone

Comments

@justinmk
Copy link
Member

justinmk commented Feb 3, 2017

:help DirChanged says:

After the current-directory was changed.

But DirChanged only fires on an explicit call to e.g. :lcd. It should also fire when user focuses a window or tab which causes CWD to change. Example:

$ strace nvim -u NONE +'split|lcd ..|wincmd w' +qa 2>&1|grep chdir
chdir("/home/vagrant/neovim")           = 0
chdir("/home/vagrant")                  = 0
chdir("/home/vagrant/neovim")           = 0
chdir("..")                             = 0
chdir("/home/vagrant/neovim")           = 0  # DirChanged should fire here. 

see neovim/neovim-ruby#22 (comment)

cc @mhinz

@justinmk justinmk added the bug issues reporting wrong behavior label Feb 3, 2017
@justinmk justinmk added this to the 0.2 milestone Feb 3, 2017
@alexgenco
Copy link
Contributor

I feel like the scope argument might make less sense in the case where it's not triggered by an explicit cd, lcd, or tcd. I suppose in your example it would be win, but I could imagine cases where it's not as clear cut, like switching to a split whose pwd was determined by a global directory change.

@justinmk
Copy link
Member Author

Perhaps it's reasonable that "scope" is simply "the current effective scope" in those cases.

justinmk added a commit to justinmk/neovim that referenced this issue Mar 12, 2017
justinmk added a commit to justinmk/neovim that referenced this issue Mar 12, 2017
@justinmk
Copy link
Member Author

like switching to a split whose pwd was determined by a global directory change.

In that case the scope would be "global", because that is the effective scope. Whether anyone will ever find this useful, I'm not sure. But the internal logic is such that exposing the conclusion is straightforward, so that's what we do.

This is implemented in #6262.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug issues reporting wrong behavior
Projects
None yet
Development

No branches or pull requests

2 participants