I tried vim/less.sh
as pager with syntax highlighting, but there is a little issue:
when displaying small file, vim uses 'full screen' and waits for a command from user.
Can I let vim to act like a less --quit-at-eof
?
In other words, is there a way to automatically quit vim if displayed file is several lines length?
I found one solution with a shell script: count file lines by wc -l
, then get terminal height, if size is small - use custom vim config file, where custom config file ending with :quit
string.
However, this solution looks terrible and leave extra lines with ~
after end of small file, so I'm looking for better way to do this.