Last Updated: February 25, 2016
· sevenadrian

easy read-only vim for a "less" with syntax highlighting!

Often you need to just go through the contents of a file. For that my goto command is less.

But less has a shortcoming, no syntax highlighting!

I decided to find out how to add syntax highlighting, but came across a better solution: read-only vim!

You can open vim in read only mode with vim -R yourFile.rb, but there is an awesome shortcut for this;

view yourFile.rb

That's it!

Now you can open files to read with syntax highlighting and all your favorite movement shortcuts with an easy-to-remember 4 letter command!

2 Responses
Add your response


That would be really handy if view supported piping: cat some_file.rb | view doesn't seem to work very well for me. any way around that?

over 1 year ago ·
cat some_file.rb | view -

will work

over 1 year ago ·