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

The 'default highlighting' after loading empty (each line commented) syntax file

Expand Messages
  • Kamil Libich
    Hi, I m writing my own syntax file. From the beginning I came across some problems. Whereas some of them I m going to solve myself, one of the problems appears
    Message 1 of 4 , Nov 30, 2010
    • 0 Attachment
      Hi,

      I'm writing my own syntax file. From the beginning I came across some problems. Whereas some of them I'm going to solve myself, one of the problems appears to be solved at the beginning.

      I created a syntax file in which I commented each line. Basically, that file looks like below:

      (BOF)
      " syn some text
      " syn some text
      " syn some text
      (...)
      " highlight some text
      (EOF)

      I named my syntax file as test01.vim and I put it into vim72\syntax folder.

      Then I opened my file with my language.
      Then I cleared syntax by executing :cal SetSyn(""). As a result of that I've got white text on the black background. That is fine.
      Then I called my syntax file by executing :cal SetSyn("test01.vim") and as a result of doing that a surprise: instead of having expected no change (becouse I didn't define anything in my syntax file) and still having white text on black background I've got some highighting in a two colors: yellow (words as 'on' and 'check') and purple (numbers and everything in  " ").

      What's happened?

      What is that 'default highlighting' from?

      Kamil



      --
      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
    • Ben Fritz
      ... What is this SetSyn function? I ve never heard of it and it doesn t seem to be defined in my Vim installation. Normally you would set syntax with: set
      Message 2 of 4 , Dec 1, 2010
      • 0 Attachment
        On Nov 30, 12:30 pm, Kamil Libich <kamil.lib...@...> wrote:
        > Hi,
        >
        > I'm writing my own syntax file. From the beginning I came across some
        > problems. Whereas some of them I'm going to solve myself, one of the
        > problems appears to be solved at the beginning.
        >
        > I created a syntax file in which I commented each line. Basically, that file
        > looks like below:
        >
        > (BOF)
        > " syn some text
        > " syn some text
        > " syn some text
        > (...)
        > " highlight some text
        > (EOF)
        >
        > I named my syntax file as test01.vim and I put it into vim72\syntax folder.
        >
        > Then I opened my file with my language.
        > Then I cleared syntax by executing :cal SetSyn(""). As a result of that I've
        > got white text on the black background. That is fine.
        > Then I called my syntax file by executing :cal SetSyn("test01.vim") and as a
        > result of doing that a surprise: instead of having expected no change
        > (becouse I didn't define anything in my syntax file) and still having white
        > text on black background I've got some highighting in a two colors: yellow
        > (words as 'on' and 'check') and purple (numbers and everything in  " ").
        >
        > What's happened?
        >
        > What is that 'default highlighting' from?
        >

        What is this SetSyn function? I've never heard of it and it doesn't
        seem to be defined in my Vim installation.

        Normally you would set syntax with:

        set filetype=someft

        or

        set syntax=someft

        which will automatically load your someft.vim syntax file if you put
        it in the correct place.

        --
        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
      • Kamil Libich
        Hi Ben, When I go to the menu- syntax- show filetypes in menu at the bottom of vim window the calling statement appears as :cal SetSyn( c ). That it was how I
        Message 3 of 4 , Dec 1, 2010
        • 0 Attachment
          Hi Ben,

          When I go to the menu->syntax->show filetypes in menu at the bottom of vim window the calling statement appears as :cal SetSyn("c"). That it was how I worked out the 'enable syntax' statement. So, then I execute my statement as  :cal SetSyn("test.vim") and I have no error.

          I thought the syntax is enabled (I had some highlighting effect). However, having read your email I realised that the syntax is not enabled. I used your syntax and everything is OK and works as expected! No default highlight and problem with the new line anchor disappear!

          Cheers,

          Kamil

          On Wed, Dec 1, 2010 at 3:37 PM, Ben Fritz <fritzophrenic@...> wrote:


          On Nov 30, 12:30 pm, Kamil Libich <kamil.lib...@...> wrote:
          > Hi,
          >
          > I'm writing my own syntax file. From the beginning I came across some
          > problems. Whereas some of them I'm going to solve myself, one of the
          > problems appears to be solved at the beginning.
          >
          > I created a syntax file in which I commented each line. Basically, that file
          > looks like below:
          >
          > (BOF)
          > " syn some text
          > " syn some text
          > " syn some text
          > (...)
          > " highlight some text
          > (EOF)
          >
          > I named my syntax file as test01.vim and I put it into vim72\syntax folder.
          >
          > Then I opened my file with my language.
          > Then I cleared syntax by executing :cal SetSyn(""). As a result of that I've
          > got white text on the black background. That is fine.
          > Then I called my syntax file by executing :cal SetSyn("test01.vim") and as a
          > result of doing that a surprise: instead of having expected no change
          > (becouse I didn't define anything in my syntax file) and still having white
          > text on black background I've got some highighting in a two colors: yellow
          > (words as 'on' and 'check') and purple (numbers and everything in  " ").
          >
          > What's happened?
          >
          > What is that 'default highlighting' from?
          >

          What is this SetSyn function? I've never heard of it and it doesn't
          seem to be defined in my Vim installation.

          Normally you would set syntax with:

          set filetype=someft

          or

          set syntax=someft

          which will automatically load your someft.vim syntax file if you put
          it in the correct place.

          --
          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 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
        • Ben Fritz
          ... Ah, perhaps it is defined somewhere in the menu runtime code as needed. I don t use the GUI menus. It appears that SetSyn takes a filetype, not a file
          Message 4 of 4 , Dec 3, 2010
          • 0 Attachment
            On Dec 1, 5:10 pm, Kamil Libich <kamil.lib...@...> wrote:
            > Hi Ben,
            >
            > When I go to the menu->syntax->show filetypes in menu at the bottom of vim
            > window the calling statement appears as :cal SetSyn("c"). That it was how I
            > worked out the 'enable syntax' statement. So, then I execute my statement
            > as  :cal SetSyn("test.vim") and I have no error.
            >

            Ah, perhaps it is defined somewhere in the menu runtime code as
            needed. I don't use the GUI menus.

            It appears that SetSyn takes a filetype, not a file name. So your
            SetSyn("test.vim") is actually setting up filetype test AND vim
            (see :help 'ft' for the dot syntax).

            > I thought the syntax is enabled (I had some highlighting effect). However,
            > having read your email I realised that the syntax is not enabled. I used
            > your syntax and everything is OK and works as expected! No default highlight
            > and problem with the new line anchor disappear!
            >

            Good! I'm glad you found a solution. Please bottom-post next time.

            --
            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
          Your message has been successfully submitted and would be delivered to recipients shortly.