diff --git a/README.md b/README.md index 76609b5..c3e0862 100644 --- a/README.md +++ b/README.md @@ -1,91 +1,65 @@ -# c\_formatter\_42 [![Build Status](https://api.travis-ci.com/cacharle/c_formatter_42.svg?branch=master)](https://app.travis-ci.com/cacharle/c_formatter_42) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/c-formatter-42)](https://pypi.org/project/c-formatter-42/) +

+ c_formatter_42 +

-![What\_is\_it](./Img/final_back.png) +

+ PyPI version + +

-# What is c\_formatter\_42? + + +

+ +

+ +## What is c_formatter_42? It is Prettier for C in 42. I know you are already a good Human norm. It's just for convenience. +## Installation -## Vim - -Checkout [c\_formatter\_42.vim](https://github.com/cacharle/c_formatter_42.vim) - +Requires Python3.6+ (3.7, 3.8, 3.9, 3.10) +### from pypi -## VSCode - -1. Install clang-format. - -- MacOS -``` -$ brew install clang-format ``` - Or you can install vscode extension `Clang-Format` - - -2. Copy `.clang-format` in your Workspace directory. - - -3. VSCode Settings -- Set Default Formatter as clang-format. -- Turn off `Format On Paste`, `Format On Save`. -- Or You can just copy this in your `.vscode/settings.json` file. -``` -"editor.defaultFormatter": "xaver.clang-format", -"editor.formatOnPaste": false, -"editor.formatOnSave": false, +$ pip3 install c-formatter-42 +$ pip3 install --user c-formatter-42 # if you don't have root privileges ``` -##### 🚨 **CAUTION** Check your **clang-format version**. -If version is lower than 10, `SpaceBeforeSquareBrackets: false` and `AllowShortBlocksOnASingleLine: Never` can't work well. -So you should comment them out!) - -4. Execute code formatting -- On Windows: Shift + Alt + F -- On Mac: Shift + Option + F -- On Linux: Ctrl + Shift + I +### from source (recommended for Norminette v3 users) -#### 🚨Caution(VSCode) - -It's not perfect. -**You should format these rules MANUALLY after auto-formatting.** -- `global aligned` -- `declarations aligned` -- `declarations must be followed by one empty line` -- `Empty line` ``` -int aaaa = 12; -float b = 23; -std::string ccc = 23; +$ git clone https://github.com/cacharle/c_formatter_42 +$ cd c_formatter_42 +$ pip3 install -e . ``` -Recommended to set in `Workspace Preference`. +## usage ---- +### Vim -## Command line tool +Checkout [c_formatter_42.vim](https://github.com/cacharle/c_formatter_42.vim) plugin. This plugin automatically installs the c_formatter_42 package using pip. -### Installation +### VSCode -#### pip +1. Install [emeraldwalk.runonsave](https://marketplace.visualstudio.com/items?itemName=emeraldwalk.RunOnSave) extension. +2. Add Configuration to vscode. (We recommend you to put it in `Workspace Preference`) ``` -$ pip3 install c-formatter-42 -$ pip3 install --user c-formatter-42 # if you don't have root privileges -``` - -#### Manual - -``` -$ git clone https://github.com/dawnbeen/c_formatter_42 -$ cd c_formatter_42 -$ pip3 install -e . +"emeraldwalk.runonsave": { + "commands": [{ + "match": ".[ch]", + "cmd": "python3 -m c_formatter_42 < ${file} | tee _cfdump && cat _cfdump | tee ${file} && rm -f _cfdump" + }] +} ``` +You can copy above and paste it in the `.vscode/setting.json`. -### Usage +### Command line ``` $ c_formatter_42 < file.c