Skip to main content
added news
Source Link
not2qubit
  • 1.8k
  • 2
  • 21
  • 24

Syntax highlighting of less, works just fine on most *nix systems.

apt install source-highlight
export LESSOPEN="| /usr/share/source-highlight/src-hilite-lesspipe.sh %s"
export LESS=' -R '

On Fedora/RedHat based distros use /usr/bin/src-hilite-lesspipe.sh instead.

Even on Cygwin you can do it with the minor adjustment of the shell script path and installing with apt-cyg instead of apt.

However, using this drastically slows down browsing of large files. I suggest to use alias in such a way to only implement the LESSOPEN export above when needed, like this:

alias lessh='LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s" less -M '

where the -M flag is convenient to also show filename and line number.


 

Also remember to copy the script into your bin path:

cp /usr/share/source-highlight/src-hilite-lesspipe.sh /usr/bin/src-hilite-lesspipe.sh

UPDATE: 2019-07-24

Apparently, on more recent Cygwin installs, you have the following files in your path:

source-highlight.exe
source-highlight-esc.sh
source-highlight-settings.exe

So now you also need to execute the source-highlight-settings.exe that will add the configuration file:
$HOME/.source-highlight/source-highlight.conf.

Syntax highlighting of less, works just fine on most *nix systems.

apt install source-highlight
export LESSOPEN="| /usr/share/source-highlight/src-hilite-lesspipe.sh %s"
export LESS=' -R '

On Fedora/RedHat based distros use /usr/bin/src-hilite-lesspipe.sh instead.

Even on Cygwin you can do it with the minor adjustment of the shell script path and installing with apt-cyg instead of apt.

However, using this drastically slows down browsing of large files. I suggest to use alias in such a way to only implement the LESSOPEN export above when needed, like this:

alias lessh='LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s" less -M '

where the -M flag is convenient to also show filename and line number.


 

Also remember to copy the script into your bin path:

cp /usr/share/source-highlight/src-hilite-lesspipe.sh /usr/bin/src-hilite-lesspipe.sh

Syntax highlighting of less, works just fine on most *nix systems.

apt install source-highlight
export LESSOPEN="| /usr/share/source-highlight/src-hilite-lesspipe.sh %s"
export LESS=' -R '

On Fedora/RedHat based distros use /usr/bin/src-hilite-lesspipe.sh instead.

Even on Cygwin you can do it with the minor adjustment of the shell script path and installing with apt-cyg instead of apt.

However, using this drastically slows down browsing of large files. I suggest to use alias in such a way to only implement the LESSOPEN export above when needed, like this:

alias lessh='LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s" less -M '

where the -M flag is convenient to also show filename and line number.

Also remember to copy the script into your bin path:

cp /usr/share/source-highlight/src-hilite-lesspipe.sh /usr/bin/src-hilite-lesspipe.sh

UPDATE: 2019-07-24

Apparently, on more recent Cygwin installs, you have the following files in your path:

source-highlight.exe
source-highlight-esc.sh
source-highlight-settings.exe

So now you also need to execute the source-highlight-settings.exe that will add the configuration file:
$HOME/.source-highlight/source-highlight.conf.

added 40 characters in body
Source Link
not2qubit
  • 1.8k
  • 2
  • 21
  • 24

Syntax highlighting of less, works just fine on most *nix systems.

apt install source-highlight
export LESSOPEN="| /usr/share/source-highlight/src-hilite-lesspipe.sh %s"
export LESS=' -R '

On Fedora/RedHat based distros use /usr/bin/src-hilite-lesspipe.sh instead.

Even on Cygwin you can do it with the minor adjustment of the shell script path and installing with apt-cygapt-cyg instead of apt.

However, using this drastically slows down browsing of large files. I suggest to use alias in such a way to only implement the LESSOPEN export above when needed, like this:

alias lessh='LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s" less -M '

where the -M flag is convenient to also show filename and line number.


Also remember to copy the script into your bin path:

cp /usr/share/source-highlight/src-hilite-lesspipe.sh /usr/bin/src-hilite-lesspipe.sh

Syntax highlighting of less, works just fine on most *nix systems.

apt install source-highlight
export LESSOPEN="| /usr/share/source-highlight/src-hilite-lesspipe.sh %s"
export LESS=' -R '

On Fedora/RedHat based distros use /usr/bin/src-hilite-lesspipe.sh instead.

Even on Cygwin you can do it with the minor adjustment of the shell script path and installing with apt-cyg instead of apt.

However, using this drastically slows down browsing of large files. I suggest to use alias in such a way to only implement the LESSOPEN export above when needed, like this:

alias lessh='LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s" less -M '

where the -M flag is convenient to also show filename and line number.


Also remember to copy the script into your bin path:

cp /usr/share/source-highlight/src-hilite-lesspipe.sh /usr/bin/src-hilite-lesspipe.sh

Syntax highlighting of less, works just fine on most *nix systems.

apt install source-highlight
export LESSOPEN="| /usr/share/source-highlight/src-hilite-lesspipe.sh %s"
export LESS=' -R '

On Fedora/RedHat based distros use /usr/bin/src-hilite-lesspipe.sh instead.

Even on Cygwin you can do it with the minor adjustment of the shell script path and installing with apt-cyg instead of apt.

However, using this drastically slows down browsing of large files. I suggest to use alias in such a way to only implement the LESSOPEN export above when needed, like this:

alias lessh='LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s" less -M '

where the -M flag is convenient to also show filename and line number.


Also remember to copy the script into your bin path:

cp /usr/share/source-highlight/src-hilite-lesspipe.sh /usr/bin/src-hilite-lesspipe.sh

Syntax highlighting of less, works just fine on most *nix systems. Even on Cygwin you can do it with the minor adjustment of the shell script path and installing with apt-cyg.

apt-cyg install source-highlight
export LESSOPEN="| /usr/binshare/source-highlight/src-hilite-lesspipe.sh %s"
export LESS=' -R '

On Fedora/RedHat based distros use /usr/bin/src-hilite-lesspipe.sh instead.

Even on Cygwin you can do it with the minor adjustment of the shell script path and installing with apt-cyg instead of apt.

However, using this drastically slows down browsing of large files. I suggest to use alias in such a way to only implement the LESSOPEN export above when needed, like this:

alias lessh='LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s" less -M '

where the -M flag is convenient to also show filename and line number.


Also remember to copy the script into your bin path:

cp /usr/share/source-highlight/src-hilite-lesspipe.sh /usr/bin/src-hilite-lesspipe.sh

Syntax highlighting of less, works just fine on most *nix systems. Even on Cygwin you can do it with the minor adjustment of the shell script path and installing with apt-cyg.

apt-cyg install source-highlight
export LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s"
export LESS=' -R '

However, using this drastically slows down browsing of large files. I suggest to use alias in such a way to only implement the LESSOPEN export above when needed, like this:

alias lessh='LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s" less -M '

where the -M flag is convenient to also show filename and line number.


Also remember to copy the script into your bin path:

cp /usr/share/source-highlight/src-hilite-lesspipe.sh /usr/bin/src-hilite-lesspipe.sh

Syntax highlighting of less, works just fine on most *nix systems.

apt install source-highlight
export LESSOPEN="| /usr/share/source-highlight/src-hilite-lesspipe.sh %s"
export LESS=' -R '

On Fedora/RedHat based distros use /usr/bin/src-hilite-lesspipe.sh instead.

Even on Cygwin you can do it with the minor adjustment of the shell script path and installing with apt-cyg instead of apt.

However, using this drastically slows down browsing of large files. I suggest to use alias in such a way to only implement the LESSOPEN export above when needed, like this:

alias lessh='LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s" less -M '

where the -M flag is convenient to also show filename and line number.


Also remember to copy the script into your bin path:

cp /usr/share/source-highlight/src-hilite-lesspipe.sh /usr/bin/src-hilite-lesspipe.sh
added 155 characters in body
Source Link
not2qubit
  • 1.8k
  • 2
  • 21
  • 24
Loading
Source Link
not2qubit
  • 1.8k
  • 2
  • 21
  • 24
Loading