Formatting
Formatting
Onivim supports code formatting, powered by Code language extensions. Onivim comes bundled with several format providers by default.
Keybindings
Onivim supports both the =
and gq
operators from Vim - in Onivim, these are functionality equivalent, and can be used to format a range of text.
In both cases, Onivim requests from an installed extension that provides format capabilities.
For example:
In the above example, the gqap
key sequence does the following:
gq
format operatorap
around-paragraph motion
In addition, the document can be formatted using these keybindings:
- Linux: Control+Shift+I
- Mac: Option+Shift+F
- Windows: Alt+Shift+F
Multiple Format Providers
If there are multiple available format providers for the active filetype, Onivim will prompt to choose the default format provider:
Configuration
Format on Save
The "editor.formatOnSave"
setting can be used to request that Onivim runs a formatter after saving:
This setting is recommended to be set per-filetype, for example:
"[javascript]": {
"editor.formatOnSave": true
}