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

vim/gvim distinction in .vimrc

Expand Messages
  • Matthias Langer
    Normally i use gvim with a white background. But sometimes, when i just want to do some small modifications to a file i prefer to use vim from a gnome-terminal
    Message 1 of 6 , Jan 31, 2006
      Normally i use gvim with a white background. But sometimes, when i just
      want to do some small modifications to a file i prefer to use vim from a
      gnome-terminal with a dark background. Thus, i have to
      ':set bg=dark' before start editing. Now i'm woundering if there isn't a
      way to tell vim to use bg=dark only for vim but not for gvim, propably
      in my .vimrc.

      Thanks,
      Matthias
    • Gerald Lai
      ... Place in vimrc: if !has( gui_running ) set bg=dark endif See :help has . Hope this helps. -- Gerald
      Message 2 of 6 , Jan 31, 2006
        On Wed, 1 Feb 2006, Matthias Langer wrote:

        > Normally i use gvim with a white background. But sometimes, when i just
        > want to do some small modifications to a file i prefer to use vim from a
        > gnome-terminal with a dark background. Thus, i have to
        > ':set bg=dark' before start editing. Now i'm woundering if there isn't a
        > way to tell vim to use bg=dark only for vim but not for gvim, propably
        > in my .vimrc.

        Place in vimrc:

        if !has("gui_running")
        set bg=dark
        endif

        See ":help has". Hope this helps.
        --
        Gerald
      • A. J. Mechelynck
        ... Normally it should do this by default (check it in vim, or maybe by loading vim as vim -N -u NONE ). If it doesn t: if !has( gui_running ) set bg=dark
        Message 3 of 6 , Jan 31, 2006
          Matthias Langer wrote:
          > Normally i use gvim with a white background. But sometimes, when i just
          > want to do some small modifications to a file i prefer to use vim from a
          > gnome-terminal with a dark background. Thus, i have to
          > ':set bg=dark' before start editing. Now i'm woundering if there isn't a
          > way to tell vim to use bg=dark only for vim but not for gvim, propably
          > in my .vimrc.
          >
          > Thanks,
          > Matthias
          >
          >
          >
          >

          Normally it should do this by default (check it in vim, or maybe by
          loading vim as "vim -N -u NONE"). If it doesn't:

          if !has("gui_running")
          set bg=dark
          endif


          see under ":help feature-list":

          gui_running Vim is running in the GUI, or it will start soon.



          Best regards,
          Tony.
        • Lasse Pommerenke
          ... vim reads .vimrc; and gvim will read .gvimrc -- Lasse
          Message 4 of 6 , Jan 31, 2006
            > way to tell vim to use bg=dark only for vim but not for gvim, propably
            > in my .vimrc.

            vim reads .vimrc; and gvim will read .gvimrc

            --
            Lasse
          • A. J. Mechelynck
            ... gvim reads both. You should still bracket it by if !has( gui_running ) in your vimrc to make it not apply to the GUI. Best regards, Tony.
            Message 5 of 6 , Feb 1, 2006
              Lasse Pommerenke wrote:
              >> way to tell vim to use bg=dark only for vim but not for gvim, propably
              >> in my .vimrc.
              >
              > vim reads .vimrc; and gvim will read .gvimrc
              >
              > --
              > Lasse

              gvim reads both. You should still bracket it by "if !has('gui_running')"
              in your vimrc to make it not apply to the GUI.


              Best regards,
              Tony.
            • Matthias Langer
              ... Thanks, that works fine :-)
              Message 6 of 6 , Feb 1, 2006
                On Tue, 2006-01-31 at 18:55 -0800, Gerald Lai wrote:
                > On Wed, 1 Feb 2006, Matthias Langer wrote:
                >
                > > Normally i use gvim with a white background. But sometimes, when i just
                > > want to do some small modifications to a file i prefer to use vim from a
                > > gnome-terminal with a dark background. Thus, i have to
                > > ':set bg=dark' before start editing. Now i'm woundering if there isn't a
                > > way to tell vim to use bg=dark only for vim but not for gvim, propably
                > > in my .vimrc.
                >
                > Place in vimrc:
                >
                > if !has("gui_running")
                > set bg=dark
                > endif
                >
                Thanks, that works fine :-)
              Your message has been successfully submitted and would be delivered to recipients shortly.
              »
              «