What's in your .bashrc/.zshrc?

mh, good question :thinking: I assume it did not work for a specific situation, then I got used to do it by find (I vaguely remeber that this snippet was part of a bigger solution once).

By looking at my code, I realized another embarassing mistake - it is grep -n of course, not grep -c :confounded: .

Edit:
I tried a little and I think what I did not like about grep -R is that it also give the matching line (with -o only the match). I just simply want a list of occurences with path and line number.
Therefore my new solution is this:

regrep () {
  grep -nR $1 ${2:-"."} | cut -d: -f1 -f2 
}
1 Like

I use this very ugly hack to sync my local .pry_history (ruby repl) with the docker dev container.

function d() {
   docker cp $HOME/.pry_history "$(docker-compose ps -q api)":/app/.pry_history
   docker exec -ti $(docker-compose ps -q api) env TERM=xterm $@
   docker cp "$(docker-compose ps -q api)":/app/.pry_history $HOME/.pry_history
}

Looks bad, has hard coded paths and container names but it works ¯\_(ツ)_/¯

You should give ripgrep a try. :slight_smile:

1 Like

Just added:

PROMPT='%-0d:
$ '

So I can easily see where I am and not have to type pwd all the time:

/Users/Aston:
$ gv
/Users/Aston/projects/code/giveaways:
$ 
1 Like

I like the line break. I print my path before the $ sign but the line gets pretty full when I go too deep.

1 Like

Yeah that’s why I removed the path to begin with as I didn’t like the prompt start point varying. Think this is what I’ll settle on:

PROMPT='
%F{7}%D{%d/%m/%y %H:%M:%S}
%F{8}%-0d
%F{52}$ %F{0}'

1 Like

I have this in my .inputrc. So like Ctrl R but by using up/down arrows.

# Key bindings, up/down arrow searches through history
"\e[A": history-search-backward
"\e[B": history-search-forward
"\eOA": history-search-backward
"\eOB": history-search-forward
1 Like

You might like fzf history search.

2 Likes

That looks very cool - thanks for the link!

1 Like