From 2a1e8442564a1b7e313f0f2b1eb33bd78c647c00 Mon Sep 17 00:00:00 2001 From: Joshua Li Date: Wed, 29 Mar 2023 19:15:27 -0700 Subject: [PATCH] Read from stdin and write to stdout --- vims | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vims b/vims index 9f02898..18260a1 100755 --- a/vims +++ b/vims @@ -80,14 +80,14 @@ while :; do done # Headless vim which exits after printing all lines -# Taken from Csaba Hoch: -# https://groups.google.com/forum/#!msg/vim_use/NfqbCdUkDb4/Ir0faiNaFZwJ if [ "$PRINT_ALL" -eq "1" ]; then - set -- "$@" -c ":%p" + set -- "$@" -c "%w! /dev/stdout | q!" +else + set -- "$@" -c "q!" fi if [ "$DISABLE_VIMRC" -eq "1" ]; then set -- -u NONE "$@" fi # Finally, we execute the stored array of vim commands: -vim - -nes "$@" -c ':q!' | tail -n +2 +vim -nes "$@" /dev/stdin