extr0py / oni
- среда, 23 августа 2017 г. в 03:13:25
Oni: An IDE powered by Neovim
ONI is a NeoVim front-end UI with rich IDE-like UI integration points, drawing inspiration from VSCode, Atom, and LightTable
This repository is under active development, and until 1.0 please consider everything unstable.
Check out Releases for the latest binaries, or Build Oni from source.
ONI brings several IDE-like integrations to NeoVim:
Check out Releases for the latest binary.
Windows & OSX releases come with a bundled Neovim release.
C:\Program Files (x86)\Oni
for a 64-bit machine.You can also find install via a zip archive
You may want to add Oni to your
%PATH%
, so that from the console, you can open Oni viaoni
Oni.app
to the Applications
folderIf you do not have Neovim, follow the instructions to Install Neovim and ensure the 'nvim' binary is available. Version
0.2.0
is required..
sudo dpkg -i <file>.deb
A tar.gz is also available.
If you do not have Neovim, follow the instructions to Install Neovim and ensure the 'nvim' binary is available. Version
0.2.0
is required..
sudo dnf install <file>.rpm
A tar.gz is also available.
Clone the repository: git clone https://github.com/extr0py/oni.git
Install dependencies by running npm install
from the root
Build using npm run build
from the root
Run npm link
to register the ONI command
Run oni
at the command line
The goal of this project is to provide both the full-fledged VIM experience, with no compromises, while pushing forward to enable new scenarios.
VIM is an incredible tool for manipulating text at the speed of thought. With a composable, modal command language, it is no wonder that VIM usage is still prevalent today even in the realm of modern editors.
However, going from thought to code has some different challenges than going from thought to text. IDEs today provide several benefits that help to reduce cognitive load when writing code, and that benefit is tremendously important - not only in terms of pure coding efficiency and productivity, but also in making the process of writing code enjoyable and fun.
In my journey of learning VIM and increasing proficiency in other editors, I've found there is always a trade-off - either enjoy the autocompletion and IDE features, and compromise on the experience and muscle memory I've built with VIM, or work in VIM and compromise on the rich language functionality we have in an IDE.
The goal of this project is to give an editor that gives the best of both worlds - the power, speed, and flexibility of using VIM for manipulating text, as well as the rich tooling that comes with an IDE.
Code completion is a commonly requested add-on to Vim, and the most common solutions are to use a plugin like YouCompleteMe, deoplete, or AutoComplPop.
These are all great plugins - but they all have the same fundamental issue that they are bounded by the limitations of the Vim terminal UI, and as such, can never be quite up-to-par with new editors that do not have such limitations. In addition, some require an involved installation process. The goal of code completion in ONI is to be able to break free of these restrictions, and provide the same richness that modern editors like Atom or VSCode provide for completion.
If a language extension is available for a language, then that language service will be queried as you type, and if there are completions available, those will be presented automatically.
Out of the box, the supported languages for rich completion are JavaScript & TypeScript. There is no special setup required for JavaScript & TypeScript language completion, but you will get best results by having a
jsconfig.json
ortsconfig.json
at the root of your project.. You can use an empty json file with{}
to get the rich completion.
<C-n>
- navigate to next entry in the completion menu<C-p>
- navigate to previous entry in the completion menu<Enter>
- selected completion item<Esc>
- close the completion menuoni.useExternalPopupMenu
- if set to true, will render the Vim popupmenu in the same UI as the language extension menu, so that it has a consistent look and feel. If set to false, will fallback to allow Neovim to render the menu.Fuzzy Finder is a quick and easy way to switch between files. It's similiar in goal to the Ctrl-P plugin, and the built-in functionality editors like VSCode and Atom provide.
<C-p>
- show the Fuzzy Finder menu<C-n>
- navigate to next entry in the Fuzzy Finder menu<C-p>
- navigate to previous entry in the Fuzzy Finder menu<Enter>
- select a Fuzzy Finder item<Esc>
- close the Fuzzy Finder menuBy default, Fuzzy Finder uses git ls-files
to get the available files in the directory, but if git is not present, it will fallback to a non-git strategy.
The Fuzzy Finder strategy can be configured by the editor.quickOpen.execCommand
, and must be a shell command that returns a list of files, separated by newlines.
The Command Palette offers another command-line based interface to Oni.
<C-P>
<C-n>
- navigate to next entry in the Command Palette menu<C-p>
- navigate to previous entry in the Command Palette menu<Enter>
- select a Command Palette item<Esc>
- close the Command Palette menuCurrently, the Command Palette includes items from:
scripts
.oni
folderQuick Info gives a quick summary of an identifier when the cursor is held on it. JavaScript and TypeScript is supported out of the box.
Leave the cursor hovering over an identifier.
oni.quickInfo.enabled
- If set to true
, the Quick Info feature is enabled. (Default: true
)oni.quickInfo.delay
- Delay in milliseconds for the Quick Info window to show. (Default: 500
)Oni features a rich status bar, designed as a replacement for vim-powerline and vim-airline.
Oni provides a StatusBar
API for adding new items to the status bar.
oni.statusbar.enabled
- If set to true
, the status bar feature is enabled. (Default: true
)Users that are coming from Neovim and have highly customized status bars may want to set
oni.statusbar.enabled
to false, along with setting theoni.loadInitVim
totrue
andoni.useDefaultConfig
tofalse
.
Oni features a buffer tab bar, like many common IDEs. VIM has its own definition of a "Tab", which is really a set of windows and buffers. By default, the tabs in Oni correspond to open files (buffers). You can override this, and show vim-defined tabs, by setting the tabs.showVimTabs
setting to true
[b
and ]b
will cycle through buffers, which has the effect of moving through the tabs.tabs.enabled
- If set to true
, the tabs are visible. (Default: true
)tabs.showVimTabs
- If set to true
, shows vim tabs. Otherwise, shows open buffers. (Default: false
. Requires Neovim 0.2.1+)Configuration
JavaScript and TypeScript support is enabled out-of-the-box using the TypeScript Standalone Server. No setup and configuration is necessary, however, you will get better results if you use a tsconfig.json
or a jsconfig.json
to structure your project.
Supported Language features
Completion | Goto Definition | Formatting | Enhanced Syntax Highlighting | Quick Info | Signature Help | Live Evaluation | Debugging |
---|---|---|---|---|---|---|---|
+ | + | + | + | + | + | + | - |
Configuration
C# language support requires the oni-language-csharp plugin, which provides langauge capabilities for both .NET and Mono.
Follow the installation instructions to get started.
Supported Language features
Completion | Goto Definition | Formatting | Enhanced Syntax Highlighting | Quick Info | Signature Help | Live Evaluation | Debugging |
---|---|---|---|---|---|---|---|
+ | + | - | - | + | - | - | - |
Configuration
Go language support depends on the go-langserver by SourceGraph, which provides language support for Go. Follow their installation instructions as this language server is not bundled out-of-the-box with Oni.
go-langserver
must be available in your PATH. You can override this by setting thegolang.langServerCommand
configuration value.
Supported Language features
Completion | Goto Definition | Formatting | Enhanced Syntax Highlighting | Quick Info | Signature Help | Live Evaluation | Debugging |
---|---|---|---|---|---|---|---|
- | + | - | - | + | - | - | - |
Known Issues
Configuration
Python language support depends on pyls by Palantir, which provides language support for Python. Follow their installation instructions as this language server is not bundled out-of-the-box with Oni.
pyls
must be available in your PATH. You can override this by setting thepython.langServerCommand
configuration value.
Supported Language features
Completion | Goto Definition | Formatting | Enhanced Syntax Highlighting | Quick Info | Signature Help | Live Evaluation | Debugging |
---|---|---|---|---|---|---|---|
+ | + | - | - | + | - | - | - |
Known Issues
Configuration
Reason and OCaml support depends on ocaml-language-server by @freebroccolo.
You will need to build the language server locally, as the currently published NPM package is out-of-date:
git clone https://github.com/freebroccolo/ocaml-language-server.git
cd ocaml-language-server
yarn install
yarn run compile
npm link
NOTE: Once the NPM package is updated with a fix for #22, steps 2-6 can be replaced with
npm install -g ocaml-language-server
.
Supported Language features
Completion | Goto Definition | Formatting | Enhanced Syntax Highlighting | Quick Info | Signature Help | Live Evaluation | Debugging |
---|---|---|---|---|---|---|---|
+ | + | - | + | + | - | - | - |
ONI is configurable via a 'config.js' located in $HOME/.oni
Here's an example config.js:
module.exports = {
"oni.useDefaultConfig": true,
"oni.loadInitVim": true,
"editor.fontSize": "14px",
"editor.fontFamily": "Monaco",
"editor.completions.enabled": true
}
A few interesting configuration options to set:
oni.audio.bellUrl
- Set a custom sound effect for the bell
(:help bell
). The value should be an absolute path to a supported audio file, such as a WAV file.oni.useDefaultConfig
- ONI comes with an opinionated default set of plugins for a predictable out-of-box experience. This will be great for newcomes to ONI or Vim, but for Vim/Neovim veterans, this will likely conflict. Set this to false
to avoid loading the default config, and to load settings from init.vim
instead (If this is false, it implies oni.loadInitVim
is true)oni.loadInitVim
- This determines whether the user's init.vim
is loaded. Use caution when setting this to true
and setting oni.useDefaultConfig
to true, as there could be conflicts with the default configuration.oni.exclude
- Glob pattern of files to exclude from Fuzzy Finder (Ctrl-P). Defaults to ["**/node_modules/**"]
oni.hideMenu
- (default: false
) If true, hide menu bar. When hidden, menu bar can still be displayed with Alt
.editor.clipboard.enabled
- (default: true
) Enables / disables system clipboard integration.editor.fontSize
- Font sizeeditor.fontFamily
- Font familyeditor.fontLigatures
- (default: true
). If true, ligatures are enabled.editor.backgroundImageUrl
- specific a custom background imageeditor.backgroundImageSize
- specific a custom background size (cover, contain)editor.scrollBar.visible
- (default: true
) sets whether the buffer scrollbar is visibleenvironment.additionalPaths
- (default: [] on Windows, ['/usr/bin', '/usr/local/bin'] on OSX and Linux
). Sets additional paths for binaries. This may be necessary to configure, if using plugins or a Language Server that is not in the default set of runtime paths. Note that depending on where you launch Oni, there may be a different set of runtime paths sent to it - you can always check by opening the developer tools and running process.env.PATH
in the console.See the Config.ts
file for other interesting values to set.
In VimL, the g:gui_oni
variable will be set to 1
, and can be validated with if exists("g:gui_oni")
in VimL.
Oni, by default, integrates with the system clipboard. This is controlled by the editor.clipboard.enabled
option.
The behavior is as follows:
If you have custom behavior or functionality bound to <C-c>
, <C-v>
(or <M-c>
, <M-v>
on OSX), you may wish to disable this behavior by setting editor.clipboard.enabled
to false
.
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, by default, load all plugins in the $HOME/.oni/plugins
directory.
To install a Vim plugin, you just need to create a directory inside $HOME/.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 home directory (ie,
C:/users/<your username
) instead of~
cd ~/.oni
mkdir -p plugins
cd plugins
git clone https://github.com/lifepillar/vim-solarized8
This will clone the vim-solarized8
plugin and create an ~/.oni/plugins/vim-solarized8
folder.
Restart Oni, and execute :colorscheme solarized8_light
, and enjoy your new theme!
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.
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 ~/.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:
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:
<C-P>
(open Command Palette)ONI currently supports the setting of a background image as well as background opacity.
TL;DR - Set the
oni.useDefaultConfig
configuration value to false
By default, Oni has an opinionated, prescribed set of plugins, in order to facilitate a predictable out-of-box experience that highlights the additional UI integration points. However, this will likely have conflicts with a Vim/Neovim veteran's finely-honed configuration.
To avoid loading the Oni defaults, and instead use your init.vim
, set this configuration value to false in $HOME/.oni/config.json.
This distribution contains several VIM plugins that enhance the VIM experience.
These are:
As well as some color-schemes:
See roadmap
MIT License. Copyright (c) extropygames
There are a few image and audio assets bundled with Oni - see ASSETS.md for attribution.
Windows and OSX have a bundled version of Neovim, which is covered under Neovim's license
Bundled plugins have their own license terms. These include:
oni/vim/core/typescript.vim
)oni/vim/default/bundle/targets.vim
)oni/vim/default/bundle/vim-commentary
)oni/vim/default/bundle/vim-unimpaired
).vim
files in oni/vim/core/oni-plugin-reasonml
)Contributions are very much welcome :)
If you're interested in helping out, check out CONTRIBUTING.md for tips and tricks for working with ONI.
Big thanks to the NeoVim team - without their work, this project would not be possible. The deep integration with VIM would not be possible without the incredible work that was done to enable the msgpack-RPC interface. Thanks!
A big THANK YOU to our current monthly sponsors. Your contributions help keep this project alive!
In addition, there are several other great NeoVim front-end UIs here that served as great reference points and learning opportunities.
Also, thanks to our contributors for helping out!
Special thanks to Till Arnold for handing over the oni
NPM package name.