Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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!

share|improve this question

1 Answer 1

up vote 0 down vote accepted

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'
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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