Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to bulk format code in Sublime Text?

Is there a plugin, or setting in Sublime Text that will enable project-level code formatting and application of the .EditorConfig plugin?

I'm wondering specifically about manual application of .editorconfig preferences re-indenting multiple, deleting trailing whitespace, converting spaces to tabs, etc., across file types. To keep it basic, I'll limit my query to HTML, CSS/LESS/SASS, and JS.

like image 245
Kevin Suttle Avatar asked Feb 05 '14 20:02

Kevin Suttle


People also ask

How do I beautify the code in Sublime Text?

Ctrl+Shift+H (or Cmd+Shift+H if you're on a Mac). Right click in the current buffer and select HTML/CSS/JS Prettify -> Prettify Code . Open a HTML, CSS, JavaScript, JSON, React or Vue file, pop out the console in Sublime Text from View -> Show Console, and type view. run_command("htmlprettify") .

How do I enable auto format in Sublime Text?

Open an HTML file in sublime text. Select the file content using ctrl+A command, It selects all the content. Go to Edit Menu – Select Line + Select Reindent . This formats the HTML files.

How can I beautify PHP code in Sublime Text 3?

Usage. ctrl + shift + P and type Tidy PHP , or you can use the ctrl + alt + T keybinding.


1 Answers

There is no tool quite like this yet. There are some tools that almost do what you want. For example my not-yet-stable EditorConfig tools, eclint (not sure how stable this is), and codepainter (which works for JavaScript only).

An EditorConfig bulk reformatter would be great. If anyone finds one I didn't mention or wants to create a better one, you could probably find some help or moral support on the EditorConfig mailing list.

like image 191
Trey Hunner Avatar answered Oct 17 '22 04:10

Trey Hunner