-
Notifications
You must be signed in to change notification settings - Fork 298
Plugins
Oni does not require the use of a plugin-manager such as pathogen or vundle (although you may use one if you wish, and this will be necessary if you are sharing a configuration between Neovim and Oni). Oni will attempt to load all plugins found in the $HOME/.config/oni/plugins
directory.
To install a Vim plugin, you just need to create a directory inside $HOME/.config/oni/plugins
.
git clone
will usually do this for you, so for example, if you wanted to install this Solarized Theme by lifepillar, you'd run:
NOTE: On Windows, use your AppData folder (ie,
%APPDATA%/oni
) instead of~/.config/oni
cd ~/.config/oni
mkdir -p plugins
cd plugins
git clone https://github.com/lifepillar/vim-solarized8
This will clone the vim-solarized8
plugin and create an ~/.config/oni/plugins/vim-solarized8
folder.
Restart Oni, and execute :colorscheme solarized8_light
, and enjoy your new theme!
Several plugins are included with Oni:
As well as some color-schemes:
NOTE: You can disable these by setting the
oni.useDefaultConfig
configuration value tofalse
. See Configuration for details.
In general, most vim plugins should work with Oni. However, we've found a few that have compatibility issues.
If you are running an older version of Dein, there was an issue with it storing a cached version of the runtimepath
variable, which would cause issues with swapping from Oni to terminal Vim.
This is fixed in later versions of Dein, so make sure to update if you hit this issue.
Installing an Oni plugin is much the same as installing a Vim plugin. However, because they potentially have JavaScript extension code in addition to VimL, you often need to install NPM dependencies.
Oni currently has the following plugins:
Prerequisite: Make sure the
npm
command is available. If not, install the latest node
As above, you just need to create a folder hosting the plugin, and install the dependencies. As an example, here's how you'd install the oni-plugin-tslint extension.
cd ~/.config/oni
mkdir -p plugins
cd plugins
git clone https://github.com/extr0py/oni-plugin-tslint
cd oni-plugin-tslint
npm install
Restart Oni, and linting should now be enabled when you open up a TypeScript (.ts
) file.
Oni offers several rich extensibility points, with the focus being on various UI integrations as well as IDE-like capabilities.
NOTE: The API will be in-flux until v1.0.
Language extenders given ONI rich integration with languages, offering services like:
- Code Completion
- Quick Info
- Goto Definition
- Formatting
- Live code evaluation
- Unit test integration
- Enhanced syntax highlighting
To see the in-progress API, check out the Oni.d.ts definition file as well as the typescript language plugin, which demonstrates several of these features:
You can explore the Oni API during runtime by doing the following:
- Press
<C-P>
(open Command Palette) - Select "Open Dev Tools"
- You can access the Oni object directly, ie:
const helloMenu = Oni.menu.create();
const menuItems = [{
icon: 'bookmark',
detail: 'You created a menu!',
label: 'Hello, menu!',
}]
helloMenu.show();
helloMenu.setItems(menuItems);
Plugins bundled with Oni include: Prettier autoformatting plugin
Prettier is:
- An opinionated code formatter
- Supports many languages
- Integrates with most editors
- Has few options
To use the prettier plugin in oni some default options must first be set
//The default config Oni ships with
"oni.plugins.prettier": {
settings: {
semi: false,
tabWidth: 2,
useTabs: false,
singleQuote: false,
trailingComma: "es5",
bracketSpacing: true,
jsxBracketSameLine: false,
arrowParens: "avoid",
printWidth: 80,
},
// TODO: Set this to true to enable formatting on save
formatOnSave: false,
// TODO: Set this to true to enable the plugin
enabled: false,
},
A list of the available configuration options can be found here.
Once enabled a prettier statusbar item should appear in compatible files, if not compatible the plugin does not run and the icon disappears. Once formatted the icon will briefly change to indicate success or failure of the formatting and will also save the buffer.
A format can also be manually triggered by clicking the statubar icon or selecting the Autoformat with Prettier
option in the command pallette