2020-02-17 17:05:51 +01:00
|
|
|
"
|
2020-02-16 12:41:12 +01:00
|
|
|
" General config
|
|
|
|
" ______________________________
|
2020-02-17 17:05:51 +01:00
|
|
|
|
2020-03-19 14:28:07 +01:00
|
|
|
set nocompatible
|
|
|
|
filetype plugin indent on
|
|
|
|
|
2020-02-16 12:41:12 +01:00
|
|
|
set encoding=utf-8
|
2020-02-17 17:05:51 +01:00
|
|
|
set hidden
|
2020-02-16 12:41:12 +01:00
|
|
|
set ttyfast
|
2020-02-17 17:05:51 +01:00
|
|
|
set updatetime=300
|
2020-02-16 12:41:12 +01:00
|
|
|
set timeout timeoutlen=1000 ttimeoutlen=50
|
2020-02-17 17:05:51 +01:00
|
|
|
set undolevels=500
|
|
|
|
set history=500
|
|
|
|
set shortmess+=c
|
|
|
|
set signcolumn=yes
|
|
|
|
set nowrap
|
2020-03-19 14:28:07 +01:00
|
|
|
set relativenumber
|
|
|
|
set number
|
2020-02-17 17:05:51 +01:00
|
|
|
set signcolumn=yes
|
2020-03-19 14:28:07 +01:00
|
|
|
set clipboard=unnamedplus "use p to paste clipboard
|
2020-02-17 17:05:51 +01:00
|
|
|
|
2020-03-19 14:28:07 +01:00
|
|
|
" indentation
|
2020-02-17 17:05:51 +01:00
|
|
|
set backspace=indent,eol,start
|
2020-03-19 14:28:07 +01:00
|
|
|
set tabstop=2 softtabstop=2 shiftwidth=2 expandtab autoindent
|
2020-02-17 17:05:51 +01:00
|
|
|
set ignorecase smartcase incsearch hlsearch
|
|
|
|
set emoji
|
|
|
|
|
|
|
|
" no backups
|
|
|
|
set nocursorcolumn
|
|
|
|
set nocursorline
|
|
|
|
set scrolljump=5
|
|
|
|
set lazyredraw
|
|
|
|
set synmaxcol=180
|
2020-02-16 12:41:12 +01:00
|
|
|
set nobackup
|
|
|
|
set nowritebackup
|
|
|
|
set noswapfile
|
|
|
|
set viminfo='20,\"100 "max 100 lines in registers
|
|
|
|
|
2020-02-17 17:05:51 +01:00
|
|
|
set cmdheight=2
|
2020-02-17 17:51:37 +01:00
|
|
|
set novisualbell
|
2020-02-17 17:05:51 +01:00
|
|
|
|
|
|
|
"
|
2020-03-19 14:28:07 +01:00
|
|
|
" Keybindings
|
2020-02-16 12:41:12 +01:00
|
|
|
" ______________________________
|
2020-02-17 17:05:51 +01:00
|
|
|
|
2020-03-19 14:28:07 +01:00
|
|
|
" leader key
|
2020-02-17 17:05:51 +01:00
|
|
|
|
2020-03-19 14:28:07 +01:00
|
|
|
let mapleader = " "
|
2020-02-17 17:05:51 +01:00
|
|
|
|
2020-03-19 14:28:07 +01:00
|
|
|
" hard mode
|
2020-02-16 09:45:55 +01:00
|
|
|
map <Up> <NOP>
|
|
|
|
map <Down> <NOP>
|
|
|
|
map <Left> <NOP>
|
|
|
|
map <Right> <NOP>
|
|
|
|
|
2020-02-16 13:15:17 +01:00
|
|
|
" quick-quit
|
2020-02-16 12:41:12 +01:00
|
|
|
:ca Q q
|
2020-02-16 13:15:17 +01:00
|
|
|
:ca Q! q!
|
|
|
|
|
|
|
|
" quick help
|
|
|
|
:ca htab :tab h
|
2020-02-16 12:41:12 +01:00
|
|
|
|
2020-02-17 17:05:51 +01:00
|
|
|
" coc
|
|
|
|
inoremap <silent><expr> <TAB>
|
|
|
|
\ pumvisible() ? "\<C-n>" :
|
|
|
|
\ <SID>check_back_space() ? "\<TAB>" :
|
|
|
|
\ coc#refresh()
|
2020-02-17 17:51:37 +01:00
|
|
|
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
|
2020-02-17 17:05:51 +01:00
|
|
|
|
|
|
|
function! s:check_back_space() abort
|
|
|
|
let col = col('.') - 1
|
|
|
|
return !col || getline('.')[col - 1] =~# '\s'
|
|
|
|
endfunction
|
|
|
|
|
2020-02-17 17:51:37 +01:00
|
|
|
" use @ instead of space
|
|
|
|
inoremap <silent><expr> <c-@> coc#refresh()
|
2020-02-17 17:05:51 +01:00
|
|
|
|
|
|
|
if has('patch8.1.1068')
|
|
|
|
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
|
|
|
|
else
|
|
|
|
imap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
|
|
|
|
endif
|
2020-02-16 12:41:12 +01:00
|
|
|
|
2020-02-17 17:05:51 +01:00
|
|
|
nmap <silent> [g <Plug>(coc-diagnostic-prev)
|
|
|
|
nmap <silent> ]g <Plug>(coc-diagnostic-next)
|
|
|
|
|
|
|
|
nmap <silent> gd <Plug>(coc-definition)
|
|
|
|
nmap <silent> gy <Plug>(coc-type-definition)
|
|
|
|
nmap <silent> gi <Plug>(coc-implementation)
|
|
|
|
nmap <silent> gr <Plug>(coc-references)
|
|
|
|
|
|
|
|
nnoremap <silent> K :call <SID>show_documentation()<CR>
|
|
|
|
|
|
|
|
function! s:show_documentation()
|
|
|
|
if (index(['vim','help'], &filetype) >= 0)
|
|
|
|
execute 'h '.expand('<cword>')
|
|
|
|
else
|
|
|
|
call CocAction('doHover')
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
autocmd CursorHold * silent call CocActionAsync('highlight')
|
|
|
|
|
2020-03-19 14:28:07 +01:00
|
|
|
"nmap <leader>rn <Plug>(coc-rename)
|
2020-02-17 17:05:51 +01:00
|
|
|
|
2020-03-19 14:28:07 +01:00
|
|
|
"xmap <leader>f <Plug>(coc-format-selected)
|
|
|
|
"nmap <leader>f <Plug>(coc-format-selected)
|
2020-02-17 17:05:51 +01:00
|
|
|
|
|
|
|
augroup mygroup
|
|
|
|
autocmd!
|
|
|
|
autocmd FileType typescript, json setl formatexpr=CocAction('formatSelected')
|
|
|
|
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
|
|
|
|
augroup end
|
|
|
|
|
2020-03-19 14:28:07 +01:00
|
|
|
"xmap <leader>a <Plug>(coc-codeaction-selected)
|
|
|
|
"nmap <leader>a <Plug>(coc-codeaction-selected)
|
2020-02-17 17:05:51 +01:00
|
|
|
|
2020-03-19 14:28:07 +01:00
|
|
|
"nmap <leader>ac <Plug>(coc-codeaction)
|
|
|
|
"nmap <leader>qf <Plug>(coc-fix-current)
|
2020-02-17 17:05:51 +01:00
|
|
|
|
2020-03-19 14:28:07 +01:00
|
|
|
"xmap if <Plug>(coc-funcobj-i)
|
|
|
|
"xmap af <Plug>(coc-funcobj-a)
|
|
|
|
"omap if <Plug>(coc-funcobj-i)
|
|
|
|
"omap af <Plug>(coc-funcobj-a)
|
2020-02-17 17:05:51 +01:00
|
|
|
|
2020-03-19 14:28:07 +01:00
|
|
|
"nmap <silent> <TAB> <Plug>(coc-range-select)
|
|
|
|
"xmap <silent> <TAB> <Plug>(coc-range-select)
|
2020-02-17 17:05:51 +01:00
|
|
|
|
|
|
|
command! -nargs=0 Format :call CocAction('format')
|
|
|
|
command! -nargs=? Fold :call CocAction('fold', <f-args>)
|
|
|
|
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
|
|
|
|
|
|
|
|
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
|
|
|
|
|
2020-03-19 14:28:07 +01:00
|
|
|
"nnoremap <silent> <space>a :<C-u>CocList diagnostics<cr>
|
|
|
|
"nnoremap <silent> <space>e :<C-u>CocList extensions<cr>
|
|
|
|
"nnoremap <silent> <space>c :<C-u>CocList commands<cr>
|
|
|
|
"nnoremap <silent> <space>o :<C-u>CocList outline<cr>
|
|
|
|
"nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr>
|
|
|
|
"nnoremap <silent> <space>j :<C-u>CocNext<CR>
|
|
|
|
"nnoremap <silent> <space>k :<C-u>CocPrev<CR>
|
|
|
|
"nnoremap <silent> <space>p :<C-u>CocListResume<CR>
|
2020-02-17 17:05:51 +01:00
|
|
|
|
|
|
|
let g:coc_global_extensions = [
|
|
|
|
\'coc-css',
|
|
|
|
\'coc-eslint',
|
|
|
|
\'coc-html',
|
|
|
|
\'coc-json',
|
|
|
|
\'coc-prettier',
|
|
|
|
\'coc-svelte',
|
2020-02-19 10:26:20 +01:00
|
|
|
\'coc-tsserver',
|
|
|
|
\'coc-emmet'
|
2020-02-17 17:05:51 +01:00
|
|
|
\]
|
|
|
|
|
|
|
|
command! -nargs=0 Prettier :CocCommand prettier.formatFile
|
|
|
|
|
|
|
|
"
|
2020-02-16 12:41:12 +01:00
|
|
|
" Plugins
|
|
|
|
" ______________________________
|
|
|
|
|
2020-02-16 09:45:55 +01:00
|
|
|
call plug#begin()
|
2020-02-17 17:05:51 +01:00
|
|
|
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
2020-02-16 09:45:55 +01:00
|
|
|
Plug 'arcticicestudio/nord-vim'
|
|
|
|
Plug 'scrooloose/nerdtree'
|
2020-02-17 17:05:51 +01:00
|
|
|
Plug 'yuezk/vim-js'
|
2020-02-16 09:45:55 +01:00
|
|
|
Plug 'maxmellon/vim-jsx-pretty'
|
|
|
|
Plug 'ryanoasis/vim-devicons'
|
|
|
|
Plug 'junegunn/fzf', { 'do': './install --bin' }
|
|
|
|
Plug 'junegunn/fzf.vim'
|
|
|
|
Plug 'leafgarland/typescript-vim'
|
|
|
|
Plug 'peitalin/vim-jsx-typescript'
|
2020-03-19 14:28:07 +01:00
|
|
|
Plug 'supercollider/scvim'
|
|
|
|
Plug 'tidalcycles/vim-tidal'
|
|
|
|
Plug 'preservim/nerdcommenter'
|
2020-02-16 09:45:55 +01:00
|
|
|
call plug#end()
|
|
|
|
|
|
|
|
" NERDTree
|
|
|
|
let g:NERDTreeShowHidden = 1
|
|
|
|
let g:NERDTreeMinimalUI = 1
|
|
|
|
let g:NERDTreeIgnore = []
|
|
|
|
let g:NERDTreeStatusline = ''
|
|
|
|
|
2020-03-19 14:28:07 +01:00
|
|
|
" NERDCommenter
|
|
|
|
let g:NERDSpaceDelims = 1
|
|
|
|
let g:NERDCompactSexyComs = 1
|
|
|
|
let NERDAltDelims_haskell = 1
|
|
|
|
let g:NERDCustomDelimiters = { 'tidal': { 'left': '{-','right': '-}' } }
|
|
|
|
let g:NERDCustomDelimiters = { 'tidal': { 'left': '--','right': '' } }
|
|
|
|
let g:NERDCommentEmptyLines = 1
|
|
|
|
|
2020-02-17 17:05:51 +01:00
|
|
|
" FZF - use silversearcher-ag to respect .gitignore
|
2020-02-16 09:45:55 +01:00
|
|
|
let $FZF_DEFAULT_COMMAND = 'ag -g ""'
|
2020-03-19 14:28:07 +01:00
|
|
|
let g:ag_working_path_mode="r"
|
2020-02-17 17:05:51 +01:00
|
|
|
let g:vim_jsx_pretty_colorful_config = 1
|
2020-02-16 13:37:24 +01:00
|
|
|
|
2020-03-19 14:28:07 +01:00
|
|
|
" FZF ignore
|
|
|
|
set wildignore+=*/node_modules/*,*/tmp/*,*.so,*.swp,*.zip
|
|
|
|
|
|
|
|
" SuperCollider
|
|
|
|
au BufEnter,BufWinEnter,BufNewFile,BufRead *.sc,*.scd set filetype=supercollider
|
|
|
|
au Filetype supercollider packadd scvim
|
|
|
|
|
|
|
|
" tidalvim
|
|
|
|
let g:tidal_flash_duration = 50
|
|
|
|
|
2020-02-16 09:45:55 +01:00
|
|
|
" plugin keybindings
|
|
|
|
nnoremap <silent> <C-b> :NERDTreeToggle<CR>
|
|
|
|
nnoremap <C-p> :FZF<CR>
|
|
|
|
let g:fzf_action = {
|
|
|
|
\ 'ctrl-t': 'tab split',
|
|
|
|
\ 'ctrl-s': 'split',
|
|
|
|
\ 'ctrl-v': 'vsplit'
|
|
|
|
\}
|
2020-02-16 12:41:12 +01:00
|
|
|
|
2020-02-17 17:05:51 +01:00
|
|
|
"
|
2020-02-16 12:41:12 +01:00
|
|
|
" Theme
|
|
|
|
" ______________________________
|
|
|
|
|
|
|
|
colorscheme nord
|
2020-02-17 17:05:51 +01:00
|
|
|
set t_Co=256
|
2020-03-19 14:28:07 +01:00
|
|
|
if &t_Co == 8 && $TERM !~# '^Eterm'
|
|
|
|
set t_Co=16
|
|
|
|
endif
|