How can I disable spell checking for a block of text in TextMate?

2

When I am editing a plain text document and making notes in it, TextMate will put red lines under parts of it which should not be spell checked:

enter image description here

How can I disable spell checking for a block of text? I don't even mind if I have to wrap it inside of something like {{ and }}.

In the Textmate Manual it says

Since TextMate is intended for structured text it is possible to exclude parts of the document from being checked. This is done by creating a preferences item in the bundle editor, setting spellChecking to 0 and filling in the scope selector with the selector to target for no spell checking.

But I am still unclear about how to do this - I don't even see the spelling section in my preference pane (cmd+,, right?)

I'm looking for a few step-by-step instructions of how to disable spell checking for part of a plain text document.

cwd

Posted 2011-12-21T02:55:34.130

Reputation: 13 508

What textmate version? – Daniel Beck – 2011-12-21T03:27:13.767

@DanielBeck 1.5.10 (latest) – cwd – 2011-12-21T03:36:59.400

What programming language / syntax is this? – Daniel Beck – 2011-12-21T03:50:36.380

It's a plain text file that I use for reference. I don't like that it is underlining mis-spellings for code words. i suggested delimiters for "scoped" sections of {{ and }} but i would be open to other delimiters. i do want it to check spelling on the actual text part of the document. – cwd – 2011-12-21T04:18:02.467

No, I meant what language for syntax highlighting etc. do you have selected in TextMate? Plain text then? – Daniel Beck – 2011-12-21T04:19:06.757

yes that's correct. also tried markdown but i think plaintext may be better as i'm not really using structured markup in a lot of my existing .txt files – cwd – 2011-12-21T04:27:04.607

Answers

2

TextMate uses user-configurable bundles of scripts and language definitions for syntax highlighting, indentation recognition, and the menu items in the Bundles menu.

TextMate can be extended by adding new bundles to e.g. support other programming languages.

Likewise, you can edit existing bundles to match your custom requirements.


You can view your bundles and their contents via Bundles » Bundle Editor » Show Bundle Editor.

The following instructions will explain how to ignore the text between two delimiters for spell checking.

enter image description here

  1. Open the Bundle Editor
  2. Select the Text bundle's Plain text language entry in the list.
  3. Add the following to the list of patterns matched under contentName = 'meta.paragraph.text' as a sibling to the block whose name is markup.underline.link.text:

    {   name = 'meta.no-spellcheck';
        begin = '{{';
        end = '}}';
    },
    

    This defines a new scope, named meta.no-spellcheck, as a subscope to the regular meta.paragraph.text scope. So only if a scope is a regular text paragraph will it also possibly be a meta.no-spellcheck scope, and therefore excluded from spell checking.

  4. In the Text » Spell Checking: Disable item, add meta.no-spellcheck to the Scope Selector list. This will apply the rule to all meta.no-spellcheck scopes.

  5. Close the Bundle Editor and test your changes (no saving needed).


To view a certain position's active scopes, press Ctrl-Shift-P. This can help you in defining your own rules.

enter image description here

Daniel Beck

Posted 2011-12-21T02:55:34.130

Reputation: 98 421

any chance to update this for TM 2? – tim – 2017-01-10T00:00:08.830

@tim It's basically the same. I haven't used TextMate in years and got it to work with my instructions above. A handful of labels (e.g. Text bundle instead of Plain text) and menu items (e.g. Bundles » Edit Bundles instead of Bundles » Bundle Editor » Show Bundle Editor) are different and that's about it. How to define the scope is a bit different, but as there are pre-existing scopes one can just copy and paste from the others. – Daniel Beck – 2017-01-10T02:58:51.163