Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A complementary tip for Ctr+R is to tag long reusable commands with a comment in the end, e.g.,

find . -name "*.png" -print0 | xargs -0 -P8 pngquant --ext .png --force 256 #optimizepng

(if you’re using zsh, you have to enable INTERACTIVE_COMMENTS option first; just run set -k)



Cool tip, did not know that, though I prefer to put long reusable commands in script files, in part so I can comment them to better remember what everything is doing.


Thanks! I didn't know about INTERACTIVE_COMMENTS.

Adding a comment there is a neat trick. It also works with bang searches (!?), almost like creating a temporary ad-hoc alias:

    find . -name "*.png" -print0 | xargs -0 -P8 pngquant --ext .png --force 256 #optimizepng
    ... many other commands, time passes ...
    !?optimizepng




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: