vim icon indicating copy to clipboard operation
vim copied to clipboard

How to avoid vim set terminal to raw mode when stdin is /dev/null?

Open user202729 opened this issue 1 year ago • 3 comments

Instructions: Replace the template text and remove irrelevant text (including this line)

Is your feature request about something that is currently impossible or hard to do? Please describe the problem.

Currently vimtex uses vim -v --not-a-term -T dumb -c … to invoke some function as needed. This is invoked inside zathura.

However, if you run in bash

command vim -v --not-a-term -T dumb -c "quitall!" < /dev/null  # mess the terminal up

(the terminal is set to raw mode or something.)

Apparently when both stdin and stderr are redirected to /dev/null then it's fine.

command vim -v --not-a-term -T dumb -c "quitall!" < /dev/null 2> /dev/null  # okay
command vim -v --not-a-term -T dumb -c "quitall!"   2> /dev/null  # okay

Describe the solution you'd like Vim should return the terminal to normal on exit, or otherwise it should not put the terminal to raw mode in the first place.

Related: https://github.com/vim/vim/issues/3313

user202729 avatar Oct 18 '24 04:10 user202729

(the terminal is set to raw mode or something.)

What does that mean exactly?

chrisbra avatar Oct 18 '24 12:10 chrisbra

Means when I type subsequent bash commands, nothing appears (if I type reset then press enter then things are fixed but I don't see the reset itself.)

user202729 avatar Oct 18 '24 16:10 user202729

hm, strange. And why are you redirecting stdin? Why not echo | command vim -v --not-a-term -T dumb -c "quitall!"

chrisbra avatar Oct 18 '24 18:10 chrisbra

It wasn't exactly something I control, zathura is spawned by vimtex with stdin closed (I think).

user202729 avatar Nov 10 '24 11:11 user202729