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

Re: Syntax highlight not happening on :newtab

Expand Messages
  • Ben Fritz
    ... But, doesn t Vim use the filetype to figure out which syntax file to load? From the help: *:filetype* *:filet* To enable file type detection, use this
    Message 1 of 20 , Jan 31, 2013
    • 0 Attachment
      On Thursday, January 31, 2013 12:01:53 PM UTC-6, Gary Johnson wrote:
      >
      > The "filetype on" command is not needed for "syntax on" to work.
      >

      But, doesn't Vim use the filetype to figure out which syntax file to load?

      From the help:

      *:filetype* *:filet*
      To enable file type detection, use this command in your vimrc: >
      :filetype on
      Each time a new or existing file is edited, Vim will try to recognize the type
      of the file and set the 'filetype' option. This will trigger the FileType
      event, which can be used to set the syntax highlighting, set options, etc.

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

      ---
      You received this message because you are subscribed to the Google Groups "vim_use" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Gary Johnson
      ... Yes, but if filetype detection is not already enabled when syntax on is executed, the syntax system enables it itself. The command syntax on sources
      Message 2 of 20 , Jan 31, 2013
      • 0 Attachment
        On 2013-01-31, Ben Fritz wrote:
        > On Thursday, January 31, 2013 12:01:53 PM UTC-6, Gary Johnson wrote:
        > >
        > > The "filetype on" command is not needed for "syntax on" to work.
        > >
        >
        > But, doesn't Vim use the filetype to figure out which syntax file to load?

        Yes, but if filetype detection is not already enabled when "syntax
        on" is executed, the syntax system enables it itself.

        The command "syntax on" sources the file
        $VIMRUNTIME/syntax/syntax.vim. You can see in that file where
        "filetype on" is executed.

        Regards,
        Gary

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

        ---
        You received this message because you are subscribed to the Google Groups "vim_use" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • naaj_ila
        Hi Gary , Thanks for the reply. By default, when i used which vim . It shows /usr/ /bin/vim . I didnot like taht version of vim . So in my .cshrc
        Message 3 of 20 , Jan 31, 2013
        • 0 Attachment
          Hi Gary ,

          Thanks for the reply.
          By default, when i used "which vim" . It shows "/usr/<comp_name>/bin/vim" .
          I didnot like taht version of vim .
          So in my .cshrc file i used an alias like this

          "alias vim /usr/<comp_name>/pkgs/vim/7.2/bin/vim" . I liked this version.

          Is this effecting anyways?





          --
          View this message in context: http://vim.1045645.n5.nabble.com/VIM-loses-syntax-highlighting-when-using-split-command-tp5713478p5713517.html
          Sent from the Vim - General mailing list archive at Nabble.com.

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

          ---
          You received this message because you are subscribed to the Google Groups "vim_use" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
          For more options, visit https://groups.google.com/groups/opt_out.
        • Christian Brabandt
          ... Possibly. It would help, if you started answering the questions, that have been asked. Try to redo the examples given by Gary in
          Message 4 of 20 , Jan 31, 2013
          • 0 Attachment
            On Fri, February 1, 2013 05:51, naaj_ila wrote:
            > Hi Gary ,
            >
            > Thanks for the reply.
            > By default, when i used "which vim" . It shows "/usr/<comp_name>/bin/vim"
            > .
            > I didnot like taht version of vim .
            > So in my .cshrc file i used an alias like this
            >
            > "alias vim /usr/<comp_name>/pkgs/vim/7.2/bin/vim" . I liked this version.
            >
            > Is this effecting anyways?

            Possibly.

            It would help, if you started answering the questions,
            that have been asked. Try to redo the examples given by Gary in
            <20130131162709.GA1644@phoenix> and show us the result.

            BTW: Where did you get the verilog.vim file from (there should be
            some installation instructions other then drop into your .vim
            directory, this is usually just plain wrong)? And what is wrong
            with the one that is bundled with vim?

            regards,
            Christian

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

            ---
            You received this message because you are subscribed to the Google Groups "vim_use" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
            For more options, visit https://groups.google.com/groups/opt_out.
          • Gary Johnson
            ... I thought of another command that might give us more information than my previous suggestions. Execute the following at your shell prompt. vim -N -u NONE
            Message 5 of 20 , Feb 1, 2013
            • 0 Attachment
              On 2013-02-01, Christian Brabandt wrote:
              > On Fri, February 1, 2013 05:51, naaj_ila wrote:
              > > Hi Gary ,
              > >
              > > Thanks for the reply.
              > > By default, when i used "which vim" . It shows "/usr/<comp_name>/bin/vim"
              > > .
              > > I didnot like taht version of vim .
              > > So in my .cshrc file i used an alias like this
              > >
              > > "alias vim /usr/<comp_name>/pkgs/vim/7.2/bin/vim" . I liked this version.
              > >
              > > Is this effecting anyways?
              >
              > Possibly.
              >
              > It would help, if you started answering the questions,
              > that have been asked. Try to redo the examples given by Gary in
              > <20130131162709.GA1644@phoenix> and show us the result.

              I thought of another command that might give us more information
              than my previous suggestions. Execute the following at your shell
              prompt.

              vim -N -u NONE -i NONE -V9verbose --cmd 'syntax on' file1.v

              Then execute the following within vim.

              :sp file2.v

              Note any syntax highlighting in either window, then execute

              :qa

              There will be a file in the current directory named verbose which
              will contain a record of the autocommands executed and files
              sourced. See ":help 'verbose'" for more on what is in that file.
              Open the file and verify that it doesn't contain any sensitive
              information (it shouldn't). Then attach it to your next reply to
              this list.

              If you saw file2.v properly highlighted, then there is something in
              one of your configuration files that is causing the problem. In
              that case, you could repeat the steps above starting with this
              command,

              vim -V9verbose2 file1.v

              and also attach the file verbose2 to your next reply.

              Regards,
              Gary

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

              ---
              You received this message because you are subscribed to the Google Groups "vim_use" group.
              To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
              For more options, visit https://groups.google.com/groups/opt_out.
            • naaj_ila
              Hi Gary , Its working fine i added these things in ~/.vim/syntax/filetype.vim augroup filetypedetect au! BufRead,BufNewFile *.v so ~/.vim/syntax/verilog.vim
              Message 6 of 20 , Feb 1, 2013
              • 0 Attachment
                Hi Gary ,
                Its working fine
                i added these things in ~/.vim/syntax/filetype.vim

                augroup filetypedetect
                au! BufRead,BufNewFile *.v so ~/.vim/syntax/verilog.vim
                augroup END


                Working fine from now
                -----------------------------------------------------
                I need one more help

                Whenever , i wanted to open VIm in new buffer via (sp and tabnew ) , i need
                to source one command

                :let b:match_words =
                '\<begin\>:\<end\>,'.'\<class\>:\<endclass\>,'.'\<task\>:\<endtask\>,'.'\<case\>:\<endcase\>'

                How can i do that
                I added thsi one in .vimrc. Its working only for one file but not in split
                files







                --
                View this message in context: http://vim.1045645.n5.nabble.com/VIM-loses-syntax-highlighting-when-using-split-command-tp5713478p5713540.html
                Sent from the Vim - General mailing list archive at Nabble.com.

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

                ---
                You received this message because you are subscribed to the Google Groups "vim_use" group.
                To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                For more options, visit https://groups.google.com/groups/opt_out.
              • Gary Johnson
                ... How does putting that in ~/.vim/syntax/filetype.vim help you? That file should be sourced by vim only when you open a file whose file type is filetype.
                Message 7 of 20 , Feb 1, 2013
                • 0 Attachment
                  On 2013-02-01, naaj_ila wrote:
                  > Hi Gary ,
                  > Its working fine
                  > i added these things in ~/.vim/syntax/filetype.vim
                  >
                  > augroup filetypedetect
                  > au! BufRead,BufNewFile *.v so ~/.vim/syntax/verilog.vim
                  > augroup END
                  >
                  >
                  > Working fine from now

                  How does putting that in ~/.vim/syntax/filetype.vim help you? That
                  file should be sourced by vim only when you open a file whose file
                  type is filetype.

                  While your solution may work in this instance, it is not the
                  standard way of doing these things. If your version of vim does not
                  automatically detect verilog files, a proper solution is to put
                  something like this

                  augroup filetypedetect
                  au! BufRead,BufNewFile *.v setfiletype verilog
                  augroup END

                  in ~/.vim/filetype.vim. Vim will then take care of sourcing
                  ~/.vim/syntax/verilog.vim for you if you have "syntax on". It will
                  also source any other verilog plugins such as
                  ~/.vim/ftplugin/verilog.vim if you have an appropriate "filetype on"
                  command in your ~/.vimrc. See

                  :help new-filetype

                  There is nothing wrong with doing things a non-standard way as long
                  as you know what you're doing. If you're not sure what you're
                  doing, or you seem to be having difficulty in getting something to
                  work, it is better to follow the standard methods as you will have
                  fewer problems and it will be easier for others to help you.

                  > -----------------------------------------------------
                  > I need one more help
                  >
                  > Whenever , i wanted to open VIm in new buffer via (sp and tabnew ) , i need
                  > to source one command
                  >
                  > :let b:match_words =
                  > '\<begin\>:\<end\>,'.'\<class\>:\<endclass\>,'.'\<task\>:\<endtask\>,'.'\<case\>:\<endcase\>'
                  >
                  > How can i do that
                  > I added thsi one in .vimrc. Its working only for one file but not in split
                  > files

                  It's not working for any but the first file you open because
                  b:match_words is a buffer-local variable. See

                  :help buffer-variable

                  The setting of b:match_words should be done in a filetype plugin so
                  that it is done for every buffer of that filetype. In this case, it
                  should be put in ~/.vim/ftplugin/verilog.vim or
                  ~/.vim/after/ftplugin/verilog.vim.

                  This is a good example of why your autocommand above should set the
                  filetype to verilog instead of sourcing your syntax file. If you
                  set the filetype properly, things like filetype plugins just work.

                  Regards,
                  Gary

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

                  ---
                  You received this message because you are subscribed to the Google Groups "vim_use" group.
                  To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                  For more options, visit https://groups.google.com/groups/opt_out.
                • Christian Brabandt
                  Hi naaj_ila! ... What was wrong with the answer you received last time? regards, Christian -- Oft tut auch der Unrecht, der nichts tut. Wer das Unrecht nicht
                  Message 8 of 20 , Feb 1, 2013
                  • 0 Attachment
                    Hi naaj_ila!

                    On Fr, 01 Feb 2013, naaj_ila wrote:

                    > Whenever , i wanted to open VIm in new buffer via (sp and tabnew ) , i need
                    > to source one command
                    >
                    > :let b:match_words =
                    > '\<begin\>:\<end\>,'.'\<class\>:\<endclass\>,'.'\<task\>:\<endtask\>,'.'\<case\>:\<endcase\>'
                    >
                    > How can i do that
                    > I added thsi one in .vimrc. Its working only for one file but not in split
                    > files

                    What was wrong with the answer you received last time?

                    regards,
                    Christian
                    --
                    Oft tut auch der Unrecht, der nichts tut. Wer das Unrecht nicht
                    verbietet, wenn er kann, der befiehlt es.
                    -- Mark Aurel (römischer Kaiser, 121-180)

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

                    ---
                    You received this message because you are subscribed to the Google Groups "vim_use" group.
                    To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                    For more options, visit https://groups.google.com/groups/opt_out.
                  • Christian Brabandt
                    Hi naaj_ila! ... This looks totally wrong. ... I am wondering, why do you need this? Vim should automatically detect *.v files as verilog files? Does yours
                    Message 9 of 20 , Feb 1, 2013
                    • 0 Attachment
                      Hi naaj_ila!

                      On Fr, 01 Feb 2013, naaj_ila wrote:

                      > Its working fine
                      > i added these things in ~/.vim/syntax/filetype.vim

                      This looks totally wrong.
                      >
                      > augroup filetypedetect
                      > au! BufRead,BufNewFile *.v so ~/.vim/syntax/verilog.vim
                      > augroup END

                      I am wondering, why do you need this? Vim should automatically detect
                      *.v files as verilog files? Does yours not?

                      Try this: vim -u NONE -N file.v

                      What does Vim tell you, after entering:

                      :filetype detect
                      :set ft?

                      regards,
                      Christian
                      --
                      Lieber Kaker-Laken, als gar keine Bettwäsche.

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

                      ---
                      You received this message because you are subscribed to the Google Groups "vim_use" group.
                      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                      For more options, visit https://groups.google.com/groups/opt_out.
                    • Christian Brabandt
                      Hi alijohnshaik! (redirecting to vim_use) ... Interesting. Your vim does not by default detect verilog files. What vim version is this? To make vim recognize
                      Message 10 of 20 , Feb 3, 2013
                      • 0 Attachment
                        Hi alijohnshaik!
                        (redirecting to vim_use)

                        On Sa, 02 Feb 2013, alijohnshaik@... wrote:

                        > <quote author='Christian Brabandt'>
                        > Hi naaj_ila!
                        >
                        > On Fr, 01 Feb 2013, naaj_ila wrote:
                        >
                        > > Its working fine
                        > > i added these things in ~/.vim/syntax/filetype.vim
                        >
                        > This looks totally wrong.
                        > >
                        > > augroup filetypedetect
                        > > au! BufRead,BufNewFile *.v so ~/.vim/syntax/verilog.vim
                        > > augroup END
                        >
                        > I am wondering, why do you need this? Vim should automatically detect
                        > *.v files as verilog files? Does yours not?
                        >
                        > Try this: vim -u NONE -N file.v
                        >
                        > What does Vim tell you, after entering:
                        >
                        > :filetype detect
                        > :set ft?
                        > --------------------------------------
                        > Its coming like this after executing the command
                        > filetype =
                        > -----------------------------------

                        Interesting. Your vim does not by default detect verilog files. What vim
                        version is this?

                        To make vim recognize .v files as verilog filetypes, put the following
                        into your .vimrc:
                        filetype plugin on

                        Now create a file called ~/.vim/ftdetect/verilog.vim (create
                        non-existing directories) and put in that file:
                        ,----
                        | au BufRead,BufNewFile *.v set filetype=verilog
                        `----

                        and then place your verilog.vim syntax file into
                        ~/.vim/syntax/ (again, creating non-existent directories).
                        (and make sure, your .vimrc contains:
                        :syntax on


                        See also the help at :h new-filetype and have a look at section 26 of
                        the faq http://vimhelp.appspot.com/vim_faq.txt.html

                        regards,
                        Christian
                        --
                        Was kann an der Arbeit gut sein, wenn die Reichen sie den Armen überlassen.

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

                        ---
                        You received this message because you are subscribed to the Google Groups "vim_use" group.
                        To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                        For more options, visit https://groups.google.com/groups/opt_out.
                      • alijaan
                        Thanks Christian Yeah its wroking fine ... -- -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are
                        Message 11 of 20 , Feb 3, 2013
                        • 0 Attachment
                          Thanks Christian 

                          Yeah its wroking fine 


                          On Sun, Feb 3, 2013 at 6:26 PM, Christian Brabandt <cblists@...> wrote:
                          Hi alijohnshaik!
                          (redirecting to vim_use)

                          On Sa, 02 Feb 2013, alijohnshaik@... wrote:

                          > <quote author='Christian Brabandt'>
                          > Hi naaj_ila!
                          >
                          > On Fr, 01 Feb 2013, naaj_ila wrote:
                          >
                          > > Its working fine
                          > > i added these things in ~/.vim/syntax/filetype.vim
                          >
                          > This looks totally wrong.
                          > >
                          > > augroup filetypedetect
                          > > au! BufRead,BufNewFile *.v so ~/.vim/syntax/verilog.vim
                          > > augroup END
                          >
                          > I am wondering, why do you need this? Vim should automatically detect
                          > *.v files as verilog files? Does yours not?
                          >
                          > Try this: vim -u NONE -N file.v
                          >
                          > What does Vim tell you, after entering:
                          >
                          > :filetype detect
                          > :set ft?
                          > --------------------------------------
                          > Its coming like this  after executing the command
                          > filetype =
                          > -----------------------------------

                          Interesting. Your vim does not by default detect verilog files. What vim
                          version is this?

                          To make vim recognize .v files as verilog filetypes, put the following
                          into your .vimrc:
                          filetype plugin on

                          Now create a file called ~/.vim/ftdetect/verilog.vim (create
                          non-existing directories) and put in that file:
                          ,----
                          | au BufRead,BufNewFile *.v set filetype=verilog
                          `----

                          and then place your verilog.vim syntax file into
                          ~/.vim/syntax/ (again, creating non-existent directories).
                          (and make sure, your .vimrc contains:
                          :syntax on


                          See also the help at :h new-filetype and have a look at section 26 of
                          the faq http://vimhelp.appspot.com/vim_faq.txt.html

                          regards,
                          Christian
                          --
                          Was kann an der Arbeit gut sein, wenn die Reichen sie den Armen überlassen.

                          --
                          --
                          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
                           
                          ---
                          You received this message because you are subscribed to the Google Groups "vim_use" group.
                          To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                          For more options, visit https://groups.google.com/groups/opt_out.
                           
                           
                        • Venu Gopal
                          I had the same issue, but is now solved with your solution. Thanks, Christian! ... -- -- You received this message from the vim_use maillist. Do not
                          Message 12 of 20 , Jan 8, 2014
                          • 0 Attachment
                            I had the same issue, but is now solved with your solution.

                            Thanks, Christian!


                            On Sunday, February 3, 2013 4:56:22 AM UTC-8, Christian Brabandt wrote:
                            > Hi alijohnshaik!
                            >
                            > (redirecting to vim_use)
                            >
                            >
                            >
                            > On Sa, 02 Feb 2013, alijohnshaik@... wrote:
                            >
                            >
                            >
                            > > <quote author='Christian Brabandt'>
                            >
                            > > Hi naaj_ila!
                            >
                            > >
                            >
                            > > On Fr, 01 Feb 2013, naaj_ila wrote:
                            >
                            > >
                            >
                            > > > Its working fine
                            >
                            > > > i added these things in ~/.vim/syntax/filetype.vim
                            >
                            > >
                            >
                            > > This looks totally wrong.
                            >
                            > > >
                            >
                            > > > augroup filetypedetect
                            >
                            > > > au! BufRead,BufNewFile *.v so ~/.vim/syntax/verilog.vim
                            >
                            > > > augroup END
                            >
                            > >
                            >
                            > > I am wondering, why do you need this? Vim should automatically detect
                            >
                            > > *.v files as verilog files? Does yours not?
                            >
                            > >
                            >
                            > > Try this: vim -u NONE -N file.v
                            >
                            > >
                            >
                            > > What does Vim tell you, after entering:
                            >
                            > >
                            >
                            > > :filetype detect
                            >
                            > > :set ft?
                            >
                            > > --------------------------------------
                            >
                            > > Its coming like this after executing the command
                            >
                            > > filetype =
                            >
                            > > -----------------------------------
                            >
                            >
                            >
                            > Interesting. Your vim does not by default detect verilog files. What vim
                            >
                            > version is this?
                            >
                            >
                            >
                            > To make vim recognize .v files as verilog filetypes, put the following
                            >
                            > into your .vimrc:
                            >
                            > filetype plugin on
                            >
                            >
                            >
                            > Now create a file called ~/.vim/ftdetect/verilog.vim (create
                            >
                            > non-existing directories) and put in that file:
                            >
                            > ,----
                            >
                            > | au BufRead,BufNewFile *.v set filetype=verilog
                            >
                            > `----
                            >
                            >
                            >
                            > and then place your verilog.vim syntax file into
                            >
                            > ~/.vim/syntax/ (again, creating non-existent directories).
                            >
                            > (and make sure, your .vimrc contains:
                            >
                            > :syntax on
                            >
                            >
                            >
                            >
                            >
                            > See also the help at :h new-filetype and have a look at section 26 of
                            >
                            > the faq http://vimhelp.appspot.com/vim_faq.txt.html
                            >
                            >
                            >
                            > regards,
                            >
                            > Christian
                            >
                            > --
                            >
                            > Was kann an der Arbeit gut sein, wenn die Reichen sie den Armen �berlassen.

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

                            ---
                            You received this message because you are subscribed to the Google Groups "vim_use" group.
                            To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                            For more options, visit https://groups.google.com/groups/opt_out.
                          Your message has been successfully submitted and would be delivered to recipients shortly.