Created
March 13, 2019 22:37
-
-
Save Capster/827b7c1ab264708db6415dc50c4a3aa6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
" let g:python_host_prog='/usr/bin/python3' | |
call plug#begin('~/.config/nvim/plugged') | |
" Plugins | |
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } | |
Plug 'jiangmiao/auto-pairs' | |
Plug 'tpope/vim-fugitive' | |
Plug 'airblade/vim-gitgutter' | |
Plug 'kien/ctrlp.vim' | |
Plug 'easymotion/vim-easymotion' | |
" Plug 'vim-airline/vim-airline' | |
" Plug 'vim-airline/vim-airline-themes' | |
Plug 'vim-scripts/gmlua.vim', {'for': 'lua'} | |
Plug 'scrooloose/nerdcommenter' | |
Plug 'tpope/vim-surround' | |
Plug 'matze/vim-move' | |
Plug 'mattn/emmet-vim', {'for': 'javascript'} | |
Plug 'neovimhaskell/haskell-vim' | |
Plug 'Valloric/YouCompleteMe', {'for': 'javascript'} | |
Plug 'SirVer/ultisnips' | |
Plug 'honza/vim-snippets' | |
Plug 'elixir-editors/vim-elixir' | |
" Plug 'takac/vim-hardtime' | |
Plug 'tikhomirov/vim-glsl' | |
" Plug 'vim-syntastic/syntastic' | |
" Plug 'aurieh/discord.nvim' | |
" Color schemes | |
" Plug 'dracula/vim' | |
" Plug 'NLKNguyen/papercolor-theme' | |
" Plug 'lmintmate/blue-mood-vim' | |
Plug 'jdkanani/vim-material-theme' | |
call plug#end() | |
" Editor settings | |
syntax on | |
set t_Co=256 | |
set background=dark | |
set termguicolors | |
colorscheme material-theme | |
let g:mapleader=',' | |
" Show line numbers | |
set number | |
set relativenumber | |
" Show invisible characters. | |
set listchars=tab:→\ ,trail:·,eol:¬,nbsp:_,space:· | |
" Tabs | |
filetype plugin indent on | |
set tabstop=2 | |
set shiftwidth=2 | |
set softtabstop=2 | |
set expandtab | |
" Enable folding | |
set foldmethod=indent | |
set foldlevel=99 | |
" Search things | |
set hlsearch | |
set incsearch | |
" TODO Fix Russian keymap | |
set keymap=russian-jcukenwin | |
set iminsert=0 | |
set imsearch=0 | |
highlight lCursor guifg=NONE guibg=Cyan | |
" NERDCommenter | |
let g:NERDSpaceDelims = 1 | |
autocmd! BufWritePost .vimrc source % | |
" Dirty fix for garry's mod | |
autocmd BufNewFile,BufRead *.lua | |
\ autocmd BufWritePost * call timer_start(200, {tid -> execute("! copy /b % +,,")}) | |
autocmd BufNewFile,BufRead *.mjs set syntax=javascript | |
" autocmd VimEnter,BufNewFile,BufReadPost * silent! call HardMode() | |
let g:hardtime_default_on = 1 | |
function! RunHaskell() | |
execute "0read ! runhaskell" expand('%') | |
" execute "new | 0read ! runhaskell" expand('%') | |
endfunction | |
autocmd BufNewFile,BufRead *.hs | |
\ nnoremap <buffer> <space> :call RunHaskell()<CR> | |
command! Reload execute "so ~/.config/nvim/init.vim" | |
" Mappings | |
inoremap jj <Esc>`^ | |
inoremap <leader>; <C-o>A; | |
map <C-n> :NERDTreeToggle<CR> | |
map <Leader> <Plug>(easymotion-prefix) | |
nmap <S-Enter> <Plug>(easymotion-overwin-f) | |
nmap <CR> o<Esc> | |
" Semicolon toggle | |
nnoremap ;; :call ToggleEndChar(';')<CR> | |
function! ToggleEndChar(charToMatch) | |
s/\v(.)$/\=submatch(1)==a:charToMatch ? '' : submatch(1).a:charToMatch | |
endfunction | |
" Window management | |
map <silent> <C-h> :call WinMove('h')<CR> | |
map <silent> <C-j> :call WinMove('j')<CR> | |
map <silent> <C-k> :call WinMove('k')<CR> | |
map <silent> <C-l> :call WinMove('l')<CR> | |
function! WinMove(key) | |
let t:curwin = winnr() | |
exec "wincmd ".a:key | |
if (t:curwin == winnr()) | |
if (match(a:key, '[jk]')) | |
wincmd v | |
else | |
wincmd s | |
endif | |
exec "wincmd ".a:key | |
endif | |
endfunction | |
" Search highlight | |
nnoremap <silent> n n:call HLNext(0.4)<cr> | |
nnoremap <silent> N N:call HLNext(0.4)<cr> | |
highlight WhiteOnRed ctermbg=red ctermfg=white | |
function! HLNext(blinktime) | |
let [bufbum, lnum, col, off] = getpos('.') | |
let matchlen = strlen(matchstr(strpart(getline('.'), col - 1), @/)) | |
let target_pat = '\c\%#'.@/ | |
let blinks = 3 | |
for n in range(1, blinks) | |
let red = matchadd('WhiteOnRed', target_pat, 101) | |
redraw | |
exec 'sleep ' . float2nr(a:blinktime / (2 * blinks) * 1000) . 'm' | |
call matchdelete(red) | |
redraw | |
exec 'sleep ' . float2nr(a:blinktime / (2 * blinks) * 1000) . 'm' | |
endfor | |
endfunction | |
" Custom cursor | |
let &t_ti.="\e[1 q" | |
let &t_SI.="\e[5 q" | |
let &t_EI.="\e[1 q" | |
let &t_te.="\e[0 q" | |
" Syntastic configuration | |
let g:syntastic_always_populate_loc_list = 1 | |
let g:syntastic_auto_loc_list = 1 | |
let g:syntastic_check_on_open = 1 | |
let g:syntastic_check_on_wq = 0 | |
let g:syntastic_javascript_checkers = ['eslint'] | |
autocmd FileType javascript let b:syntastic_checkers = ['eslint'] | |
" YCM configutaion | |
set completeopt-=preview | |
let g:ycm_add_preview_to_completeopt = 0 | |
" Oni settings | |
" set shell="bash" | |
set noshowmode | |
set noruler | |
set laststatus=0 | |
set noshowcmd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment