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

set syntax for all windows opened using "open tab" in gvim

Expand Messages
  • rajesh
    Hi vim_dev, I am using gvim to open multiple files. Every time I open a new file using open Tab option under file Menu, It is required to use :set
    Message 1 of 7 , Sep 8, 2009
    • 0 Attachment
      Hi vim_dev, I am using gvim to open multiple files. Every time I open
      a new file using "open Tab" option under file Menu, It is required to
      use ":set syntax=verilog". I wanted this to be made permanent so that
      whenever I open a new windows that syntax should be applied by
      default. Thanks in Adavance -- Siva

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Gary Johnson
      ... Here s one approach. This will set the filetype to verilog if no other filetype has been determined by the time the BufWinEnter event occurs. au
      Message 2 of 7 , Sep 9, 2009
      • 0 Attachment
        On 2009-09-08, rajesh wrote:
        > Hi vim_dev, I am using gvim to open multiple files. Every time I open
        > a new file using "open Tab" option under file Menu, It is required to
        > use ":set syntax=verilog". I wanted this to be made permanent so that
        > whenever I open a new windows that syntax should be applied by
        > default. Thanks in Adavance -- Siva

        Here's one approach. This will set the filetype to "verilog" if no
        other filetype has been determined by the time the BufWinEnter event
        occurs.

        au BufWinEnter * if &ft == "" | set ft=verilog | endif

        This does more that just set the syntax, which I think is better.
        Modify to suit.

        HTH,
        Gary



        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_dev" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • rajesh
        Hi Gary, Great for the reply. But I still see the problem in other aspect. The command u gave me is entered in gvim window in command window. But this is
        Message 3 of 7 , Sep 9, 2009
        • 0 Attachment
          Hi Gary, Great for the reply.
          But I still see the problem in other aspect.
          The command u gave me is entered in gvim window in command window.
          But this is applicable only for all the tabbed files in the current
          gvim console where i typed that command
          But If I open new gvim console and new tabbed file, same problem
          exists.
          Can't I set something in .vimrc file so that it can be applicable for
          all gvim window?

          Thanks in Advance, Siva

          On Sep 9, 7:06 pm, Gary Johnson <garyj...@...> wrote:
          > On 2009-09-08, rajesh wrote:
          > > Hi vim_dev, I am using gvim to open multiple files. Every time I open
          > > a new file using "open Tab" option under file Menu, It is required to
          > > use ":set syntax=verilog". I wanted this to be made permanent so that
          > > whenever I open a new windows that syntax should be applied by
          > > default. Thanks in Adavance -- Siva
          >
          > Here's one approach.  This will set the filetype to "verilog" if no
          > other filetype has been determined by the time the BufWinEnter event
          > occurs.
          >
          >     au BufWinEnter * if &ft == "" | set ft=verilog | endif
          >
          > This does more that just set the syntax, which I think is better.
          > Modify to suit.
          >
          > HTH,
          > Gary
          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_dev" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • John Little
          ... BTW, Gary, the :setfiletype command has the only set if not already set logic in it; so wouldn t au BufWinEnter * setf verilog be simpler? Regards, John
          Message 4 of 7 , Sep 10, 2009
          • 0 Attachment
            >     au BufWinEnter * if &ft == "" | set ft=verilog | endif

            BTW, Gary, the :setfiletype command has the "only set if not already
            set" logic in it; so wouldn't

            au BufWinEnter * setf verilog

            be simpler?

            Regards, John
            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_dev" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          • Gary Johnson
            ... Yes, I intended that you should put that command in your .vimrc file. I m sorry I didn t make that clear. Regards, Gary
            Message 5 of 7 , Sep 10, 2009
            • 0 Attachment
              On 2009-09-09, rajesh wrote:

              > On Sep 9, 7:06 pm, Gary Johnson <garyj...@...> wrote:
              > > On 2009-09-08, rajesh wrote:
              > > > Hi vim_dev, I am using gvim to open multiple files. Every time I open
              > > > a new file using "open Tab" option under file Menu, It is required to
              > > > use ":set syntax=verilog". I wanted this to be made permanent so that
              > > > whenever I open a new windows that syntax should be applied by
              > > > default. Thanks in Adavance -- Siva
              > >
              > > Here's one approach.  This will set the filetype to "verilog" if no
              > > other filetype has been determined by the time the BufWinEnter event
              > > occurs.
              > >
              > >     au BufWinEnter * if &ft == "" | set ft=verilog | endif
              > >
              > > This does more that just set the syntax, which I think is better.
              > > Modify to suit.

              > Hi Gary, Great for the reply.
              > But I still see the problem in other aspect.
              > The command u gave me is entered in gvim window in command window.
              > But this is applicable only for all the tabbed files in the current
              > gvim console where i typed that command
              > But If I open new gvim console and new tabbed file, same problem
              > exists.
              > Can't I set something in .vimrc file so that it can be applicable for
              > all gvim window?

              Yes, I intended that you should put that command in your .vimrc file.
              I'm sorry I didn't make that clear.

              Regards,
              Gary



              --~--~---------~--~----~------------~-------~--~----~
              You received this message from the "vim_dev" maillist.
              For more information, visit http://www.vim.org/maillist.php
              -~----------~----~----~----~------~----~------~--~---
            • Gary Johnson
              ... Good point. I didn t think about that distinction when I wrote that. Thanks. Regards, Gary --~--~---------~--~----~------------~-------~--~----~ You
              Message 6 of 7 , Sep 10, 2009
              • 0 Attachment
                On 2009-09-10, John Little wrote:
                > >     au BufWinEnter * if &ft == "" | set ft=verilog | endif
                >
                > BTW, Gary, the :setfiletype command has the "only set if not already
                > set" logic in it; so wouldn't
                >
                > au BufWinEnter * setf verilog
                >
                > be simpler?

                Good point. I didn't think about that distinction when I wrote
                that. Thanks.

                Regards,
                Gary



                --~--~---------~--~----~------------~-------~--~----~
                You received this message from the "vim_dev" maillist.
                For more information, visit http://www.vim.org/maillist.php
                -~----------~----~----~----~------~----~------~--~---
              • rajesh
                Thanks Gary and John, It works fine ... --~--~---------~--~----~------------~-------~--~----~ You received this message from the vim_dev maillist. For more
                Message 7 of 7 , Sep 10, 2009
                • 0 Attachment
                  Thanks Gary and John, It works fine

                  On Sep 10, 7:23 pm, Gary Johnson <garyj...@...> wrote:
                  > On 2009-09-10, John Little wrote:
                  >
                  > > >     au BufWinEnter * if &ft == "" | set ft=verilog | endif
                  >
                  > > BTW, Gary, the :setfiletype command has the "only set if not already
                  > > set" logic in it; so wouldn't
                  >
                  > >     au BufWinEnter * setf verilog
                  >
                  > > be simpler?
                  >
                  > Good point.  I didn't think about that distinction when I wrote
                  > that.  Thanks.
                  >
                  > Regards,
                  > Gary
                  --~--~---------~--~----~------------~-------~--~----~
                  You received this message from the "vim_dev" maillist.
                  For more information, visit http://www.vim.org/maillist.php
                  -~----------~----~----~----~------~----~------~--~---
                Your message has been successfully submitted and would be delivered to recipients shortly.