Skip to content

Latest commit

History

16 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Micro <3 Prettier

A Micro editor plugin that formats files using Prettier.

Installation and Usage

Note

For the plugin to work, you must first install Prettier globally, and ensure it is in your $PATH. You can install Prettier globally by running npm install --global prettier in terminal.

First, add the following line to your Micro configuration file:

{// ....,"pluginrepos": ["https://raw.githubusercontent.com/gamemaker1/micro-plugin-prettier/main/repo.json"]}

Then run the following in terminal to install the plugin:

micro --plugin install prettier

The next time you edit and save a file using Micro, it will get automatically formatted using Prettier.

Configuration

If Prettier detects a configuration file, the options set for the plugin will not apply. If there is no configuration present, then the options set for the plugin (or the default values) will be used.

You can set an option by running the following command (Press Ctrl+E, then run the following):

set prettier.<name> <value>

Where name is an option from the table, and value is one of the possible values for that option. See the official Prettier documentation for an even more detail explanation of each option and its possible values.

OptionDescriptionDefault ValuePossible Values
tabwidthSpecify the number of spaces per indentation-level.2<number>
usetabsIndent lines with tabs instead of spaces.falsetrue, false
semiPrint semicolons at the ends of statements.truetrue, false
singlequoteUse single quotes instead of double quotes.falsetrue, false
quotePropsChange when properties in objects are quoted.as-neededas-needed, consistent, preserve
jsxsinglequoteUse single quotes instead of double quotes in JSX.falsetrue, false
trailingcommaPrint trailing commas wherever possible in multi-line comma-separated syntactic structures.es5none, es5, always
bracketspacingPrint spaces between brackets in object literals.truetrue, false
bracketsamelinePut the > of a multi-line HTML element at the end of the last line instead of being alone on the next line.falsetrue, false
arrowparensInclude parentheses around a sole arrow function parameter.alwaysalways , avoid
wrapHard wrap lines at the column specified by the cols setting.preservealways, never, preserve
colsSpecify the line length that the printer will wrap on.80<number>
eolThe line feed character to use in all files.lflf, crlf, cr, auto
formatembeddedcodeWhether or not to format quoted code embedded in the file.autoauto, off
indentvuecodeWhether or not to indent the code inside <script> and <style> tags in Vue files.falsetrue, false
htmlwhitespacesensitivitySpecify the global whitespace sensitivity for HTML, Vue, Angular, and Handlebars.csscss, strict, ignore
requirepragmaWhether to only format files that contain a special comment, called a pragma, at the top of the file.falsetrue, false
insertpragmaWhether to insert a special @format marker at the top of files specifying that the file has been formatted with Prettier.falsetrue, false

You can also format the document without saving it by running the following command (Press Ctrl+E, then run the following):

format

You can switch off the format-on-save feature by running the following command (Press Ctrl+E, then run the following):

set prettier.autoformat off

Issues and Contributing

Found a bug? Don't like something? Want to see something added/changed? Open an issue!

License

This plugin is licensed under the ISC license. See the license file for the complete license text.

About

A Micro plugin that formats your code using Prettier

Topics

Resources

Stars

9 stars

Watchers

1 watching

Forks

Releases

Contributors

Languages