Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Vim comes with a script that is supposed to make it behave like an advanced version of less.

As per this blog article, one can use vim as a pager by setting up this alias:

alias lessv='/usr/share/vim/vim71/macros/less.sh'

However, if I do this on windows:

type console.aspx |vim -u "C:\Program Files (x86)\Vim\vim73\macros\less.vim"

Vim just kind of hangs there and does not respond to keystrokes. I have to kill the vim process to get my command line back. Is there a way to make this work on windows?

share|improve this question

You have to create a DOS batch file equivalent of macros\less.sh. The macros\less.vim file is just a set of macros that remap keys to make Vim behave more like less; macros\less.vim has to be read by Vim, not executed by itself.

I don't know enough about batch file programming to give you a complete solution, but this much will handle the case of reading the output of a pipe:

"C:\Program Files\Vim\vim73\vim.exe" --cmd "let no_plugin_maps = 1" -c "runtime! macros/less.vim" -

Put that line into a file named less.bat. You may have to change the path to vim.exe for your installation, or replace it with just vim.exe if vim.exe is in your PATH.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .