Loading ...
Sorry, an error occurred while loading the content.

Re: determining if gui or console is running from plugin?

Expand Messages
  • Tony Mechelynck
    ... Yes, there are in fact two possible answers, corresponding to two different questions: - The Subject of this thread: How can I know if Vim is running as a
    Message 1 of 3 , Jan 1, 2011
    • 0 Attachment
      On 26/12/10 23:33, Christian J. Robinson wrote:
      > On Sun, 26 Dec 2010, Britton Kerin wrote:
      >
      >> Is there a good way to detect if you have a gui version or console?
      >
      > This query should have been sent to the vim_use@... list.
      >
      > But the answer is yes, see the second example at the top of ":help
      > feature-list".
      >
      > - Christian
      >

      Yes, there are in fact two possible answers, corresponding to two
      different questions:

      - The Subject of this thread: How can I know if Vim is running as a GUI
      or in the console?

      if has('gui_running')
      " running as gvim
      else
      " running in some console terminal
      endif

      - The question at the top of the OP's body text: How can I know if this
      Vim instance supports GUI mode?

      if has('gui')
      " this version of Vim can be run as gvim
      else
      " it cannot
      endif

      Under Windows, both are equivalent (GUI mode and Console mode require
      different executables) but not on Unix-like systems (where a GUI-enabled
      executable can also run in Console mode).


      Best regards,
      Tony.
      --
      Everything should be built top-down, except the first time.

      --
      You received this message from the "vim_dev" 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
    Your message has been successfully submitted and would be delivered to recipients shortly.