Is it legal to do :r!vi in vi?A friend asked me to try it and it jammed my terminal. What exactly causes this? Is there anyway to recover the terminal without closing it and opening a new one?
Why does :r!vi jam my terminal?
external command;terminal
If you're looking for why it jams your terminal it's because :r! reads a command from your terminal and inserts it into the buffer. Since it's trying to insert the output of the vi command, it's waiting for vi to finish. But all it does is open another instance of vi, which never returns.Is it legal?Technically, yes. :r! takes a valid shell command and vi is a valid shell command. It's just not advised because of the aforementioned behavior.See :help :r! for more info.