From 7d383d0bb01e8c674b4a3ef691f9a1de9416a691 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20P=C5=82azie=C5=84ski?= Date: Fri, 22 Jul 2016 12:27:43 +0200 Subject: [PATCH] added vim pager --- .zshrc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.zshrc b/.zshrc index 16f9790..ad12246 100644 --- a/.zshrc +++ b/.zshrc @@ -448,6 +448,26 @@ alias su="sudo -u root -i" # disable sudo correction for commands alias sudo="nocorrect sudo" +#---------------------------------- VIM pager -------------------------------- + +vim_pager() { + local source_file; + if [ ! -t 1 ]; then + echo "Cannot use vim pager with non-terminal output" 1>&2 + return 1 + fi + if [ $# -gt 0 ]; then + source_file="$@"; + elif [ ! -t 0 ]; then + source_file="-"; + else + echo "Input stream or file name missing" 1>&2 + return 2 + fi + vim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' $source_file +} +alias vless='vim_pager' + #---------------------------------- Maven ------------------------------------ # Read project information from current directory - needed for prompt