Tuesday, February 1, 2011

Re: Determining if Vim is running in text-console mode or X Windows

>>> but the strange thing is, if $TERM is set to xterm and not xterm-256color,
>>> gkrellm locks up... something to do with the email part of it.
>>>
>>> If I could just find where xterm is being set and change it to xterm-256color
>>> without altering tty mode's TERM settings (i.e. cons25) I'd be laughing.

Maybe just whack something in .bashrc or .profile like

if [ "$TERM" = xterm ] ; then
export TERM=xterm-256color
fi

?

> I think I like the $WINDOWID version best. It feels ... ??cleaner??. I don't know
> why because, without looking it up, I don't even know what $SHLVL is. I suspect
> it's shell level and if we're running in the first level of the shell, then it's
> likely to be text console given that that's what I first log into. Am I right?

Yep. If you're in bash and start another bash and then echo $SHLVL,
it'll have increased. Maybe also if you source scripts, or start
scripts as executables using shebangs. I can't remember the details. But
you're basically right. It's certainly not all that reliable a thing to
use for this purpose!

Ben.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment