Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to check if a shell is running inside mintty #867

Closed
iamFIREcracker opened this issue Apr 16, 2019 · 3 comments

Comments

@iamFIREcracker
Copy link

@iamFIREcracker iamFIREcracker commented Apr 16, 2019

Is there a way to check if a shell is running inside mintty?

Probably changing TERM to something different from xterm is not ideal, but what about setting a new environment variable instead (eg. MINTTY)?

With this, users could for example add the following to their .vimrc and conditionally change cursor shape based on the containing terminal:

if exists('$MINTTY')
    let &t_ti.="\e[1 q"
    let &t_SI.="\e[5 q"
    let &t_EI.="\e[1 q"
    let &t_te.="\e[0 q"
endif
@avih

This comment has been minimized.

Copy link
Contributor

@avih avih commented Apr 16, 2019

No, but you can configure mintty to use some other TERM value, and in your ~/.bashrc check if it's mintty, and if yes replace it to the xterm value and export some other variable which you can later check in vim.

e.g. configure mintty to use TERM=MINTTY, then in your bashrc add:

if [ "$TERM" = "MINTTY" ]; then
    export TERM=xterm-256color
    export INSIDE_MINTTY=1
fi
@mintty

This comment has been minimized.

Copy link
Owner

@mintty mintty commented Apr 17, 2019

setting a new environment variable

This has also been discussed already, see #776. In that issue you'll also see how the terminal type can be detected. I will summarize a complete guide and add it to the wiki.

mintty added a commit to mintty/utils that referenced this issue May 3, 2019
mintty added a commit that referenced this issue May 17, 2019
Offer terminal types vt420, vt525; also xterm-direct, mintty, mintty-direct if installed (~#866, ~#867).
Describe VT52 support.
@mintty

This comment has been minimized.

Copy link
Owner

@mintty mintty commented May 28, 2019

Released 3.0.1.

@mintty mintty closed this May 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.