Plaintext Syntax Highlighting and/or Custom Highlighting Syntax

0

How can you add custom syntax highlighting for a plaintext file? (for any filetype, not just txt)

I leave this question open to any editor for those who know - I'm not picky. If you want me to be specific, assume Sublime Text 2 or 3. (I write a lot of things in Sublime Text, I use many IDEs regularly, I used to use Notepad++.)

Sometimes I want to be able to write up notes in a file, but it would be helpful to have my own custom syntax highlighting for plaintext notes.

Is there a way to do this?

I would also consider an alternative file extension as a valid answer (like .yml)

What I'm looking for is a way to color "*", ">", "-", digits, etc. in a plaintext file (of any file type).

There are many ways to state this question, and I'm not finding anybody asking it.

Thanks!

EDIT:

I realize that a solution would be to have access to the Sublime Text files that define the syntax highlighting grammars. Does anyone know where those would be, so that I could examine them and make my own? (Your own grammar is not for the lay person, I know)

Plasmarob

Posted 2015-04-23T20:17:02.870

Reputation: 116

That's easy copy paste, and I found those. They're saying "no-NP++ can't" in the answers, which as a dev, I am aware of. Sublime has some ability to configure it's large language support. I'm essentially wondering if I can access the files that define the grammar for each syntax and make my own. – Plasmarob – 2015-04-23T20:42:18.160

The accepted answer in the second link leads here, which shows you how to set up a custom syntax highlighting scheme. Also the Language menu allows you to create a user-defined language and apply its highlighting rules to any file including text files. So how is that equivalent to "no NP++ can't"?

– Karan – 2015-04-23T20:51:24.730

See top answer in the first link. Why is there no currently existing (non-archived) copy of that document if the process is still supported in Notepad++? Or is it no longer supported? (I'm going to have to look this up further when I have time) I'm looking to add a grammar to a set, not reinvent the wheel. – Plasmarob – 2015-04-23T20:57:32.133

1

Wiki page may have been deleted for a variety of reasons, or moved elsewhere. Doesn't mean feature's gone. NP++ > Language menu > Define your language shows this.

– Karan – 2015-04-23T21:04:42.863

Excellent. I should re-install it and take a look. – Plasmarob – 2015-04-23T21:06:15.147

Maybe you should remove the NP++ tag and focus this question on Sublime Text. Perhaps add an NP++-specific question separately. – Karan – 2015-04-23T21:07:13.110

Good idea. Thanks for the help. I'm new being active on SU - and every SE has a different mindset. – Plasmarob – 2015-04-23T21:09:00.083

Answers

0

I think this might be the answer to my question:

http://docs.sublimetext.info/en/latest/reference/syntaxdefs.html?highlight=syntax

However, it's not completely transparent how you would add a new one.

A good answer is here:

https://stackoverflow.com/questions/15646926/sublime-text-how-to-customize-syntax-highlighting

The answer is .tmTheme files as per this topic.

Plasmarob

Posted 2015-04-23T20:17:02.870

Reputation: 116