
Show HN: Turn your fzf into a live REPL - pawelduda
https://paweldu.dev/posts/fzf-live-repl/
======
alien1993
I obtain a similar thing by adding this snippet to my .zshrc[0]. Notice I use
bat[1] and exa[2] as alternative to cat and ls.

This is the result:
[https://gfycat.com/brokengiantcockerspaniel](https://gfycat.com/brokengiantcockerspaniel)

[0]:
[https://github.com/silvanocerza/dotfiles/blob/master/zsh/zsh...](https://github.com/silvanocerza/dotfiles/blob/master/zsh/zshrc#L44-L55)

[1]: [https://github.com/sharkdp/bat](https://github.com/sharkdp/bat)

[2]: [https://github.com/ogham/exa](https://github.com/ogham/exa)

~~~
invsblduck
Nice tips!! bat(1) is fantastic, wow. exa(1) seems neat, but the inconsiderate
--and likely deliberate--lack of compatibility with ls(1) flags means I will
never use it any time soon... I have decades' worth of aliases, scripts, and
reflexive muscle-memory using GNU ls, so it's not even close to being worth
the pain of changing.

~~~
dflock
It's not like your going to delete `ls` - you can have both?

I have a `ll` alias which is use for 80% of my "what's in this folder" ls use
- I just changed this alias (and a couple of others) to use exa. I left ls
alone: I didn't alias ls to exa.

It's been a good QoL improvement for me, at ~zero cost.

~~~
invsblduck
You're right. I can do that. I didn't want to risk starting a flame war by
admitting I have twelve main `ls' aliases (twelve unique argv incantations),
and that I keep them portable across platforms. LOL. I started doing this
about 20 yrs ago. Many times, I will inject them with a zsh or keyboard macro,
since I type on a custom keymap on a programmable keyboard. So I didn't want
yet another conditional branch in my configuration management. ;) Not sure
whether "special" or just demented...

------
nfoz
The missing piece I needed to understand this:

> [https://github.com/junegunn/fzf](https://github.com/junegunn/fzf)

> fzf is a general-purpose command-line fuzzy finder.

> It's an interactive Unix filter for command-line that can be used with any
> list; files, command history, processes, hostnames, bookmarks, git commits,
> etc.

~~~
stinos
Also:
[https://github.com/kelleyma49/PSFzf](https://github.com/kelleyma49/PSFzf), 'A
PowerShell wrapper around the fuzzy finder fzf'. I keep on posting this here
because it seems so unknown, yet it's so useful.

Just the fact that fzf turns Ctrl-R into something which is actually usable
(in comparison with the standard implementation like bash has which requires
you to type exact commands from the start). And then all the other goodies
which prevent you from having to type way too much cd/tab strokes. Maybe I
just rely on fuzzy matching too much but since most software I use daily has
it (text editors, IDEs and shells), it's really hard to imagine the amount of
time lost before I had it.

------
akkartik
Very cool. Relevant:
[https://github.com/akavel/up](https://github.com/akavel/up)

~~~
carreau
Yep, which you can kind-of do with : echo '' | fzf --multi --preview='bash -c
{q}' \--preview-window=up:70

~~~
core1024
In fact no need of `: echo '' |` here. Only `: |` is enough.

------
eridius
This looks cool, though running e.g. arbitrary ruby scripts seems kinda
dangerous when it executes on every character instead of only when you ask it
to.

~~~
akavel
<shameless-plug> You may also like to have a look at
[https://github.com/akavel/up](https://github.com/akavel/up) as an
alternative. It now executes the command only after Enter is pressed (though
originally I also went with execution on every keypress). By default it runs
shell commands/pipelines, but you can change the contents of SHELL env.
variable to write raw ruby, awk, or else.

------
pawelduda
Hello HN! I am sorry for the fact that the article is so "raw". I made this
blog literally a week ago, without any prior knowledge or plans. If you have
any feedback on how to make the site more approachable, please let me know!

~~~
CaptainMarvel
The live previews were great, but it took absolutely forever for the command
to get typed out before it moved onto the execution! I might suggest speeding
up the typing, or just skipping it

~~~
pawelduda
Good point. I am new to this and I just wanted to publish it & go to bed. Will
fix it later.

------
nickjj
In a familiar fashion, if you use fzf.vim along with ripgrep you can run :Rg
without any arguments and get a real time filter on finding any text within
your project.

Normally you would run :Rg with a phrase to search for, but leaving it empty
and typing it in live is really useful sometimes.

It's really fast too. On my machine running in WSL, it searches through
hundreds of files and almost a megabyte of text as fast as I can type.

~~~
city41
This is also true with ag and :Ag

------
spraak
Tangentially related, but I've been trying to find a fancy Node/Typescript
(either would be great) REPL. By fancy I mean vim bindings (like `set -o vi`
in bash), color schemes, and terminal based.

