bling / fzf.el

A front-end for fzf
GNU General Public License v3.0
366 stars 50 forks source link

fzf launches but selecting an item doesn't cause the file to get opened #21

Closed tibbe closed 6 years ago

tibbe commented 7 years ago

I'm using fzf and projectile. Launching the fzf buffer works fine and I can search for files but when I select a file by pressing enter, the fzf buffer closes but nothing else happens. Is there a way to debug the output from the fzf command line or otherwise figure out why it's not working?

oskarkv commented 7 years ago

I had the same issue. I think I solved it. Try it out and see if it solves it for you. Please let me know how it goes. https://github.com/oskarkv/fzf.el/commit/a26314f6757fa268527e3e0c7041152262f02847

AndyMoreland commented 7 years ago

This did not resolve it for me, but thank you for contributing @oskarkv!

oskarkv commented 7 years ago

I guess different versions of fzf, Emacs or the OS make it work differently. In the original version, this version, the output from fzf is read from the buffer before destroying it. And some assumptions are made about where the output comes. For me it did not work, as the output got inserted on the same line as the text I had typed.

There are a few other forks that have a few different solutions, all presumably solving the issue for their authors.

The code is not long, and if you know ELisp you could probably debug it yourself, looking at the forks for ideas.

AndyMoreland commented 7 years ago

Yes, I'll definitely take a look. I didn't mean that thank you sarcastically in case it came across that way. I definitely appreciate it when people post this stuff for the public instead of just saying "fixed it."

oskarkv commented 7 years ago

Don't worry. :)

romanodesouza commented 7 years ago

Definetely is about fzf version. I've just upgraded it and fzf.el stopped to work.

@oskarkv Interesting approach! I don't tried yet, but if I understand, you caught the output sent to stdout instead of the result buffer interaction?

romanodesouza commented 7 years ago

@oskarkv Worked like a charm! Thank you! I recommend open a PR. ping @bling

@AndyMoreland Probably you copied/pasted and didn't pay attention to control character ^M. Type it with Ctrl-v, Ctrl-m and try again. Hope it helps. :)

oskarkv commented 7 years ago

@romanoaugusto88 For me it stopped working all of a sudden. Or, I can type something I know exists, and it will open, but the output while typing looks all messed up. I can't think of any reason why it should have changed at all, so I stopped using it. But glad it works for you! I now use ido-flx and projectile. Not quite as nice, but it has the advantage of finding dotfiles too. I know fzf can be configured, but I don't want to deal with it.

romanodesouza commented 7 years ago

@oskarkv I am interested in to improve the fzf.el experience, but for now I am trying to get the stdout from term-mode, instead of the printed characters. Getting the stdout, if possible, turns unnecessary the post term-mode filter on msg to obtain the selected option. This will guarantee 100% of funcionality, forever, but can't find any help on stackoverflow. If you have some tips, I am here. :)

oskarkv commented 7 years ago

@romanoaugusto88 I don't have a lot of tips. I tried to read the code for term-mode, but it is pretty low-level, so it takes kind of a long time to make sense of anything. But maybe there is an alternative.

tagrudev commented 7 years ago

I had the same problem the buffer is closed upon selection of fzf find, the fork of @romanoaugusto88 worked for me - maybe it's a good idea to add a PR ? Thanks for the awesome work.

romanodesouza commented 7 years ago

I am really trying to get time to work on a PR, but not only for this. I have been working on a small design refactoring to get more from fzf. Hope I will share what I achieved very soon.

codesoverhill commented 7 years ago

Am facing little different problem. fzf buffer opens fine, but selecting a file will open a random file or few files below the selected entry.

romanodesouza commented 6 years ago

FYI this commit has solved this.