Quantcast
Channel: A Technologists Corner
Viewing all articles
Browse latest Browse all 8

Less with VIM syntax highlighting

$
0
0

This is awesome! I’ve started using VIM instead of less when working in the command line to view files so I can have my normal syntax highlighting available, but now I don’t have to, or more correctly I’m still using VIM but setup to emulate the less functionality with VIM syntax highlighting.

If you run a search on your Linux box for ‘less.sh’ you should find it living in you vim install

find /usr/share/vim -name 'less.sh'

To use this just add it to the end of your .bashrc file and restart or just source it again and you’re off to the races.

# Enable less.sh script that is provided by VIM install to be used instead of less.
# This will enable syntax hightlighting in less.

VLESS=$(find /usr/share/vim -name 'less.sh')
if [ ! -z $VLESS ]; then
  alias less=$VLESS
fi

And to source it just run

source .bashrc
from the terminal command line

Viewing all articles
Browse latest Browse all 8

Latest Images

Trending Articles





Latest Images