shellex icon indicating copy to clipboard operation
shellex copied to clipboard

fzf command history integration

Open eyalev opened this issue 7 years ago • 6 comments

fzf (https://github.com/junegunn/fzf) enables fuzzy-searching the command history (among other things).

When I'm in a regular shell I can hit Ctrl+R and filter with fuzzy-search through previous commands.

Is there a way to achieve this is shellex?

Thanks

eyalev avatar Oct 09 '17 10:10 eyalev

Hi, since shellex just runs a zsh, and fzf lists zsh as supported shells, I claim fzf should just work out of the box in shellex. You'd only need to create a config file like ${HOME}/.shellex/99-fzf which contains what you'd put in your ${HOME}/.zshrc to use fzf in zsh. I'll give it a try in the next days. Cheers.

pseyfert avatar Oct 09 '17 11:10 pseyfert

following what fzf does in the installation, I added

export PATH="$PATH:/home/pseyfert/coding/fzf/bin"
source /home/pseyfert/coding/fzf/shell/key-bindings.zsh

to ~/.shellex/99-fzf. fzf mostly works, the problem is that the resizing of shellex doesn't let you see the search results, so that's kind of useless.

As a hack one could prevent shrinking of the window in urxvt/shellex.in in on_line_update, or at least shrinking to less than 20 lines, but then you have the large shellex, even after you picked your match and want to edit the line further. It should be possible to do better…

pseyfert avatar Oct 09 '17 16:10 pseyfert

Thanks for your efforts!

I guess I could work with fixed-lines-height.


Related question:

When I'm running shellex from my current terminal it works as you described. But when I'm running from 'Alt-F2` (command launcher on Ubuntu) I get:

fzf-history-widget:4: command not found: fzf

Anyway to fix this?

eyalev avatar Oct 09 '17 17:10 eyalev

I also had that first, do you have your equivalent of the line

export PATH="$PATH:/home/pseyfert/coding/fzf/bin"

right?

Also, assuming you already have fzf installed for your regular shell, I assume you ran the install script in fzf at some point. Do you have a fzf/bin/fzf executable? In my case - not to mess with my standard shell - I ran ./install --no-bash --no-zsh --no-fish, such that the executable is prepared but no rc file manipulated.

pseyfert avatar Oct 09 '17 17:10 pseyfert

Oh, my bad(!) I had a typo in the export line..

Thanks again

eyalev avatar Oct 09 '17 17:10 eyalev

In my case, the problem was that I cloned the repository, but did not compile the fzf binary file. Go to your fzf installation path, and run ./install:

$ cd $FZF_BASE && ./install

Hope it helps!

kolypto avatar Mar 31 '19 00:03 kolypto