What is the equivalent of re-formatting and checking syntax on save of Textmate in SublimeText2? - textmate

I recently switched to SublimeText2 from Textmate and I've been enjoying it.
But there are some features of Textmate which I don't know for SBT2.
Selecting a block of code and pressing CMD+OPTION+[ re-formats the selected block.
While saving a file CMD+S, ruby or jquery or coffee-script, etc.. Texmate checks the syntax of the code.
How to do the same with SBT2?

To check syntax on save you can use SublimeLinter and to reformat code you can use something like the following depending on what languages you work with:
HTMLTidy
Sublime-HTMLPrettify (HTML, JS, CSS)
Pretty JSON
PHPTidy
PythonTidy
BeautifyRuby
There are plenty of other similar and other useful extensions and plugins here: http://wbond.net/sublime_packages/community
All of which can be easily installed and kept up to date using Package Control.

Related

Is there an editor (or a solution for kate) doing syntax highlighting in a mixed code?

I'm using Kate as the editor of my Node.js projects. In the Node.js projects, I sometimes prefer to code whole index.html in a single file. At that time, I need to use:
html
css (<style>...</style>)
livescript (<script type="text/ls">...</script>)
javascript (<script [type="text/javascript"]>...</script>)
at the same time. Kate can highlight these codes if they are in their separate files.
How can I make the code highlighted correctly when they are mixed in a single file (preferably in Kate, or any other editor that would run on Linux)?
Kate can do this, too. It is supported in e.g. HTML/PHP highlighting and similar. Just have a look into the respective highlighting xml files to get an idea how to implement a highlighting for this. More information about how to write syntax highlighting files can be found in the KatePart Handbook.

Is there a way in Sublime Text 2 to support JavaScript completion of objects/functions defined in other files?

If I am editing a .js file in Sublime Text 2 that makes use of a library defined in a separate .js file, is there a way to support tab completion of objects/functions defined in the external library file?
Something analogous to the following from Visual Studio:
/// <reference path="/js/some-library.min.js" />
which enables IntelliSense over the library/plugin code.
I haven't tried it myself yet, but there's SublimeCodeIntel: https://github.com/Kronuz/SublimeCodeIntel#readme
The OP in this thread: http://www.sublimetext.com/forum/viewtopic.php?f=3&t=5319 seems to be complaining that it's pulling suggestions from outside the current file, which may mean it's doing what you want.
I was looking for the exact same thing, and I can confirm that SublimeCodeIntel works well. However, Sublime Text seems slightly less responsive when using SublimeCodeIntel, which is a drawback.
Another cool thing coming from a Visual Studio environment is the support for "Go to definition" in this plugin.
Another option is TernJS:
http://emmet.io/blog/sublime-tern/
I haven't yet used it, but it looks promising. Editor slowdown seems to be an issue with any code completion plugin; sounds like authors are still working out kinks in scraping and caching related files for code completion. The TernJS page addresses this issue and offers some config options for managing how it handles related files.

Markdown syntax highlighting in SciTE/Notepad++

I'm looking for a .properties file for Markdown syntax in SciTE. Is it possible?
A partial highlighter would do, otherwise.
I'm using this syntax file: https://github.com/leafnode/markdown_npp with some color changes to fit dark background.
I've uploaded my (dark) user-defined language Markdown highlighter on GitHub. It uses different workarounds than thomsmits', which for the style of Markdown I've chosen work better.
Until the Markdown Scintilla lexer is imported into Notepad++, user defined languages are the best we can do.
I don't use Notepad++ any more and have deleted my project. Try Brettz9's fork of the project here: https://github.com/brettz9/Notepad---Markdown-Highlighting
I'm using Markdown-plus-plus. The install instruction is outdated on many projects. The actual instruction is:
Select menu "Language" → "Define your language..."
Press button "Import...", and select {markdown}.xml (from GitHub repositories).
Restart Notepad++
I believe somebody mentioned on the mailing list that he is working on such a lexer.
I don't think a simple .properties file can do the job, as there isn't any existing lexer (to my knowledge) with similar syntax.

textmate bundles not recognizing differences

So i'm trying to make a set of grammars recognizing different file extensions properly.
All my files (js/css/html) end with template. This is similiar to how ruby does it with js.erb, css.erb, etc. So I modified the file type attribute to js.template css.template and template itself for html. But it doesn't seem to work. They just default to template even though there are more specific ones.
But for some reason Textmate doesn't want to recognize my different file extensions. Any idea why this would be happening or why the Ruby grammars seem to work but mine don't?
The detailed answer depends on the scope and therefore syntax highlighting you want. The general approach is as follows:
Open the Bundles Editor (Control-Meta-Command-B)
Search for the language definition of JavaScript, i.e. in the JavaScript bundle is a grammar definition called "JavaScript"
Open it and look for the line which starts with "filetypes", which should look like fileTypes = ( 'js', 'htc', 'jsx' );
Add your own file ending, i.e. "js.template"
Close the Bundle Editor or activate another snippet / command / grammar or click the Test button to reload the grammar (note that manual language definitions are preferred over file ending, so create a new file with that extension and load it with TextMate to make sure it works)
Repeat for any grammar definition you want to work with another file ending, i.e. HTML and CSS
This way you will have the default syntax highlighting working in your files with .template endings. However, the Ruby on Rails bundle extends those grammars a little, so maybe you want to extend the supported filetypes of these grammars as well.

How can I revert back the native javascript code coloring in Dreamweaver CS4?

I recently installed Adobe Dreamweaver CS4. When I tried to code in javascript, all my code is written in pink font. I checked my Preferences > Code Coloring then choose Javascript. I was surprised to see that it only recognizes 3 types of code: jQuery Identifiers, jQuery Keywords and Methods, jQuery objects. I do code jQuery, but I want to see the previous color coding from my pass Installation (Macromedia Dreamweaver version XX). What can I do to revert or add these native code types so I can set their syntax color. I'm just used to seeing these codes more color-coded. Thanks in advance!
I ask because I have the following options when I open up the JavaScript code coloring options:
JavaScript Bracket
JavaScript Client Keywords
JavaScript Comment
JavaScript Default Text
JavaScript Function Keyword
JavaScript Identifier
JavaScript Native Keywords
JavaScript Number
JavaScript Operator
JavaScript RegExp
JavaScript Reserved Keywords
JavaScript String
I just checked in CS4 and CS5 and those entries are present in both, there are no entries for jQuery. Have you installed an extension that provides jQuery support (at least code coloring)? If you have, then I'd suggest you uninstalling it and the modifications may be reverted.
If you have uninstalled the extension, or if you don't have an extension installed, and the code coloring is still awry, to get back to the original code coloring that's built into Dreamweaver, you may need to perform step 12 on this page:
http://kb2.adobe.com/cps/191/tn_19105.html
For CS4 and CS5, the folder to remove will have a "language" folder that the Configuration folder is within. On my Vista system for CS5, it's at:
C:\Users[username]\AppData\Roaming\Adobe\Dreamweaver CS5\en_US\configuration\

Resources