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

Re: Wildcards in Spell-check?

Expand Messages
  • Ben Fritz
    ... Well, spelling integrates with syntax highlight. You could define a simple syntax to recognize the URLs and disallow spelling in that syntax region. -- You
    Message 1 of 7 , Nov 1, 2012
    • 0 Attachment
      On Wednesday, October 31, 2012 3:49:22 PM UTC-5, Ian Donegan wrote:
      > I am trying to find a way to use pattern recognition in spell-check. At the moment, I am not even sure if that is possible, but it seems like it should be. If I want to have a url in a file with ":set spell" I have to either mark the link as correct or deal with the red hilighting. Is there any way to white-list everything that starts with "http://"? Thanks in advance.

      Well, spelling integrates with syntax highlight. You could define a simple syntax to recognize the URLs and disallow spelling in that syntax region.

      --
      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
    • Ian Donegan
      ... Great. Thanks for the response. I am relativity new to Vim though, so I have no idea how I would go about setting up syntax hilighting rules. The closest
      Message 2 of 7 , Nov 1, 2012
      • 0 Attachment
        On Thursday, November 1, 2012 10:34:23 AM UTC-4, Ben Fritz wrote:
        > On Wednesday, October 31, 2012 3:49:22 PM UTC-5, Ian Donegan wrote:
        >
        > > I am trying to find a way to use pattern recognition in spell-check. At the moment, I am not even sure if that is possible, but it seems like it should be. If I want to have a url in a file with ":set spell" I have to either mark the link as correct or deal with the red hilighting. Is there any way to white-list everything that starts with "http://"? Thanks in advance.
        >
        >
        >
        > Well, spelling integrates with syntax highlight. You could define a simple syntax to recognize the URLs and disallow spelling in that syntax region.

        Great. Thanks for the response. I am relativity new to Vim though, so I have no idea how I would go about setting up syntax hilighting rules. The closest thing that I could find in the help file was something about "contains=@NoSpell" but I do not really understand it. How would I go about setting it up, or at least, where could I read more about it?

        --
        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
        ... You can type this directly, put it in a mapping or command, or put this in a file with pretty much any name you want, in ~/.vim/syntax, and set the syntax
        Message 3 of 7 , Nov 2, 2012
        • 0 Attachment
          On Thursday, November 1, 2012 9:22:23 PM UTC-5, Ian Donegan wrote:
          > On Thursday, November 1, 2012 10:34:23 AM UTC-4, Ben Fritz wrote:
          > >
          > > Well, spelling integrates with syntax highlight. You could define a simple syntax to recognize the URLs and disallow spelling in that syntax region.
          >
          > Great. Thanks for the response. I am relativity new to Vim though, so I have no idea how I would go about setting up syntax hilighting rules. The closest thing that I could find in the help file was something about "contains=@NoSpell" but I do not really understand it. How would I go about setting it up, or at least, where could I read more about it?

          :help syntax
          :help :syn-match

          If you are just editing a plaintext file with no existing syntax highlighting, it is very easy. Assuming you have "syntax on" in your .vimrc somewhere, just do something like this:

          :syntax match NoSpellURL 'http://\S*' contains=@NoSpell

          You can type this directly, put it in a mapping or command, or put this in a file with pretty much any name you want, in ~/.vim/syntax, and set the syntax to the chosen name to activate it. E.g. if you name the file ~/.vim/txtspell.vim you can do :set syntax=txtspell to apply the rule.

          It gets somewhat more complicated if you have an existing syntax you want to enhance with this rule but is still quite possible. The "after directory" is useful for this, i.e. ~/.vim/after/syntax.

          --
          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
        • Ian Donegan
          ... Well, I thank you, Ben Fritz. I stuck that line in my .vimrc file and it fixed my problem for the most part. I still do not understand all of the syntax
          Message 4 of 7 , Nov 2, 2012
          • 0 Attachment
            On Friday, November 2, 2012 11:00:28 AM UTC-4, Ben Fritz wrote:
            > On Thursday, November 1, 2012 9:22:23 PM UTC-5, Ian Donegan wrote:
            >
            > > On Thursday, November 1, 2012 10:34:23 AM UTC-4, Ben Fritz wrote:
            >
            > > >
            >
            > > > Well, spelling integrates with syntax highlight. You could define a simple syntax to recognize the URLs and disallow spelling in that syntax region.
            >
            > >
            >
            > > Great. Thanks for the response. I am relativity new to Vim though, so I have no idea how I would go about setting up syntax hilighting rules. The closest thing that I could find in the help file was something about "contains=@NoSpell" but I do not really understand it. How would I go about setting it up, or at least, where could I read more about it?
            >
            >
            >
            > :help syntax
            >
            > :help :syn-match
            >
            >
            >
            > If you are just editing a plaintext file with no existing syntax highlighting, it is very easy. Assuming you have "syntax on" in your .vimrc somewhere, just do something like this:
            >
            >
            >
            > :syntax match NoSpellURL 'http://\S*' contains=@NoSpell
            >
            >
            >
            > You can type this directly, put it in a mapping or command, or put this in a file with pretty much any name you want, in ~/.vim/syntax, and set the syntax to the chosen name to activate it. E.g. if you name the file ~/.vim/txtspell.vim you can do :set syntax=txtspell to apply the rule.
            >
            >
            >
            > It gets somewhat more complicated if you have an existing syntax you want to enhance with this rule but is still quite possible. The "after directory" is useful for this, i.e. ~/.vim/after/syntax.

            Well, I thank you, Ben Fritz. I stuck that line in my .vimrc file and it fixed my problem for the most part. I still do not understand all of the syntax behind it yet but I should be able to figure the rest out with the help of the manual. It has been a pleasure learning from you.

            --
            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
            ... If you never apply any other syntax highlighting, I suppose adding it to your .vimrc will work. But more likely eventually you ll edit something syntax
            Message 5 of 7 , Nov 2, 2012
            • 0 Attachment
              On Friday, November 2, 2012 12:57:02 PM UTC-5, Ian Donegan wrote:
              > >
              > > :syntax match NoSpellURL 'http://\S*' contains=@NoSpell
              > >
              >
              > Well, I thank you, Ben Fritz. I stuck that line in my .vimrc file and it fixed my problem for the most part. I still do not understand all of the syntax behind it yet but I should be able to figure the rest out with the help of the manual. It has been a pleasure learning from you.

              If you never apply any other syntax highlighting, I suppose adding it to your .vimrc will work.

              But more likely eventually you'll edit something syntax highlighted. I suggest wrapping it in a command or syntax plugin of your own.

              See :help new-filetype for detecting when to apply the plugin. See :help usr_44.txt for setting up the syntax plugin itself.

              --
              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
            • Ian Donegan
              ... That is probably what I will end up doing. I discovered that if I just have it in my .vimrc file, it will not take effect when I restore a session, or like
              Message 6 of 7 , Nov 2, 2012
              • 0 Attachment
                On Friday, November 2, 2012 3:59:45 PM UTC-4, Ben Fritz wrote:
                > On Friday, November 2, 2012 12:57:02 PM UTC-5, Ian Donegan wrote:
                >
                > > >
                >
                > > > :syntax match NoSpellURL 'http://\S*' contains=@NoSpell
                >
                > > >
                >
                > >
                >
                > > Well, I thank you, Ben Fritz. I stuck that line in my .vimrc file and it fixed my problem for the most part. I still do not understand all of the syntax behind it yet but I should be able to figure the rest out with the help of the manual. It has been a pleasure learning from you.
                >
                >
                >
                > If you never apply any other syntax highlighting, I suppose adding it to your .vimrc will work.
                >
                >
                >
                > But more likely eventually you'll edit something syntax highlighted. I suggest wrapping it in a command or syntax plugin of your own.
                >
                >
                >
                > See :help new-filetype for detecting when to apply the plugin. See :help usr_44.txt for setting up the syntax plugin itself.

                That is probably what I will end up doing. I discovered that if I just have it in my .vimrc file, it will not take effect when I restore a session, or like you said, when I edit file types that have other syntax highlighting.

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