How to Detect that Current (Bash) Shell is a (Vi/Vim) Subshell?
- by Jeet
From inside Vi/Vim, I can type:
:shell
to drop into a shell.
Is there any way to detect that I am in a Vi-spawned subshell?
The environmental variable SHLVL is 2, but that does not tell me explicitly that I am in a Vi/Vim-spawned subshell.
On OS X, the following variables are also set: MYVIMRC, VIMRUNTIME, VIM.
How universal are these? Can I count on these being set in any system, if and only if I am in a Vi/Vim subshell?
If not, is there any portable, robust and hopefully efficient way to tell that I am in a Vi/Vim subshell?
Thanks.