How to use uncrustify with atom-beautify?

6.8k views Asked by At

I've been looking at the atom-beautify site and example .jsbeauifyrc, .editorconfig, and uncrustify.cgf files.

I've also reviewed the options for atom-beautify. I know I'm supposed to specify where the config file is located in the atom-beautify settings. I've tried putting a .jsbeautifyrc file, an uncrustify.cfg file, and both files in the same directory I specify in the atom-beautify settings. It doesn't have any effect. The default settings are used. I'd like to make some old C++ code look more uniform for my current project and future projects my group is working on.

  • Which file am I supposed to use?
  • What must I include in each file?
  • Where should this/these file(s) be located?
  • How do I specify the path?
  • Are there any other changes I need to make that I'm not aware of?

To sum up, I want to use uncrustify from within the Atom editor (using the atom-beautify package) to make my C++ code look nice.

3

There are 3 answers

0
kartsims On BEST ANSWER
  • Make sure uncrustify is installed on your computer, and accessible from CLI
  • In the settings for atom-beautify, go under the C++ section and type uncrustify.cfg as a Config Path
  • Place the config file name uncrustify.cfg in the root folder
  • Try beautifying your code, it should be using your config file now
0
Prathamesh More On

Download zip On Windows, download the latest version of Uncrustify here: https://sourceforge.net/projects/uncrustify/files/latest/download

Extract zip The program is a standalone exe, so just extract the downloaded uncrustify-...-win32.zip file anywhere. For this example, I'll use C:\Uncrustify. So, the uncrustify.exe would be in that directory.

Add directory to PATH System Environment Variable In Windows 7+: Type Winkey + env - Select "Edit the system environment variables"

On the Advanced tab, click the Environment Variables button at the bottom. In the System variables section at the bottom, click the Path variable, then click the Edit... button.

Click the New button, and type C:\Uncrustify, or the directory that you extracted uncrustify.exe to.

Important: Click OK to close the dialog boxes or your change will not save. Verify

In a CMD window, typing where uncrustify should return the path to the uncrustify.exe.

In my case it shows C:\Uncrustify\uncrustify.exe Close Atom and reopen it. Now you should be able to atom-beautify and it will use Uncrustify to format your selection

0
soufiane ELAMMARI On

you have to add PathVariable of uncrustify.exe (From Source AtomBeatify : https://atom.io/packages/atom-beautify ) on your system , when you upload you code to Atom click on ALT+CTRL+B it will beautify you Code .