Live data from Hacker News

How FZF and ripgrep improved my workflow

medium.com

21–30 of 89 posts

Re: How FZF and ripgrep improved my workflow

#21

Earlier quoted context omitted.

Assuming it's hosted on something like GitHub, you can just as easily download a zip/tarball of the repository instead.

A copy is, so I can grab my bashrc if I need it. However, it’s still impossible to install things on certain systems…

If it's the "too complicated to bother" sort of "impossible" as opposed to "denied by the company security policies", you can always use linuxbrew or nix.

https://docs.brew.sh/Homebrew-on-Linux

https://nixos.org/nix/

Re: How FZF and ripgrep improved my workflow

#22
post #18

Fuzzy down selection (fzf) is the big win. In Emacs that would be Helm of swiper. Instead of local completion (tab tab tab ;) do a global search, and narrow down interactively using fuzzy selection. It's really a different experience, a bit disconcerting at first (tab built into muscle memory), but it quickly becomes a one way change. No way I'd let go of fuzzy selection now. The connection with ripgrep is that fuzzy…

> Instead of local completion (tab tab tab ;) do a global search, and narrow down interactively using fuzzy

It's great. I wouldn't work the old way anymore. The way I use it is wherever I am in emacs I just type the file name, then the matches are listed from all of my working directories, most recently used ones displayed first and I can quickly narrow down by typing any part of the path.

In practice, since I store the last 1000 files in the recent files list, the desired match is usually the first or at least in the top 3, if I work on the same group of files for a while.

Re: How FZF and ripgrep improved my workflow

#23
post #7

I can't really fault both of these tools at all. They have good defaults and are easy to configure and are well documented. Of course they are very performant too, but if you take the time to configuring your wildignore, learn how to use find's and rgrep's flags (maybe script some of this with shell or vimscript if necessary) you can get close to the performance of these tools and define your own usability if needed.…

Not to argue with you as I see where you're coming from (all things being equal I too usually go with the defaults) but the argument about "not having to install and setup additional tools...on lots of different machines" is very weak in these days of: git clone https://gitlab.com/myaccount/mydotfiles followed by an optional: ./deploy_stuff_if_required which for me I have working on any number of linux boxes as well…

Yes that's a good point. I also have a dotfiles repo and I actually go one step further in that most things are organised into Ansible roles, for my laptop locally and for remote machines if necessary. But as the other responses have suggested it's also to include times when using a dotfiles approach isn't possible or desired. Also, not that it's a day job thing for me, but it's handy being more portable across the Unices. I am especially interested in both NetBSD and OpenBSD (and most of my work colleagues develop on macOS). Some "newer" tools might of course be readily available in the base packages or ports but being able to use the defaults in Linux and other Unices is good. Of course there is still the different flag issue due to GNUisms vs everything else but then when you factor in a cloud virtual machine with might be running a different distro to you locally or container images that you may only use interactively, I think it ends up being easier and simpler to learn the defaults rather than having to deal with different package systems or manual compilation. Again this is how I work and is my opinion, nothing against these tools or the people using them.

Re: How FZF and ripgrep improved my workflow

#27
May be of interest:

The author creates small wrappers to kill processes, search files, etc.

The concept could be extended to recognize certain object types. E.g. if you select some files with search then you could choose from a list of operations on files (delete, grep, copy path, etc.)

If you select from processes then after selection you could select from process actions to perform on the selection (killing, sending some other signal, etc.)

So this way you don't implement separate wrappers for every kind of usage, you just create actions for certain object types and connect selections to object types.

This is how Helm works in Emacs, and probably there is a VIM equivalent too.

Re: How FZF and ripgrep improved my workflow

#28

I'm pretty junior at coding but I find FZF great. Ctrl-r for shell history Ctrl-t for file search Especially writing `code` and then ctrl-t, finding the file and then enter to open it in visual studio. Game changer.

Ctrl-t is a game changer, thank you for sharing this, I only knew the notation.

Re: How FZF and ripgrep improved my workflow

#29
post #16

Been using linux for 15 years and I never found any use case for all these fancy grep/ctrl+r/find replacements. Honestly I just feel like the authors of these tools were just too lazy to learn grep/find/cut/tr/bash/awk/etc and decided to implement everything in their own toy program, which always The list of "features" in the article lead me to the same conclusion > no need of googling the right command Yeah right bu…

> I feel like the author just don't understand the unix philosophy. The unix philosophy isn't magically better and faster than other software philosophies

Maybe, but has been used since dozen of years successfully and productively by millions of programmers. It may be worth learning instead of reinventing...

Re: How FZF and ripgrep improved my workflow

#30

I also use fzf as git branch picker :) In my fish_user_key_bindings.fish (but surely adaptable to other shells), I bind it to Alt+G: function fish_user_key_bindings bind \eg 'test -d .git; and git checkout (string trim -- (git branch | fzf)); and commandline -f repaint' bind \eG 'test -d .git; and git checkout (string trim -- (git branch --all | fzf)); and commandline -f repaint' end This goes neatly with fzf's defau…

In Bash/Zsh you can do it with `git config --global alias.cof $'!git for-each-ref --format=\''%\(refname:short\)\'' refs/heads | fzf | xargs git checkout'`

and then do a checkout with `git cof`

Post reply on HN