136 lines
3.5 KiB
VimL
136 lines
3.5 KiB
VimL
if empty(glob('~/.vim/autoload/plug.vim'))
|
|
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
|
|
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
|
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
|
|
endif
|
|
|
|
call plug#begin()
|
|
|
|
Plug 'tpope/vim-repeat'
|
|
Plug 'tpope/vim-commentary'
|
|
Plug 'tpope/vim-surround'
|
|
Plug 'jiangmiao/auto-pairs'
|
|
Plug 'yggdroot/indentline'
|
|
Plug 'kien/ctrlp.vim'
|
|
Plug 'mbbill/undotree'
|
|
|
|
Plug 'SirVer/ultisnips'
|
|
Plug 'honza/vim-snippets'
|
|
|
|
Plug 'vim-airline/vim-airline'
|
|
|
|
" style
|
|
Plug 'sonph/onehalf', { 'rtp': 'vim' }
|
|
|
|
" js/ts/...
|
|
Plug 'pangloss/vim-javascript'
|
|
Plug 'leafgarland/typescript-vim'
|
|
Plug 'peitalin/vim-jsx-typescript'
|
|
|
|
" html
|
|
Plug 'mattn/emmet-vim'
|
|
|
|
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
|
let g:coc_global_extensions = [
|
|
\ 'coc-tsserver',
|
|
\ 'coc-html',
|
|
\ 'coc-json',
|
|
\ 'coc-pyright',
|
|
\ 'coc-rust-analyzer'
|
|
\ ]
|
|
|
|
call plug#end()
|
|
|
|
|
|
" snippets
|
|
let g:UltiSnipsExpandTrigger="<tab>"
|
|
|
|
|
|
" coc
|
|
if isdirectory('./node_modules') && isdirectory('./node_modules/prettier')
|
|
let g:coc_global_extensions += ['coc-prettier']
|
|
endif
|
|
|
|
" disabled eslint in favor of xo
|
|
if isdirectory('./node_modules') && isdirectory('./node_modules/eslint')
|
|
let g:coc_global_extensions += ['coc-eslint']
|
|
endif
|
|
|
|
" coc shortcuts
|
|
inoremap <silent><expr> <C-y>y coc#pum#visible() ? coc#pum#confirm() : "\<CR>"
|
|
nnoremap <silent> gK :call CocAction('doHover')<CR>
|
|
nmap <silent> gd <Plug>(coc-definition)
|
|
nmap <silent> gy <Plug>(coc-type-definition)
|
|
nmap <silent> gr <Plug>(coc-references)
|
|
nmap <silent> [g <Plug>(coc-diagnostic-prev)
|
|
nmap <silent> ]g <Plug>(coc-diagnostic-next)
|
|
nnoremap <silent> <space>d :<C-u>CocList diagnostics<cr>
|
|
nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr>
|
|
nmap <leader>do <Plug>(coc-codeaction)
|
|
nmap <leader>rn <Plug>(coc-rename)
|
|
nmap <leader>xo :!npx xo --fix %<CR>
|
|
|
|
let g:ctrlp_custom_ignore = 'node_modules'
|
|
|
|
if has("persistent_undo")
|
|
let target_path = expand('~/.vimundo')
|
|
|
|
" create the directory and any parent directories
|
|
" if the location does not exist.
|
|
if !isdirectory(target_path)
|
|
call mkdir(target_path, "p", 0700)
|
|
endif
|
|
|
|
let &undodir=target_path
|
|
set undofile
|
|
endif
|
|
|
|
" style
|
|
if exists('+termguicolors')
|
|
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
|
|
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
|
|
set termguicolors
|
|
endif
|
|
syntax on
|
|
autocmd ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red
|
|
autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\t/
|
|
set t_Co=256
|
|
colorscheme onehalfdark
|
|
let g:airline_theme='onehalfdark'
|
|
let g:lightline = { 'colorscheme': 'onehalfdark' }
|
|
|
|
" select last paste in visual mode
|
|
nnoremap <expr> gb '`[' . strpart(getregtype(), 0, 1) . '`]'
|
|
|
|
filetype plugin indent on
|
|
|
|
set conceallevel=0
|
|
let g:indentLine_setConceal = 0
|
|
|
|
" js/ts/...
|
|
autocmd Filetype javascript setlocal ts=2 sw=2 expandtab
|
|
autocmd Filetype typescript setlocal ts=2 sw=2 expandtab
|
|
autocmd Filetype json setlocal ts=2 sw=2 expandtab
|
|
autocmd Filetype typescriptreact setlocal ts=2 sw=2 expandtab
|
|
autocmd Filetype html setlocal ts=2 sw=2 expandtab
|
|
autocmd Filetype htmldjango setlocal ts=2 sw=2 expandtab
|
|
autocmd Filetype scss setlocal ts=2 sw=2 expandtab
|
|
autocmd Filetype css setlocal ts=2 sw=2 expandtab
|
|
autocmd Filetype python setlocal ts=4 sts=4 sw=4 expandtab
|
|
|
|
" rust
|
|
|
|
|
|
" PYTHON PROVIDERS {{{
|
|
|
|
if has('macunix')
|
|
|
|
" OSX
|
|
|
|
let g:python3_host_prog = '/opt/homebrew/bin/python3' " -- Set python 3 provider
|
|
|
|
let g:python_host_prog = '/opt/homebrew/bin/python2' " --- Set python 2 provider
|
|
|
|
endif
|
|
|
|
" lua require('init')
|