[vim/vim] vim does not handle STDIN set to /dev/null (#982)

39 views
Skip to first unread message

Aaron Peschel

unread,
Aug 15, 2016, 4:27:55 PM8/15/16
to vim/vim

As described in this StackOverflow question:

http://superuser.com/questions/336016/invoking-vi-through-find-xargs-breaks-my-terminal-why

This is a common case when piping find to xargs with vim as the command, eg

find . -type f | xargs vim

Running this chain breaks the tty interaction in vim, and breaks the shell tty upon exit from vim.

A workaround is to run stty sane upon exit from vim, but the tty still has issues while using vim. One annoying example is the backspace button not actually deleting, but inserting a backspace character.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, .

Aaron Peschel

unread,
Aug 15, 2016, 4:35:29 PM8/15/16
to vim/vim

I have also discovered the -o flag will reopen STDIN with xargs, which also fixes the issue.

sebma

unread,
Oct 2, 2020, 1:37:31 PM10/2/20
to vim/vim, Subscribed

I have also discovered the -o flag will reopen STDIN with xargs, which also fixes the issue.

find . -type f -print0 | xargs -o -0 vim

@apeschel Hi xargs -o is not a GNU xargs option but a BSD xargs option.
Any workaround for Linux ?


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or unsubscribe.

Gary Johnson

unread,
Oct 2, 2020, 3:45:45 PM10/2/20
to reply+ACY5DGB7ACHMXEX2VI...@reply.github.com, vim...@googlegroups.com
On 2020-10-02, sebma wrote:
> I have also discovered the -o flag will reopen STDIN with xargs, which also
> fixes the issue.
>
> find . -type f -print0 | xargs -o -0 vim
>
> @apeschel Hi xargs -o is not a GNU xargs option but a BSD xargs option.
> Any workaround for Linux ?

I use GNU parallel instead of xargs for this. For example:

find -type f | parallel --tty -X vim

Ubuntu has a package for parallel. You can also find it here:

https://www.gnu.org/software/parallel/

Regards,
Gary

vim-dev ML

unread,
Oct 2, 2020, 3:46:04 PM10/2/20
to vim/vim, vim-dev ML, Your activity


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or unsubscribe.

sebma

unread,
Oct 2, 2020, 8:02:07 PM10/2/20
to vim/vim, vim-dev ML, Mention

@vim-ml I just found this command thanks to james-mcguigan's answer on superuser :
find ..... | xargs sh -c 'vim </dev/tty "$@"' whatever
With that command you don't need to install parallel on the machine anymore 😄


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

Christian Brabandt

unread,
Oct 6, 2020, 7:33:57 AM10/6/20
to vim/vim, vim-dev ML, Mention

@apeschel Hi xargs -o is not a GNU xargs option but a BSD xargs option.

FWIW: This has been added to GNU xargs as of https://git.savannah.gnu.org/cgit/findutils.git/commit/?id=40cd25147 (2017)

So any recent linux distribution should have it.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

sebma

unread,
Oct 8, 2020, 8:42:04 AM10/8/20
to vim/vim, vim-dev ML, Mention

@apeschel Hi xargs -o is not a GNU xargs option but a BSD xargs option.

FWIW: This has been added to GNU xargs as of https://git.savannah.gnu.org/cgit/findutils.git/commit/?id=40cd25147 (2017)

So any recent linux distribution should have it.

My findutils package is my Linux distrib is from 2016.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

Tony Mechelynck

unread,
Oct 8, 2020, 8:58:39 AM10/8/20
to vim/vim, vim-dev ML, Mention

2016? Four years ago? Don't you think it might perhaps be time to think, just think, of getting ready for, I don't know, an upgrade?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

Christian Brabandt

unread,
Oct 8, 2020, 9:14:20 AM10/8/20
to vim/vim, vim-dev ML, Mention

well Ubuntu 14.04 LTS is still maintained until around 2022 and I remember having to work with an older Cent OS release that was still available.

Anyhow, I am currently tending to close this issue, as this thread has shown various ways to prevent or work around closing of stdin.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

sebma

unread,
Oct 8, 2020, 10:26:46 AM10/8/20
to vim/vim, vim-dev ML, Mention

@chrisbra Ubuntu 16.04 LTS has findutils version 4.6.0+git+20160126-2


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

Christian Brabandt

unread,
Oct 9, 2020, 4:44:51 AM10/9/20
to vim/vim, vim-dev ML, Mention

Closed #982.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

Reply all
Reply to author
Forward
0 new messages