I’ve been looking for a way to use less with syntax highlight and ended up in a page of Ubuntu Tutorials website with a very good tip: Using VIM as a syntax highlighting pager.
All you’ll need is the package vim-full, só, in Debian-like systems, you’ll need to execute:
# aptitude install vim-full
Then, you’ll have to execute:
$ vim -u /usr/share/vim/vim72/macros/less.vim <FILE>
And you have it working!
NOTE: Depending on the version of your VIM, the path to less.vim might be different.
You can make this command simpler by creating an alias and adding it to your .bashrc file:
$ echo "alias vless=\"vim -u /usr/share/vim/vim72/macros/less.vim\"" >> ~/.bashrc
Now the system will need to re-read your .bashrc file, so the changes may be applied:
$ . ~/.bashrc
And after this you can test vless:
$ vless <FILE>