2021-03-20 22:36:25 +00:00
|
|
|
" Install vim-plug if not found
|
2021-03-21 15:09:03 +00:00
|
|
|
if empty(glob('~/.vim/autoload/plug.vim'))
|
2021-03-20 22:36:25 +00:00
|
|
|
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
|
|
|
|
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
|
|
|
endif
|
|
|
|
|
|
|
|
" Run PlugInstall if there are missing plugins
|
|
|
|
autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
|
|
|
|
\| PlugInstall --sync | source $MYVIMRC
|
|
|
|
\| endif
|
|
|
|
|
|
|
|
"--- Plugins
|
2021-03-21 07:23:10 +00:00
|
|
|
call plug#begin('~/.vim/plugged')
|
2021-03-21 10:59:47 +00:00
|
|
|
Plug 'sonph/onehalf', { 'rtp': 'vim' }
|
2021-03-21 07:23:10 +00:00
|
|
|
Plug 'ojroques/vim-oscyank'
|
2021-03-20 22:36:25 +00:00
|
|
|
|
|
|
|
Plug 'tpope/vim-fugitive'
|
|
|
|
Plug 'airblade/vim-gitgutter'
|
|
|
|
Plug 'vim-airline/vim-airline'
|
|
|
|
Plug 'junegunn/fzf.vim'
|
|
|
|
Plug 'preservim/nerdtree'
|
2021-03-21 07:23:10 +00:00
|
|
|
Plug 'ctrlpvim/ctrlp.vim'
|
2021-03-20 22:36:25 +00:00
|
|
|
|
|
|
|
Plug 'editorconfig/editorconfig-vim'
|
|
|
|
|
|
|
|
Plug 'fatih/vim-go'
|
|
|
|
Plug 'pangloss/vim-javascript'
|
|
|
|
Plug 'leafgarland/typescript-vim'
|
|
|
|
Plug 'peitalin/vim-jsx-typescript'
|
|
|
|
Plug 'styled-components/vim-styled-components', { 'branch': 'main' }
|
|
|
|
Plug 'jparise/vim-graphql'
|
|
|
|
Plug 'kevinoid/vim-jsonc'
|
|
|
|
|
|
|
|
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
2021-03-21 07:23:10 +00:00
|
|
|
call plug#end()
|
|
|
|
"--- CodeServer Configurations
|
2021-03-20 22:36:25 +00:00
|
|
|
let g:coc_global_extensions = [
|
|
|
|
\ 'coc-tsserver',
|
2021-03-20 22:52:08 +00:00
|
|
|
\ 'coc-prettier',
|
2021-03-21 12:13:37 +00:00
|
|
|
\ 'coc-yaml',
|
|
|
|
\ 'coc-json'
|
2021-03-20 22:36:25 +00:00
|
|
|
\ ]
|
|
|
|
|
|
|
|
if isdirectory('./node_modules') && isdirectory('./node_modules/prettier')
|
|
|
|
let g:coc_global_extensions += ['coc-prettier']
|
|
|
|
endif
|
|
|
|
|
|
|
|
if isdirectory('./node_modules') && isdirectory('./node_modules/eslint')
|
|
|
|
let g:coc_global_extensions += ['coc-eslint']
|
|
|
|
endif
|
|
|
|
"--- TMUX/Clipboard fixes
|
|
|
|
set t_Co=256
|
2021-03-21 07:23:10 +00:00
|
|
|
set t_ut=
|
2021-03-20 22:36:25 +00:00
|
|
|
" Set Vim-specific sequences for RGB colors
|
|
|
|
" Fixes 'termguicolors' usage in vim+tmux
|
|
|
|
" :h xterm-true-color
|
|
|
|
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
|
|
|
|
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
|
|
|
|
|
|
|
|
" Enables 24-bit RGB color in the terminal
|
|
|
|
if has('termguicolors')
|
|
|
|
if empty($COLORTERM) || $COLORTERM =~# 'truecolor\|24bit'
|
|
|
|
set termguicolors
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
" Use system clipboard to get buffers synced between TMUX and VIM
|
|
|
|
if has('clipboard') && has('vim_starting')
|
|
|
|
" set clipboard& clipboard+=unnamedplus
|
|
|
|
set clipboard& clipboard^=unnamed,unnamedplus
|
|
|
|
endif
|
|
|
|
|
|
|
|
if exists('##TextYankPost')
|
|
|
|
augroup BlinkClipboardIntegration
|
|
|
|
autocmd!
|
|
|
|
autocmd TextYankPost * silent! if v:event.operator ==# 'y' | call YankOSC52(join(v:event["regcontents"],"\n")) | endif
|
|
|
|
augroup END
|
|
|
|
endif
|
2021-03-21 07:23:10 +00:00
|
|
|
"--- VIM Configuration
|
2021-03-21 15:09:03 +00:00
|
|
|
|
|
|
|
"- Custom commands
|
2021-03-21 12:39:42 +00:00
|
|
|
command! -nargs=0 Prettier :CocCommand prettier.formatFile
|
2021-03-21 12:13:37 +00:00
|
|
|
|
2021-03-21 15:09:03 +00:00
|
|
|
"- NERDTree
|
|
|
|
nnoremap <leader>n :NERDTreeFocus<CR>
|
|
|
|
nnoremap <C-n> :NERDTree<CR>
|
|
|
|
nnoremap <C-t> :NERDTreeToggle<CR>
|
|
|
|
nnoremap <C-f> :NERDTreeFind<CR>
|
|
|
|
nnoremap <leader>f 1z= " fix spelling
|
|
|
|
|
2021-03-21 07:23:10 +00:00
|
|
|
"- Keybindings
|
2021-03-21 15:09:03 +00:00
|
|
|
let mapleader = "'"
|
|
|
|
|
2021-03-21 07:23:10 +00:00
|
|
|
let g:ctrlp_map = '<c-p>'
|
|
|
|
let g:ctrlp_cmd = 'CtrlP'
|
2021-03-20 22:36:25 +00:00
|
|
|
|
2021-03-21 07:23:10 +00:00
|
|
|
"- Visuals
|
|
|
|
set number
|
2021-03-21 10:59:47 +00:00
|
|
|
set cursorline
|
2021-03-21 15:09:03 +00:00
|
|
|
set noswapfile
|
|
|
|
set hlsearch " highlight all results
|
|
|
|
set ignorecase
|
|
|
|
set incsearch " search as you type
|
2021-03-21 15:12:08 +00:00
|
|
|
set signcolumn=yes " always show git diff column
|
2021-03-21 15:09:03 +00:00
|
|
|
set spell spelllang=en_us
|
2021-03-21 10:59:47 +00:00
|
|
|
colorscheme onehalflight
|
|
|
|
let g:airline_theme = 'onehalflight'
|
2021-03-20 22:36:25 +00:00
|
|
|
|