Tuesday, February 1, 2011

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

On 02/02/11 08:24, Marvin Renich wrote:
> * Steve Laurie<mr.steven.laurie@gmail.com> [110201 09:17]:
>> Hi Marvin,
>>
>> On my system, "gui_running" only distinguishes between Vim and gvim.
>>
>> I put let my_has_gui_running = has("gui_running") early in my
>> ~/.vimrc file and did :echo my_has_gui_running
>>
>> In Vim run from the black and white tty text console, I get 0;
>> In Vim run insde of gnome-terminal, I also get 0;
>> In gvim, I get a 1
>>
>> That's why it's not working. I'm trying to distinguish between tty
>> text mode and X mode.
>> Not between Vim and gvim.
>>
>> Regards,
>> Steve
> Ah, you want to distinguish between running in a terminal on a text
> console and running in a terminal emulator under X. Does this do what
> you want?
>
> if $DISPLAY == ""
> let is_x_terminal = 0
> else
> let is_x_terminal = 1
> endif
>
> ...Marvin
>
Thanks for your help Marvin.

Both in text console and in gnome-terminal, :echo $DISPLAY returns 0
(int, not a string) - still no difference between tty text mode and
terminal emulator.

I have had some success using:

if &term=~'cons25'
colorscheme myvim
elseif &term=~'xterm'
set t_Co=256
colorscheme calmar256-dark
endif

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.

Thx,
Steve

--
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