It feels like I'm missing something really simple here. I've been using Coda for a while now and I'm now playing around with Textmate. I'm unable to find a way to syntax highlight function calls in Textmate. I've poked around the documentation but can't believe I'd have to dig deep into Textmate and mess around with regex to make this work.
This is in textmate: http://imgur.com/acACa.png
Function calls are inheriting the foreground color. This is javascript but I get the same in PHP.
In Textmate, syntax coloring is entirely controlled by the language definition in the "bundle" of the relevant language. Both the PHP (HTML) and Javascript bundles give function definitions special treatment, but neither highlights function calls.
So yes, if you want to change this, you'll need to use the Bundle Editor and learn to edit the regex-based language definition (marked with an L icon in the bundle).
Related
For example, I would like to highlight #param, #type, and #return (i.e. epytext declarations) in my Python docstrings. I have figured out how to do this by simply editing Python/Python.tmLanguage; however, I would really like to put this in its own file, for a couple of reasons:
I don't always want to apply this highlighting. It's only for projects that use epydoc as their documentation tool; in other projects, I would want to highlight reStructuredText instead.
When Sublime Text updates, I'd like to have my own syntax as an overlay onto the included features. there are several features of Python that Sublime's author may choose to include in future versions and I don't want to have to manually figure out what I changed each time an update modifies the base Python syntax definition.
I keep my own editor configuration in version control, but I want that to be my own original stuff; I don't want to be burdened with having to carry copies (possibly proprietary? I don't know, it doesn't seem to have an independent license) of syntax definitions that come with Sublime.
Is there a way to put highlighting rules into a separate file, perhaps to only be applied to a particular scope?
Sounds to me like you want to create your own syntax file, inherit from the Python syntax file (source.python), and make your changes and customizations there. Sublime Text 2 uses the .tmLanguage format for syntax files, which is a bit complex, but fortunately most of the work has already been done for you, just by inheriting from source.python.
What you want to do is set up a regex pattern to match the substrings that you want to highlight, and give that pattern a name; something like punctuation.definition.comment.epydoc, to follow the convention set in Java/JavaDoc.tmLanguage. Then, check your color scheme file (ending in .tmTheme) and make sure there are settings for the scope that you've chosen -- or for one of its parents, since ST2 should use proper scoping rules for this sort of thing.
To use the syntax file you've created, stick it in Packages/User (so that ST2 doesn't overwrite it on upgrades), open a Python file in the editor, and then select your new syntax from the dropdown list in the bottom right corner of the window. If you've set up everything correctly, the epydoc strings should change to be whatever color you've set in your color scheme.
Good luck! And post a link somewhere when you've got a syntax file that works, so others can see and use it, as well!
Does any one know if textmate has a visual way to denote a nested block? I just started using coffee script (which uses tabbed nesting) and thought it would be great to have something similar to this:
http://www.mathworks.com/help/matlab/matlab_prog/section_thirdlevel_highlight.png
Would it be possible to write a plugin that does something along these lines in textmate 2?
Thanks!
Edit: After some more searching I found this is sometimes called "indentation guides". I still havne't found any way to do this in textmate 2 but sublime text has the feature on by default.
Is there any way with TextMate to hide comments when editing code? Sometimes I want to see my code with the full comments and other times just want to see the code itself with all comments hidden. I was hoping there would be a way to toggle the display of comments, but haven't been able to find anything about this.
It is something you will need to edit on a language by language basis, but it is very doable. Inside of Bundles -> Bundle Editor -> Edit Languages you will find the language definition that TextMate uses to highlight that particular syntax. Inside of the syntax definition you will find foldingStartMarker and foldingStopMarker.
You can add comment syntax to those to allow the folding off comments themselves. It might be pretty tricky for single line comments, but multiline comments, that have both a clear and unique start and stop syntax, should work fine.
For PHP, for example, we are going to want to add \/\* to the start syntax, and \*\/ to the end syntax. You will need to reload the bundle for these changes to take effect (or restart TM).
Is there any way to have syntax highlighting in the "editor" of dokuwiki?
By this I mean to have syntax highlighting in the actual editing window (in real time) just like using a text editor.
I have never seen anything like this but I was wondering if this is possible. Since I'm inputting a lot of LaTeX math thing into my dokuwiki, it would be great if it can be done.
Have a look at http://www.dokuwiki.org/plugin:aceeditor - I never tried it myself, but it seems to do what you're looking for.
I have recently begun working with Objective-C in Textmate and noticed that the syntax highlighting is rather poor (a comment is the exact same color as a variable declaration).
I've never done syntax highlighting changes in Textmate and I'm having trouble figuring out how to correctly modify it.
For example the scope of a comment in an Objective-c file is:
source.objc.iphone
meta.implementation.objc
meta.scope.implementation.objc
meta.function-with-body.objc
but changing the colors on that changes alot more than just comments.
Does anyone know of a good place to start learning how to do this?
You can check the scope of your current cursor with ^ + Shift + P or Bundles > Bundle Development > Show Scode.
After you know the scope, you can create / change the color of it.
If the comment is not detected by the language grammar, you have to extend it. See the documentation for further information:
http://manual.macromates.com/en/language_grammars#language_grammars