I am running OS X. On vim, if you do the :sh command, you can drop to a shell to execute commands. I constantly forget whether I am in this shell or not.
Is there any way to check if I am in the shell coming from vim?
|
feedback
|
|
| |||||||
feedback
|
|
I type | |||||
feedback
|
|
You can look at the command name of the shell's parent process: Furthermore, if you only want to change your prompt in shells that are not running directly inside a terminal emulator, you can test this by checking whether the shell's controlling terminal is the same as its parent process's. If the parent is a terminal emulator, it won't have its own terminal as a controlling terminal. For example, if you put the following lines in your
You may also be interested in some of the discussion on How to know the “level” of shells I am in?. | |||||||||||
feedback
|
|
You could use MacVim (http://code.google.com/p/macvim/). Whether or not your shell came from a vim instance becomes pretty obviously since your shell is in a MacVim window and not a Terminal window. | |||
|
feedback
|