Live data from Hacker News

FZF and RipGrep – Navigate with bash faster than ever before

owen.cymru

21–30 of 55 posts

Re: FZF and RipGrep – Navigate with bash faster than ever before

#21

I am using ag. Is it worth changing to RipGrep ? The other unix command line tool that I love is autojump. I am thinking on trying fish and probably fzf.

You might find this discussion between the creators of The Silver Searcher and ripgrep useful:

https://news.ycombinator.com/item?id=12567328

Re: FZF and RipGrep – Navigate with bash faster than ever before

#22

I am using ag. Is it worth changing to RipGrep ? The other unix command line tool that I love is autojump. I am thinking on trying fish and probably fzf.

FZF and fish don't play well if I remember correctly (I hope I'm mistaken though.)

Re: FZF and RipGrep – Navigate with bash faster than ever before

#23
post #16

Earlier quoted context omitted.

It isn't super clear in the article, but I now use bfs & fzf for replacing cd. https://github.com/bag-man/dotfiles/blob/master/bashrc#L73 Lets you change directory with alt+c, although I have tweaked it so you always search from your root folder. Which isn't for everyone. Otherwise fzf alt+c doesn't let you go back up directories which gets frustrating.

I've just tried this and in my case it leads to "cd \~[...]" which obviously does not work.

That's strange. Maybe just change it to:

    export FZF_ALT_C_COMMAND="bfs -type d -nohidden"
(and install bfs of course)

It won't let you go back up the tree, but if you are clever you can use `cd -` to jump back to your previous location.

Re: FZF and RipGrep – Navigate with bash faster than ever before

#24
I added ctrl-P bind to open with vim. But if I realize I didn't want to do that and want to cancel then hitting ESC or ctrl-c just drops me into vim with no file. Any ideas on how to change that bind so that I can cancel back to the command line?

Edit: actually it's even worse, it seems like rg keeps running in the background even after I ctrl-c, which if I'm starting in some directory at the top of my directory tree means it runs for a long time.

Edit 2: Looks like the problem in my edit is a known issue with ripgrep: https://github.com/BurntSushi/ripgrep/issues/200

Re: FZF and RipGrep – Navigate with bash faster than ever before

#25

Earlier quoted context omitted.

Hope you don't mind some brief clarifications. Work on adding ripgrep to Linux distros is being tracked here[1]. We've made good progress so far, but AFAIK it's still missing in Ubuntu and Debian. I'm not caught up with what's required to get ripgrep into those repos. With respect to making it a literal default---as in replacing GNU grep---I don't really expect that to ever happen. There is a ton of intersection betw…

Have you set up a Hackernews/Reddit crawler that pings you each time someone mentions "ripgrep"? Seriously, I'd be interested in knowing what solution you use.

HN Search, at the bottom of the page, is very useful for keeping tabs on discussions of topics you care about.

Re: FZF and RipGrep – Navigate with bash faster than ever before

#26

I love the combination of these! Really opens up a world of possibilities. The one command I'm still trying to replace is `cd` itself. For instance, can anyone suggest a way to add bookmarks, so that I can move around faster? I found a few, but was never happy with them.

> The one command I'm still trying to replace is `cd` itself.

zsh will implicitly cd if you just mention a directory e.g. `$ ../foo/bar [RET]` will cd there without mention. These days I only use `cd -`.

Re: FZF and RipGrep – Navigate with bash faster than ever before

#27
post #24

I added ctrl-P bind to open with vim. But if I realize I didn't want to do that and want to cancel then hitting ESC or ctrl-c just drops me into vim with no file. Any ideas on how to change that bind so that I can cancel back to the command line? Edit: actually it's even worse, it seems like rg keeps running in the background even after I ctrl-c, which if I'm starting in some directory at the top of my directory tree…

Sorry, I should update the article with the better solution, it's just a few more lines:

https://github.com/bag-man/dotfiles/blob/master/bashrc#L116-...

Re: FZF and RipGrep – Navigate with bash faster than ever before

#28
post #27
post #24

I added ctrl-P bind to open with vim. But if I realize I didn't want to do that and want to cancel then hitting ESC or ctrl-c just drops me into vim with no file. Any ideas on how to change that bind so that I can cancel back to the command line? Edit: actually it's even worse, it seems like rg keeps running in the background even after I ctrl-c, which if I'm starting in some directory at the top of my directory tree…

Sorry, I should update the article with the better solution, it's just a few more lines: https://github.com/bag-man/dotfiles/blob/master/bashrc#L116-...

Yeah, that worked, thank you!

Re: FZF and RipGrep – Navigate with bash faster than ever before

#29
post #22

I am using ag. Is it worth changing to RipGrep ? The other unix command line tool that I love is autojump. I am thinking on trying fish and probably fzf.

FZF and fish don't play well if I remember correctly (I hope I'm mistaken though.)

I was just looking at fish.

It has a plugin system called fisherman. With plugins fzf, and z - An autojump clone.

https://github.com/fisherman/fzf

https://github.com/fisherman/z

Re: FZF and RipGrep – Navigate with bash faster than ever before

#30

I love the combination of these! Really opens up a world of possibilities. The one command I'm still trying to replace is `cd` itself. For instance, can anyone suggest a way to add bookmarks, so that I can move around faster? I found a few, but was never happy with them.

The $CDPATH variable (built into `cd`)[0] plus the `bash_completion`[1] script to enable tab-completion of CDPATH dirs - works for my use case (FWIW).

[0] http://linuxcommand.org/lc3_man_pages/cdh.html [1] http://www.caliban.org/bash/index.shtml#completion

Post reply on HN