5 ms·
I wonder if having the search use context like cwd is a win in practice or not. I’ll have to try this out to see. I’ve been using `history | grep` since forev
by gumby 3y ago
I wonder if having the search use context like cwd is a win in practice or not. I’ll have to try this out to see.
I’ve been using `history | grep` since forever (usually `history | grep foo | tail -n 5` which has been a single-character alias for more than 30 years). Hard to beat. Since history gives you the line number you can just `!12345` — no need to copy/paste, and works through an ssh connection!
- TacticalCoder 3y ago> I’ve been using `history | grep` since forever... which has been a single-character alias for more than 30 years... I have "history | grep" basically aliased to "h?"
- IggleSniggle 3y agoOk? Sounds like the person you're replying to said they did too? Why are we ending our statements in question marks.
- oops 3y agoMy understanding is that the question mark is part of the alias name.
- IggleSniggle 3y agoOh that makes sense. I never am completely sure how to deal with the interaction of quote marks at the intersection of code and English
- TacticalCoder 3y agoYup: that's why I put in quotes... I'm literally using "h?" as a Bash alias, as GP said. It may be a bit weird to use a question mark as part of a Bash alias that said: sorry for the confusion!
- urdbjtdvbg 3y agoWhy are we ending our questions with full stops!
- IggleSniggle 3y agoGreat question?
- gumby 3y agoBecause we sheeple kowtow to the periodarchy.. I’ve decided to end sentances with two to try to avoid their ire..
- flohofwoe 3y agoIt definitely is (IME, and YMMV of course). Fish shell and the similar zsh-autosuggestion plugin work with directory context, and it almost always suggests the intended autocompletion (not sure why this McFly thingie needs a neural network for this when a per-directory most-recently-used pattern matcher already works perfectly).
- gumby 3y agoI’m surprised that it is useful because I often want to use the same commands in different directories! But just to be clear: I didn’t at all write “surprised” as some polite euphemism for “this is dumb”. Clearly people have found it useful for a while and it’s harmless easy for me to collect some empirical data, so I just installed it. Might turn out to be a big win.
- Conscat 3y agoIn Fish you can still do that. The cwd is a hint to the candidate sorting algorithm, but not a strict requirement.
- ilaksh 3y agoIf anything is going to beat fish, it's probably something with a neural network. I wonder if it is actually better.
- ktm5j 3y agoJust curious, how do you grep for foo in the middle of an alias like that? I usually use a function for something like this, or are you using alias colloquially?
- hiccuphippo 3y agoProbably a bash function rather than an alias.
- gumby 3y agoYeah, lazy imprecision on my part. A function in my .bashrc .
- ramses0 3y ago$ cat ~/bin/f #!/bin/bash if [ "$1" != "" ] ; then find . -type f | grep -v '\.git' | grep -i "$1" else find . -type f | grep -v '\.git' fi
- oxygen_crisis 3y agoPiping `find` through `grep` like that is inefficient, find has robust filtering capabilities you can use without the overhead of spawning subshells with pipes and calling another binary like grep. find . -type f -not -path '*/.git/*' -name "*$1*"
- ramses0 3y agoHrm... `f foo` vs. `.............................................foo..`
- jsr-p 3y agoI just fzf through history, works like a charm
- epiccoleman 3y agoThis is by far my favorite fzf feature, I barely use all the other (awesome) things it can do, but I probably use the history thing 100 times a day. It's funny because it's replaced some of what I used to do with aliases and shell config - why remember a command when I can just fzf and pull it up effortlessly ;)
- deleted 3y ago[deleted]
- ctur 3y agoI find it very useful. I made a tool similar to mcfly (before knowing it existed) and use this workflow (`--here`) constantly. Also hostname context and shell session can be useful at times, too, to reconstruct something in the past. https://github.com/chipturner/pxhist https://github.com/chipturner/pxhist