I use Vim to edit the output of shell commands all the time. Appending the dash in this line is second nature:$ ./some-command | vim -But every once in a while I get distracted and forget:$ ./some-command | vimThis typically causes Vim to hang, pegs one core at 100% CPU, and may disrupt the terminal. Is there a way to fool-proof Vim for me?
How to prevent accidentally piping text to Vim?
terminal;linux;bash
As @chicks pointed out, you can place this script in your PATH:#!/usr/bin/env bashif [[ $# -ne 0 ]] || [[ -t 0 ]]; then    exec vim $@else    exec vim -fiI am using a variant of this script in ~/bin/e to open the current directory (vim .) when no argument is provided.I guess you could also use a shell function:v() { if [[ $# -ne 0 ]] || [[ -t 0 ]]; then vim $@; else vim -; fi; } 