map icon indicating copy to clipboard operation
map copied to clipboard

Vim: Warning: Input is not from a terminal

Open chocolateboy opened this issue 11 years ago • 4 comments

Thanks for map!

I use it for almost everything I used to use xargs/parallel for, apart from passing a list of files to vim, which results in the warning above. The files can be edited OK, but afterwards the screen is unresponsive/mangled (until a reset).

parallel has an option to work around this (--tty), as does xargs on OS X/BSD (-o). Could something similar be implemented in map?

chocolateboy avatar Oct 28 '14 12:10 chocolateboy

As a workaround, I've created a vip command which reattaches vim's stdin to /dev/tty e.g.:

#!/bin/sh
# usage: whatever | map vip
exec vim < /dev/tty "$@"

chocolateboy avatar Nov 29 '14 16:11 chocolateboy

my apologies; I did not see this until now. I generally don't log on to github much.

Anyway, map was not designed to support anything interactive. However, looking at the xargs man page, it seems this would work (and it is essentially the same solution you have): whatever | map -n 1 'vim < /dev/tty'

To make that happen internally, I suspect I would have close STDIN before launching; I'll try it out when I get some time.

sitaramc avatar Aug 25 '15 10:08 sitaramc

my apologies; I did not see this until now. I generally don't log on to github much.

Anyway, map was not designed to support anything interactive. However, looking at the xargs man page, it seems this would work (and it is essentially the same solution you have): whatever | map -n 1 'vim < /dev/tty'

To make that happen internally, I suspect I would have close STDIN before launching; I'll try it out when I get some time.

sitaramc avatar Aug 25 '15 10:08 sitaramc

I've completely rewritten the command, and vim appears to work, but has the same issue (need 'stty sane' after exit). I'll take another look once it has stabilised; will keep this issue open to remind me (but please note I log on to github about once in 6 months, if that!)

sitaramc avatar Nov 17 '15 14:11 sitaramc