cli – Grey Panthers Savannah https://grey-panther.net Just another WordPress site Tue, 13 Sep 2011 16:14:00 +0000 en-US hourly 1 https://wordpress.org/?v=6.9 206299117 Using less with syntax highlight https://grey-panther.net/2011/09/using-less-with-syntax-highlight.html https://grey-panther.net/2011/09/using-less-with-syntax-highlight.html#respond Tue, 13 Sep 2011 16:14:00 +0000 https://grey-panther.net/?p=53 You can use vim as your pager and obtain two benefits: syntax highlight and access to all the advanced commands (like search). You can do this under ubuntu by adding the following line to your ~/.bashrc:

alias less='/usr/share/vim/vimcurrent/macros/less.sh'

Note:

  • You have to have vim installed (which doesn’t come by default, but it is as simple as sudo apt-get install vim-nox)
  • It supports viewing directly bz2 and gz archives as well as pipe input from stdin (but in that case it fails sometime to highlight)
  • Edit commands (like dd) are disabled, so you can’t accidentally modify the file you are viewing
]]>
https://grey-panther.net/2011/09/using-less-with-syntax-highlight.html/feed 0 53