Live data from Hacker News

FZF and RipGrep – Navigate with bash faster than ever before

owen.cymru

11–20 of 55 posts

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

#11

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.

Scratched that itch of mine for bash/zsh in 30 lines[0]. kd stands for quicKDir or worKDir depending on the moon.

    kd foobar ~/Workspace/foobar  # define bookmark
    cd ~/some/where
    kd foobar                     # goes to bookmark
    kd foo                        # matches on string prefix, last entry wins
    
    cd ~/Workspace/quuuuuux
    kd qux "$PWD"                 # quick bookmark current dir
    
    touch Gemfile                 # define project root
    cd app/controllers/name/space/whatevs
    kd                            # goes to project root
Turns out autojump doesn't work for me, too many projects in parallel. Since this one is manual, it can be very semantic. Those 30 lines saved me hours on end of tab mashing, especially in Go workspaces.

[0]: https://github.com/lloeki/dotfiles/blob/master/shell/kd

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

#12

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.

I recommend https://github.com/clvv/fasd It basically makes bookmarks automatically as you navigate your filesystem anyway.

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

#13

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.

https://github.com/rupa/z could also be interesting for you.

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

#14
post #4

The second post i read today about fzf. And also again i see ripgrep. I think it is time to make these tools a default in linux distros. Maybe a small you could use ripgrep instead of grep, just before the first use of these tools would be interesting.

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…

The most effective way into “official” Ubuntu is probably via Debian, although there's nothing stopping you from providing your own Ubuntu PPA.

If you want to get a ripgrep package into Debian then you’ll need to do the work to turn the sources into something that Debian can build automatically & find yourself a Debian developer who’ll act as a sponsor for your package and upload it to the Debian archive.

The Debian Mentors mailing list is probably a good place to start, although you could make a sponsor request directly via the bug tracking system if you wanted to:

https://wiki.debian.org/DebianMentorsFaq#How_do_I_get_a_spon...

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

#15
post #10

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…

> Work on adding ripgrep to Linux distros is being tracked here[1] There are multiple interpretations of the GP's comment, each one being a prerequisite of the next: - ripgrep is available in the distro repos - ripgrep is included on the main install medium (first Debian CD, Arch net iso even?) - ripgrep is selected for inclusion on a default install (but grep is still there) - ripgrep replaces grep altogether On fir…

I agree with the multiple possible interpretations. I conservatively chose the most controversial one and responded to that, which should cover all of them. :-)

RE compatibility: yes, something like that. But "change its defaults" is the easy part. I said more here: https://news.ycombinator.com/item?id=15430770

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

#16

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.

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.

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

#18
post #16

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.

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.

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

#19

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.

I use a combination of https://github.com/clvv/fasd and https://github.com/ranger/ranger.

When tasks like navigating into a project, starting tests, local server and neovim become repetitive I usually end up making a tmux script which does everything for me.

Also, aliasing ‘..’ to ‘cd ..’ and such.

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

#20

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.

RipGrep doesn't have some very useful PCRE features.

https://github.com/BurntSushi/ripgrep#why-shouldnt-i-use-rip...

If you use lookarounds (or often use grep -P), RipGrep may not cover all of your needed use cases.

That said, it's very fast for general use.

Post reply on HN