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!
Written by Adrian Artiles
Related protips
2 Responses
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
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#