Onivim supports code formatting, powered by Code language extensions. Onivim comes bundled with several format providers by default.
Onivim supports both the
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.
In the above example, the
gqap key sequence does the following:
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:
Format on Save
"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: