Syntax highlighting with less.

18 02 2010

Hey there again people,

I’m always using `cat` to check lines of code within scripts, and find it incredibly frustrating that it has no syntax highlighting functionality. Vim, however, has amazing highlighting. I have found a vim macro which basically causes it to act pretty much identically to `less`. Here’s how to use it…

vim -u /usr/share/vim/{vim version}/macros/less.vim {filename}

This, on it’s own is a monstrous command, and a bit of a nightmare to type, but if you put this as an alias to vless in /etc/profile, or ~/.bash_profile, then all you’ll have to type is vless when you want to access it! It’s by no means perfect, but it makes searching through pages and pages of code a lot easier.

There ya go! Two posts in one day! Productive!

See ya!





Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: