Skip to content

Instantly share code, notes, and snippets.

@GeordieP
Created July 18, 2018 17:42
Show Gist options
  • Select an option

  • Save GeordieP/47a0eaa444e5ba8fff3d893bf2e987bb to your computer and use it in GitHub Desktop.

Select an option

Save GeordieP/47a0eaa444e5ba8fff3d893bf2e987bb to your computer and use it in GitHub Desktop.
Oni configuration
"==========================
" visuals
"==========================
set title
set titleold="Terminal"
set titlestring=%F
set guioptions=egmrti
set gcr=a:blinkon0
set scrolloff=5
set laststatus=2
set modeline
set modelines=10
set hidden
set nowrap
set statusline=%F%m%r%h%w%=(%{&ff}/%Y)\ (line\ %l\/%L,\ col\ %c)\
" set cursorline
"==========================
" lines
"==========================
syntax on
set ruler
set number
"==========================
" encoding
"==========================
set encoding=utf-8
set fileencoding=utf-8
set fileencodings=utf-8
set bomb
set binary
"==========================
" interaction
"==========================
set mousemodel=popup
" cause ctrl+w to always delete previous word (instead of only words entered
" since beginning of current insert mode)
set backspace=indent,eol,start
set mouse=nicr " fix mouse for iTerm2
"==========================
" indentation
"==========================
set tabstop=4
set softtabstop=0
set shiftwidth=4
set expandtab
set backspace=indent,eol,start
"==========================
" searching
"==========================
" set hlsearch " enable highlighting of search results - bound to key in keys.vim
set nohlsearch "disable search highlighting (it's on by default)
set incsearch
set ignorecase
set smartcase
"==========================
" files
"==========================
set nobackup
set noswapfile
set fileformats=unix,dos,mac
set autoread
"==========================
" keys
"==========================
" map leader ,
let mapleader=','
" buffer nav
noremap <leader>z :bp<CR>
noremap <leader>q :bn<CR>
nnoremap <silent> <C-Tab> :bn<CR>
nnoremap <silent> <C-S-Tab> :bp<CR>
" close buffer
noremap <leader>c :bd<CR>
" switching windows
noremap <C-j> <C-w>j
noremap <C-k> <C-w>k
noremap <C-l> <C-w>l
noremap <C-h> <C-w>h
"
" clean search (highlight)
nnoremap <silent> <leader><space> :noh<cr>
" press enter to clear search highlight
nnoremap <cr> :noh<cr>
" enter normal mode
inoremap kj <Esc>
" delete previous word ctrl+backspace
imap <C-BS> <C-W>
" Opens an edit command with the path of the currently edited file filled in
noremap <Leader>e :e <C-R>=expand("%:p:h") . "/" <CR>
" Opens a tab edit command with the path of the currently edited file filled
noremap <Leader>te :tabe <C-R>=expand("%:p:h") . "/" <CR>
" set cwd to current file cwd
nnoremap <leader>. :lcd %:p:h<CR>
" next tab
nnoremap <Tab> gt
" prev tab
nnoremap <S-Tab> gT
" create tab
nnoremap <silent> <C-t> :tabnew<CR>
" horiz split
noremap <Leader>sh :<C-u>split<CR>
" vert split
noremap <Leader>v :<C-u>vsplit<CR>
" toggle relative line numbers
noremap <S-t> :set relativenumber!<cr>
" center view on next find result
nnoremap n nzzzv
" center view on prev find result
nnoremap N Nzzzv
" abbrev case insensitivity
cnoreabbrev W! w!
cnoreabbrev Q! q!
cnoreabbrev Qall! qall!
cnoreabbrev Wq wq
cnoreabbrev Wa wa
cnoreabbrev wQ wq
cnoreabbrev WQ wq
cnoreabbrev W w
cnoreabbrev Q q
cnoreabbrev Qall qall
" close buffer in current split without losing split
nnoremap <silent> <leader>x :b #\|:bd #<CR>
nmap <C-_> gcc
" leader,ctrl-h to toggle search highlighting
nnoremap <leader><C-h> :set hls!\|set hls?<CR>
import * as React from "/Applications/Oni.app/Contents/Resources/app/node_modules/react"
import * as Oni from "/Applications/Oni.app/Contents/Resources/app/node_modules/oni-api"
export const activate = (oni: Oni.Plugin.Api) => {
console.log("config activated")
// helpers (from default key binds)
const isMenuOpen = () => oni.menu.isMenuOpen()
const isNormalMode = () => oni.editors.activeEditor.mode === "normal"
// Input
//
// Add input bindings here:
//
/* oni.input.bind("<c-enter>", () => console.log("Control+Enter was pressed")) */
/* oni.input.bind("<c-k, b>", () => { oni.configuration.setValues({ 'sidebar.enabled': false }) }) */
/* oni.input.bind("<c-enter>", () => { oni.configuration.setValues({ 'sidebar.enabled': false }) }) */
//
oni.input.bind("<c-p>", "quickOpen.show", () => isNormalMode() && !isMenuOpen())
// Or remove the default bindings here by uncommenting the below line:
//
// oni.input.unbind("<c-p>")
}
export const deactivate = (oni: Oni.Plugin.Api) => {
console.log("config deactivated")
}
export const configuration = {
//add custom config here, such as
"ui.colorscheme": "nord",
"achievements.enabled": false,
"oni.loadInitVim": "~/.vimrc",
//"oni.useDefaultConfig": true,
//"oni.bookmarks": ["~/Documents"],
//"oni.loadInitVim": false,
"editor.fontSize": "16px",
/* "editor.fontFamily": "Monaco", */
// UI customizations
"ui.animations.enabled": false,
"ui.fontSmoothing": "auto",
"autoClosingPairs": [
{
"open": '"',
"close": '"'
},
{
"open": "'",
"close": "'",
}
],
"sidebar.enabled": false,
"tabs.mode": "buffers"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment