简体   繁体   中英

Can Sublime Text 2 reformat C++ the same as Eclipse does?

I am trying to transition from Eclipse (too heavy) to Sublime for my simple C++ codes.

So far I am quite happy with Sublime Text 2, but I am completely unhappy with the indent and reformat styles.

In Eclipse you just hit a combo of keys, CMD+SHIFT+F , and the code gets magnificently readable, I have to say that the standard Edit>Line>Reindent does not quite compete. So I have tried a couple of packages for reformatting but so far I have not found anything looking like eclipse. Does anybody know of one package that does the job?

Have a look at the three styles from 1. reindent 2. eclipse 3. the package

Cheers, Roberto

在此处输入图片说明 在此处输入图片说明

在此处输入图片说明

There is a very nice plugin system EditorConfig to do source code formatting.

You create a "style" definition for you project, for example:

# 4 space indentation
[*.py]
indent_style = space
indent_size = 4

And then it can be shared across supported editors (which are many), so that all devs working on the same project can share the same specs.

You can obviously also setup global styles for yourself.

Otherwise, for the actual auto-formatting, Sublime has a handful of plugins, like this one for example

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM