Sublime Forum

Req.: Code Formater/beautifier

#1

Code formating for:

  • HTML
  • CSS
  • JS
  • PHP
    … other langs. later :wink:

I think this future in Sublime Text 2 can bring alot of people because APP developers mostly use Microsoft Visual Strudio and other developers (web, scripting …) editors like this.

I know code is indented when in new line but CUT-ing and COPY-ing does not indent code so their should be option Format whole code via keyboard and menu.

I know their is JS Formater and PHP formater:

  • JS formater send data to web which i dont like because code is private property
  • PHP formater doesnt work :frowning: getting strange error

Hopefully this feauture will be realesed till BETA ends.

0 Likes

#2

HTML: github.com/SublimeText/Tag
JS: github.com/jdc0589/JsFormat ( no code to network, works locally )

0 Likes

#3

[quote=“tito”]HTML: github.com/SublimeText/Tag
JS: github.com/jdc0589/JsFormat ( no code to network, works locally )[/quote]

Tnx JSFormat works well
HTML tag plugins works also but has issues with PHP mixed in HTML.

What i dont like about this seperate plugins is that each one has its own keybinding and are seperated plugins.

Would it be great that their is one plugins which contains:

  • One keybinding CTRL+F
  • All in one plugin which detects what file it is and use that formating
  • Formating HTML, CSS,JS, PHP …
0 Likes

#4

[quote=“molchy”]Would it be great that their is one plugins which contains:

  • One keybinding CTRL+F
  • All in one plugin which detects what file it is and use that formating
  • Formating HTML, CSS,JS, PHP …[/quote]

You can change the keybindings to all be the same (they don’t need to be the same plugin) and there won’t be any conflicts as long as the plugins know to only run in a certain scope.

0 Likes

#5

One plugin to rule them all…

[code]import sublime, sublime_plugin

class FormatFileCommand(sublime_plugin.TextCommand):
def run(self, edit):
if self.view.match_selector(0, “source.js, source.json”):
self.view.run_command(“js_format”)
elif self.view.match_selector(0, “text.html.basic”):
self.view.run_command(“html_tidy”)[/code]

0 Likes

#6

molchy:
Tag package key binding has been changed to “CTRL+ALT+F” as in jsformat.
CTRL+F is find!

0 Likes

#7

[quote=“tito”]molchy:
Tag package key binding has been changed to “CTRL+ALT+F” as in jsformat.
CTRL+F is find![/quote]

Yea sorry typo :wink: tnx

Tested sublime text 2 and is nice but some feautures are missing which are needet for my development so will stick with Netbeans 7.1 until this feautures are in sublime text:

  • HTML ( Doesnt brake if PHP in it ), CSS, XML,JS, PHP formater as one plugin
  • Good is that code frameworks can be implemented in snippets for auto complete so thats not issue
  • Function DOC tip
  • Visaul Diff tool which shows two documents and differences
  • Navigator which shows (HTML DOM structure, CSS structure, PHP functions) and on click jumps to the function
  • When working on file i wanna see open path to it in file browser
    … maybe some other stuff but cant remamber :wink:

Sublime text 2 is not bad but i dont wanna pay for licence if i must develop plugins for it to have what i need in my development. I need a tool which i setup, install plugins and use.

0 Likes

#8

[quote=“molchy”]Tested sublime text 2 and is nice but some feautures are missing which are needet for my development so will stick with Netbeans 7.1 until this feautures are in sublime text:

  • HTML ( Doesnt brake if PHP in it ), CSS, XML,JS, PHP formater as one plugin
  • Good is that code frameworks can be implemented in snippets for auto complete so thats not issue
  • Function DOC tip
  • Visaul Diff tool which shows two documents and differences
  • Navigator which shows (HTML DOM structure, CSS structure, PHP functions) and on click jumps to the function
  • When working on file i wanna see open path to it in file browser
    … maybe some other stuff but cant remamber :wink:

Sublime text 2 is not bad but i dont wanna pay for licence if i must develop plugins for it to have what i need in my development. I need a tool which i setup, install plugins and use.[/quote]

So, in short you want SublimeText behave like Netbeans. If you are happy with Netbeans, why not just stick with it?

0 Likes

#9

[quote=“svenax”]

[quote=“molchy”]Tested sublime text 2 and is nice but some feautures are missing which are needet for my development so will stick with Netbeans 7.1 until this feautures are in sublime text:

  • HTML ( Doesnt brake if PHP in it ), CSS, XML,JS, PHP formater as one plugin
  • Good is that code frameworks can be implemented in snippets for auto complete so thats not issue
  • Function DOC tip
  • Visaul Diff tool which shows two documents and differences
  • Navigator which shows (HTML DOM structure, CSS structure, PHP functions) and on click jumps to the function
  • When working on file i wanna see open path to it in file browser
    … maybe some other stuff but cant remamber :wink:

Sublime text 2 is not bad but i dont wanna pay for licence if i must develop plugins for it to have what i need in my development. I need a tool which i setup, install plugins and use.[/quote]

So, in short you want SublimeText behave like Netbeans. If you are happy with Netbeans, why not just stick with it?[/quote]

Sublime has some feautures which are better or new and useful also. Not all of above feautures are 100 % needet but multie purpuse Code Formater is something which every editor need. Auto compleate can be self made so their is no problem. Other stuff is good but not 100 % nesecary.

So make code formater which works HTML, PHP, CSS, XML, JS and i am happy with sublime :wink: auto compleate for Codeigniter i can make myself :wink:

0 Likes