I found many sites saying that vim can be used as a pager like less with syntax highlighting.

So to make it work I added this line to my .bash_aliases file:

alias vless='vim -u /usr/share/vim/vim73/macros/less.vim'

but when I run something like

ps -A | vless 

It gives this output and exits without showing me the output of ps:

Vim: Warning: Input is not from a terminal

Please help!


I found the problem. The above command vim -u /usr/share/vim/vim73/macros/less.vim is not handling input from STDIN correctly. However, opening a file with the above works just fine.

Fortunately the Vim installation provides a shell script less.sh which loads less.vim and handles the case where input is from STDIN correctly. So changing the alias to this works:

alias vless = '/usr/share/vim/vim73/macros/less.sh'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.