4 added 3 characters in body
source | link

I use GNU source-highlight combined with less -R for this. Add the following lines to your shell's initialization file (~/.bashrc, for example):

cless(){
 LESSOPEN='| source-highlight --failsafe --out-format=escformat=esc256 -o STDOUT -i %s 2>/dev/null ' less -R "$@"
}

That should automatically color source code according to the language used and, if it can't, it will launch less on its input directly.

I use GNU source-highlight combined with less -R for this. Add the following lines to your shell's initialization file (~/.bashrc, for example):

cless(){
 LESSOPEN='| source-highlight --failsafe --out-format=esc -o STDOUT -i %s 2>/dev/null ' less -R "$@"
}

That should automatically color source code according to the language used and, if it can't, it will launch less on its input directly.

I use GNU source-highlight combined with less -R for this. Add the following lines to your shell's initialization file (~/.bashrc, for example):

cless(){
 LESSOPEN='| source-highlight --failsafe --out-format=esc256 -o STDOUT -i %s 2>/dev/null ' less -R "$@"
}

That should automatically color source code according to the language used and, if it can't, it will launch less on its input directly.

3 might as well pass the `-R` directly to `less` so the user can have his own `$LESS` for other preferences.
source | link

I use GNU source-highlight combined with less -R for this. Add the following lines to your shell's initialization file (~/.bashrc, for example):

cless(){
 LESSOPEN='| source-highlight --failsafe --out-format=esc -o STDOUT -i %s 2>/dev/null ' LESS=less -R less "$@"
}

That should automatically color source code according to the language used and, if it can't, it will launch less on its input directly.

I use GNU source-highlight combined with less -R for this. Add the following lines to your shell's initialization file (~/.bashrc, for example):

cless(){
 LESSOPEN='| source-highlight --failsafe --out-format=esc -o STDOUT -i %s 2>/dev/null ' LESS=-R less "$@"
}

That should automatically color source code according to the language used and, if it can't, it will launch less on its input directly.

I use GNU source-highlight combined with less -R for this. Add the following lines to your shell's initialization file (~/.bashrc, for example):

cless(){
 LESSOPEN='| source-highlight --failsafe --out-format=esc -o STDOUT -i %s 2>/dev/null ' less -R "$@"
}

That should automatically color source code according to the language used and, if it can't, it will launch less on its input directly.

2 deleted 60 characters in body
source | link

I use GNU source-highlight combined with less -R for this. Add the following lines to your shell's initialization file (~/.bashrc, for example):

cless(){
 for fn in "$@"; do 
 LESSOPEN='| source-highlight --failsafe --out-format=esc -o STDOUT -i "$fn" %s 2>/dev/null | 
    /usr/bin/less' LESS=-R || /usr/bin/less -R "$fn"; done"$@"
}

That should automatically color source code according to the language used and, if it can't, it will launch less on its input directly.

I use GNU source-highlight combined with less -R for this. Add the following lines to your shell's initialization file (~/.bashrc, for example):

cless(){
 for fn in "$@"; do 
  source-highlight --failsafe --out-format=esc -o STDOUT -i "$fn"  2>/dev/null | 
    /usr/bin/less -R || /usr/bin/less -R "$fn"; done
}

That should automatically color source code according to the language used and, if it can't, it will launch less on its input directly.

I use GNU source-highlight combined with less -R for this. Add the following lines to your shell's initialization file (~/.bashrc, for example):

cless(){
 LESSOPEN='| source-highlight --failsafe --out-format=esc -o STDOUT -i %s 2>/dev/null ' LESS=-R less "$@"
}

That should automatically color source code according to the language used and, if it can't, it will launch less on its input directly.

1
source | link