|
| 1 | +## Coding |
| 2 | + |
| 3 | +- Use `const` instead of `let` if available |
| 4 | +- Don't `l:` to define local variables unless necessary |
| 5 | +- Use the conditional operator `foo ? bar : baz` instead of `if` when it is more readable |
| 6 | +- Use the conditional operator `foo ? bar : baz` when it is more readable than `if` |
| 7 | +- Define the name if use optional arguments. e.g., `a:0`, `a:1`, ... |
| 8 | + - For example: `const filetype = get(a:000, 0, v:null)` |
| 9 | +- Don't use `==`. Use `==#` instead |
| 10 | +- Make the tests if you add new features |
| 11 | + |
| 12 | +## doc |
| 13 | + |
| 14 | +1. Text Formatting |
| 15 | + - Normal descriptions are not indented |
| 16 | + - One line should not exceed 78 characters (including tabs) |
| 17 | + - Break lines at meaningful points, not mechanically at character 78 |
| 18 | + - Keep related information together, use blank lines to separate different topics |
| 19 | + |
| 20 | +2. Structure and Indentation |
| 21 | + - `*:CommandName*` tags are not indented |
| 22 | + - Option/argument descriptions are indented with 2 spaces |
| 23 | + - Additional details under options are indented with 4 spaces |
| 24 | + - Empty lines are used to separate logical sections |
| 25 | + |
| 26 | +3. Code Examples |
| 27 | + - Use tab characters for indentation inside code blocks |
| 28 | + - Surround code blocks with `>` and `<` |
| 29 | + - Group related commands in the same block |
| 30 | + - Add descriptive comments starting with `"` |
| 31 | + - Empty lines between command groups are allowed for clarity |
| 32 | + |
| 33 | +Example: |
| 34 | +```help |
| 35 | + *:FooCommand* |
| 36 | +:FooCommand [arg1] [arg2] |
| 37 | + Opens a new foo with specified arguments. |
| 38 | + |
| 39 | + [arg1] is an optional argument: |
| 40 | + - When omitted: Uses default value |
| 41 | + - Otherwise: Uses specified value |
| 42 | +> |
| 43 | + " Basic usage |
| 44 | + :FooCommand |
| 45 | + |
| 46 | + " With specific arguments |
| 47 | + :FooCommand value |
| 48 | + :FooCommand value1 value2 |
| 49 | +< |
| 50 | +The buffer is opened with certain properties: |
| 51 | +> |
| 52 | + " Default settings |
| 53 | + setlocal setting1 |
| 54 | + setlocal setting2 |
| 55 | +< |
| 56 | +``` |
0 commit comments