Skip to content
This repository has been archived by the owner on Apr 1, 2020. It is now read-only.

How To: Minimal Oni Configuration

Piping edited this page Jun 27, 2018 · 19 revisions

Oni by default overrides some configurations to provide an IDE-like experience, here follows a method to strip Oni to make it behave more like vim:

// .config/oni/config.tsx

import * as React from "react"
import * as Oni from "oni-api"

export const activate = (oni: Oni.Plugin.Api) => {
  oni.input.unbind("<c-g>") // make C-g work as expected in vim
  oni.input.bind("<s-c-g>", () => oni.commands.executeCommand("sneak.show")) // You can rebind Oni's behaviour to a new keybinding
}

export const configuration = {
    activate,
    "oni.hideMenu"             : "hidden", // Hide top bar menu
    "oni.loadInitVim"          : true, // Load user's init.vim
    "oni.useDefaultConfig"     : false, // Do not load Oni's init.vim
    "ui.colorscheme"           : "n/a", // Load init.vim colorscheme, remove this line if wants Oni's default
    "autoClosingPairs.enabled" : false, // disable autoclosing pairs
    "commandline.mode"         : false, // Do not override commandline UI
    "wildmenu.mode"            : false, // Do not override wildmenu UI,
    "tabs.mode"                : "native", // Use vim's tabline, need completely quit Oni and restart a few times
    "statusbar.enabled"        : false, //Use vim's default statusline
    "sidebar.enabled"          : true, //Keep the side bar, set to false if you want
    "sidebar.default.open"     : false, //Keep the side bar collapse by default}
    "learning.enabled"         : false, // Turn off learning pane
    "achievements.enabled"     : false, // Turn off achievements tracking / UX
    "editor.typingPrediction"  : false, // Wait for vim's confirmed typed characters, avoid edge cases
    "editor.textMateHighlighting.enabled" : false, // Use vim syntax highlighting
}

Since we're not loading Oni's init.vim defaults, prepend and adjust these lines to your init.vim:

" init.vim

set nocompatible              " be iMproved, required
filetype off                  " required

set number
set noswapfile
set smartcase

" Turn off statusbar, because it is externalized
set noshowmode
set noruler
set laststatus=0
set noshowcmd

" Enable GUI mouse behavior
set mouse=a

If you share a config file between vim versions, you may use the following to check if you are in Oni or not. This will allow you to enable or disable features in Oni specifically.

if exists('g:gui_oni')
    " Statements here
endif
Clone this wiki locally