Administrators of Unix-like OS very often
write command scripts to automate the execution of routine tasks using their favorite text editor. From time to time you have to open scripts written once in order to peep at something in them. I do this with less. With the help of the latter, I really liked
to read the colored manuals and I wanted the same while viewing the text in the console (shell script, html document, etc.).
It turned out, everything is extremely simple. In the open source world, there is a
program that accepts text at the entrance, and outputs it at the output, but already highlighted. Just install the
source-highlight package and declare a couple of shell environment variables (bash example):
echo 'export LESSOPEN="| /usr/share/source-highlight/src-hilite-lesspipe.sh %s"' >> ~/.bashrc
echo "export LESS=' -R '" >> ~/.bashrc
See the result .
Another option is to use the vim
macro . At the beginning of writing he kept it in his head, and in the process he forgot. Thank you,
tishka17 , for the reminder! :)