Created
January 20, 2020 20:41
-
-
Save zindel/81007a77554d358c7607b9e8a1be4fe5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" {{{ Plugins | |
call plug#begin('~/.vim/plugged2') | |
Plug 'altercation/vim-colors-solarized' | |
Plug 'editorconfig/editorconfig-vim' | |
Plug '/usr/local/opt/fzf' | |
Plug 'junegunn/fzf.vim' | |
Plug 'zindel/vim-reasonml' | |
Plug 'let-def/ocp-indent-vim' | |
Plug 'tpope/vim-commentary' | |
Plug 'dense-analysis/ale' | |
Plug 'mattn/webapi-vim' | |
Plug 'mattn/gist-vim' | |
Plug 'pangloss/vim-javascript' | |
Plug 'mxw/vim-jsx' | |
Plug 'purescript-contrib/purescript-vim' | |
call plug#end() | |
" }}} | |
" {{{ Base settings | |
scriptencoding utf-8 | |
set autochdir | |
set expandtab | |
set tabstop=4 | |
set softtabstop=4 | |
set sw=4 | |
set rtp+=/usr/local/opt/fzf | |
set clipboard=unnamed | |
set list | |
set listchars=trail:•,tab:>- | |
let mapleader="," | |
let g:solarized_visibility="high" | |
colorscheme solarized | |
command! -nargs=0 Only :only | |
nnoremap <Enter> :nohl<CR> | |
" }}} | |
" {{{ FZF | |
let $FZF_DEFAULT_COMMAND = 'ag -l --nocolor | |
\ --hidden | |
\ --ignore .git | |
\ --ignore .svn | |
\ --ignore .hg | |
\ --ignore .DS_Store | |
\ --ignore coverage | |
\ --ignore build | |
\ --ignore node_modules | |
\ --ignore site-packages | |
\ --ignore "*.egg-info" | |
\ --ignore "**/*.pyc" | |
\ --ignore "*.pyc" | |
\ -g ""' | |
" make sure fzf quits easily | |
:au FileType fzf tnoremap <nowait><buffer> <esc> <c-g> | |
function! FindRepoRoot() | |
let current = expand('%:p:h') | |
let home = expand("$HOME") | |
while 1 | |
if isdirectory(expand(current . "/./.git")) | |
\ || isdirectory(expand(current . "/./.hg")) | |
break | |
endif | |
if current == home | |
break | |
endif | |
let current = fnamemodify(current . "/../", ":p:h") | |
endwhile | |
return current | |
endfunction | |
function! OpenRepoRoot() | |
exe 'Files '. FindRepoRoot() | |
endfunction | |
nnoremap <C-p> :call OpenRepoRoot()<CR> | |
nnoremap <C-b> :Buffers<CR> | |
nnoremap <C-f> :Ag | |
" }}} | |
" {{{ Tab Autocompletion | |
function! TabForward() | |
if col('.')>1 && strpart( getline('.'), col('.')-2, 3 ) =~ '^\w' | |
return "\<C-N>" | |
else | |
return "\<Tab>" | |
endfunction | |
inoremap <Tab> <C-R>=TabForward()<CR> | |
" }}} | |
" {{{ Prettier | |
function! Prettier() | |
let save_cursor = getpos(".") | |
exe "normal! gggqG" | |
if v:shell_error | |
let line = getline(1) | |
undo | |
echo line | |
else | |
write | |
endif | |
call setpos('.', save_cursor) | |
endfunction | |
" }}} | |
" {{{ OCaml | |
let g:opamshare = substitute(system('opam var share'),'\n$','','''') | |
" this is not from OPAM since I don't want merlin-type-history to be closed | |
" on CursorMoved | |
execute "set rtp+=/Users/zindel/.vim/merlin/vim/merlin" | |
execute "set rtp+=" . g:opamshare . "/ocp-indent/vim" | |
" execute "set rtp+=" . g:opamshare . "/ocp-index/vim" | |
let g:merlin_type_history_auto_open = 0 | |
function! SetupOcamlBuffer() | |
nnoremap <leader>t :MerlinTypeOf<CR> | |
nnoremap <leader>d :MerlinDestruct<CR> | |
nnoremap <leader>l :MerlinLocate<CR> | |
nnoremap <leader><Enter> :MerlinClearEnclosing<CR> :call merlin_type#HideTypeHistory(0)<CR> | |
nnoremap <buffer> <leader>f :call Prettier()<CR> | |
nnoremap <buffer> <leader>f :call Prettier()<CR> | |
if expand('%:t') =~ '.mli$' | |
setlocal formatprg=ocamlformat\ --name=input.mli\ - | |
endif | |
endfunction | |
autocmd FileType reason setlocal formatprg=refmt\ --parse\ re | |
autocmd FileType ocaml setlocal formatprg=ocamlformat\ --name=input.ml\ - | |
autocmd FileType ocaml,reason call SetupOcamlBuffer() | |
" }}} | |
" {{{ Ale | |
nnoremap <leader>n :ALENextWrap<CR> | |
let g:ale_lint_on_text_changed = 'never' | |
let g:ale_lint_on_insert_leave = 0 | |
" }}} | |
" {{{ Russian Phonetic Mapping | |
cmap я q | |
cmap Я Q | |
nmap я q | |
nmap Я Q | |
vmap я q | |
vmap Я Q | |
cmap ш w | |
cmap Ш W | |
nmap ш w | |
nmap Ш W | |
vmap ш w | |
vmap Ш W | |
cmap е e | |
cmap Е E | |
nmap е e | |
nmap Е E | |
vmap е e | |
vmap Е E | |
cmap р r | |
cmap Р R | |
nmap р r | |
nmap Р R | |
vmap р r | |
vmap Р R | |
cmap т t | |
cmap Т T | |
nmap т t | |
nmap Т T | |
vmap т t | |
vmap Т T | |
cmap ы y | |
cmap Ы Y | |
nmap ы y | |
nmap Ы Y | |
vmap ы y | |
vmap Ы Y | |
cmap у u | |
cmap У U | |
nmap у u | |
nmap У U | |
vmap у u | |
vmap У U | |
cmap и i | |
cmap И I | |
nmap и i | |
nmap И I | |
vmap и i | |
vmap И I | |
cmap о o | |
cmap О O | |
nmap о o | |
nmap О O | |
vmap о o | |
vmap О O | |
cmap п p | |
cmap П P | |
nmap п p | |
nmap П P | |
vmap п p | |
vmap П P | |
cmap ю [ | |
cmap Ю [ | |
nmap ю [ | |
nmap Ю [ | |
vmap ю [ | |
vmap Ю [ | |
cmap ж ] | |
cmap Ж ] | |
nmap ж ] | |
nmap Ж ] | |
vmap ж ] | |
vmap Ж ] | |
cmap а a | |
cmap А A | |
nmap а a | |
nmap А A | |
vmap а a | |
vmap А A | |
cmap с s | |
cmap С S | |
nmap с s | |
nmap С S | |
vmap с s | |
vmap С S | |
cmap д d | |
cmap Д D | |
nmap д d | |
nmap Д D | |
vmap д d | |
vmap Д D | |
cmap ф f | |
cmap Ф F | |
nmap ф f | |
nmap Ф F | |
vmap ф f | |
vmap Ф F | |
cmap г g | |
cmap Г G | |
nmap г g | |
nmap Г G | |
vmap г g | |
vmap Г G | |
cmap ч h | |
cmap Ч H | |
nmap ч h | |
nmap Ч H | |
vmap ч h | |
vmap Ч H | |
cmap й j | |
cmap Й J | |
nmap й j | |
nmap Й J | |
vmap й j | |
vmap Й J | |
cmap к k | |
cmap К K | |
nmap к k | |
nmap К K | |
vmap к k | |
vmap К K | |
cmap л l | |
cmap Л L | |
nmap л l | |
nmap Л L | |
vmap л l | |
vmap Л L | |
cmap э \ | |
cmap Э \ | |
nmap э \ | |
nmap Э \ | |
vmap э \ | |
vmap Э \ | |
cmap щ ` | |
cmap Щ ` | |
nmap щ ` | |
nmap Щ ` | |
vmap щ ` | |
vmap Щ ` | |
cmap з z | |
cmap З Z | |
nmap з z | |
nmap З Z | |
vmap з z | |
vmap З Z | |
cmap х x | |
cmap Х X | |
nmap х x | |
nmap Х X | |
vmap х x | |
vmap Х X | |
cmap ц c | |
cmap Ц C | |
nmap ц c | |
nmap Ц C | |
vmap ц c | |
vmap Ц C | |
cmap в v | |
cmap В V | |
nmap в v | |
nmap В V | |
vmap в v | |
vmap В V | |
cmap б b | |
cmap Б B | |
nmap б b | |
nmap Б B | |
vmap б b | |
vmap Б B | |
cmap н n | |
cmap Н N | |
nmap н n | |
nmap Н N | |
vmap н n | |
vmap Н N | |
cmap м m | |
cmap М M | |
nmap м m | |
nmap М M | |
vmap м m | |
vmap М M | |
cmap ь - | |
cmap Ь - | |
nmap ь - | |
nmap Ь - | |
vmap ь - | |
vmap Ь - | |
cmap ъ = | |
cmap Ъ = | |
nmap ъ = | |
nmap Ъ = | |
vmap ъ = | |
vmap Ъ = | |
" }}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment