Grep to Less that maintain colors
I often use grep
to search for todo's in my code and other people's code and
then pipe them in less
and I missed having colors that grep outputs in less
.
- Grep's
--color=always
use markers to highlight the matching strings. - Less's
-R
option outputs "raw" control characters.
You could use alias grep='grep --color=always'
and alias less='less -R'
or
create todo function in your .bashrc
that accepts first argument as search
string.
# This is where the magic happens.
grep --color=always -rni "TODO:" | less -R
Other notes
- plan9 Drawing Pixels in Plan9
- Parse RSS feeds with Lua
- Easy measure time took in a bash script
- plan9 Run 9front in Qemu
- Cronjobs on Github with Github Actions
- Extending dte editor
- Using ffmpeg to combine videos side by side
- plan9 Fix bootloader not being written in Plan9
- AWS EB PyYAML fix
- Cache busting in Hugo
- Uninstall Ollama from a Linux box
- vim Personal sane Vim defaults
- dcss Dungeon Crawl Stone Soup - New player guide
- c Extend Lua with custom C functions using Clang
- Sane defaults for tmux with more visible statusbar