User Tools

Site Tools


linux:less-syntax-highlight

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
linux:less-syntax-highlight [2022/01/20 15:20] – created Wulf Rajeklinux:less-syntax-highlight [2023/05/29 11:55] (current) – external edit 127.0.0.1
Line 8: Line 8:
 # Setup: "apt-get install highlight" # Setup: "apt-get install highlight"
  
-# Pipe Highlight to less +# Pipe Highlight to less (remove --line-numbers option for better copy&pasting) 
-export LESSOPEN="| $(which highlight) %s --out-format xterm256 --line-numbers --quiet --force --style solarized-light"+export LESSOPEN="| $(which highlight) %s --out-format xterm256 --line-numbers --quiet --force --style freya"
 export LESS=" -R" export LESS=" -R"
 +# remove -N and --line-numbers for better copy&pasting. other options can be defined like this:
 alias less='less -m -N -g -i -J --line-numbers --underline-special' alias less='less -m -N -g -i -J --line-numbers --underline-special'
 alias more='less' alias more='less'
  
 # Use "highlight" in place of "cat" # Use "highlight" in place of "cat"
-alias cat="highlight $1 --out-format xterm256 --line-numbers --quiet --force --style solarized-light"+alias cat="highlight $1 --out-format xterm256 --line-numbers --quiet --force --style freya"
  
 # Setup JSON Syntax Highlighting # Setup JSON Syntax Highlighting
Line 23: Line 24:
  
 Source: https://gist.github.com/textarcana/4611277 Source: https://gist.github.com/textarcana/4611277
 +
 +On dark terminal, the following themes work well:
 +bluegreen
 +ekvoli
 +freya
 +moria
 +solarized-light
 +
 +
 +To only allow ansi control characters of text files, add to .bashrc
 +<code>
 +export LESS=" -R"
 +</code>
 +
 +
linux/less-syntax-highlight.1642692014.txt.gz · Last modified: 2023/05/29 11:53 (external edit)