this post was submitted on 16 Aug 2024
604 points (98.1% liked)

Programmer Humor

32400 readers
252 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 9 points 2 months ago (7 children)

I will have to try that, I didn't know that functionality existed, thanks!

[–] [email protected] 18 points 2 months ago (6 children)

Let me tell you that you can also add comments to your terminal commands and use them to search history using fzf. This might sound confusing but basically you do this:

commandwithweirdoptions --option1=value1 --option2=value2 # run the usual thing

Then you press Ctrl+R and type anything like «the thing», it uses fuzzy matching and finds the command in history, with a menu of other similar commands. Press enter, done.

Note that you need to have fzf installed, otherwise there is no fuzzy matching and no menu of matching history results.

[–] [email protected] 11 points 2 months ago (5 children)

Seems to work with [Ctrl]+[R] as well, though of course only with exact matches.

[–] [email protected] 4 points 2 months ago (1 children)

Sure, just as I said, this would work id you don't need menu or fuzzy matching. But I would recommend using fzf history search anyway, it's just too good.

[–] [email protected] 3 points 2 months ago

M-hm, I will try it as well! I was just letting people know the comment trick works regardless, cause that's a nice tip as well!

load more comments (3 replies)
load more comments (3 replies)
load more comments (3 replies)