Wikia

Vim Tips Wiki

Ewfalor/less.bat

Talk0
1,612pages on
this wiki

< User:Ewfalor

Vim ships with a program called less.sh, which makes the UN*X less command use a customized Vim set up to page through your files.

This batch file does the same thing, but for Windows users. This beats the default 'more' command, as it supports scrolling up as well as down, searching, and highlights the syntax if Vim recognizes the filetype.

Put this code into a file called 'less.bat', and add the directory containing less.bat to your %PATH%: Control Panel->System->Advanced->Environment Variables

@echo off
rem Batch file to start Vim with less.vim.
rem Read stdin if no arguments were given.
rem Based upon less.sh from the Vim distribution.
rem Version: 1.0
rem Author:  Erik Falor <ewfalor@gmail.com>

IF !%1==! (vim --cmd "let no_plugin_maps = 1" -c "runtime! macros/less.vim" -) ELSE (vim --cmd "let no_plugin_maps = 1" -c "runtime! macros/less.vim" %*)

Around Wikia's network

Random Wiki