Home Download Buy Blog Forum Support

clang-format plugin (from clang)

clang-format plugin (from clang)

Postby Jibz on Sun Jan 12, 2014 10:55 am

Hi,

Firstly, I have nothing to do with this plugin other than trying it out, but I figured it might be of interest to any C/C++ programmers, and possibly any plugin experts who could help improve it.

The clang compiler package includes a tool to do code formatting (clang-format), which also includes a plugin to run it from ST:

http://llvm.org/svn/llvm-project/cfe/tr ... sublime.py

I have been playing with it today (on Win7 64) and it seems to work well. I can press ctrl-shift-c and it will format the current line, or highlight something and format that.
Jibz
 
Posts: 23
Joined: Fri Feb 01, 2013 10:56 am

Re: clang-format plugin (from clang)

Postby rosshemsley on Wed Apr 16, 2014 8:01 am

Firstly, I have nothing to do with this plugin other than trying it out, but I figured it might be of interest to any C/C++ programmers, and possibly any plugin experts who could help improve it.


My thoughts exactly! I'm not sure I count as a plugin 'expert'... but I did go ahead and write a package:

https://sublime.wbond.net/packages/Clang%20Format

It offers the following extensions over the old simple plugin:

- It has far fewer bugs.
- You can select the current style from the command palette.
- You can customise the style (different indent behaviour etc.) using the standard ST
settings interface.
- It has an item in the main menu for accessing preference (shortcut keys + custom styles)
- You can set the path easily and quickly from ST.
- The shortcuts are limited to C/C++ files (so clang-format doesn't go crazy on your Python code..)
- It actually shows error output from CF. to the user (and doesn't write over your buffer if they occurred).
- You can get it on package control!

Do let me know if you find any bugs!
rosshemsley
 
Posts: 4
Joined: Mon Dec 02, 2013 6:14 pm

Re: clang-format plugin (from clang)

Postby Jibz on Mon May 05, 2014 5:45 pm

Just installed it, looks awesome so far -- great work :D
Jibz
 
Posts: 23
Joined: Fri Feb 01, 2013 10:56 am


Return to Plugin Announcements

Who is online

Users browsing this forum: Google [Bot] and 5 guests