5 ms·
Show HN: Turn your fzf into a live REPL
- pawelduda 7y agoHello 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!
- tazard 7y agoHey, pretty cool! Thanks for sharing.
- tylorr 7y agoI didn't know about these features, this is awesome. Thanks for sharing. I think you have a small typo at the bottom of the page: Please ____ the repo which will be updated regularly here
- pawelduda 7y agoThank you! Will be fixed in a second.
- CaptainMarvel 7y agoThe 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 7y agoGood point. I am new to this and I just wanted to publish it & go to bed. Will fix it later.
- nlh 7y agoThank you for sharing! I had no idea what fzf was when I read your post at first, so I was confused. Maybe just a quick intro sentence (with a link) to help set some context. Otherwise awesome!
- akkartik 7y agoVery cool. Relevant: https://github.com/akavel/up https://github.com/akavel/up
- nfoz 7y agoThe 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 7y agoAlso: 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.
- pawelduda 7y agoExactly! Then stay tuned for more! I have another article about getting creative with fzf in progress. And another some more ideas that I will not disclose yet because I haven't validated them :)
- eridius 7y agoThis 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.
- colordrops 7y agoAnd many other things besides Ruby scripts
- pawelduda 7y agoMy exact concern with this. For now I can only recommend using it with read-only commands and not pasting anything into it that you do not fully understand. Probably will add some security check to prevent user from running destructive commands at some point.
- akavel 7y ago<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.
- alien1993 7y agoI 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/zshrc#L44-L55 https://github.com/silvanocerza/dotfiles/blob/master/zsh/zsh... [1]: https://github.com/sharkdp/bat https://github.com/sharkdp/bat [2]: https://github.com/ogham/exa https://github.com/ogham/exa
- scriptdevil 7y agoThis is really cool. I didn't realize --preview could take something as complex as this.
- yankcrime 7y agoThe fzf.vim[0] plugin offers similar capability in vim to give you this: https://asciinema.org/a/171913 https://asciinema.org/a/171913 [0]: https://github.com/junegunn/fzf.vim https://github.com/junegunn/fzf.vim
- invsblduck 7y agoNice 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 7y agoIt'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 7y agoYou'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...
- spraak 7y agoTangentially 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.
- nickjj 7y agoIn 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 7y agoThis is also true with ag and :Ag
- deleted 7y ago[deleted]