Skip to content
New issue

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

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

Already on GitHub? # to your account

FuzzyOpen changes the working directory of vim to the the parent dir of the file #10

Open
bbatha opened this issue Oct 20, 2016 · 31 comments

Comments

@bbatha
Copy link

bbatha commented Oct 20, 2016

Opening a file is now changing the cwd of vim or fzy such that subsequent uses of FuzzyOpen only search the folder the last file was found in.

@cloudhead
Copy link
Owner

I can't reproduce this. Are you inside a .git repo or not?

@bbatha
Copy link
Author

bbatha commented Oct 26, 2016

I am in a git repo

On Wednesday, October 26, 2016, Alexis Sellier notifications@github.com
wrote:

I can't reproduce this. Are you inside a .git repo or not?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#10 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AASZo4FsRpcCV5vtABl14UrNm8mGX6BNks5q3yw8gaJpZM4KcgYJ
.

@tssm
Copy link

tssm commented Nov 13, 2016

I have encounter a weird issue that can be related: some times all the filesystem files disappear from the fuzzy list and only the open buffers remain. I have tried to isolate when it happens without luck.

@cloudhead
Copy link
Owner

I've had this issue, and on my side it had to do with my /tmp dir being full. The plugin creates a temporary file there to interface with the cli.

@tssm
Copy link

tssm commented Nov 21, 2016

@cloudhead how is called that temporary file? I would like to help debugging this (and hopefully send a pull request). I think @bbatha problem is the same.

@bbatha
Copy link
Author

bbatha commented Nov 21, 2016

I checked my machine, my /tmp dir has several GB free. I also set my vim's tmp dir through backupdir and directory to be a directory in my home folder, which also has a lot of space in it.

@cloudhead
Copy link
Owner

@tssm what makes you think it's the same problem? The temp file name is always different, but you can get an idea by running:

:echom tempname()

in nvim.

@tssm
Copy link

tssm commented Nov 22, 2016

Just a hunch. I don't know if @bbatha has checked :pwd and/or getcwd() but in my case sometimes it seems like the working directory changed (:FuzzyOpen only shows files from src/ because I only opened files from that dir) but in fact it didn't (pwd returns the expected working dir).

@bbatha
Copy link
Author

bbatha commented Nov 22, 2016

I'm actually seeing the same behavior as @tssm my :pwd is still the same but :FuzzyOpen acts like my pwd is in a child-folder, usually the one containing the file I last opened through :FuzzyOpen. It does not happen every time I open a file with :FuzzyOpen though.

@cloudhead
Copy link
Owner

Can you both check if the problem exists with the noroot branch? With vimplug you can do:

Plug 'cloudhead/neovim-fuzzy', { 'branch': 'noroot' }

This branch is reset to an older commit which doesn't base your search path on whether or not you're in a git repo. I suspect that could be what is causing the problem.

@cloudhead
Copy link
Owner

Also I forgot to ask, what is shown in the fuzzy open status bar? The correct search dir or the incorrect one? ie:

FuzzyOpen ~/src/neovim-fuzzy (2 files)

@cloudhead
Copy link
Owner

And finally, is anyone of you using set autochdir in your vim configs?

@tssm
Copy link

tssm commented Nov 23, 2016

@cloudhead just installed the plug-in from the noroot branch, let's see what happens.

FuzzyOpen always show the correct search dir and I don't have autochdir on $MYVIMRC.

@tssm
Copy link

tssm commented Nov 23, 2016

@cloudhead same issue on noroot branch, but this time I realized that the status line is wrong: it says FuzzyOpen (23 files) so no current dir (although :pwd reports the expected dir).

@tssm
Copy link

tssm commented Nov 23, 2016

@cloudhead just realized that the smaller status line is part of the noroot branch.

@cloudhead
Copy link
Owner

In the current master branch, the status bar shows the search root, since the search root is not necessarily your pwd, it could be for instance the git root if you're in a repo.

In the noroot branch, this feature does not exist, and hence the search root is always the pwd, so nothing is shown on the status line.

So from what I understand, the issue you're having is not related to that feature, since you're having it with the noroot branch too. That narrows things down!

@tssm
Copy link

tssm commented Nov 26, 2016

Yep, it occurs on noroot too. It's pretty weird: the plug-in always starts working. I think some usage pattern makes it behave badly. Any other thing that you like s to try?

@tssm
Copy link

tssm commented Nov 28, 2016

@cloudhead I think I found the problem (in both master and noroot): when I do a search using :grep (directly or through a plug-in) the issue appears. Normally I use Grepper for search and if I close the quick fix list Fuzzy behaves normal again. If I use :grep directly I need to restart Neovim. @bbatha can you confirm that this is the problem?

@bbatha
Copy link
Author

bbatha commented Nov 28, 2016

I can't seem to reproduce on either branch any more. I'm wondering if one of my other plugins caused the issue.

Edit: I stand corrected I still see the issue. I did not use grep not any other grepping plugin. I'll keep an eye close eye on potential interference.

Perhaps a hacky solution is to look in a parent dir for a .git or something.

@cloudhead
Copy link
Owner

@tssm great, will see if I can reproduce!

@cloudhead
Copy link
Owner

I haven't been able to reproduce, but I've recently run into another issue, and I'm wondering if there's a chance they are related: it happens when netrw is used, for example by using :E. Looking into this at the moment.

@tssm
Copy link

tssm commented Dec 6, 2016

@cloudhead yeah, I have seen a similar behavior using FileBeagle (a netrw replacement) but seems to be random...

@silenc3r
Copy link

I can reproduce this behavior with vim-signify enabled.

@tssm
Copy link

tssm commented Apr 16, 2017

I think since one of the last commits I haven't experienced this behavior again. At least not that often. Can someone else confirm?

@cloudhead
Copy link
Owner

In a recent patch I fixed an issue when the quickfix list is open, so it might have been the same bug.

@tssm
Copy link

tssm commented Apr 19, 2017

Yeah, that's what I thought when I saw the git log. Anyone else can confirm?

@tssm
Copy link

tssm commented Dec 3, 2017

Playing around trying to fix #24 I realized that the behavior described by me on this issue is indeed related to the quick fix window, which was fixed long ago, so I would close this unless @bbatha and @silenc3r still experience weird behavior

@cloudhead
Copy link
Owner

I'll close this for now.

@smarquez1
Copy link

This recently started happening to me. I red the comments on this issue and found out that it stops happenning when I disable the vim-signify plugin. I checked out the latest changes on said plugin and found a commit that might be related: mhinz/vim-signify@ea6db3c

@IvRRimum
Copy link

IvRRimum commented Jun 2, 2021

This problem is present if you have Plug 'fatih/vim-go' present. If you disable it, then it doesnt change the current folder to target of your search, but the problem is that vim-gois super great problem, which i don't want to sacrifice :(

@cloudhead
Copy link
Owner

I'm guessing that the problem is caused by the use of the lcd command (local change dir). If we found a way to not use that command, the problem should go away.

@cloudhead cloudhead reopened this Jun 2, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants