Tuesday, February 1, 2011

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

* 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

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