├── .editorconfig ├── .github ├── PULL_REQUEST_TEMPLATE.md └── issue_template.md ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── configs └── uncrustify │ └── defaults.cfg ├── fmt.lua ├── help └── fmt.md └── repo.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | charset = utf-8 9 | end_of_line = lf 10 | indent_style = tab 11 | indent_size = 2 12 | insert_final_newline = true 13 | trim_trailing_whitespace = true 14 | 15 | # Ignore .md files, because 2 spaces at end-of-line has meaning 16 | [*.md] 17 | trim_trailing_whitespace = false 18 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Before submitting any changes, make sure you read [CONTRIBUTING](../CONTRIBUTING.md) 2 | -------------------------------------------------------------------------------- /.github/issue_template.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ##### fmt version: ##### 5 | 6 | 7 | 8 | ##### Expected behavior: ##### 9 | 10 | 11 | ##### Actual behavior: ##### 12 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). 6 | 7 | ## [Unreleased] 8 | 9 | ## [3.2.0] - 2017-01-07 10 | 11 | ### Added 12 | 13 | * Support to use an unsupported formatter, or otherwise just override default args. 14 | The setting looks like `"fmt|filetype": "clicmd arg1 arg2 arg3 etc etc"` 15 | 16 | ### Changed 17 | 18 | * Spaces to tabs 19 | * From using the file's path to its abspath 20 | 21 | ## [3.1.1] - 2017-12-17 22 | 23 | ### Fixed 24 | 25 | * Nested table bug 26 | 27 | ## [3.1.0] - 2017-12-17 28 | 29 | ### Added 30 | 31 | * The `fmt unsetall formattername` command, which unsets all settings the specified formatter is currently set to. 32 | 33 | ## [3.0.0] - 2017-12-13 34 | 35 | ### Added 36 | 37 | * Tab support for Luafmt (new feature in the formatter itself) 38 | * The `fmt setall formattername` command 39 | * The `fmt formattername` command, so that the specified formatter can be run without affecting your settings 40 | 41 | ### Changed 42 | 43 | * How the settings work, so now each language gets its own line in `settings.json`, instead of each formatter. Example: `"css-formatter": "csscomb"` 44 | * How `fmt list` output looks, so that it now displays much more information 45 | 46 | ## [2.4.0] - 2017-12-10 47 | 48 | ### Added 49 | 50 | * Fprettify support 51 | * Dartfmt support 52 | * Tidy support 53 | 54 | ### Fixed 55 | 56 | * Missing filetype support (CSS and HTML) for js-beautify 57 | 58 | ## [2.3.0] - 2017-11-29 59 | 60 | ### Added 61 | 62 | * Rufo support 63 | * Beautysh support 64 | * Dfmt support 65 | * Tsfmt support 66 | 67 | ### Changed 68 | 69 | * Shortened the message you get when you do `fmt list` (doesn't change the log 70 | output) 71 | 72 | ## [2.2.0] - 2017-11-26 73 | 74 | ### Added 75 | 76 | * Config file detection in the current directory (with a fallback on our bundled 77 | `fmt-micro/configs`). Currently used only on Uncrustify, but it's easy to add 78 | to others. 79 | * Add an `fmt update` command to force formatter settings to refresh. 80 | 81 | ### Changed 82 | 83 | * Move extension detection to their own functions 84 | * Updated Uncrustify config to `0.66.1` 85 | * Minor optimizations 86 | 87 | ## [2.1.0] - 2017-11-23 88 | 89 | ### Changed 90 | 91 | * The way formatters are launched, so that the more safe/portable `JobSpawn` (a 92 | Micro binding to Go's `exec.Command`) is used. 93 | * Performance improvements across the board (not benchmarked) by following 94 | advice at https://springrts.com/wiki/Lua_Performance 95 | 96 | ## [2.0.2] - 2017-11-18 97 | 98 | ### Changed 99 | 100 | * The arguments, so now they're held in a table, to make adding them not require 101 | so much careful string concatenation. 102 | 103 | ### Fixed 104 | 105 | * Windows support 106 | 107 | ## [2.0.1] - 2017-11-18 108 | 109 | ### Changed 110 | 111 | * The two python formatters into one line like the `go` formatters. 112 | 113 | ### Fixed 114 | 115 | * A whitespace error in the command. 116 | 117 | ## [2.0.0] - 2017-11-18 118 | 119 | ### Added 120 | 121 | * The ability to have duplicate supported languages from formatters, which makes 122 | adding new formatters even safer/easier. 123 | * This changelog :smile: 124 | * The `fmt-onsave` option, to disable formatting on-save (on by default). 125 | * A new `fmt list` command, which prints the supported formatters (and their 126 | on/off status) to Micro's log in a pretty table. 127 | * Any output from the formatter is printed to Micro's log for easier debugging. 128 | * `goimports` formatter for alternative `Go` support 129 | * `htmlbeautifier` formatter for `HTML` support 130 | * `coffee-fmt` formatter for `CoffeeScript` support 131 | * `cljfmt` formatter for `Clojure` support 132 | * `elm-format` formatter for `Elm` support 133 | * `clang-format` formatter for alternative `C`, `C++`, and `Objective-C` support 134 | * `pug-beautifier-cli` formatter for `Pug` (previously `Jade`) support 135 | * `latexindent.pl` formatter for `LaTeX` support 136 | * `CSScomb` formatter for alternative `CSS` support 137 | * `marko-prettyprint` formatter for `Marko` support 138 | * `ocp-indent` formatter for `OCaml` support 139 | * `align-yaml` formatter for `YAML` support 140 | * `perltidy` formatter for `Perl` support 141 | * `stylish-haskell` formatter for `Haskell` support 142 | * `puppet-lint` formatter for `Puppet` support 143 | * `js-beautify` formatter for alternative `Javascript` support 144 | * `autopep8` formatter for alternative `Python` support 145 | * Some more info to `CONTRIBUTING.md` 146 | 147 | ### Changed 148 | 149 | * The execution of the actual command, from Lua's `io.popen()`, to Micro's 150 | `JobStart()`, which should improve cross-platform support. 151 | * The `fmt` command now runs the formatter on the current file. 152 | * Applied as many [luacheck](https://github.com/mpeterv/luacheck) 153 | recommendations as possible, aka change stuff to `local` 154 | * Formatted all the markdown files with the Prettier formatter 155 | 156 | ## [1.3.0] - 2017-11-11 157 | 158 | ### Added 159 | 160 | * The full command to Micro's log. 161 | * Users settings in the formatter arguments, where possible. 162 | * Python support via the `yapf` formatter. 163 | * PHP support via the `php-cs-fixer` formatter. 164 | * A link to `CONTRIBUTING.md` in the pull request template. 165 | * A `.gitignore` to hide a simple script I use for testing. 166 | * All the languages supported by `uncrustify`, and its `defaults.cfg` config 167 | file. 168 | 169 | ### Changed 170 | 171 | * The "how to add a formatter" comments got moved from the code to 172 | [CONTRIBUTING.md](./CONTRIBUTING.md) 173 | * To using the `CurView()` passed from onSave instead of manually calling 174 | `CurView()` 175 | * `fmt.lua` formatted with luafmt. 176 | * The name of Crystal's formatter in the README. 177 | * Capitalized the languages in the README. 178 | 179 | ### Fixed 180 | 181 | * The `if` check to see if the current settings match the ones used by the fmt 182 | args. 183 | 184 | ### Removed 185 | 186 | * The redundant psudo-contributing guide in the pull request template. 187 | 188 | ## [1.2.1] - 2017-11-09 189 | 190 | ### Added 191 | 192 | * The fact that markdown works with Prettier to the README. 193 | * A literal file extension detection fallback for when Micro returns `Unknown` 194 | on the filetype. 195 | 196 | ## [1.2.0] - 2017-11-07 197 | 198 | ### Added 199 | 200 | * Markdown to Prettier's file-type support. 201 | 202 | ## [1.1.1] - 2017-11-07 203 | 204 | ### Added 205 | 206 | * Pull request template for Github. 207 | * Issue template for Github. 208 | 209 | ### Fixed 210 | 211 | * Crystal actually uses the correct command now.. 212 | 213 | ## [1.1.0] - 2017-11-07 214 | 215 | ### Added 216 | 217 | * Crystal formatting. 218 | 219 | ### Changed 220 | 221 | * Flipped the table to hopefully look better. 222 | 223 | ## [1.0.1] - 2017-11-07 224 | 225 | ### Fixed 226 | 227 | * Rubocop 228 | * Luafmt 229 | 230 | ## 1.0.0 - 2017-11-06 231 | 232 | First release 233 | 234 | [unreleased]: https://github.com/sum01/fmt-micro/compare/v3.2.0...HEAD 235 | [3.2.0]: https://github.com/sum01/fmt-micro/compare/v3.1.1...v3.2.0 236 | [3.1.1]: https://github.com/sum01/fmt-micro/compare/v3.1.0...v3.1.1 237 | [3.1.0]: https://github.com/sum01/fmt-micro/compare/v3.0.0...v3.1.0 238 | [3.0.0]: https://github.com/sum01/fmt-micro/compare/v2.4.0...v3.0.0 239 | [2.4.0]: https://github.com/sum01/fmt-micro/compare/v2.3.0...v2.4.0 240 | [2.3.0]: https://github.com/sum01/fmt-micro/compare/v2.2.0...v2.3.0 241 | [2.2.0]: https://github.com/sum01/fmt-micro/compare/v2.1.0...v2.2.0 242 | [2.1.0]: https://github.com/sum01/fmt-micro/compare/v2.0.2...v2.1.0 243 | [2.0.2]: https://github.com/sum01/fmt-micro/compare/v2.0.1...v2.0.2 244 | [2.0.1]: https://github.com/sum01/fmt-micro/compare/v2.0.0...v2.0.1 245 | [2.0.0]: https://github.com/sum01/fmt-micro/compare/v1.3.0...v2.0.0 246 | [1.3.0]: https://github.com/sum01/fmt-micro/compare/v1.2.1...v1.3.0 247 | [1.2.1]: https://github.com/sum01/fmt-micro/compare/v1.2.0...v1.2.1 248 | [1.2.0]: https://github.com/sum01/fmt-micro/compare/v1.1.1...v1.2.0 249 | [1.1.1]: https://github.com/sum01/fmt-micro/compare/v1.1.0...v1.1.1 250 | [1.1.0]: https://github.com/sum01/fmt-micro/compare/v1.0.1...v1.1.0 251 | [1.0.1]: https://github.com/sum01/fmt-micro/compare/v1.0.0...v1.0.1 252 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Everything below assumes you're using 4 | [the Micro text-editor](https://github.com/zyedidia/micro) and this `fmt` 5 | plugin. 6 | 7 | **Tooling for contributions:** 8 | 9 | * Use the [editorconfig](http://editorconfig.org/) plugin to keep everything 10 | uniform, which can be installed by doing `plugin install editorconfig` 11 | * Download and use [luafmt](https://github.com/trixnz/lua-fmt) if you're editing a `.lua` 12 | file, which can be run with `fmt luafmt` 13 | * Download and use [prettier](https://github.com/prettier/prettier) if you're editing a `.md` 14 | file, which can be run with `fmt prettier` 15 | 16 | ## Git workflow 17 | 18 | First fork the repo, create a branch from `master`, push your changes to your repo, then submit a PR. 19 | 20 | Please don't commit tons of changes in one big commit. Instead, use `git add -p` to selectively add lines. 21 | 22 | When making changes, put a short blurb about it under `Unreleased` in the `CHANGELOG.md`. 23 | Make sure to adhear to the [Keep a changelog](http://keepachangelog.com/en/1.0.0/) format. 24 | 25 | Changes to `.md` files can be left out of the changelog. 26 | 27 | ## Adding another formatter 28 | 29 | To see if Micro supports the filetype, open the file and run `show filetype`. 30 | If the filetype is not known by Micro (displayed as `Unknown`), then use the file extension without the period as the "language". 31 | 32 | The `insert()` function is used to insert a formatter into the table. 33 | 34 | ### Using insert 35 | 36 | Both `filetype` and/or `args` can be in tables for multiple filetypes or args. 37 | 38 | If no args are needed, don't put any in. So no empty string for args, just leave 39 | it out. 40 | 41 | Do NOT concat any args/filetypes, even when one arg depends on another. 42 | Everything must be seperate strings. 43 | 44 | If an arg depends on another, put them in order, such as `"--arg", "arginput"` 45 | 46 | Note that, regardless of how you structure the `insert()` code, the file path is always the last "argument". 47 | If you have an arg that requires the filepath, then put it at the very end. 48 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # fmt-micro 2 | 3 | [![GitHub tag](https://img.shields.io/github/tag/sum01/fmt-micro.svg)](https://github.com/sum01/fmt-micro/releases) [![Gitter](https://img.shields.io/gitter/room/fmt-micro/general.svg)](https://gitter.im/fmt-micro/general?utm_source=share-link&utm_medium=link&utm_campaign=share-link) 4 | 5 | This is a multi-language formatting plugin for the [Micro text-editor.](https://github.com/zyedidia/micro) 6 | 7 | This plugin does NOT bundle any formatters, so you must install whichever you want to use. 8 | 9 | **Installation:** Just run `plugin install fmt` and restart Micro :+1: 10 | 11 | ## Language Support 12 | 13 | Is your favorite formatter missing? Make a request in [the issue tracker](https://github.com/sum01/fmt-micro/issues), or [submit a PR](./CONTRIBUTING.md#adding-another-formatter) :smile: 14 | 15 | | Language | Supported Formatter(s) | 16 | | :----------- | :-------------------------------------- | 17 | | C | [clang-format], [uncrustify] | 18 | | C# | [uncrustify] | 19 | | C++ | [clang-format], [uncrustify] | 20 | | CSS | [csscomb], [js-beautify], [prettier] | 21 | | Clojure | [cljfmt] | 22 | | CoffeeScript | [coffee-fmt] | 23 | | Crystal | [crystal] | 24 | | D | [dfmt], [uncrustify] | 25 | | Dart | [dartfmt] | 26 | | Elm | [elm-format] | 27 | | Fish | [fish_indent] | 28 | | Flow | [prettier] | 29 | | Fortran | [fprettify] | 30 | | Go | [gofmt], [goimports] | 31 | | GraphQL | [prettier] | 32 | | HTML | [htmlbeautifier], [js-beautify], [tidy] | 33 | | Haskell | [stylish-haskell] | 34 | | JSON | [prettier] | 35 | | JSX | [prettier] | 36 | | Java | [uncrustify] | 37 | | JavaScript | [js-beautify], [prettier] | 38 | | LaTeX | [latexindent] | 39 | | Less | [prettier] | 40 | | Lua | [luafmt] | 41 | | Markdown | [prettier] | 42 | | Marko | [marko-prettyprint] | 43 | | OCaml | [ocp-indent] | 44 | | Objective-C | [clang-format], [uncrustify] | 45 | | PHP | [php-cs-fixer] | 46 | | Pawn | [uncrustify] | 47 | | Perl | [perltidy] | 48 | | Pug | [pug-beautifier-cli] | 49 | | Puppet | [puppet-lint] | 50 | | Python | [autopep8], [yapf] | 51 | | Ruby | [rubocop], [rufo] | 52 | | Rust | [rustfmt] | 53 | | Sass | [prettier] | 54 | | Shell | [beautysh], [sh] | 55 | | TypeScript | [prettier], [tsfmt] | 56 | | Vala | [uncrustify] | 57 | | XML | [tidy] | 58 | | YAML | [align-yaml] | 59 | 60 | ### Usage 61 | 62 | The formatter will run on-save, unless `fmt-onsave` is set to false. 63 | 64 | Run `help fmt` to bring up a help file while in Micro. 65 | 66 | #### Commands 67 | 68 | * `fmt` to run the formatter on the current file. 69 | * `fmt formattername` to run the specified formatter on the current file without affecting your settings. 70 | * `fmt list` to output the supported formatters to Micro's log. 71 | * `fmt update` to force an update of the in-memory formatter settings. 72 | Useful for after adding a config file, or changing editor settings. 73 | * `fmt setall formattername` to set the specified formatter to be used in all the options of its supported language types. 74 | * `fmt unsetall formattername` to unset all settings the specified formatter is currently set to. 75 | This is useful for if you uninstalled a formatter. 76 | 77 | #### Using Custom Formatter/Args 78 | 79 | You can add your own formatter, or just use different args, by adding its command (and filetype) into `settings.json` 80 | The format looks like `"fmt|js": "prettier --write"` in your `settings.json`. 81 | 82 | Note that you must use the filetype detected by Micro, and if it's `Unknown` then use it's literal filetype extension (ex: `p` for Pawn) 83 | You can check a file's type by running `show filetype` 84 | 85 | 86 | 87 | [align-yaml]: https://github.com/jonschlinkert/align-yaml 88 | [autopep8]: https://github.com/hhatto/autopep8 89 | [beautysh]: https://github.com/bemeurer/beautysh 90 | [clang-format]: https://clang.llvm.org/docs/ClangFormat.html 91 | [cljfmt]: https://github.com/snoe/node-cljfmt 92 | [coffee-fmt]: https://github.com/sterpe/coffee-fmt 93 | [crystal]: https://github.com/crystal-lang/crystal 94 | [csscomb]: https://github.com/csscomb/csscomb.js 95 | [dartfmt]: https://github.com/dart-lang/dart_style 96 | [dfmt]: https://github.com/dlang-community/dfmt 97 | [elm-format]: https://github.com/avh4/elm-format 98 | [fish_indent]: https://fishshell.com/docs/current/commands.html#fish_indent 99 | [gofmt]: https://golang.org/cmd/gofmt/ 100 | [goimports]: https://godoc.org/golang.org/x/tools/cmd/goimports 101 | [htmlbeautifier]: https://github.com/threedaymonk/htmlbeautifier 102 | [js-beautify]: https://github.com/beautify-web/js-beautify 103 | [latexindent]: https://github.com/cmhughes/latexindent.pl 104 | [luafmt]: https://github.com/trixnz/lua-fmt 105 | [marko-prettyprint]: https://github.com/marko-js/marko-prettyprint 106 | [ocp-indent]: https://www.typerex.org/ocp-indent.html 107 | [perltidy]: http://perltidy.sourceforge.net/ 108 | [pug-beautifier-cli]: https://github.com/lgaticaq/pug-beautifier-cli 109 | [fprettify]: https://github.com/pseewald/fprettify 110 | [rubocop]: https://github.com/bbatsov/rubocop 111 | [rufo]: https://github.com/ruby-formatter/rufo 112 | [rustfmt]: https://github.com/rust-lang-nursery/rustfmt 113 | [sh]: https://github.com/mvdan/sh 114 | [stylish-haskell]: https://github.com/jaspervdj/stylish-haskell 115 | [tidy]: http://www.html-tidy.org/ 116 | [tsfmt]: https://github.com/vvakame/typescript-formatter 117 | [php-cs-fixer]: https://github.com/friendsofphp/PHP-CS-Fixer 118 | [prettier]: https://github.com/prettier/prettier 119 | [puppet-lint]: http://puppet-lint.com/ 120 | [uncrustify]: https://github.com/uncrustify/uncrustify 121 | [yapf]: https://github.com/google/yapf 122 | -------------------------------------------------------------------------------- /configs/uncrustify/defaults.cfg: -------------------------------------------------------------------------------- 1 | # Uncrustify-0.66.1 2 | 3 | # 4 | # General options 5 | # 6 | 7 | # The type of line endings. Default=Auto. 8 | newlines = auto # auto/lf/crlf/cr 9 | 10 | # The original size of tabs in the input. Default=8. 11 | input_tab_size = 8 # unsigned number 12 | 13 | # The size of tabs in the output (only used if align_with_tabs=true). Default=8. 14 | output_tab_size = 8 # unsigned number 15 | 16 | # The ASCII value of the string escape char, usually 92 (\) or 94 (^). (Pawn). 17 | string_escape_char = 92 # unsigned number 18 | 19 | # Alternate string escape char for Pawn. Only works right before the quote char. 20 | string_escape_char2 = 0 # unsigned number 21 | 22 | # Replace tab characters found in string literals with the escape sequence \t instead. 23 | string_replace_tab_chars = false # false/true 24 | 25 | # Allow interpreting '>=' and '>>=' as part of a template in 'void f(list>=val);'. 26 | # If True, 'assert(x<0 && y>=3)' will be broken. Default=False 27 | # Improvements to template detection may make this option obsolete. 28 | tok_split_gte = false # false/true 29 | 30 | # Override the default ' *INDENT-OFF*' in comments for disabling processing of part of the file. 31 | disable_processing_cmt = "" # string 32 | 33 | # Override the default ' *INDENT-ON*' in comments for enabling processing of part of the file. 34 | enable_processing_cmt = "" # string 35 | 36 | # Enable parsing of digraphs. Default=False. 37 | enable_digraphs = false # false/true 38 | 39 | # Control what to do with the UTF-8 BOM (recommend 'remove'). 40 | utf8_bom = ignore # ignore/add/remove/force 41 | 42 | # If the file contains bytes with values between 128 and 255, but is not UTF-8, then output as UTF-8. 43 | utf8_byte = false # false/true 44 | 45 | # Force the output encoding to UTF-8. 46 | utf8_force = false # false/true 47 | 48 | # 49 | # Spacing options 50 | # 51 | 52 | # Add or remove space around arithmetic operator '+', '-', '/', '*', etc 53 | # also '>>>' '<<' '>>' '%' '|'. 54 | sp_arith = ignore # ignore/add/remove/force 55 | 56 | # Add or remove space around arithmetic operator '+' and '-'. Overrides sp_arith 57 | sp_arith_additive = ignore # ignore/add/remove/force 58 | 59 | # Add or remove space around assignment operator '=', '+=', etc. 60 | sp_assign = ignore # ignore/add/remove/force 61 | 62 | # Add or remove space around '=' in C++11 lambda capture specifications. Overrides sp_assign. 63 | sp_cpp_lambda_assign = ignore # ignore/add/remove/force 64 | 65 | # Add or remove space after the capture specification in C++11 lambda. 66 | sp_cpp_lambda_paren = ignore # ignore/add/remove/force 67 | 68 | # Add or remove space around assignment operator '=' in a prototype. 69 | sp_assign_default = ignore # ignore/add/remove/force 70 | 71 | # Add or remove space before assignment operator '=', '+=', etc. Overrides sp_assign. 72 | sp_before_assign = ignore # ignore/add/remove/force 73 | 74 | # Add or remove space after assignment operator '=', '+=', etc. Overrides sp_assign. 75 | sp_after_assign = ignore # ignore/add/remove/force 76 | 77 | # Add or remove space in 'NS_ENUM ('. 78 | sp_enum_paren = ignore # ignore/add/remove/force 79 | 80 | # Add or remove space around assignment '=' in enum. 81 | sp_enum_assign = ignore # ignore/add/remove/force 82 | 83 | # Add or remove space before assignment '=' in enum. Overrides sp_enum_assign. 84 | sp_enum_before_assign = ignore # ignore/add/remove/force 85 | 86 | # Add or remove space after assignment '=' in enum. Overrides sp_enum_assign. 87 | sp_enum_after_assign = ignore # ignore/add/remove/force 88 | 89 | # Add or remove space around assignment ':' in enum. 90 | sp_enum_colon = ignore # ignore/add/remove/force 91 | 92 | # Add or remove space around preprocessor '##' concatenation operator. Default=Add. 93 | sp_pp_concat = add # ignore/add/remove/force 94 | 95 | # Add or remove space after preprocessor '#' stringify operator. Also affects the '#@' charizing operator. 96 | sp_pp_stringify = ignore # ignore/add/remove/force 97 | 98 | # Add or remove space before preprocessor '#' stringify operator as in '#define x(y) L#y'. 99 | sp_before_pp_stringify = ignore # ignore/add/remove/force 100 | 101 | # Add or remove space around boolean operators '&&' and '||'. 102 | sp_bool = ignore # ignore/add/remove/force 103 | 104 | # Add or remove space around compare operator '<', '>', '==', etc. 105 | sp_compare = ignore # ignore/add/remove/force 106 | 107 | # Add or remove space inside '(' and ')'. 108 | sp_inside_paren = ignore # ignore/add/remove/force 109 | 110 | # Add or remove space between nested parens: '((' vs ') )'. 111 | sp_paren_paren = ignore # ignore/add/remove/force 112 | 113 | # Add or remove space between back-to-back parens: ')(' vs ') ('. 114 | sp_cparen_oparen = ignore # ignore/add/remove/force 115 | 116 | # Whether to balance spaces inside nested parens. 117 | sp_balance_nested_parens = false # false/true 118 | 119 | # Add or remove space between ')' and '{'. 120 | sp_paren_brace = ignore # ignore/add/remove/force 121 | 122 | # Add or remove space before pointer star '*'. 123 | sp_before_ptr_star = ignore # ignore/add/remove/force 124 | 125 | # Add or remove space before pointer star '*' that isn't followed by a variable name 126 | # If set to 'ignore', sp_before_ptr_star is used instead. 127 | sp_before_unnamed_ptr_star = ignore # ignore/add/remove/force 128 | 129 | # Add or remove space between pointer stars '*'. 130 | sp_between_ptr_star = ignore # ignore/add/remove/force 131 | 132 | # Add or remove space after pointer star '*', if followed by a word. 133 | sp_after_ptr_star = ignore # ignore/add/remove/force 134 | 135 | # Add or remove space after pointer star '*', if followed by a qualifier. 136 | sp_after_ptr_star_qualifier = ignore # ignore/add/remove/force 137 | 138 | # Add or remove space after a pointer star '*', if followed by a func proto/def. 139 | sp_after_ptr_star_func = ignore # ignore/add/remove/force 140 | 141 | # Add or remove space after a pointer star '*', if followed by an open paren (function types). 142 | sp_ptr_star_paren = ignore # ignore/add/remove/force 143 | 144 | # Add or remove space before a pointer star '*', if followed by a func proto/def. 145 | sp_before_ptr_star_func = ignore # ignore/add/remove/force 146 | 147 | # Add or remove space before a reference sign '&'. 148 | sp_before_byref = ignore # ignore/add/remove/force 149 | 150 | # Add or remove space before a reference sign '&' that isn't followed by a variable name. 151 | # If set to 'ignore', sp_before_byref is used instead. 152 | sp_before_unnamed_byref = ignore # ignore/add/remove/force 153 | 154 | # Add or remove space after reference sign '&', if followed by a word. 155 | sp_after_byref = ignore # ignore/add/remove/force 156 | 157 | # Add or remove space after a reference sign '&', if followed by a func proto/def. 158 | sp_after_byref_func = ignore # ignore/add/remove/force 159 | 160 | # Add or remove space before a reference sign '&', if followed by a func proto/def. 161 | sp_before_byref_func = ignore # ignore/add/remove/force 162 | 163 | # Add or remove space between type and word. Default=Force. 164 | sp_after_type = force # ignore/add/remove/force 165 | 166 | # Add or remove space before the paren in the D constructs 'template Foo(' and 'class Foo('. 167 | sp_before_template_paren = ignore # ignore/add/remove/force 168 | 169 | # Add or remove space in 'template <' vs 'template<'. 170 | # If set to ignore, sp_before_angle is used. 171 | sp_template_angle = ignore # ignore/add/remove/force 172 | 173 | # Add or remove space before '<>'. 174 | sp_before_angle = ignore # ignore/add/remove/force 175 | 176 | # Add or remove space inside '<' and '>'. 177 | sp_inside_angle = ignore # ignore/add/remove/force 178 | 179 | # Add or remove space between '<>' and ':'. 180 | sp_angle_colon = ignore # ignore/add/remove/force 181 | 182 | # Add or remove space after '<>'. 183 | sp_after_angle = ignore # ignore/add/remove/force 184 | 185 | # Add or remove space between '<>' and '(' as found in 'new List(foo);'. 186 | sp_angle_paren = ignore # ignore/add/remove/force 187 | 188 | # Add or remove space between '<>' and '()' as found in 'new List();'. 189 | sp_angle_paren_empty = ignore # ignore/add/remove/force 190 | 191 | # Add or remove space between '<>' and a word as in 'List m;' or 'template static ...'. 192 | sp_angle_word = ignore # ignore/add/remove/force 193 | 194 | # Add or remove space between '>' and '>' in '>>' (template stuff C++/C# only). Default=Add. 195 | sp_angle_shift = add # ignore/add/remove/force 196 | 197 | # Permit removal of the space between '>>' in 'foo >' (C++11 only). Default=False. 198 | # sp_angle_shift cannot remove the space without this option. 199 | sp_permit_cpp11_shift = false # false/true 200 | 201 | # Add or remove space before '(' of 'if', 'for', 'switch', 'while', etc. 202 | sp_before_sparen = ignore # ignore/add/remove/force 203 | 204 | # Add or remove space inside if-condition '(' and ')'. 205 | sp_inside_sparen = ignore # ignore/add/remove/force 206 | 207 | # Add or remove space before if-condition ')'. Overrides sp_inside_sparen. 208 | sp_inside_sparen_close = ignore # ignore/add/remove/force 209 | 210 | # Add or remove space after if-condition '('. Overrides sp_inside_sparen. 211 | sp_inside_sparen_open = ignore # ignore/add/remove/force 212 | 213 | # Add or remove space after ')' of 'if', 'for', 'switch', and 'while', etc. 214 | sp_after_sparen = ignore # ignore/add/remove/force 215 | 216 | # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while', etc. 217 | sp_sparen_brace = ignore # ignore/add/remove/force 218 | 219 | # Add or remove space between 'invariant' and '(' in the D language. 220 | sp_invariant_paren = ignore # ignore/add/remove/force 221 | 222 | # Add or remove space after the ')' in 'invariant (C) c' in the D language. 223 | sp_after_invariant_paren = ignore # ignore/add/remove/force 224 | 225 | # Add or remove space before empty statement ';' on 'if', 'for' and 'while'. 226 | sp_special_semi = ignore # ignore/add/remove/force 227 | 228 | # Add or remove space before ';'. Default=Remove. 229 | sp_before_semi = remove # ignore/add/remove/force 230 | 231 | # Add or remove space before ';' in non-empty 'for' statements. 232 | sp_before_semi_for = ignore # ignore/add/remove/force 233 | 234 | # Add or remove space before a semicolon of an empty part of a for statement. 235 | sp_before_semi_for_empty = ignore # ignore/add/remove/force 236 | 237 | # Add or remove space after ';', except when followed by a comment. Default=Add. 238 | sp_after_semi = add # ignore/add/remove/force 239 | 240 | # Add or remove space after ';' in non-empty 'for' statements. Default=Force. 241 | sp_after_semi_for = force # ignore/add/remove/force 242 | 243 | # Add or remove space after the final semicolon of an empty part of a for statement: for ( ; ; ). 244 | sp_after_semi_for_empty = ignore # ignore/add/remove/force 245 | 246 | # Add or remove space before '[' (except '[]'). 247 | sp_before_square = ignore # ignore/add/remove/force 248 | 249 | # Add or remove space before '[]'. 250 | sp_before_squares = ignore # ignore/add/remove/force 251 | 252 | # Add or remove space inside a non-empty '[' and ']'. 253 | sp_inside_square = ignore # ignore/add/remove/force 254 | 255 | # Add or remove space after ',', 'a,b' vs 'a, b'. 256 | sp_after_comma = ignore # ignore/add/remove/force 257 | 258 | # Add or remove space before ','. Default=Remove. 259 | sp_before_comma = remove # ignore/add/remove/force 260 | 261 | # Add or remove space between ',' and ']' in multidimensional array type 'int[,,]'. Only for C#. 262 | sp_after_mdatype_commas = ignore # ignore/add/remove/force 263 | 264 | # Add or remove space between '[' and ',' in multidimensional array type 'int[,,]'. Only for C#. 265 | sp_before_mdatype_commas = ignore # ignore/add/remove/force 266 | 267 | # Add or remove space between ',' in multidimensional array type 'int[,,]'. Only for C#. 268 | sp_between_mdatype_commas = ignore # ignore/add/remove/force 269 | 270 | # Add or remove space between an open paren and comma: '(,' vs '( ,'. Default=Force. 271 | sp_paren_comma = force # ignore/add/remove/force 272 | 273 | # Add or remove space before the variadic '...' when preceded by a non-punctuator. 274 | sp_before_ellipsis = ignore # ignore/add/remove/force 275 | 276 | # Add or remove space after class ':'. 277 | sp_after_class_colon = ignore # ignore/add/remove/force 278 | 279 | # Add or remove space before class ':'. 280 | sp_before_class_colon = ignore # ignore/add/remove/force 281 | 282 | # Add or remove space after class constructor ':'. 283 | sp_after_constr_colon = ignore # ignore/add/remove/force 284 | 285 | # Add or remove space before class constructor ':'. 286 | sp_before_constr_colon = ignore # ignore/add/remove/force 287 | 288 | # Add or remove space before case ':'. Default=Remove. 289 | sp_before_case_colon = remove # ignore/add/remove/force 290 | 291 | # Add or remove space between 'operator' and operator sign. 292 | sp_after_operator = ignore # ignore/add/remove/force 293 | 294 | # Add or remove space between the operator symbol and the open paren, as in 'operator ++('. 295 | sp_after_operator_sym = ignore # ignore/add/remove/force 296 | 297 | # Overrides sp_after_operator_sym when the operator has no arguments, as in 'operator *()'. 298 | sp_after_operator_sym_empty = ignore # ignore/add/remove/force 299 | 300 | # Add or remove space after C/D cast, i.e. 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a'. 301 | sp_after_cast = ignore # ignore/add/remove/force 302 | 303 | # Add or remove spaces inside cast parens. 304 | sp_inside_paren_cast = ignore # ignore/add/remove/force 305 | 306 | # Add or remove space between the type and open paren in a C++ cast, i.e. 'int(exp)' vs 'int (exp)'. 307 | sp_cpp_cast_paren = ignore # ignore/add/remove/force 308 | 309 | # Add or remove space between 'sizeof' and '('. 310 | sp_sizeof_paren = ignore # ignore/add/remove/force 311 | 312 | # Add or remove space after the tag keyword (Pawn). 313 | sp_after_tag = ignore # ignore/add/remove/force 314 | 315 | # Add or remove space inside enum '{' and '}'. 316 | sp_inside_braces_enum = ignore # ignore/add/remove/force 317 | 318 | # Add or remove space inside struct/union '{' and '}'. 319 | sp_inside_braces_struct = ignore # ignore/add/remove/force 320 | 321 | # Add or remove space after open brace in an unnamed temporary direct-list-initialization. 322 | sp_after_type_brace_init_lst_open = ignore # ignore/add/remove/force 323 | 324 | # Add or remove space before close brace in an unnamed temporary direct-list-initialization. 325 | sp_before_type_brace_init_lst_close = ignore # ignore/add/remove/force 326 | 327 | # Add or remove space inside an unnamed temporary direct-list-initialization. 328 | sp_inside_type_brace_init_lst = ignore # ignore/add/remove/force 329 | 330 | # Add or remove space inside '{' and '}'. 331 | sp_inside_braces = ignore # ignore/add/remove/force 332 | 333 | # Add or remove space inside '{}'. 334 | sp_inside_braces_empty = ignore # ignore/add/remove/force 335 | 336 | # Add or remove space between return type and function name 337 | # A minimum of 1 is forced except for pointer return types. 338 | sp_type_func = ignore # ignore/add/remove/force 339 | 340 | # Add or remove space between type and open brace of an unnamed temporary direct-list-initialization. 341 | sp_type_brace_init_lst = ignore # ignore/add/remove/force 342 | 343 | # Add or remove space between function name and '(' on function declaration. 344 | sp_func_proto_paren = ignore # ignore/add/remove/force 345 | 346 | # Add or remove space between function name and '()' on function declaration without parameters. 347 | sp_func_proto_paren_empty = ignore # ignore/add/remove/force 348 | 349 | # Add or remove space between function name and '(' on function definition. 350 | sp_func_def_paren = ignore # ignore/add/remove/force 351 | 352 | # Add or remove space between function name and '()' on function definition without parameters. 353 | sp_func_def_paren_empty = ignore # ignore/add/remove/force 354 | 355 | # Add or remove space inside empty function '()'. 356 | sp_inside_fparens = ignore # ignore/add/remove/force 357 | 358 | # Add or remove space inside function '(' and ')'. 359 | sp_inside_fparen = ignore # ignore/add/remove/force 360 | 361 | # Add or remove space inside the first parens in the function type: 'void (*x)(...)'. 362 | sp_inside_tparen = ignore # ignore/add/remove/force 363 | 364 | # Add or remove between the parens in the function type: 'void (*x)(...)'. 365 | sp_after_tparen_close = ignore # ignore/add/remove/force 366 | 367 | # Add or remove space between ']' and '(' when part of a function call. 368 | sp_square_fparen = ignore # ignore/add/remove/force 369 | 370 | # Add or remove space between ')' and '{' of function. 371 | sp_fparen_brace = ignore # ignore/add/remove/force 372 | 373 | # Java: Add or remove space between ')' and '{{' of double brace initializer. 374 | sp_fparen_dbrace = ignore # ignore/add/remove/force 375 | 376 | # Add or remove space between function name and '(' on function calls. 377 | sp_func_call_paren = ignore # ignore/add/remove/force 378 | 379 | # Add or remove space between function name and '()' on function calls without parameters. 380 | # If set to 'ignore' (the default), sp_func_call_paren is used. 381 | sp_func_call_paren_empty = ignore # ignore/add/remove/force 382 | 383 | # Add or remove space between the user function name and '(' on function calls 384 | # You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file. 385 | sp_func_call_user_paren = ignore # ignore/add/remove/force 386 | 387 | # Add or remove space between a constructor/destructor and the open paren. 388 | sp_func_class_paren = ignore # ignore/add/remove/force 389 | 390 | # Add or remove space between a constructor without parameters or destructor and '()'. 391 | sp_func_class_paren_empty = ignore # ignore/add/remove/force 392 | 393 | # Add or remove space between 'return' and '('. 394 | sp_return_paren = ignore # ignore/add/remove/force 395 | 396 | # Add or remove space between '__attribute__' and '('. 397 | sp_attribute_paren = ignore # ignore/add/remove/force 398 | 399 | # Add or remove space between 'defined' and '(' in '#if defined (FOO)'. 400 | sp_defined_paren = ignore # ignore/add/remove/force 401 | 402 | # Add or remove space between 'throw' and '(' in 'throw (something)'. 403 | sp_throw_paren = ignore # ignore/add/remove/force 404 | 405 | # Add or remove space between 'throw' and anything other than '(' as in '@throw [...];'. 406 | sp_after_throw = ignore # ignore/add/remove/force 407 | 408 | # Add or remove space between 'catch' and '(' in 'catch (something) { }' 409 | # If set to ignore, sp_before_sparen is used. 410 | sp_catch_paren = ignore # ignore/add/remove/force 411 | 412 | # Add or remove space between 'version' and '(' in 'version (something) { }' (D language) 413 | # If set to ignore, sp_before_sparen is used. 414 | sp_version_paren = ignore # ignore/add/remove/force 415 | 416 | # Add or remove space between 'scope' and '(' in 'scope (something) { }' (D language) 417 | # If set to ignore, sp_before_sparen is used. 418 | sp_scope_paren = ignore # ignore/add/remove/force 419 | 420 | # Add or remove space between 'super' and '(' in 'super (something)'. Default=Remove. 421 | sp_super_paren = remove # ignore/add/remove/force 422 | 423 | # Add or remove space between 'this' and '(' in 'this (something)'. Default=Remove. 424 | sp_this_paren = remove # ignore/add/remove/force 425 | 426 | # Add or remove space between macro and value. 427 | sp_macro = ignore # ignore/add/remove/force 428 | 429 | # Add or remove space between macro function ')' and value. 430 | sp_macro_func = ignore # ignore/add/remove/force 431 | 432 | # Add or remove space between 'else' and '{' if on the same line. 433 | sp_else_brace = ignore # ignore/add/remove/force 434 | 435 | # Add or remove space between '}' and 'else' if on the same line. 436 | sp_brace_else = ignore # ignore/add/remove/force 437 | 438 | # Add or remove space between '}' and the name of a typedef on the same line. 439 | sp_brace_typedef = ignore # ignore/add/remove/force 440 | 441 | # Add or remove space between 'catch' and '{' if on the same line. 442 | sp_catch_brace = ignore # ignore/add/remove/force 443 | 444 | # Add or remove space between '}' and 'catch' if on the same line. 445 | sp_brace_catch = ignore # ignore/add/remove/force 446 | 447 | # Add or remove space between 'finally' and '{' if on the same line. 448 | sp_finally_brace = ignore # ignore/add/remove/force 449 | 450 | # Add or remove space between '}' and 'finally' if on the same line. 451 | sp_brace_finally = ignore # ignore/add/remove/force 452 | 453 | # Add or remove space between 'try' and '{' if on the same line. 454 | sp_try_brace = ignore # ignore/add/remove/force 455 | 456 | # Add or remove space between get/set and '{' if on the same line. 457 | sp_getset_brace = ignore # ignore/add/remove/force 458 | 459 | # Add or remove space between a variable and '{' for C++ uniform initialization. Default=Add. 460 | sp_word_brace = add # ignore/add/remove/force 461 | 462 | # Add or remove space between a variable and '{' for a namespace. Default=Add. 463 | sp_word_brace_ns = add # ignore/add/remove/force 464 | 465 | # Add or remove space before the '::' operator. 466 | sp_before_dc = ignore # ignore/add/remove/force 467 | 468 | # Add or remove space after the '::' operator. 469 | sp_after_dc = ignore # ignore/add/remove/force 470 | 471 | # Add or remove around the D named array initializer ':' operator. 472 | sp_d_array_colon = ignore # ignore/add/remove/force 473 | 474 | # Add or remove space after the '!' (not) operator. Default=Remove. 475 | sp_not = remove # ignore/add/remove/force 476 | 477 | # Add or remove space after the '~' (invert) operator. Default=Remove. 478 | sp_inv = remove # ignore/add/remove/force 479 | 480 | # Add or remove space after the '&' (address-of) operator. Default=Remove 481 | # This does not affect the spacing after a '&' that is part of a type. 482 | sp_addr = remove # ignore/add/remove/force 483 | 484 | # Add or remove space around the '.' or '->' operators. Default=Remove. 485 | sp_member = remove # ignore/add/remove/force 486 | 487 | # Add or remove space after the '*' (dereference) operator. Default=Remove 488 | # This does not affect the spacing after a '*' that is part of a type. 489 | sp_deref = remove # ignore/add/remove/force 490 | 491 | # Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7'. Default=Remove. 492 | sp_sign = remove # ignore/add/remove/force 493 | 494 | # Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;'. Default=Remove. 495 | sp_incdec = remove # ignore/add/remove/force 496 | 497 | # Add or remove space before a backslash-newline at the end of a line. Default=Add. 498 | sp_before_nl_cont = add # ignore/add/remove/force 499 | 500 | # Add or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;'. 501 | sp_after_oc_scope = ignore # ignore/add/remove/force 502 | 503 | # Add or remove space after the colon in message specs 504 | # '-(int) f:(int) x;' vs '-(int) f: (int) x;'. 505 | sp_after_oc_colon = ignore # ignore/add/remove/force 506 | 507 | # Add or remove space before the colon in message specs 508 | # '-(int) f: (int) x;' vs '-(int) f : (int) x;'. 509 | sp_before_oc_colon = ignore # ignore/add/remove/force 510 | 511 | # Add or remove space after the colon in immutable dictionary expression 512 | # 'NSDictionary *test = @{@"foo" :@"bar"};'. 513 | sp_after_oc_dict_colon = ignore # ignore/add/remove/force 514 | 515 | # Add or remove space before the colon in immutable dictionary expression 516 | # 'NSDictionary *test = @{@"foo" :@"bar"};'. 517 | sp_before_oc_dict_colon = ignore # ignore/add/remove/force 518 | 519 | # Add or remove space after the colon in message specs 520 | # '[object setValue:1];' vs '[object setValue: 1];'. 521 | sp_after_send_oc_colon = ignore # ignore/add/remove/force 522 | 523 | # Add or remove space before the colon in message specs 524 | # '[object setValue:1];' vs '[object setValue :1];'. 525 | sp_before_send_oc_colon = ignore # ignore/add/remove/force 526 | 527 | # Add or remove space after the (type) in message specs 528 | # '-(int)f: (int) x;' vs '-(int)f: (int)x;'. 529 | sp_after_oc_type = ignore # ignore/add/remove/force 530 | 531 | # Add or remove space after the first (type) in message specs 532 | # '-(int) f:(int)x;' vs '-(int)f:(int)x;'. 533 | sp_after_oc_return_type = ignore # ignore/add/remove/force 534 | 535 | # Add or remove space between '@selector' and '(' 536 | # '@selector(msgName)' vs '@selector (msgName)' 537 | # Also applies to @protocol() constructs. 538 | sp_after_oc_at_sel = ignore # ignore/add/remove/force 539 | 540 | # Add or remove space between '@selector(x)' and the following word 541 | # '@selector(foo) a:' vs '@selector(foo)a:'. 542 | sp_after_oc_at_sel_parens = ignore # ignore/add/remove/force 543 | 544 | # Add or remove space inside '@selector' parens 545 | # '@selector(foo)' vs '@selector( foo )' 546 | # Also applies to @protocol() constructs. 547 | sp_inside_oc_at_sel_parens = ignore # ignore/add/remove/force 548 | 549 | # Add or remove space before a block pointer caret 550 | # '^int (int arg){...}' vs. ' ^int (int arg){...}'. 551 | sp_before_oc_block_caret = ignore # ignore/add/remove/force 552 | 553 | # Add or remove space after a block pointer caret 554 | # '^int (int arg){...}' vs. '^ int (int arg){...}'. 555 | sp_after_oc_block_caret = ignore # ignore/add/remove/force 556 | 557 | # Add or remove space between the receiver and selector in a message. 558 | # '[receiver selector ...]'. 559 | sp_after_oc_msg_receiver = ignore # ignore/add/remove/force 560 | 561 | # Add or remove space after @property. 562 | sp_after_oc_property = ignore # ignore/add/remove/force 563 | 564 | # Add or remove space around the ':' in 'b ? t : f'. 565 | sp_cond_colon = ignore # ignore/add/remove/force 566 | 567 | # Add or remove space before the ':' in 'b ? t : f'. Overrides sp_cond_colon. 568 | sp_cond_colon_before = ignore # ignore/add/remove/force 569 | 570 | # Add or remove space after the ':' in 'b ? t : f'. Overrides sp_cond_colon. 571 | sp_cond_colon_after = ignore # ignore/add/remove/force 572 | 573 | # Add or remove space around the '?' in 'b ? t : f'. 574 | sp_cond_question = ignore # ignore/add/remove/force 575 | 576 | # Add or remove space before the '?' in 'b ? t : f'. Overrides sp_cond_question. 577 | sp_cond_question_before = ignore # ignore/add/remove/force 578 | 579 | # Add or remove space after the '?' in 'b ? t : f'. Overrides sp_cond_question. 580 | sp_cond_question_after = ignore # ignore/add/remove/force 581 | 582 | # In the abbreviated ternary form (a ?: b), add/remove space between ? and :.'. Overrides all other sp_cond_* options. 583 | sp_cond_ternary_short = ignore # ignore/add/remove/force 584 | 585 | # Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here. 586 | sp_case_label = ignore # ignore/add/remove/force 587 | 588 | # Control the space around the D '..' operator. 589 | sp_range = ignore # ignore/add/remove/force 590 | 591 | # Control the spacing after ':' in 'for (TYPE VAR : EXPR)'. Only JAVA. 592 | sp_after_for_colon = ignore # ignore/add/remove/force 593 | 594 | # Control the spacing before ':' in 'for (TYPE VAR : EXPR)'. Only JAVA. 595 | sp_before_for_colon = ignore # ignore/add/remove/force 596 | 597 | # Control the spacing in 'extern (C)' (D). 598 | sp_extern_paren = ignore # ignore/add/remove/force 599 | 600 | # Control the space after the opening of a C++ comment '// A' vs '//A'. 601 | sp_cmt_cpp_start = ignore # ignore/add/remove/force 602 | 603 | # True: If space is added with sp_cmt_cpp_start, do it after doxygen sequences like '///', '///<', '//!' and '//!<'. 604 | sp_cmt_cpp_doxygen = false # false/true 605 | 606 | # True: If space is added with sp_cmt_cpp_start, do it after Qt translator or meta-data comments like '//:', '//=', and '//~'. 607 | sp_cmt_cpp_qttr = false # false/true 608 | 609 | # Controls the spaces between #else or #endif and a trailing comment. 610 | sp_endif_cmt = ignore # ignore/add/remove/force 611 | 612 | # Controls the spaces after 'new', 'delete' and 'delete[]'. 613 | sp_after_new = ignore # ignore/add/remove/force 614 | 615 | # Controls the spaces between new and '(' in 'new()'. 616 | sp_between_new_paren = ignore # ignore/add/remove/force 617 | 618 | # Controls the spaces between ')' and 'type' in 'new(foo) BAR'. 619 | sp_after_newop_paren = ignore # ignore/add/remove/force 620 | 621 | # Controls the spaces inside paren of the new operator: 'new(foo) BAR'. 622 | sp_inside_newop_paren = ignore # ignore/add/remove/force 623 | 624 | # Controls the space after open paren of the new operator: 'new(foo) BAR'. 625 | # Overrides sp_inside_newop_paren. 626 | sp_inside_newop_paren_open = ignore # ignore/add/remove/force 627 | 628 | # Controls the space before close paren of the new operator: 'new(foo) BAR'. 629 | # Overrides sp_inside_newop_paren. 630 | sp_inside_newop_paren_close = ignore # ignore/add/remove/force 631 | 632 | # Controls the spaces before a trailing or embedded comment. 633 | sp_before_tr_emb_cmt = ignore # ignore/add/remove/force 634 | 635 | # Number of spaces before a trailing or embedded comment. 636 | sp_num_before_tr_emb_cmt = 0 # unsigned number 637 | 638 | # Control space between a Java annotation and the open paren. 639 | sp_annotation_paren = ignore # ignore/add/remove/force 640 | 641 | # If True, vbrace tokens are dropped to the previous token and skipped. 642 | sp_skip_vbrace_tokens = false # false/true 643 | 644 | # If True, a is inserted after #define. 645 | force_tab_after_define = false # false/true 646 | 647 | # 648 | # Indenting 649 | # 650 | 651 | # The number of columns to indent per level. 652 | # Usually 2, 3, 4, or 8. Default=8. 653 | indent_columns = 8 # unsigned number 654 | 655 | # The continuation indent. If non-zero, this overrides the indent of '(' and '=' continuation indents. 656 | # For FreeBSD, this is set to 4. Negative value is absolute and not increased for each '(' level. 657 | indent_continue = 0 # number 658 | 659 | # The continuation indent for func_*_param if they are true. 660 | # If non-zero, this overrides the indent. 661 | indent_param = 0 # unsigned number 662 | 663 | # How to use tabs when indenting code 664 | # 0=spaces only 665 | # 1=indent with tabs to brace level, align with spaces (default) 666 | # 2=indent and align with tabs, using spaces when not on a tabstop 667 | indent_with_tabs = 1 # unsigned number 668 | 669 | # Comments that are not a brace level are indented with tabs on a tabstop. 670 | # Requires indent_with_tabs=2. If false, will use spaces. 671 | indent_cmt_with_tabs = false # false/true 672 | 673 | # Whether to indent strings broken by '\' so that they line up. 674 | indent_align_string = false # false/true 675 | 676 | # The number of spaces to indent multi-line XML strings. 677 | # Requires indent_align_string=True. 678 | indent_xml_string = 0 # unsigned number 679 | 680 | # Spaces to indent '{' from level. 681 | indent_brace = 0 # unsigned number 682 | 683 | # Whether braces are indented to the body level. 684 | indent_braces = false # false/true 685 | 686 | # Disabled indenting function braces if indent_braces is True. 687 | indent_braces_no_func = false # false/true 688 | 689 | # Disabled indenting class braces if indent_braces is True. 690 | indent_braces_no_class = false # false/true 691 | 692 | # Disabled indenting struct braces if indent_braces is True. 693 | indent_braces_no_struct = false # false/true 694 | 695 | # Indent based on the size of the brace parent, i.e. 'if' => 3 spaces, 'for' => 4 spaces, etc. 696 | indent_brace_parent = false # false/true 697 | 698 | # Indent based on the paren open instead of the brace open in '({\n', default is to indent by brace. 699 | indent_paren_open_brace = false # false/true 700 | 701 | # indent a C# delegate by another level, default is to not indent by another level. 702 | indent_cs_delegate_brace = false # false/true 703 | 704 | # Whether the 'namespace' body is indented. 705 | indent_namespace = false # false/true 706 | 707 | # Only indent one namespace and no sub-namespaces. 708 | # Requires indent_namespace=True. 709 | indent_namespace_single_indent = false # false/true 710 | 711 | # The number of spaces to indent a namespace block. 712 | indent_namespace_level = 0 # unsigned number 713 | 714 | # If the body of the namespace is longer than this number, it won't be indented. 715 | # Requires indent_namespace=True. Default=0 (no limit) 716 | indent_namespace_limit = 0 # unsigned number 717 | 718 | # Whether the 'extern "C"' body is indented. 719 | indent_extern = false # false/true 720 | 721 | # Whether the 'class' body is indented. 722 | indent_class = false # false/true 723 | 724 | # Whether to indent the stuff after a leading base class colon. 725 | indent_class_colon = false # false/true 726 | 727 | # Indent based on a class colon instead of the stuff after the colon. 728 | # Requires indent_class_colon=True. Default=False. 729 | indent_class_on_colon = false # false/true 730 | 731 | # Whether to indent the stuff after a leading class initializer colon. 732 | indent_constr_colon = false # false/true 733 | 734 | # Virtual indent from the ':' for member initializers. Default=2. 735 | indent_ctor_init_leading = 2 # unsigned number 736 | 737 | # Additional indent for constructor initializer list. 738 | # Negative values decrease indent down to the first column. Default=0. 739 | indent_ctor_init = 0 # number 740 | 741 | # False=treat 'else\nif' as 'else if' for indenting purposes 742 | # True=indent the 'if' one level. 743 | indent_else_if = false # false/true 744 | 745 | # Amount to indent variable declarations after a open brace. neg=relative, pos=absolute. 746 | indent_var_def_blk = 0 # number 747 | 748 | # Indent continued variable declarations instead of aligning. 749 | indent_var_def_cont = false # false/true 750 | 751 | # Indent continued shift expressions ('<<' and '>>') instead of aligning. 752 | # Turn align_left_shift off when enabling this. 753 | indent_shift = false # false/true 754 | 755 | # True: force indentation of function definition to start in column 1 756 | # False: use the default behavior. 757 | indent_func_def_force_col1 = false # false/true 758 | 759 | # True: indent continued function call parameters one indent level 760 | # False: align parameters under the open paren. 761 | indent_func_call_param = false # false/true 762 | 763 | # Same as indent_func_call_param, but for function defs. 764 | indent_func_def_param = false # false/true 765 | 766 | # Same as indent_func_call_param, but for function protos. 767 | indent_func_proto_param = false # false/true 768 | 769 | # Same as indent_func_call_param, but for class declarations. 770 | indent_func_class_param = false # false/true 771 | 772 | # Same as indent_func_call_param, but for class variable constructors. 773 | indent_func_ctor_var_param = false # false/true 774 | 775 | # Same as indent_func_call_param, but for templates. 776 | indent_template_param = false # false/true 777 | 778 | # Double the indent for indent_func_xxx_param options. 779 | # Use both values of the options indent_columns and indent_param. 780 | indent_func_param_double = false # false/true 781 | 782 | # Indentation column for standalone 'const' function decl/proto qualifier. 783 | indent_func_const = 0 # unsigned number 784 | 785 | # Indentation column for standalone 'throw' function decl/proto qualifier. 786 | indent_func_throw = 0 # unsigned number 787 | 788 | # The number of spaces to indent a continued '->' or '.' 789 | # Usually set to 0, 1, or indent_columns. 790 | indent_member = 0 # unsigned number 791 | 792 | # Spaces to indent single line ('//') comments on lines before code. 793 | indent_sing_line_comments = 0 # unsigned number 794 | 795 | # If set, will indent trailing single line ('//') comments relative 796 | # to the code instead of trying to keep the same absolute column. 797 | indent_relative_single_line_comments = false # false/true 798 | 799 | # Spaces to indent 'case' from 'switch' 800 | # Usually 0 or indent_columns. 801 | indent_switch_case = 0 # unsigned number 802 | 803 | # Whether to indent preproccesor statements inside of switch statements. 804 | indent_switch_pp = true # false/true 805 | 806 | # Spaces to shift the 'case' line, without affecting any other lines 807 | # Usually 0. 808 | indent_case_shift = 0 # unsigned number 809 | 810 | # Spaces to indent '{' from 'case'. 811 | # By default, the brace will appear under the 'c' in case. 812 | # Usually set to 0 or indent_columns. 813 | # negative value are OK. 814 | indent_case_brace = 0 # number 815 | 816 | # Whether to indent comments found in first column. 817 | indent_col1_comment = false # false/true 818 | 819 | # How to indent goto labels 820 | # >0: absolute column where 1 is the leftmost column 821 | # <=0: subtract from brace indent 822 | # Default=1 823 | indent_label = 1 # number 824 | 825 | # Same as indent_label, but for access specifiers that are followed by a colon. Default=1 826 | indent_access_spec = 1 # number 827 | 828 | # Indent the code after an access specifier by one level. 829 | # If set, this option forces 'indent_access_spec=0'. 830 | indent_access_spec_body = false # false/true 831 | 832 | # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended). 833 | indent_paren_nl = false # false/true 834 | 835 | # Controls the indent of a close paren after a newline. 836 | # 0: Indent to body level 837 | # 1: Align under the open paren 838 | # 2: Indent to the brace level 839 | indent_paren_close = 0 # unsigned number 840 | 841 | # Controls the indent of the open paren of a function definition, if on it's own line.If True, indents the open paren 842 | indent_paren_after_func_def = false # false/true 843 | 844 | # Controls the indent of the open paren of a function declaration, if on it's own line.If True, indents the open paren 845 | indent_paren_after_func_decl = false # false/true 846 | 847 | # Controls the indent of the open paren of a function call, if on it's own line.If True, indents the open paren 848 | indent_paren_after_func_call = false # false/true 849 | 850 | # Controls the indent of a comma when inside a paren.If True, aligns under the open paren. 851 | indent_comma_paren = false # false/true 852 | 853 | # Controls the indent of a BOOL operator when inside a paren.If True, aligns under the open paren. 854 | indent_bool_paren = false # false/true 855 | 856 | # If 'indent_bool_paren' is True, controls the indent of the first expression. If True, aligns the first expression to the following ones. 857 | indent_first_bool_expr = false # false/true 858 | 859 | # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended). 860 | indent_square_nl = false # false/true 861 | 862 | # Don't change the relative indent of ESQL/C 'EXEC SQL' bodies. 863 | indent_preserve_sql = false # false/true 864 | 865 | # Align continued statements at the '='. Default=True 866 | # If False or the '=' is followed by a newline, the next line is indent one tab. 867 | indent_align_assign = true # false/true 868 | 869 | # Indent OC blocks at brace level instead of usual rules. 870 | indent_oc_block = false # false/true 871 | 872 | # Indent OC blocks in a message relative to the parameter name. 873 | # 0=use indent_oc_block rules, 1+=spaces to indent 874 | indent_oc_block_msg = 0 # unsigned number 875 | 876 | # Minimum indent for subsequent parameters 877 | indent_oc_msg_colon = 0 # unsigned number 878 | 879 | # If True, prioritize aligning with initial colon (and stripping spaces from lines, if necessary). 880 | # Default=True. 881 | indent_oc_msg_prioritize_first_colon = true # false/true 882 | 883 | # If indent_oc_block_msg and this option are on, blocks will be indented the way that Xcode does by default (from keyword if the parameter is on its own line; otherwise, from the previous indentation level). 884 | indent_oc_block_msg_xcode_style = false # false/true 885 | 886 | # If indent_oc_block_msg and this option are on, blocks will be indented from where the brace is relative to a msg keyword. 887 | indent_oc_block_msg_from_keyword = false # false/true 888 | 889 | # If indent_oc_block_msg and this option are on, blocks will be indented from where the brace is relative to a msg colon. 890 | indent_oc_block_msg_from_colon = false # false/true 891 | 892 | # If indent_oc_block_msg and this option are on, blocks will be indented from where the block caret is. 893 | indent_oc_block_msg_from_caret = false # false/true 894 | 895 | # If indent_oc_block_msg and this option are on, blocks will be indented from where the brace is. 896 | indent_oc_block_msg_from_brace = false # false/true 897 | 898 | # When identing after virtual brace open and newline add further spaces to reach this min. indent. 899 | indent_min_vbrace_open = 0 # unsigned number 900 | 901 | # True: When identing after virtual brace open and newline add further spaces after regular indent to reach next tabstop. 902 | indent_vbrace_open_on_tabstop = false # false/true 903 | 904 | # If True, a brace followed by another token (not a newline) will indent all contained lines to match the token.Default=True. 905 | indent_token_after_brace = true # false/true 906 | 907 | # If True, cpp lambda body will be indentedDefault=False. 908 | indent_cpp_lambda_body = false # false/true 909 | 910 | # indent (or not) an using block if no braces are used. Only for C#.Default=True. 911 | indent_using_block = true # false/true 912 | 913 | # indent the continuation of ternary operator. 914 | # 0: (Default) off 915 | # 1: When the `if_false` is a continuation, indent it under `if_false` 916 | # 2: When the `:` is a continuation, indent it under `?` 917 | indent_ternary_operator = 0 # unsigned number 918 | 919 | # If true, ignore indent and align for asm blocks as they have their own indentation. 920 | indent_ignore_asm_block = false # false/true 921 | 922 | # 923 | # Newline adding and removing options 924 | # 925 | 926 | # Whether to collapse empty blocks between '{' and '}'. 927 | nl_collapse_empty_body = false # false/true 928 | 929 | # Don't split one-line braced assignments - 'foo_t f = { 1, 2 };'. 930 | nl_assign_leave_one_liners = false # false/true 931 | 932 | # Don't split one-line braced statements inside a class xx { } body. 933 | nl_class_leave_one_liners = false # false/true 934 | 935 | # Don't split one-line enums: 'enum foo { BAR = 15 };' 936 | nl_enum_leave_one_liners = false # false/true 937 | 938 | # Don't split one-line get or set functions. 939 | nl_getset_leave_one_liners = false # false/true 940 | 941 | # Don't split one-line function definitions - 'int foo() { return 0; }'. 942 | nl_func_leave_one_liners = false # false/true 943 | 944 | # Don't split one-line C++11 lambdas - '[]() { return 0; }'. 945 | nl_cpp_lambda_leave_one_liners = false # false/true 946 | 947 | # Don't split one-line if/else statements - 'if(a) b++;'. 948 | nl_if_leave_one_liners = false # false/true 949 | 950 | # Don't split one-line while statements - 'while(a) b++;'. 951 | nl_while_leave_one_liners = false # false/true 952 | 953 | # Don't split one-line OC messages. 954 | nl_oc_msg_leave_one_liner = false # false/true 955 | 956 | # Add or remove newline between Objective-C block signature and '{'. 957 | nl_oc_block_brace = ignore # ignore/add/remove/force 958 | 959 | # Add or remove newlines at the start of the file. 960 | nl_start_of_file = ignore # ignore/add/remove/force 961 | 962 | # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force'. 963 | nl_start_of_file_min = 0 # unsigned number 964 | 965 | # Add or remove newline at the end of the file. 966 | nl_end_of_file = ignore # ignore/add/remove/force 967 | 968 | # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force'). 969 | nl_end_of_file_min = 0 # unsigned number 970 | 971 | # Add or remove newline between '=' and '{'. 972 | nl_assign_brace = ignore # ignore/add/remove/force 973 | 974 | # Add or remove newline between '=' and '[' (D only). 975 | nl_assign_square = ignore # ignore/add/remove/force 976 | 977 | # Add or remove newline after '= [' (D only). Will also affect the newline before the ']'. 978 | nl_after_square_assign = ignore # ignore/add/remove/force 979 | 980 | # The number of blank lines after a block of variable definitions at the top of a function body 981 | # 0 = No change (default). 982 | nl_func_var_def_blk = 0 # unsigned number 983 | 984 | # The number of newlines before a block of typedefs 985 | # 0 = No change (default) 986 | # is overridden by the option 'nl_after_access_spec'. 987 | nl_typedef_blk_start = 0 # unsigned number 988 | 989 | # The number of newlines after a block of typedefs 990 | # 0 = No change (default). 991 | nl_typedef_blk_end = 0 # unsigned number 992 | 993 | # The maximum consecutive newlines within a block of typedefs 994 | # 0 = No change (default). 995 | nl_typedef_blk_in = 0 # unsigned number 996 | 997 | # The number of newlines before a block of variable definitions not at the top of a function body 998 | # 0 = No change (default) 999 | # is overridden by the option 'nl_after_access_spec'. 1000 | nl_var_def_blk_start = 0 # unsigned number 1001 | 1002 | # The number of newlines after a block of variable definitions not at the top of a function body 1003 | # 0 = No change (default). 1004 | nl_var_def_blk_end = 0 # unsigned number 1005 | 1006 | # The maximum consecutive newlines within a block of variable definitions 1007 | # 0 = No change (default). 1008 | nl_var_def_blk_in = 0 # unsigned number 1009 | 1010 | # Add or remove newline between a function call's ')' and '{', as in: 1011 | # list_for_each(item, &list) { }. 1012 | nl_fcall_brace = ignore # ignore/add/remove/force 1013 | 1014 | # Add or remove newline between 'enum' and '{'. 1015 | nl_enum_brace = ignore # ignore/add/remove/force 1016 | 1017 | # Add or remove newline between 'enum' and 'class'. 1018 | nl_enum_class = ignore # ignore/add/remove/force 1019 | 1020 | # Add or remove newline between 'enum class' and the identifier. 1021 | nl_enum_class_identifier = ignore # ignore/add/remove/force 1022 | 1023 | # Add or remove newline between 'enum class' type and ':'. 1024 | nl_enum_identifier_colon = ignore # ignore/add/remove/force 1025 | 1026 | # Add or remove newline between 'enum class identifier :' and 'type' and/or 'type'. 1027 | nl_enum_colon_type = ignore # ignore/add/remove/force 1028 | 1029 | # Add or remove newline between 'struct and '{'. 1030 | nl_struct_brace = ignore # ignore/add/remove/force 1031 | 1032 | # Add or remove newline between 'union' and '{'. 1033 | nl_union_brace = ignore # ignore/add/remove/force 1034 | 1035 | # Add or remove newline between 'if' and '{'. 1036 | nl_if_brace = ignore # ignore/add/remove/force 1037 | 1038 | # Add or remove newline between '}' and 'else'. 1039 | nl_brace_else = ignore # ignore/add/remove/force 1040 | 1041 | # Add or remove newline between 'else if' and '{' 1042 | # If set to ignore, nl_if_brace is used instead. 1043 | nl_elseif_brace = ignore # ignore/add/remove/force 1044 | 1045 | # Add or remove newline between 'else' and '{'. 1046 | nl_else_brace = ignore # ignore/add/remove/force 1047 | 1048 | # Add or remove newline between 'else' and 'if'. 1049 | nl_else_if = ignore # ignore/add/remove/force 1050 | 1051 | # Add or remove newline before 'if'/'else if' closing parenthesis. 1052 | nl_before_if_closing_paren = ignore # ignore/add/remove/force 1053 | 1054 | # Add or remove newline between '}' and 'finally'. 1055 | nl_brace_finally = ignore # ignore/add/remove/force 1056 | 1057 | # Add or remove newline between 'finally' and '{'. 1058 | nl_finally_brace = ignore # ignore/add/remove/force 1059 | 1060 | # Add or remove newline between 'try' and '{'. 1061 | nl_try_brace = ignore # ignore/add/remove/force 1062 | 1063 | # Add or remove newline between get/set and '{'. 1064 | nl_getset_brace = ignore # ignore/add/remove/force 1065 | 1066 | # Add or remove newline between 'for' and '{'. 1067 | nl_for_brace = ignore # ignore/add/remove/force 1068 | 1069 | # Add or remove newline between 'catch' and '{'. 1070 | nl_catch_brace = ignore # ignore/add/remove/force 1071 | 1072 | # Add or remove newline between '}' and 'catch'. 1073 | nl_brace_catch = ignore # ignore/add/remove/force 1074 | 1075 | # Add or remove newline between '}' and ']'. 1076 | nl_brace_square = ignore # ignore/add/remove/force 1077 | 1078 | # Add or remove newline between '}' and ')' in a function invocation. 1079 | nl_brace_fparen = ignore # ignore/add/remove/force 1080 | 1081 | # Add or remove newline between 'while' and '{'. 1082 | nl_while_brace = ignore # ignore/add/remove/force 1083 | 1084 | # Add or remove newline between 'scope (x)' and '{' (D). 1085 | nl_scope_brace = ignore # ignore/add/remove/force 1086 | 1087 | # Add or remove newline between 'unittest' and '{' (D). 1088 | nl_unittest_brace = ignore # ignore/add/remove/force 1089 | 1090 | # Add or remove newline between 'version (x)' and '{' (D). 1091 | nl_version_brace = ignore # ignore/add/remove/force 1092 | 1093 | # Add or remove newline between 'using' and '{'. 1094 | nl_using_brace = ignore # ignore/add/remove/force 1095 | 1096 | # Add or remove newline between two open or close braces. 1097 | # Due to general newline/brace handling, REMOVE may not work. 1098 | nl_brace_brace = ignore # ignore/add/remove/force 1099 | 1100 | # Add or remove newline between 'do' and '{'. 1101 | nl_do_brace = ignore # ignore/add/remove/force 1102 | 1103 | # Add or remove newline between '}' and 'while' of 'do' statement. 1104 | nl_brace_while = ignore # ignore/add/remove/force 1105 | 1106 | # Add or remove newline between 'switch' and '{'. 1107 | nl_switch_brace = ignore # ignore/add/remove/force 1108 | 1109 | # Add or remove newline between 'synchronized' and '{'. 1110 | nl_synchronized_brace = ignore # ignore/add/remove/force 1111 | 1112 | # Add a newline between ')' and '{' if the ')' is on a different line than the if/for/etc. 1113 | # Overrides nl_for_brace, nl_if_brace, nl_switch_brace, nl_while_switch and nl_catch_brace. 1114 | nl_multi_line_cond = false # false/true 1115 | 1116 | # Force a newline in a define after the macro name for multi-line defines. 1117 | nl_multi_line_define = false # false/true 1118 | 1119 | # Whether to put a newline before 'case' statement, not after the first 'case'. 1120 | nl_before_case = false # false/true 1121 | 1122 | # Add or remove newline between ')' and 'throw'. 1123 | nl_before_throw = ignore # ignore/add/remove/force 1124 | 1125 | # Whether to put a newline after 'case' statement. 1126 | nl_after_case = false # false/true 1127 | 1128 | # Add or remove a newline between a case ':' and '{'. Overrides nl_after_case. 1129 | nl_case_colon_brace = ignore # ignore/add/remove/force 1130 | 1131 | # Newline between namespace and {. 1132 | nl_namespace_brace = ignore # ignore/add/remove/force 1133 | 1134 | # Add or remove newline between 'template<>' and whatever follows. 1135 | nl_template_class = ignore # ignore/add/remove/force 1136 | 1137 | # Add or remove newline between 'class' and '{'. 1138 | nl_class_brace = ignore # ignore/add/remove/force 1139 | 1140 | # Add or remove newline before/after each ',' in the base class list, 1141 | # (tied to pos_class_comma). 1142 | nl_class_init_args = ignore # ignore/add/remove/force 1143 | 1144 | # Add or remove newline after each ',' in the constructor member initialization. 1145 | # Related to nl_constr_colon, pos_constr_colon and pos_constr_comma. 1146 | nl_constr_init_args = ignore # ignore/add/remove/force 1147 | 1148 | # Add or remove newline before first element, after comma, and after last element in enum. 1149 | nl_enum_own_lines = ignore # ignore/add/remove/force 1150 | 1151 | # Add or remove newline between return type and function name in a function definition. 1152 | nl_func_type_name = ignore # ignore/add/remove/force 1153 | 1154 | # Add or remove newline between return type and function name inside a class {} 1155 | # Uses nl_func_type_name or nl_func_proto_type_name if set to ignore. 1156 | nl_func_type_name_class = ignore # ignore/add/remove/force 1157 | 1158 | # Add or remove newline between class specification and '::' in 'void A::f() { }' 1159 | # Only appears in separate member implementation (does not appear with in-line implmementation). 1160 | nl_func_class_scope = ignore # ignore/add/remove/force 1161 | 1162 | # Add or remove newline between function scope and name 1163 | # Controls the newline after '::' in 'void A::f() { }'. 1164 | nl_func_scope_name = ignore # ignore/add/remove/force 1165 | 1166 | # Add or remove newline between return type and function name in a prototype. 1167 | nl_func_proto_type_name = ignore # ignore/add/remove/force 1168 | 1169 | # Add or remove newline between a function name and the opening '(' in the declaration. 1170 | nl_func_paren = ignore # ignore/add/remove/force 1171 | 1172 | # Overrides nl_func_paren for functions with no parameters. 1173 | nl_func_paren_empty = ignore # ignore/add/remove/force 1174 | 1175 | # Add or remove newline between a function name and the opening '(' in the definition. 1176 | nl_func_def_paren = ignore # ignore/add/remove/force 1177 | 1178 | # Overrides nl_func_def_paren for functions with no parameters. 1179 | nl_func_def_paren_empty = ignore # ignore/add/remove/force 1180 | 1181 | # Add or remove newline between a function name and the opening '(' in the call 1182 | nl_func_call_paren = ignore # ignore/add/remove/force 1183 | 1184 | # Overrides nl_func_call_paren for functions with no parameters. 1185 | nl_func_call_paren_empty = ignore # ignore/add/remove/force 1186 | 1187 | # Add or remove newline after '(' in a function declaration. 1188 | nl_func_decl_start = ignore # ignore/add/remove/force 1189 | 1190 | # Add or remove newline after '(' in a function definition. 1191 | nl_func_def_start = ignore # ignore/add/remove/force 1192 | 1193 | # Overrides nl_func_decl_start when there is only one parameter. 1194 | nl_func_decl_start_single = ignore # ignore/add/remove/force 1195 | 1196 | # Overrides nl_func_def_start when there is only one parameter. 1197 | nl_func_def_start_single = ignore # ignore/add/remove/force 1198 | 1199 | # Whether to add newline after '(' in a function declaration if '(' and ')' are in different lines. 1200 | nl_func_decl_start_multi_line = false # false/true 1201 | 1202 | # Whether to add newline after '(' in a function definition if '(' and ')' are in different lines. 1203 | nl_func_def_start_multi_line = false # false/true 1204 | 1205 | # Add or remove newline after each ',' in a function declaration. 1206 | nl_func_decl_args = ignore # ignore/add/remove/force 1207 | 1208 | # Add or remove newline after each ',' in a function definition. 1209 | nl_func_def_args = ignore # ignore/add/remove/force 1210 | 1211 | # Whether to add newline after each ',' in a function declaration if '(' and ')' are in different lines. 1212 | nl_func_decl_args_multi_line = false # false/true 1213 | 1214 | # Whether to add newline after each ',' in a function definition if '(' and ')' are in different lines. 1215 | nl_func_def_args_multi_line = false # false/true 1216 | 1217 | # Add or remove newline before the ')' in a function declaration. 1218 | nl_func_decl_end = ignore # ignore/add/remove/force 1219 | 1220 | # Add or remove newline before the ')' in a function definition. 1221 | nl_func_def_end = ignore # ignore/add/remove/force 1222 | 1223 | # Overrides nl_func_decl_end when there is only one parameter. 1224 | nl_func_decl_end_single = ignore # ignore/add/remove/force 1225 | 1226 | # Overrides nl_func_def_end when there is only one parameter. 1227 | nl_func_def_end_single = ignore # ignore/add/remove/force 1228 | 1229 | # Whether to add newline before ')' in a function declaration if '(' and ')' are in different lines. 1230 | nl_func_decl_end_multi_line = false # false/true 1231 | 1232 | # Whether to add newline before ')' in a function definition if '(' and ')' are in different lines. 1233 | nl_func_def_end_multi_line = false # false/true 1234 | 1235 | # Add or remove newline between '()' in a function declaration. 1236 | nl_func_decl_empty = ignore # ignore/add/remove/force 1237 | 1238 | # Add or remove newline between '()' in a function definition. 1239 | nl_func_def_empty = ignore # ignore/add/remove/force 1240 | 1241 | # Add or remove newline between '()' in a function call. 1242 | nl_func_call_empty = ignore # ignore/add/remove/force 1243 | 1244 | # Whether to add newline after '(' in a function call if '(' and ')' are in different lines. 1245 | nl_func_call_start_multi_line = false # false/true 1246 | 1247 | # Whether to add newline after each ',' in a function call if '(' and ')' are in different lines. 1248 | nl_func_call_args_multi_line = false # false/true 1249 | 1250 | # Whether to add newline before ')' in a function call if '(' and ')' are in different lines. 1251 | nl_func_call_end_multi_line = false # false/true 1252 | 1253 | # Whether to put each OC message parameter on a separate line 1254 | # See nl_oc_msg_leave_one_liner. 1255 | nl_oc_msg_args = false # false/true 1256 | 1257 | # Add or remove newline between function signature and '{'. 1258 | nl_fdef_brace = ignore # ignore/add/remove/force 1259 | 1260 | # Add or remove newline between C++11 lambda signature and '{'. 1261 | nl_cpp_ldef_brace = ignore # ignore/add/remove/force 1262 | 1263 | # Add or remove a newline between the return keyword and return expression. 1264 | nl_return_expr = ignore # ignore/add/remove/force 1265 | 1266 | # Whether to put a newline after semicolons, except in 'for' statements. 1267 | nl_after_semicolon = false # false/true 1268 | 1269 | # Java: Control the newline between the ')' and '{{' of the double brace initializer. 1270 | nl_paren_dbrace_open = ignore # ignore/add/remove/force 1271 | 1272 | # Whether to put a newline after the type in an unnamed temporary direct-list-initialization. 1273 | nl_type_brace_init_lst = ignore # ignore/add/remove/force 1274 | 1275 | # Whether to put a newline after open brace in an unnamed temporary direct-list-initialization. 1276 | nl_type_brace_init_lst_open = ignore # ignore/add/remove/force 1277 | 1278 | # Whether to put a newline before close brace in an unnamed temporary direct-list-initialization. 1279 | nl_type_brace_init_lst_close = ignore # ignore/add/remove/force 1280 | 1281 | # Whether to put a newline after brace open. 1282 | # This also adds a newline before the matching brace close. 1283 | nl_after_brace_open = false # false/true 1284 | 1285 | # If nl_after_brace_open and nl_after_brace_open_cmt are True, a newline is 1286 | # placed between the open brace and a trailing single-line comment. 1287 | nl_after_brace_open_cmt = false # false/true 1288 | 1289 | # Whether to put a newline after a virtual brace open with a non-empty body. 1290 | # These occur in un-braced if/while/do/for statement bodies. 1291 | nl_after_vbrace_open = false # false/true 1292 | 1293 | # Whether to put a newline after a virtual brace open with an empty body. 1294 | # These occur in un-braced if/while/do/for statement bodies. 1295 | nl_after_vbrace_open_empty = false # false/true 1296 | 1297 | # Whether to put a newline after a brace close. 1298 | # Does not apply if followed by a necessary ';'. 1299 | nl_after_brace_close = false # false/true 1300 | 1301 | # Whether to put a newline after a virtual brace close. 1302 | # Would add a newline before return in: 'if (foo) a++; return;'. 1303 | nl_after_vbrace_close = false # false/true 1304 | 1305 | # Control the newline between the close brace and 'b' in: 'struct { int a; } b;' 1306 | # Affects enums, unions and structures. If set to ignore, uses nl_after_brace_close. 1307 | nl_brace_struct_var = ignore # ignore/add/remove/force 1308 | 1309 | # Whether to alter newlines in '#define' macros. 1310 | nl_define_macro = false # false/true 1311 | 1312 | # Whether to remove blanks after '#ifxx' and '#elxx', or before '#elxx' and '#endif'. Does not affect top-level #ifdefs. 1313 | nl_squeeze_ifdef = false # false/true 1314 | 1315 | # Makes the nl_squeeze_ifdef option affect the top-level #ifdefs as well. 1316 | nl_squeeze_ifdef_top_level = false # false/true 1317 | 1318 | # Add or remove blank line before 'if'. 1319 | nl_before_if = ignore # ignore/add/remove/force 1320 | 1321 | # Add or remove blank line after 'if' statement. 1322 | # Add/Force work only if the next token is not a closing brace. 1323 | nl_after_if = ignore # ignore/add/remove/force 1324 | 1325 | # Add or remove blank line before 'for'. 1326 | nl_before_for = ignore # ignore/add/remove/force 1327 | 1328 | # Add or remove blank line after 'for' statement. 1329 | nl_after_for = ignore # ignore/add/remove/force 1330 | 1331 | # Add or remove blank line before 'while'. 1332 | nl_before_while = ignore # ignore/add/remove/force 1333 | 1334 | # Add or remove blank line after 'while' statement. 1335 | nl_after_while = ignore # ignore/add/remove/force 1336 | 1337 | # Add or remove blank line before 'switch'. 1338 | nl_before_switch = ignore # ignore/add/remove/force 1339 | 1340 | # Add or remove blank line after 'switch' statement. 1341 | nl_after_switch = ignore # ignore/add/remove/force 1342 | 1343 | # Add or remove blank line before 'synchronized'. 1344 | nl_before_synchronized = ignore # ignore/add/remove/force 1345 | 1346 | # Add or remove blank line after 'synchronized' statement. 1347 | nl_after_synchronized = ignore # ignore/add/remove/force 1348 | 1349 | # Add or remove blank line before 'do'. 1350 | nl_before_do = ignore # ignore/add/remove/force 1351 | 1352 | # Add or remove blank line after 'do/while' statement. 1353 | nl_after_do = ignore # ignore/add/remove/force 1354 | 1355 | # Whether to double-space commented-entries in struct/union/enum. 1356 | nl_ds_struct_enum_cmt = false # false/true 1357 | 1358 | # force nl before } of a struct/union/enum 1359 | # (lower priority than 'eat_blanks_before_close_brace'). 1360 | nl_ds_struct_enum_close_brace = false # false/true 1361 | 1362 | # Add or remove blank line before 'func_class_def'. 1363 | nl_before_func_class_def = 0 # unsigned number 1364 | 1365 | # Add or remove blank line before 'func_class_proto'. 1366 | nl_before_func_class_proto = 0 # unsigned number 1367 | 1368 | # Add or remove a newline before/after a class colon, 1369 | # (tied to pos_class_colon). 1370 | nl_class_colon = ignore # ignore/add/remove/force 1371 | 1372 | # Add or remove a newline around a class constructor colon. 1373 | # Related to nl_constr_init_args, pos_constr_colon and pos_constr_comma. 1374 | nl_constr_colon = ignore # ignore/add/remove/force 1375 | 1376 | # Change simple unbraced if statements into a one-liner 1377 | # 'if(b)\n i++;' => 'if(b) i++;'. 1378 | nl_create_if_one_liner = false # false/true 1379 | 1380 | # Change simple unbraced for statements into a one-liner 1381 | # 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);'. 1382 | nl_create_for_one_liner = false # false/true 1383 | 1384 | # Change simple unbraced while statements into a one-liner 1385 | # 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);'. 1386 | nl_create_while_one_liner = false # false/true 1387 | 1388 | # Change a one-liner if statement into simple unbraced if 1389 | # 'if(b) i++;' => 'if(b)\n i++;'. 1390 | nl_split_if_one_liner = false # false/true 1391 | 1392 | # Change a one-liner for statement into simple unbraced for 1393 | # 'for (i=0;<5;i++) foo(i);' => 'for (i=0;<5;i++)\n foo(i);'. 1394 | nl_split_for_one_liner = false # false/true 1395 | 1396 | # Change a one-liner while statement into simple unbraced while 1397 | # 'while (i<5) foo(i++);' => 'while (i<5)\n foo(i++);'. 1398 | nl_split_while_one_liner = false # false/true 1399 | 1400 | # 1401 | # Blank line options 1402 | # 1403 | 1404 | # The maximum consecutive newlines (3 = 2 blank lines). 1405 | nl_max = 0 # unsigned number 1406 | 1407 | # The maximum consecutive newlines in function. 1408 | nl_max_blank_in_func = 0 # unsigned number 1409 | 1410 | # The number of newlines after a function prototype, if followed by another function prototype. 1411 | nl_after_func_proto = 0 # unsigned number 1412 | 1413 | # The number of newlines after a function prototype, if not followed by another function prototype. 1414 | nl_after_func_proto_group = 0 # unsigned number 1415 | 1416 | # The number of newlines after a function class prototype, if followed by another function class prototype. 1417 | nl_after_func_class_proto = 0 # unsigned number 1418 | 1419 | # The number of newlines after a function class prototype, if not followed by another function class prototype. 1420 | nl_after_func_class_proto_group = 0 # unsigned number 1421 | 1422 | # The number of newlines before a multi-line function def body. 1423 | nl_before_func_body_def = 0 # unsigned number 1424 | 1425 | # The number of newlines before a multi-line function prototype body. 1426 | nl_before_func_body_proto = 0 # unsigned number 1427 | 1428 | # The number of newlines after '}' of a multi-line function body. 1429 | nl_after_func_body = 0 # unsigned number 1430 | 1431 | # The number of newlines after '}' of a multi-line function body in a class declaration. 1432 | nl_after_func_body_class = 0 # unsigned number 1433 | 1434 | # The number of newlines after '}' of a single line function body. 1435 | nl_after_func_body_one_liner = 0 # unsigned number 1436 | 1437 | # The minimum number of newlines before a multi-line comment. 1438 | # Doesn't apply if after a brace open or another multi-line comment. 1439 | nl_before_block_comment = 0 # unsigned number 1440 | 1441 | # The minimum number of newlines before a single-line C comment. 1442 | # Doesn't apply if after a brace open or other single-line C comments. 1443 | nl_before_c_comment = 0 # unsigned number 1444 | 1445 | # The minimum number of newlines before a CPP comment. 1446 | # Doesn't apply if after a brace open or other CPP comments. 1447 | nl_before_cpp_comment = 0 # unsigned number 1448 | 1449 | # Whether to force a newline after a multi-line comment. 1450 | nl_after_multiline_comment = false # false/true 1451 | 1452 | # Whether to force a newline after a label's colon. 1453 | nl_after_label_colon = false # false/true 1454 | 1455 | # The number of newlines after '}' or ';' of a struct/enum/union definition. 1456 | nl_after_struct = 0 # unsigned number 1457 | 1458 | # The number of newlines before a class definition. 1459 | nl_before_class = 0 # unsigned number 1460 | 1461 | # The number of newlines after '}' or ';' of a class definition. 1462 | nl_after_class = 0 # unsigned number 1463 | 1464 | # The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. 1465 | # Will not change the newline count if after a brace open. 1466 | # 0 = No change. 1467 | nl_before_access_spec = 0 # unsigned number 1468 | 1469 | # The number of newlines after a 'private:', 'public:', 'protected:', 'signals:' or 'slots:' label. 1470 | # 0 = No change. 1471 | # Overrides 'nl_typedef_blk_start' and 'nl_var_def_blk_start'. 1472 | nl_after_access_spec = 0 # unsigned number 1473 | 1474 | # The number of newlines between a function def and the function comment. 1475 | # 0 = No change. 1476 | nl_comment_func_def = 0 # unsigned number 1477 | 1478 | # The number of newlines after a try-catch-finally block that isn't followed by a brace close. 1479 | # 0 = No change. 1480 | nl_after_try_catch_finally = 0 # unsigned number 1481 | 1482 | # The number of newlines before and after a property, indexer or event decl. 1483 | # 0 = No change. 1484 | nl_around_cs_property = 0 # unsigned number 1485 | 1486 | # The number of newlines between the get/set/add/remove handlers in C#. 1487 | # 0 = No change. 1488 | nl_between_get_set = 0 # unsigned number 1489 | 1490 | # Add or remove newline between C# property and the '{'. 1491 | nl_property_brace = ignore # ignore/add/remove/force 1492 | 1493 | # Whether to remove blank lines after '{'. 1494 | eat_blanks_after_open_brace = false # false/true 1495 | 1496 | # Whether to remove blank lines before '}'. 1497 | eat_blanks_before_close_brace = false # false/true 1498 | 1499 | # How aggressively to remove extra newlines not in preproc. 1500 | # 0: No change 1501 | # 1: Remove most newlines not handled by other config 1502 | # 2: Remove all newlines and reformat completely by config 1503 | nl_remove_extra_newlines = 0 # unsigned number 1504 | 1505 | # Whether to put a blank line before 'return' statements, unless after an open brace. 1506 | nl_before_return = false # false/true 1507 | 1508 | # Whether to put a blank line after 'return' statements, unless followed by a close brace. 1509 | nl_after_return = false # false/true 1510 | 1511 | # Whether to put a newline after a Java annotation statement. 1512 | # Only affects annotations that are after a newline. 1513 | nl_after_annotation = ignore # ignore/add/remove/force 1514 | 1515 | # Controls the newline between two annotations. 1516 | nl_between_annotation = ignore # ignore/add/remove/force 1517 | 1518 | # 1519 | # Positioning options 1520 | # 1521 | 1522 | # The position of arithmetic operators in wrapped expressions. 1523 | pos_arith = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force 1524 | 1525 | # The position of assignment in wrapped expressions. 1526 | # Do not affect '=' followed by '{'. 1527 | pos_assign = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force 1528 | 1529 | # The position of boolean operators in wrapped expressions. 1530 | pos_bool = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force 1531 | 1532 | # The position of comparison operators in wrapped expressions. 1533 | pos_compare = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force 1534 | 1535 | # The position of conditional (b ? t : f) operators in wrapped expressions. 1536 | pos_conditional = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force 1537 | 1538 | # The position of the comma in wrapped expressions. 1539 | pos_comma = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force 1540 | 1541 | # The position of the comma in enum entries. 1542 | pos_enum_comma = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force 1543 | 1544 | # The position of the comma in the base class list if there are more than one line, 1545 | # (tied to nl_class_init_args). 1546 | pos_class_comma = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force 1547 | 1548 | # The position of the comma in the constructor initialization list. 1549 | # Related to nl_constr_colon, nl_constr_init_args and pos_constr_colon. 1550 | pos_constr_comma = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force 1551 | 1552 | # The position of trailing/leading class colon, between class and base class list 1553 | # (tied to nl_class_colon). 1554 | pos_class_colon = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force 1555 | 1556 | # The position of colons between constructor and member initialization, 1557 | # (tied to nl_constr_colon). 1558 | # Related to nl_constr_colon, nl_constr_init_args and pos_constr_comma. 1559 | pos_constr_colon = ignore # ignore/join/lead/lead_break/lead_force/trail/trail_break/trail_force 1560 | 1561 | # 1562 | # Line Splitting options 1563 | # 1564 | 1565 | # Try to limit code width to N number of columns 1566 | code_width = 0 # unsigned number 1567 | 1568 | # Whether to fully split long 'for' statements at semi-colons. 1569 | ls_for_split_full = false # false/true 1570 | 1571 | # Whether to fully split long function protos/calls at commas. 1572 | ls_func_split_full = false # false/true 1573 | 1574 | # Whether to split lines as close to code_width as possible and ignore some groupings. 1575 | ls_code_width = false # false/true 1576 | 1577 | # 1578 | # Code alignment (not left column spaces/tabs) 1579 | # 1580 | 1581 | # Whether to keep non-indenting tabs. 1582 | align_keep_tabs = false # false/true 1583 | 1584 | # Whether to use tabs for aligning. 1585 | align_with_tabs = false # false/true 1586 | 1587 | # Whether to bump out to the next tab when aligning. 1588 | align_on_tabstop = false # false/true 1589 | 1590 | # Whether to right-align numbers. 1591 | align_number_right = false # false/true 1592 | 1593 | # Whether to keep whitespace not required for alignment. 1594 | align_keep_extra_space = false # false/true 1595 | 1596 | # Align variable definitions in prototypes and functions. 1597 | align_func_params = false # false/true 1598 | 1599 | # The span for aligning parameter definitions in function on parameter name (0=don't align). 1600 | align_func_params_span = 0 # unsigned number 1601 | 1602 | # The threshold for aligning function parameter definitions (0=no limit). 1603 | align_func_params_thresh = 0 # unsigned number 1604 | 1605 | # The gap for aligning function parameter definitions. 1606 | align_func_params_gap = 0 # unsigned number 1607 | 1608 | # Align parameters in single-line functions that have the same name. 1609 | # The function names must already be aligned with each other. 1610 | align_same_func_call_params = false # false/true 1611 | 1612 | # The span for aligning variable definitions (0=don't align) 1613 | align_var_def_span = 0 # unsigned number 1614 | 1615 | # How to align the star in variable definitions. 1616 | # 0=Part of the type 'void * foo;' 1617 | # 1=Part of the variable 'void *foo;' 1618 | # 2=Dangling 'void *foo;' 1619 | align_var_def_star_style = 0 # unsigned number 1620 | 1621 | # How to align the '&' in variable definitions. 1622 | # 0=Part of the type 1623 | # 1=Part of the variable 1624 | # 2=Dangling 1625 | align_var_def_amp_style = 0 # unsigned number 1626 | 1627 | # The threshold for aligning variable definitions (0=no limit) 1628 | align_var_def_thresh = 0 # unsigned number 1629 | 1630 | # The gap for aligning variable definitions. 1631 | align_var_def_gap = 0 # unsigned number 1632 | 1633 | # Whether to align the colon in struct bit fields. 1634 | align_var_def_colon = false # false/true 1635 | 1636 | # align variable defs gap for bit colons. 1637 | align_var_def_colon_gap = 0 # unsigned number 1638 | 1639 | # Whether to align any attribute after the variable name. 1640 | align_var_def_attribute = false # false/true 1641 | 1642 | # Whether to align inline struct/enum/union variable definitions. 1643 | align_var_def_inline = false # false/true 1644 | 1645 | # The span for aligning on '=' in assignments (0=don't align) 1646 | align_assign_span = 0 # unsigned number 1647 | 1648 | # The threshold for aligning on '=' in assignments (0=no limit) 1649 | align_assign_thresh = 0 # unsigned number 1650 | 1651 | # The span for aligning on '=' in enums (0=don't align) 1652 | align_enum_equ_span = 0 # unsigned number 1653 | 1654 | # The threshold for aligning on '=' in enums (0=no limit) 1655 | align_enum_equ_thresh = 0 # unsigned number 1656 | 1657 | # The span for aligning class (0=don't align) 1658 | align_var_class_span = 0 # unsigned number 1659 | 1660 | # The threshold for aligning class member definitions (0=no limit). 1661 | align_var_class_thresh = 0 # unsigned number 1662 | 1663 | # The gap for aligning class member definitions. 1664 | align_var_class_gap = 0 # unsigned number 1665 | 1666 | # The span for aligning struct/union (0=don't align) 1667 | align_var_struct_span = 0 # unsigned number 1668 | 1669 | # The threshold for aligning struct/union member definitions (0=no limit) 1670 | align_var_struct_thresh = 0 # unsigned number 1671 | 1672 | # The gap for aligning struct/union member definitions. 1673 | align_var_struct_gap = 0 # unsigned number 1674 | 1675 | # The span for aligning struct initializer values (0=don't align) 1676 | align_struct_init_span = 0 # unsigned number 1677 | 1678 | # The minimum space between the type and the synonym of a typedef. 1679 | align_typedef_gap = 0 # unsigned number 1680 | 1681 | # The span for aligning single-line typedefs (0=don't align). 1682 | align_typedef_span = 0 # unsigned number 1683 | 1684 | # How to align typedef'd functions with other typedefs 1685 | # 0: Don't mix them at all 1686 | # 1: align the open paren with the types 1687 | # 2: align the function type name with the other type names 1688 | align_typedef_func = 0 # unsigned number 1689 | 1690 | # Controls the positioning of the '*' in typedefs. Just try it. 1691 | # 0: Align on typedef type, ignore '*' 1692 | # 1: The '*' is part of type name: typedef int *pint; 1693 | # 2: The '*' is part of the type, but dangling: typedef int *pint; 1694 | align_typedef_star_style = 0 # unsigned number 1695 | 1696 | # Controls the positioning of the '&' in typedefs. Just try it. 1697 | # 0: Align on typedef type, ignore '&' 1698 | # 1: The '&' is part of type name: typedef int &pint; 1699 | # 2: The '&' is part of the type, but dangling: typedef int &pint; 1700 | align_typedef_amp_style = 0 # unsigned number 1701 | 1702 | # The span for aligning comments that end lines (0=don't align) 1703 | align_right_cmt_span = 0 # unsigned number 1704 | 1705 | # If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment. 1706 | align_right_cmt_mix = false # false/true 1707 | 1708 | # If a trailing comment is more than this number of columns away from the text it follows, 1709 | # it will qualify for being aligned. This has to be > 0 to do anything. 1710 | align_right_cmt_gap = 0 # unsigned number 1711 | 1712 | # Align trailing comment at or beyond column N; 'pulls in' comments as a bonus side effect (0=ignore) 1713 | align_right_cmt_at_col = 0 # unsigned number 1714 | 1715 | # The span for aligning function prototypes (0=don't align). 1716 | align_func_proto_span = 0 # unsigned number 1717 | 1718 | # Minimum gap between the return type and the function name. 1719 | align_func_proto_gap = 0 # unsigned number 1720 | 1721 | # Align function protos on the 'operator' keyword instead of what follows. 1722 | align_on_operator = false # false/true 1723 | 1724 | # Whether to mix aligning prototype and variable declarations. 1725 | # If True, align_var_def_XXX options are used instead of align_func_proto_XXX options. 1726 | align_mix_var_proto = false # false/true 1727 | 1728 | # Align single-line functions with function prototypes, uses align_func_proto_span. 1729 | align_single_line_func = false # false/true 1730 | 1731 | # Aligning the open brace of single-line functions. 1732 | # Requires align_single_line_func=True, uses align_func_proto_span. 1733 | align_single_line_brace = false # false/true 1734 | 1735 | # Gap for align_single_line_brace. 1736 | align_single_line_brace_gap = 0 # unsigned number 1737 | 1738 | # The span for aligning ObjC msg spec (0=don't align) 1739 | align_oc_msg_spec_span = 0 # unsigned number 1740 | 1741 | # Whether to align macros wrapped with a backslash and a newline. 1742 | # This will not work right if the macro contains a multi-line comment. 1743 | align_nl_cont = false # false/true 1744 | 1745 | # # Align macro functions and variables together. 1746 | align_pp_define_together = false # false/true 1747 | 1748 | # The minimum space between label and value of a preprocessor define. 1749 | align_pp_define_gap = 0 # unsigned number 1750 | 1751 | # The span for aligning on '#define' bodies (0=don't align, other=number of lines including comments between blocks) 1752 | align_pp_define_span = 0 # unsigned number 1753 | 1754 | # Align lines that start with '<<' with previous '<<'. Default=True. 1755 | align_left_shift = true # false/true 1756 | 1757 | # Align text after asm volatile () colons. 1758 | align_asm_colon = false # false/true 1759 | 1760 | # Span for aligning parameters in an Obj-C message call on the ':' (0=don't align) 1761 | align_oc_msg_colon_span = 0 # unsigned number 1762 | 1763 | # If True, always align with the first parameter, even if it is too short. 1764 | align_oc_msg_colon_first = false # false/true 1765 | 1766 | # Aligning parameters in an Obj-C '+' or '-' declaration on the ':'. 1767 | align_oc_decl_colon = false # false/true 1768 | 1769 | # 1770 | # Comment modifications 1771 | # 1772 | 1773 | # Try to wrap comments at cmt_width columns 1774 | cmt_width = 0 # unsigned number 1775 | 1776 | # Set the comment reflow mode (Default=0) 1777 | # 0: no reflowing (apart from the line wrapping due to cmt_width) 1778 | # 1: no touching at all 1779 | # 2: full reflow 1780 | cmt_reflow_mode = 0 # unsigned number 1781 | 1782 | # Whether to convert all tabs to spaces in comments. Default is to leave tabs inside comments alone, unless used for indenting. 1783 | cmt_convert_tab_to_spaces = false # false/true 1784 | 1785 | # If False, disable all multi-line comment changes, including cmt_width. keyword substitution and leading chars. 1786 | # Default=True. 1787 | cmt_indent_multi = true # false/true 1788 | 1789 | # Whether to group c-comments that look like they are in a block. 1790 | cmt_c_group = false # false/true 1791 | 1792 | # Whether to put an empty '/*' on the first line of the combined c-comment. 1793 | cmt_c_nl_start = false # false/true 1794 | 1795 | # Whether to put a newline before the closing '*/' of the combined c-comment. 1796 | cmt_c_nl_end = false # false/true 1797 | 1798 | # Whether to group cpp-comments that look like they are in a block. 1799 | cmt_cpp_group = false # false/true 1800 | 1801 | # Whether to put an empty '/*' on the first line of the combined cpp-comment. 1802 | cmt_cpp_nl_start = false # false/true 1803 | 1804 | # Whether to put a newline before the closing '*/' of the combined cpp-comment. 1805 | cmt_cpp_nl_end = false # false/true 1806 | 1807 | # Whether to change cpp-comments into c-comments. 1808 | cmt_cpp_to_c = false # false/true 1809 | 1810 | # Whether to put a star on subsequent comment lines. 1811 | cmt_star_cont = false # false/true 1812 | 1813 | # The number of spaces to insert at the start of subsequent comment lines. 1814 | cmt_sp_before_star_cont = 0 # unsigned number 1815 | 1816 | # The number of spaces to insert after the star on subsequent comment lines. 1817 | cmt_sp_after_star_cont = 0 # number 1818 | 1819 | # For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of 1820 | # the comment are the same length. Default=True. 1821 | cmt_multi_check_last = true # false/true 1822 | 1823 | # For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of 1824 | # the comment are the same length AND if the length is bigger as the first_len minimum. Default=4 1825 | cmt_multi_first_len_minimum = 4 # unsigned number 1826 | 1827 | # The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment. 1828 | # Will substitute $(filename) with the current file's name. 1829 | cmt_insert_file_header = "" # string 1830 | 1831 | # The filename that contains text to insert at the end of a file if the file doesn't end with a C/C++ comment. 1832 | # Will substitute $(filename) with the current file's name. 1833 | cmt_insert_file_footer = "" # string 1834 | 1835 | # The filename that contains text to insert before a function implementation if the function isn't preceded with a C/C++ comment. 1836 | # Will substitute $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff. 1837 | # Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... }. 1838 | cmt_insert_func_header = "" # string 1839 | 1840 | # The filename that contains text to insert before a class if the class isn't preceded with a C/C++ comment. 1841 | # Will substitute $(class) with the class name. 1842 | cmt_insert_class_header = "" # string 1843 | 1844 | # The filename that contains text to insert before a Obj-C message specification if the method isn't preceded with a C/C++ comment. 1845 | # Will substitute $(message) with the function name and $(javaparam) with the javadoc @param and @return stuff. 1846 | cmt_insert_oc_msg_header = "" # string 1847 | 1848 | # If a preprocessor is encountered when stepping backwards from a function name, then 1849 | # this option decides whether the comment should be inserted. 1850 | # Affects cmt_insert_oc_msg_header, cmt_insert_func_header and cmt_insert_class_header. 1851 | cmt_insert_before_preproc = false # false/true 1852 | 1853 | # If a function is declared inline to a class definition, then 1854 | # this option decides whether the comment should be inserted. 1855 | # Affects cmt_insert_func_header. 1856 | cmt_insert_before_inlines = true # false/true 1857 | 1858 | # If the function is a constructor/destructor, then 1859 | # this option decides whether the comment should be inserted. 1860 | # Affects cmt_insert_func_header. 1861 | cmt_insert_before_ctor_dtor = false # false/true 1862 | 1863 | # 1864 | # Code modifying options (non-whitespace) 1865 | # 1866 | 1867 | # Add or remove braces on single-line 'do' statement. 1868 | mod_full_brace_do = ignore # ignore/add/remove/force 1869 | 1870 | # Add or remove braces on single-line 'for' statement. 1871 | mod_full_brace_for = ignore # ignore/add/remove/force 1872 | 1873 | # Add or remove braces on single-line function definitions. (Pawn). 1874 | mod_full_brace_function = ignore # ignore/add/remove/force 1875 | 1876 | # Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'. 1877 | mod_full_brace_if = ignore # ignore/add/remove/force 1878 | 1879 | # Make all if/elseif/else statements in a chain be braced or not. Overrides mod_full_brace_if. 1880 | # If any must be braced, they are all braced. If all can be unbraced, then the braces are removed. 1881 | mod_full_brace_if_chain = false # false/true 1882 | 1883 | # Make all if/elseif/else statements with at least one 'else' or 'else if' fully braced. 1884 | # If mod_full_brace_if_chain is used together with this option, all if-else chains will get braces, 1885 | # and simple 'if' statements will lose them (if possible). 1886 | mod_full_brace_if_chain_only = false # false/true 1887 | 1888 | # Don't remove braces around statements that span N newlines 1889 | mod_full_brace_nl = 0 # unsigned number 1890 | 1891 | # Blocks removal of braces if the parenthesis of if/for/while/.. span multiple lines. 1892 | mod_full_brace_nl_block_rem_mlcond = false # false/true 1893 | 1894 | # Add or remove braces on single-line 'while' statement. 1895 | mod_full_brace_while = ignore # ignore/add/remove/force 1896 | 1897 | # Add or remove braces on single-line 'using ()' statement. 1898 | mod_full_brace_using = ignore # ignore/add/remove/force 1899 | 1900 | # Add or remove unnecessary paren on 'return' statement. 1901 | mod_paren_on_return = ignore # ignore/add/remove/force 1902 | 1903 | # Whether to change optional semicolons to real semicolons. 1904 | mod_pawn_semicolon = false # false/true 1905 | 1906 | # Add parens on 'while' and 'if' statement around bools. 1907 | mod_full_paren_if_bool = false # false/true 1908 | 1909 | # Whether to remove superfluous semicolons. 1910 | mod_remove_extra_semicolon = false # false/true 1911 | 1912 | # If a function body exceeds the specified number of newlines and doesn't have a comment after 1913 | # the close brace, a comment will be added. 1914 | mod_add_long_function_closebrace_comment = 0 # unsigned number 1915 | 1916 | # If a namespace body exceeds the specified number of newlines and doesn't have a comment after 1917 | # the close brace, a comment will be added. 1918 | mod_add_long_namespace_closebrace_comment = 0 # unsigned number 1919 | 1920 | # If a class body exceeds the specified number of newlines and doesn't have a comment after 1921 | # the close brace, a comment will be added. 1922 | mod_add_long_class_closebrace_comment = 0 # unsigned number 1923 | 1924 | # If a switch body exceeds the specified number of newlines and doesn't have a comment after 1925 | # the close brace, a comment will be added. 1926 | mod_add_long_switch_closebrace_comment = 0 # unsigned number 1927 | 1928 | # If an #ifdef body exceeds the specified number of newlines and doesn't have a comment after 1929 | # the #endif, a comment will be added. 1930 | mod_add_long_ifdef_endif_comment = 0 # unsigned number 1931 | 1932 | # If an #ifdef or #else body exceeds the specified number of newlines and doesn't have a comment after 1933 | # the #else, a comment will be added. 1934 | mod_add_long_ifdef_else_comment = 0 # unsigned number 1935 | 1936 | # If True, will sort consecutive single-line 'import' statements [Java, D]. 1937 | mod_sort_import = false # false/true 1938 | 1939 | # If True, will sort consecutive single-line 'using' statements [C#]. 1940 | mod_sort_using = false # false/true 1941 | 1942 | # If True, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C] 1943 | # This is generally a bad idea, as it may break your code. 1944 | mod_sort_include = false # false/true 1945 | 1946 | # If True, it will move a 'break' that appears after a fully braced 'case' before the close brace. 1947 | mod_move_case_break = false # false/true 1948 | 1949 | # Will add or remove the braces around a fully braced case statement. 1950 | # Will only remove the braces if there are no variable declarations in the block. 1951 | mod_case_brace = ignore # ignore/add/remove/force 1952 | 1953 | # If True, it will remove a void 'return;' that appears as the last statement in a function. 1954 | mod_remove_empty_return = false # false/true 1955 | 1956 | # If True, it will organize the properties (Obj-C). 1957 | mod_sort_oc_properties = false # false/true 1958 | 1959 | # Determines weight of class property modifier (Obj-C). 1960 | mod_sort_oc_property_class_weight = 0 # number 1961 | 1962 | # Determines weight of atomic, nonatomic (Obj-C). 1963 | mod_sort_oc_property_thread_safe_weight = 0 # number 1964 | 1965 | # Determines weight of readwrite (Obj-C). 1966 | mod_sort_oc_property_readwrite_weight = 0 # number 1967 | 1968 | # Determines weight of reference type (retain, copy, assign, weak, strong) (Obj-C). 1969 | mod_sort_oc_property_reference_weight = 0 # number 1970 | 1971 | # Determines weight of getter type (getter=) (Obj-C). 1972 | mod_sort_oc_property_getter_weight = 0 # number 1973 | 1974 | # Determines weight of setter type (setter=) (Obj-C). 1975 | mod_sort_oc_property_setter_weight = 0 # number 1976 | 1977 | # Determines weight of nullability type (nullable, nonnull, null_unspecified, null_resettable) (Obj-C). 1978 | mod_sort_oc_property_nullability_weight = 0 # number 1979 | 1980 | # 1981 | # Preprocessor options 1982 | # 1983 | 1984 | # Control indent of preprocessors inside #if blocks at brace level 0 (file-level). 1985 | pp_indent = ignore # ignore/add/remove/force 1986 | 1987 | # Whether to indent #if/#else/#endif at the brace level (True) or from column 1 (False). 1988 | pp_indent_at_level = false # false/true 1989 | 1990 | # Specifies the number of columns to indent preprocessors per level at brace level 0 (file-level). 1991 | # If pp_indent_at_level=False, specifies the number of columns to indent preprocessors per level at brace level > 0 (function-level). 1992 | # Default=1. 1993 | pp_indent_count = 1 # unsigned number 1994 | 1995 | # Add or remove space after # based on pp_level of #if blocks. 1996 | pp_space = ignore # ignore/add/remove/force 1997 | 1998 | # Sets the number of spaces added with pp_space. 1999 | pp_space_count = 0 # unsigned number 2000 | 2001 | # The indent for #region and #endregion in C# and '#pragma region' in C/C++. 2002 | pp_indent_region = 0 # number 2003 | 2004 | # Whether to indent the code between #region and #endregion. 2005 | pp_region_indent_code = false # false/true 2006 | 2007 | # If pp_indent_at_level=True, sets the indent for #if, #else and #endif when not at file-level. 2008 | # 0: indent preprocessors using output_tab_size. 2009 | # >0: column at which all preprocessors will be indented. 2010 | pp_indent_if = 0 # number 2011 | 2012 | # Control whether to indent the code between #if, #else and #endif. 2013 | pp_if_indent_code = false # false/true 2014 | 2015 | # Whether to indent '#define' at the brace level (True) or from column 1 (false). 2016 | pp_define_at_level = false # false/true 2017 | 2018 | # Whether to ignore the '#define' body while formatting. 2019 | pp_ignore_define_body = false # false/true 2020 | 2021 | # Whether to indent case statements between #if, #else, and #endif. 2022 | # Only applies to the indent of the preprocesser that the case statements directly inside of. 2023 | pp_indent_case = true # false/true 2024 | 2025 | # Whether to indent whole function definitions between #if, #else, and #endif. 2026 | # Only applies to the indent of the preprocesser that the function definition is directly inside of. 2027 | pp_indent_func_def = true # false/true 2028 | 2029 | # Whether to indent extern C blocks between #if, #else, and #endif. 2030 | # Only applies to the indent of the preprocesser that the extern block is directly inside of. 2031 | pp_indent_extern = true # false/true 2032 | 2033 | # Whether to indent braces directly inside #if, #else, and #endif. 2034 | # Only applies to the indent of the preprocesser that the braces are directly inside of. 2035 | pp_indent_brace = true # false/true 2036 | 2037 | # 2038 | # Sort includes options 2039 | # 2040 | 2041 | # The regex for include category with priority 0. 2042 | include_category_0 = "" # string 2043 | 2044 | # The regex for include category with priority 1. 2045 | include_category_1 = "" # string 2046 | 2047 | # The regex for include category with priority 2. 2048 | include_category_2 = "" # string 2049 | 2050 | # 2051 | # Use or Do not Use options 2052 | # 2053 | 2054 | # True: indent_func_call_param will be used (default) 2055 | # False: indent_func_call_param will NOT be used. 2056 | use_indent_func_call_param = true # false/true 2057 | 2058 | # The value of the indentation for a continuation line is calculate differently if the line is: 2059 | # a declaration :your case with QString fileName ... 2060 | # an assignment :your case with pSettings = new QSettings( ... 2061 | # At the second case the option value might be used twice: 2062 | # at the assignment 2063 | # at the function call (if present) 2064 | # To prevent the double use of the option value, use this option with the value 'True'. 2065 | # True: indent_continue will be used only once 2066 | # False: indent_continue will be used every time (default). 2067 | use_indent_continue_only_once = false # false/true 2068 | 2069 | # SIGNAL/SLOT Qt macros have special formatting options. See options_for_QT.cpp for details. 2070 | # Default=True. 2071 | use_options_overriding_for_qt_macros = true # false/true 2072 | 2073 | # 2074 | # Warn levels - 1: error, 2: warning (default), 3: note 2075 | # 2076 | 2077 | # Warning is given if doing tab-to-\t replacement and we have found one in a C# verbatim string literal. 2078 | warn_level_tabs_found_in_verbatim_string_literals = 2 # unsigned number 2079 | 2080 | # Meaning of the settings: 2081 | # Ignore - do not do any changes 2082 | # Add - makes sure there is 1 or more space/brace/newline/etc 2083 | # Force - makes sure there is exactly 1 space/brace/newline/etc, 2084 | # behaves like Add in some contexts 2085 | # Remove - removes space/brace/newline/etc 2086 | # 2087 | # 2088 | # - Token(s) can be treated as specific type(s) with the 'set' option: 2089 | # `set tokenType tokenString [tokenString...]` 2090 | # 2091 | # Example: 2092 | # `set BOOL __AND__ __OR__` 2093 | # 2094 | # tokenTypes are defined in src/token_enum.h, use them without the 2095 | # 'CT_' prefix: 'CT_BOOL' -> 'BOOL' 2096 | # 2097 | # 2098 | # - Token(s) can be treated as type(s) with the 'type' option. 2099 | # `type tokenString [tokenString...]` 2100 | # 2101 | # Example: 2102 | # `type int c_uint_8 Rectangle` 2103 | # 2104 | # This can also be achieved with `set TYPE int c_uint_8 Rectangle` 2105 | # 2106 | # 2107 | # To embed whitespace in tokenStrings use the '\' escape character, or quote 2108 | # the tokenStrings. These quotes are supported: "'` 2109 | # 2110 | # 2111 | # - Support for the auto detection of languages through the file ending can be 2112 | # added using the 'file_ext' command. 2113 | # `file_ext langType langString [langString..]` 2114 | # 2115 | # Example: 2116 | # `file_ext CPP .ch .cxx .cpp.in` 2117 | # 2118 | # langTypes are defined in uncrusify_types.h in the lang_flag_e enum, use 2119 | # them without the 'LANG_' prefix: 'LANG_CPP' -> 'CPP' 2120 | # 2121 | # 2122 | # - Custom macro-based indentation can be set up using 'macro-open', 2123 | # 'macro-else' and 'macro-close'. 2124 | # `(macro-open | macro-else | macro-close) tokenString` 2125 | # 2126 | # Example: 2127 | # `macro-open BEGIN_TEMPLATE_MESSAGE_MAP` 2128 | # `macro-open BEGIN_MESSAGE_MAP` 2129 | # `macro-close END_MESSAGE_MAP` 2130 | # 2131 | ## option(s) with 'not default' value: 0 2132 | # 2133 | -------------------------------------------------------------------------------- /fmt.lua: -------------------------------------------------------------------------------- 1 | VERSION = "3.2.0" 2 | 3 | -- Lets the user disable the onSave() formatting 4 | if GetOption("fmt-onsave") == nil then 5 | -- Default onsave formatter as enabled 6 | AddOption("fmt-onsave", true) 7 | end 8 | 9 | -- The table that holds all the formatter objects for access from other functions 10 | local formatters = {} 11 | 12 | local function using_tabs() 13 | -- We need to use this as a string in init_table for the args 14 | local tabs = "false" 15 | 16 | -- tabstospaces returns a bool that tells whether the user is using spaces or not. 17 | -- For our purposes, we reverse by using "not" for simplicity, instead of having to reverse every time... 18 | -- because most formatters have a --use-tabs true/false, instead of a --use-spaces 19 | if not GetOption("tabstospaces") then 20 | tabs = "true" 21 | end 22 | return tabs 23 | end 24 | 25 | -- Hold the last used settings to be checked against later 26 | local saved_settings = { 27 | ["indent"] = nil, 28 | ["tabs"] = nil, 29 | ["update"] = function(self) 30 | self.indent = GetOption("tabsize") 31 | self.tabs = using_tabs() 32 | end, 33 | ["are_correct"] = function(self) 34 | if self.indent == GetOption("tabsize") and self.tabs == using_tabs() then 35 | return true 36 | else 37 | return false 38 | end 39 | end 40 | } 41 | 42 | -- Accepts either a CurView() or literal filepath.. 43 | -- and returns either Micro's CurView():FileType(), or the extension string. 44 | local function get_filetype(x) 45 | -- Uses Go's path.Ext() to get the literal file extension, as fallback 46 | local function get_gopath_ext(f_path) 47 | -- Go's path lib for getting a path's extension 48 | local golib_path = import("path") 49 | -- Use the path.Ext command to get the extension (with period), if it exists 50 | local f_type = golib_path.Ext(f_path) 51 | 52 | -- Returns an empty string if it doesn't find an extension 53 | if f_type == "" then 54 | -- Stop running if there's no extension 55 | return nil 56 | else 57 | -- Return the extension without the period from Go's path.Ext() 58 | return f_type:sub(2) 59 | end 60 | end 61 | 62 | local file_type = nil 63 | 64 | -- When passed a view, first try the built-in CurView().Buf:FileType() 65 | if x == CurView() then 66 | file_type = x.Buf:FileType() 67 | -- Returns "Unknown" when Micro can't file the type 68 | if file_type == "Unknown" then 69 | -- Fallback to the literal extension 70 | file_type = get_gopath_ext(x.Buf.Path) 71 | end 72 | else 73 | -- When passed a direct path, use Go's path lib 74 | file_type = get_gopath_ext(x) 75 | end 76 | 77 | return file_type 78 | end 79 | 80 | -- Returns a full path to either a config file in the directory, or our bundled one. 81 | -- extension should be a string of the file extension needed, sans period. 82 | -- name is the folder name in our bundled configs | ex: fmt-micro/configs/NAME 83 | local function get_conf(name, extension) 84 | -- The current local dir 85 | local dir = WorkingDirectory() 86 | -- Go's ioutil library for scanning the current dir 87 | local go_ioutil = import("ioutil") 88 | -- Gets an array of all the files in the current dir 89 | local readout = go_ioutil.ReadDir(dir) 90 | 91 | if readout ~= nil then 92 | -- The full path to the file 93 | local readout_path 94 | 95 | for i = 1, #readout do 96 | -- Save the current file's full path 97 | readout_path = JoinPaths(dir, readout[i]:Name()) 98 | 99 | -- if extension matches, return path to the config file 100 | if get_filetype(readout_path) == extension then 101 | messenger:AddLog("fmt: Found " .. name .. '\'s config, using "' .. readout_path .. '"') 102 | -- Return the found local config 103 | return readout_path 104 | end 105 | end 106 | end 107 | 108 | -- Fallback onto our bundled config if no local one is found 109 | local bundled_conf = JoinPaths(configDir, "plugins", "fmt", "configs", name) 110 | messenger:AddLog("fmt: Didn't find " .. name .. '\'s config, using bundled "', bundled_conf .. '"') 111 | -- Return the bundled config path for the requested config 112 | return bundled_conf 113 | end 114 | 115 | -- A quick check if something is a table, and converts it to one if it isn't 116 | local function to_t(input) 117 | -- Check if it's a table or not 118 | if type(input) ~= "table" then 119 | -- Return it as a table if its not already one 120 | return {input} 121 | else 122 | return input 123 | end 124 | end 125 | 126 | -- Initializes the dictionary of languages, their formatters, and the corresponding arguments 127 | local function init_table() 128 | -- Save the used settings to be checked against later in the format() function 129 | saved_settings:update() 130 | 131 | -- Hold the results of creating our formatter objects 132 | -- Eventually fed into the formatters table 133 | local temp_table = {} 134 | 135 | -- Cuts down on cruft when inserting a new formatter 136 | local function insert(supported, cli, args) 137 | -- Convert them to a table, if they aren't already, as other code expects tables 138 | supported = to_t(supported) 139 | args = to_t(args) 140 | 141 | local new_args = {} 142 | -- Unfold the nested args into a single table 143 | for i = 1, #args do 144 | -- Check if there's a nested table in the args 145 | if type(args[i]) == "table" then 146 | -- Currently only have max 1 nested, so no need for recursion/whatever 147 | for inner_i = 1, #args[i] do 148 | -- Unfold the nested tables into a single table 149 | new_args[#new_args + 1] = args[i][inner_i] 150 | end 151 | else 152 | -- Add the arg into the new table 153 | new_args[#new_args + 1] = args[i] 154 | end 155 | end 156 | 157 | -- Save the formatter as an object in the temporary table 158 | temp_table[#temp_table + 1] = { 159 | -- Its supported filetypes, as a table 160 | ["supported"] = supported, 161 | -- The cli command used to run it in JobSpawn 162 | ["cli"] = cli, 163 | -- The arguments, if any, as a table 164 | ["args"] = new_args, 165 | -- Returns a true/false if the formatters supports the filetype 166 | ["supports_type"] = function(self, target) 167 | for i = 1, #self.supported do 168 | if self.supported[i] == target then 169 | return true 170 | end 171 | end 172 | return false 173 | end 174 | } 175 | end 176 | 177 | -- The literal file extension (without period) can be used when Micro doesn't recognize the filetype 178 | 179 | insert("crystal", "crystal", {"tool", "format"}) 180 | insert("fish", "fish_indent", "-w") 181 | -- Doesn't seem to have config options 182 | insert("ruby", "rufo") 183 | insert("ruby", "rubocop", {"-f", "quiet", "-o"}) 184 | -- Doesn't have any configurable args, and forces tabs. 185 | insert("go", "gofmt", {"-s", "-w"}) 186 | insert("go", "goimports", "-w") 187 | -- Supports config files as well as cli options, unsure if this'll cause a clash. 188 | insert( 189 | {"javascript", "jsx", "flow", "typescript", "css", "less", "scss", "json", "graphql", "markdown"}, 190 | "prettier", 191 | {"--use-tabs", saved_settings.tabs, "--tab-width", saved_settings.indent, "--write"} 192 | ) 193 | -- overwrite is default, and we can't pass config options 194 | insert("rust", "rustfmt") 195 | -- Doesn't support configurable args for tabs/spaces 196 | insert("python", "yapf", "-i") 197 | -- Does more than just format, but considering this is the best formatter for php, I'll allow it... 198 | insert("php", "php-cs-fixer", "fix") 199 | -- p is for the Pawn language (literal fallback) 200 | insert( 201 | {"c", "c++", "csharp", "objective-c", "d", "java", "p", "vala"}, 202 | "uncrustify", 203 | {"-c", get_conf("uncrustify", "cfg"), "--no-backup"} 204 | ) 205 | -- Options only available via a config file 206 | insert("clojure", "cljfmt") 207 | -- No args from what I've found | This might need "--yes" after the filepath, unsure 208 | insert("elm", "elm-format", "--yes") 209 | insert({"c", "c++", "objective-c"}, "clang-format", "-i") 210 | -- LaTeX 211 | insert("tex", "latexindent.pl", "-w") 212 | -- Unsure of the exact purpose of -t, but it's recommended when used as a tool 213 | -- https://github.com/csscomb/csscomb.js/blob/dev/doc/usage-cli.md#options 214 | insert("css", "csscomb", "-t") 215 | -- Seems to have some config options, but the ones we want aren't documented 216 | insert("marko", "marko-prettyprint") 217 | insert("ocaml", "ocp-indent") 218 | -- Overwrite is default if only source (-s) used 219 | insert("yaml", "align", {"-p", saved_settings.indent, "-s"}) 220 | insert("haskell", "stylish-haskell", "-i") 221 | insert("puppet", "puppet-lint", "--fix") 222 | -- The -a arg can be used multiple times to increase aggresiveness. Unsure of what people prefer, so doing 1. 223 | insert("python", "autopep8", {"-a", "-i"}) 224 | insert("typescript", "tsfmt", "-r") 225 | -- Not configurable by design 226 | insert("dart", "dartfmt", "-w") 227 | -- For editor integration, it recommends --silent. It also seems to default to overwrite 228 | insert("fortran", "fprettify", {"--indent", saved_settings.indent, "--silent"}) 229 | 230 | -- Keep the more annoying args in a table 231 | local unruly = { 232 | ["args"] = {}, 233 | ["set"] = function(self, name, args) 234 | self.args[name] = args 235 | end, 236 | ["get"] = function(self, name) 237 | return self.args[name] 238 | end 239 | } 240 | 241 | -- Setting the non-flexible args 242 | if saved_settings.tabs == "true" then 243 | -- The various arguments used if the user is using tabs instead of spaces... 244 | unruly:set("htmlbeautifier", "-T") 245 | unruly:set("coffee-fmt", "tab") 246 | unruly:set("pug-beautifier", {"-t", saved_settings.indent}) 247 | unruly:set("perltidy", {"-et=", saved_settings.indent}) 248 | unruly:set("js-beautify", "-t") 249 | -- 0 signifies tabs 250 | unruly:set("shfmt", "0") 251 | unruly:set("beautysh", "-t") 252 | unruly:set("dfmt", {"tab", "--tab_width"}) 253 | -- Tells it to retain tabs, instead of converting them to spaces 254 | unruly:set("tidy", "0") 255 | -- --use-tabs just tells it to use tabs, it doesn't take a true/false 256 | unruly:set("luafmt", {saved_settings.indent, "--use-tabs"}) 257 | else 258 | -- The various arguments used if the user is using spaces instead of tabs.. 259 | unruly:set("htmlbeautifier", {"-t", saved_settings.indent}) 260 | unruly:set("coffee-fmt", "space") 261 | -- Doesn't use anything on spaces 262 | unruly:set("pug-beautifier") 263 | unruly:set("perltidy", {"-i=", saved_settings.indent}) 264 | unruly:set("js-beautify", {"-s", saved_settings.indent}) 265 | unruly:set("shfmt", saved_settings.indent) 266 | unruly:set("beautysh", {"-i", saved_settings.indent}) 267 | unruly:set("dfmt", {"space", "--indent_size"}) 268 | -- Just used to convert tabs to spaces 269 | unruly:set("tidy", saved_settings.indent) 270 | unruly:set("luafmt", saved_settings.indent) 271 | end 272 | 273 | insert("html", "htmlbeautifier", unruly:get("htmlbeautifier")) 274 | insert( 275 | "coffeescript", 276 | "coffee-fmt", 277 | {"--indent_style", unruly:get("coffee-fmt"), "--indent_size", saved_settings.indent, "-i"} 278 | ) 279 | insert("pug", "pug-beautifier", unruly:get("pug-beautifier")) 280 | insert("perl", "perltidy", unruly:get("perltidy")) 281 | insert({"css", "html", "javascript"}, "js-beautify", {unruly:get("js-beautify"), "-r", "-f"}) 282 | insert("shell", "shfmt", {"-i", unruly:get("shfmt"), "-s", "-w"}) 283 | insert("shell", "beautysh.py", {unruly:get("beautysh"), "-f"}) 284 | insert("d", "dfmt", {"--indent_style", unruly:get("dfmt"), saved_settings.indent, "-i"}) 285 | -- drop-empty-elements is false because Bootstrap uses empty elements 286 | insert( 287 | {"html", "xml"}, 288 | "tidy", 289 | { 290 | "--indent", 291 | "auto", 292 | "--indent-spaces", 293 | saved_settings.indent, 294 | "--tab-size", 295 | unruly:get("tidy"), 296 | "--indent-with-tabs", 297 | saved_settings.tabs, 298 | "--drop-empty-elements", 299 | "false", 300 | "-m" 301 | } 302 | ) 303 | -- Doesn't seem to have an actual option for tabs/spaces. stdout is default. 304 | insert("lua", "luafmt", {"-i", unruly:get("luafmt"), "-w", "replace"}) 305 | 306 | -- Put the table into our permanent/global table 307 | formatters = temp_table 308 | end 309 | 310 | -- Declares the options to enable/disable formatter(s) in the user settings.json 311 | local function create_options() 312 | -- Only concat once per loop by using a var 313 | local current_option 314 | -- Read each formatter in the table 315 | for i = 1, #formatters do 316 | -- Go through each language of the formatter 317 | for inner_i = 1, #formatters[i].supported do 318 | -- Creates the options to set languages to individual formatters 319 | current_option = formatters[i].supported[inner_i] .. "-formatter" 320 | -- Don't create/overwrite if it already exists 321 | if GetOption(current_option) == nil then 322 | -- Disabled by default, require user to enable for safety 323 | -- settings.json example "css-formatter": "" 324 | AddOption(current_option, "") 325 | end 326 | end 327 | end 328 | end 329 | 330 | -- Initialize the table & options when opening Micro 331 | function onViewOpen(view) 332 | -- A quick check if the table is empty 333 | if next(formatters) == nil then 334 | -- Only needs to run on the open of Micro 335 | init_table() 336 | create_options() 337 | end 338 | end 339 | 340 | -- Read the table to get a list of formatters for display 341 | local function list_supported() 342 | local function get_pad(len, pad_char) 343 | -- Remove any negative sign and round up, since we don't want negatives or decimals 344 | len = math.floor(math.abs(len)) 345 | -- Add vals into a table. Concat in a loop is laggy 346 | local padding = {} 347 | for i = 1, len do 348 | padding[i] = pad_char 349 | end 350 | return table.concat(padding) 351 | end 352 | 353 | -- Used to hold the display output 354 | local display_list = {} 355 | 356 | -- Returns the index of the language if already saved 357 | local function contains_lang(self, lang) 358 | for i = 1, #self do 359 | if self[i].language == lang then 360 | return i 361 | end 362 | end 363 | -- Return nil if it doesn't contain it yet 364 | return nil 365 | end 366 | 367 | local found_index, cur_len 368 | -- The length of the longest language and cli 369 | local max_lang_len, max_cli_len, max_validcli_len = 0, 0, 0 370 | -- Builds the display_list off of the things in the formatters table 371 | -- For efficiency, we also get max len's in this instead of running another for loop 372 | for i = 1, #formatters do 373 | -- Get the max cli len 374 | cur_len = formatters[i].cli:len() 375 | if cur_len > max_cli_len then 376 | max_cli_len = cur_len 377 | end 378 | 379 | for inner_i = 1, #formatters[i].supported do 380 | -- Get max lang len 381 | cur_len = formatters[i].supported[inner_i]:len() 382 | if cur_len > max_lang_len then 383 | max_lang_len = cur_len 384 | end 385 | 386 | -- Check if we already added the language to display_list 387 | found_index = contains_lang(display_list, formatters[i].supported[inner_i]) 388 | if found_index ~= nil then 389 | -- Append the cli command into its valid formatters table 390 | display_list[found_index]:set_valid_cli(formatters[i].cli) 391 | -- Find the longest valid_cli for padding 392 | cur_len = display_list[found_index]:get_valid_cli():len() 393 | else 394 | -- Doesn't contain, so add it in 395 | display_list[#display_list + 1] = { 396 | -- The language type 397 | ["language"] = formatters[i].supported[inner_i], 398 | -- The option used in AddOption() 399 | ["option"] = formatters[i].supported[inner_i] .. "-formatter", 400 | -- Holds a list of valid formatters (cli cmd) for the language 401 | ["valid_cli"] = {formatters[i].cli}, 402 | -- Set/append a cli command into the display_list 403 | ["set_valid_cli"] = function(self, new_cli) 404 | -- Append on the new cli cmd to the table 405 | self.valid_cli[#self.valid_cli + 1] = new_cli 406 | end, 407 | -- Get what the option is set to 408 | ["get_status"] = function(self) 409 | -- Get the lang-formatter, then check what it's set to 410 | return GetOption(self.option) 411 | end, 412 | -- Get the sorted formatters for prettyness 413 | ["get_valid_cli"] = function(self) 414 | -- Sort alphabetically 415 | table.sort(self.valid_cli) 416 | -- Return with commas and a space between each 417 | return table.concat(self.valid_cli, ", ") 418 | end 419 | } 420 | -- Find the longest valid_cli for padding 421 | cur_len = display_list[#display_list]:get_valid_cli():len() 422 | end 423 | -- cur_len is set to the current cli len above 424 | if cur_len > max_validcli_len then 425 | max_validcli_len = cur_len 426 | end 427 | end 428 | end 429 | 430 | -- -formatter adds 10 chars 431 | local max_opt_len = max_lang_len + 10 432 | 433 | -- Output the formatters supported to the log, seperated by newlines 434 | -- Minus 1 less than we normally would because of the spaces we use in "| " 435 | local table_top = 436 | "| " .. 437 | "Language" .. 438 | get_pad(max_lang_len - 8, " ") .. 439 | " | " .. 440 | "Option" .. 441 | get_pad(max_opt_len - 6, " ") .. 442 | " | " .. 443 | "Status" .. 444 | get_pad(max_cli_len - 6, " ") .. " | " .. "Valid Formatter(s)" .. get_pad(max_validcli_len - 18, " ") .. " |\n" 445 | -- Use dashes to make a pretty table 446 | -- Add 2 because of the spaces used in "| " and " |" 447 | local separator = 448 | "+" .. 449 | get_pad(max_lang_len + 2, "-") .. 450 | "+" .. 451 | get_pad(max_opt_len + 2, "-") .. 452 | "+" .. get_pad(max_cli_len + 2, "-") .. "+" .. get_pad(max_validcli_len + 2, "-") .. "+\n" 453 | 454 | -- Add elements to a table, instead of concatenating in a loop (for speed) 455 | local table_to_concat = {} 456 | 457 | local cur_cli_setting, cur_lang_len, cur_cli_len, cur_validcli 458 | for i = 1, #display_list do 459 | cur_lang_len = display_list[i].language:len() 460 | -- Returns the GetOption() 461 | cur_cli_setting = display_list[i]:get_status() 462 | -- The :len() of display_list[i]:get_status() 463 | cur_cli_len = cur_cli_setting:len() 464 | -- A sorted and concatenated string of all the valid cli commands, separated by ", " 465 | cur_validcli = display_list[i]:get_valid_cli() 466 | 467 | -- What we'll actually display into the log 468 | table_to_concat[i] = 469 | "| " .. 470 | display_list[i].language .. 471 | get_pad(max_lang_len - cur_lang_len, " ") .. 472 | " | " .. 473 | display_list[i].option .. 474 | get_pad(max_opt_len - display_list[i].option:len(), " ") .. 475 | " | " .. 476 | cur_cli_setting .. 477 | get_pad(max_cli_len - cur_cli_len, " ") .. 478 | " | " .. cur_validcli .. get_pad(max_validcli_len - cur_validcli:len(), " ") .. " |" 479 | end 480 | 481 | -- Sort the display list stuff 482 | table.sort(table_to_concat) 483 | 484 | -- Output the list of languages/options/status/valid formatters to the log 485 | messenger:AddLog( 486 | "\n" .. separator .. table_top .. separator .. table.concat(table_to_concat, "\n") .. "\n" .. separator 487 | ) 488 | 489 | messenger:Message("fmt: Formatter list printed to the log.") 490 | end 491 | 492 | function onStdout(out) 493 | if out ~= "" then 494 | messenger:AddLog("fmt info: ", out) 495 | end 496 | end 497 | 498 | function onExit() 499 | -- Refresh the CurView after the command finishes 500 | -- I've found .Buf:ReOpen() to be more smooth than just :ReOpen(), at least on crap machines 501 | CurView().Buf:ReOpen() 502 | end 503 | 504 | function onStderr(err) 505 | if err ~= "" then 506 | messenger:AddLog("fmt error: ", err) 507 | end 508 | end 509 | 510 | local function find_cli_index(fmt_name) 511 | for i = 1, #formatters do 512 | if formatters[i].cli == fmt_name then 513 | return i 514 | end 515 | end 516 | return nil 517 | end 518 | 519 | -- Find the correct formatter, its arguments, and then run on the current file 520 | local function format(tar_index) 521 | -- Prevent infinite loop of onSave() 522 | CurView():Save(false) 523 | 524 | -- Save filetype for checking 525 | local file_type = get_filetype(CurView()) 526 | -- Stop running if no extension/filetype 527 | if file_type == nil then 528 | messenger:AddLog("fmt: Exiting early since the filetype couldn't be identified") 529 | do 530 | return 531 | end 532 | end 533 | 534 | local custom_fmt = GetOption("fmt|" .. file_type) 535 | local cli = { 536 | ["cmd"] = nil, 537 | ["args"] = {}, 538 | ["set_arg"] = function(self, new_arg) 539 | self.args[#self.args + 1] = new_arg 540 | end 541 | } 542 | 543 | if custom_fmt ~= nil then 544 | local is_first = true 545 | for match in custom_fmt:gmatch("%S+") do 546 | if is_first then 547 | cli.cmd = match 548 | is_first = false 549 | else 550 | -- cli[1] will be the command, the rest will be the args 551 | cli:set_arg(match) 552 | end 553 | end 554 | else 555 | -- Makes sure the table is using up-to-date settings in args 556 | if not saved_settings:are_correct() then 557 | messenger:AddLog("fmt: Re-initializing formatters because settings don't match") 558 | -- Reload the table (to get new args) if the user has changed their settings since opening Micro 559 | init_table() 560 | end 561 | 562 | -- tar_index is nil if run on auto-save, or if the "fmt" command is used without a formatter 563 | if tar_index == nil then 564 | tar_index = find_cli_index(GetOption(file_type .. "-formatter")) 565 | -- If we weren't able to find a formatter, exit 566 | if tar_index == nil then 567 | do 568 | return 569 | end 570 | end 571 | end 572 | 573 | -- Make sure the formatter supports the filetype 574 | if not formatters[tar_index]:supports_type(file_type) then 575 | -- This only runs if the user manually ran "fmt formattername" and the specified formatter doesn't support the filetype 576 | messenger:Error('fmt: "' .. formatters[tar_index].cli .. '" doesn\'t support the file-type "' .. file_type .. '"') 577 | -- Exit because it doesn't support the filetype 578 | do 579 | return 580 | end 581 | end 582 | 583 | -- Fill the cli table with the commands 584 | cli.cmd = formatters[tar_index].cli 585 | -- Build the job args by getting args in order 586 | for i = 1, #formatters[tar_index].args do 587 | cli:set_arg(formatters[tar_index].args[i]) 588 | end 589 | end 590 | 591 | -- If no formatter command was found, exit 592 | if cli.cmd == nil then 593 | messenger:AddLog("fmt error: No cli command found") 594 | do 595 | return 596 | end 597 | end 598 | 599 | -- Append the path to the end 600 | cli:set_arg(CurView().Buf.AbsPath) 601 | -- Log exactly what will run and on what file 602 | messenger:AddLog('fmt: Running "' .. cli.cmd .. " " .. table.concat(cli.args, " ") .. '"') 603 | 604 | -- Actually run the command with Micro's binding to the Go exec.Command() 605 | JobSpawn(cli.cmd, cli.args, "fmt.onStdout", "fmt.onStderr", "fmt.onExit") 606 | end 607 | 608 | function onSave(view) 609 | -- Allows for enable/disable on-save formatting via the option 610 | if GetOption("fmt-onsave") then 611 | format() 612 | end 613 | end 614 | 615 | -- A command to set the specified formatter on all its supported languages in your settings.json 616 | local function set_all(formatter_name) 617 | local valid_index = find_cli_index(formatter_name) 618 | if valid_index ~= nil then 619 | local tar_option 620 | -- Go through the specified formatters supported types 621 | for i = 1, #formatters[valid_index].supported do 622 | -- For each supported type, set the type to the specified formatter 623 | tar_option = formatters[valid_index].supported[i] .. "-formatter" 624 | AddOption(tar_option, formatters[valid_index].cli) 625 | -- Log the specific options we're setting, and to which formatter 626 | messenger:AddLog('fmt: Setting "' .. tar_option .. '" to "' .. formatters[valid_index].cli .. '"') 627 | end 628 | messenger:Message( 629 | 'fmt: Set "' .. formatters[valid_index].cli .. '" to be used on all its supported file-types (specifics in log)' 630 | ) 631 | else 632 | messenger:Error( 633 | 'fmt: "' .. 634 | formatter_name .. '" isn\'t a valid formatter name. Run "fmt list" and use the exact name of what you want' 635 | ) 636 | end 637 | end 638 | 639 | local function unset_all(formatter_name) 640 | local valid_index = find_cli_index(formatter_name) 641 | if valid_index ~= nil then 642 | local tar_option 643 | -- Go through the specified formatters supported types 644 | for i = 1, #formatters[valid_index].supported do 645 | -- For each supported type, set the type to the specified formatter 646 | tar_option = formatters[valid_index].supported[i] .. "-formatter" 647 | -- Check if the option is actually set to the specified formatter 648 | if GetOption(tar_option) == formatters[valid_index].cli then 649 | -- Clear the option 650 | AddOption(tar_option, "") 651 | -- Log the specific option we're unsetting 652 | messenger:AddLog('fmt: Unsetting "' .. tar_option .. '"') 653 | end 654 | end 655 | messenger:Message('fmt: Unset all options that "' .. formatters[valid_index].cli .. '" was set to (specifics in log)') 656 | else 657 | messenger:Error( 658 | 'fmt: "' .. 659 | formatter_name .. '" isn\'t a valid formatter name. Run "fmt list" and use the exact name of what you want' 660 | ) 661 | end 662 | end 663 | 664 | -- A meta-command that triggers appropriate functions based on input 665 | function fmt_usr_input(input, ex_input) 666 | -- nil means they only typed "fmt" 667 | if input == nil then 668 | format() 669 | elseif input == "list" then 670 | list_supported() 671 | elseif input == "update" then 672 | -- Lets the user force an update to the table 673 | -- Mostly for if they added a conf file to the dir and didn't close Micro 674 | -- Also good for if the user changed Micro's settings without relaunching 675 | init_table() 676 | elseif input == "setall" then 677 | -- ex_input is the 3rd index of the command input (each space declares an index) 678 | if ex_input ~= nil then 679 | set_all(ex_input) 680 | else 681 | messenger:Error( 682 | 'fmt: The setall command requires the name of the formatter you want to set. Run "fmt list" and use the exact name of what you want' 683 | ) 684 | end 685 | elseif input == "unsetall" then 686 | -- ex_input is the 3rd index of the command input (each space declares an index) 687 | if ex_input ~= nil then 688 | unset_all(ex_input) 689 | else 690 | messenger:Error( 691 | 'fmt: The unsetall command requires the name of the formatter you want to unset. Run "fmt list" and use the exact name of what you want' 692 | ) 693 | end 694 | else 695 | -- Check if the passed input == an existing formatter cli command 696 | local index = find_cli_index(input) 697 | if index ~= nil then 698 | -- Runs the formatter manually with a specific formatter against the current file 699 | format(index) 700 | else 701 | messenger:Error('fmt: Unknown command! Run "help fmt" for info') 702 | end 703 | end 704 | end 705 | 706 | -- User command & help file 707 | MakeCommand("fmt", "fmt.fmt_usr_input", 0) 708 | AddRuntimeFile("fmt", "help", "help/fmt.md") 709 | -------------------------------------------------------------------------------- /help/fmt.md: -------------------------------------------------------------------------------- 1 | # fmt plugin 2 | 3 | To manually run formatting on the current file, use the `fmt` command. 4 | 5 | To manually run a specific formatter on the current file, use the `fmt formattername` command. 6 | 7 | When saving a supported file-type, the plugin will automatically run on the file 8 | & save any changes, unless you set `fmt-onsave` to false. 9 | 10 | To get the list of supported languages/formatters, run the `fmt list` command. 11 | A table of supported formatters will be printed to Micro's log. 12 | 13 | To set a formatter to be used on a specific language, run `set languagename-formatter formattername`. 14 | The specific names can be found in the list from `fmt list` 15 | 16 | To set a formatter to be used on all its supported languages, run `fmt setall formattername`. 17 | 18 | To unset all options using a specified formatter, run `fmt unsetall formattername`. 19 | 20 | To refresh the in-memory settings, run `fmt update`. 21 | This is useful if you changed your editor settings, or added a config file to your working directory. 22 | 23 | Please note that formatting of all languages is disabled by default, as to not accidentally 24 | format your files. You must enable them individually for this plugin to do 25 | anything. 26 | 27 | ## What's Bundled? 28 | 29 | No formatters are bundled with this plugin. You must install the formatter you 30 | want or it won't work. 31 | 32 | Some config files are bundled with this plugin, but are only used when one can't 33 | be found in your dir. 34 | 35 | ## Config Files 36 | 37 | If you added a config file and want to update settings, run `fmt update` to 38 | force settings to refresh. 39 | 40 | The fallback paths to the bundled config files don't have hard-coded names, so 41 | you can delete/edit the one in the relevant folder, and it should still work. 42 | 43 | #### Using Custom Formatter/Args 44 | 45 | You can add your own formatter, or just use different args, by adding its command (and filetype) into `settings.json` 46 | The format looks like `"fmt|js": "prettier --write"` in your `settings.json`. 47 | 48 | Note that you must use the filetype detected by Micro, and if it's `Unknown` then use it's literal filetype extension (ex: `p` for Pawn) 49 | You can check a file's type by running `show filetype` 50 | -------------------------------------------------------------------------------- /repo.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Name": "fmt", 4 | "Description": "A multi-language formatting plugin for Micro", 5 | "Tags": [ 6 | "beautifying", 7 | "beautifier", 8 | "beautify", 9 | "formatter", 10 | "formatting", 11 | "multi-language", 12 | "pretty-printer", 13 | "prettifier" 14 | ], 15 | "Versions": [ 16 | { 17 | "Version": "3.2.0", 18 | "Url": "https://github.com/sum01/fmt-micro/archive/v3.2.0.zip", 19 | "Require": { 20 | "micro": ">=1.3.0" 21 | } 22 | } 23 | ] 24 | } 25 | ] 26 | --------------------------------------------------------------------------------