Last active
May 14, 2020 08:30
-
-
Save acidstorm/838b27ca2601bbe1cd59f86b42413c87 to your computer and use it in GitHub Desktop.
Vim config
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
call plug#begin("~/.vim/plugged") | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
Plug 'preservim/nerdtree' | |
Plug 'mechatroner/rainbow_csv' | |
Plug 'tpope/vim-projectionist' | |
Plug 'tpope/vim-unimpaired' | |
Plug 'puremourning/vimspector' | |
Plug 'tpope/vim-commentary' | |
"Plug 'Xuyuanp/nerdtree-git-plugin' | |
let g:coc_global_extensions = ['coc-emmet', 'coc-css', 'coc-html', 'coc-json', 'coc-tsserver'] | |
Plug 'leafgarland/typescript-vim' | |
Plug 'peitalin/vim-jsx-typescript' | |
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } | |
Plug 'junegunn/fzf.vim' | |
Plug 'morhetz/gruvbox' | |
Plug 'mlaursen/vim-react-snippets' | |
"Plug 'HerringtonDarkholme/yats.vim' " TS Syntax | |
" Plug 'pangloss/vim-javascript' | |
Plug 'wellle/targets.vim' | |
Plug 'airblade/vim-gitgutter' | |
Plug 'cohama/lexima.vim' | |
Plug 'tpope/vim-surround' | |
Plug 'rafi/awesome-vim-colorschemes' | |
Plug 'prettier/vim-prettier', { | |
\ 'do': 'yarn install', | |
\ 'for': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'graphql', 'markdown', 'vue', 'yaml', 'html'] } | |
Plug 'itchyny/lightline.vim' | |
Plug 'tpope/vim-fugitive' | |
Plug 'frazrepo/vim-rainbow' | |
Plug 'editorconfig/editorconfig-vim' | |
Plug 'Yggdroot/indentLine' | |
Plug 'ryanoasis/vim-devicons' | |
call plug#end() | |
set wildmenu | |
set foldmethod=manual | |
set relativenumber | |
set number | |
set hidden | |
set path=** | |
set wildignore+=**/node_modules/** | |
let $NVIM_TUI_ENABLE_TRUE_COLOR=1 | |
set encoding=UTF-8 | |
set mouse=a | |
set cursorline | |
"autocmd StdinReadPre * let s:std_in=1 | |
"autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif | |
"autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif | |
let g:NERDTreeIndicatorMapCustom = { | |
\ "Modified" : "✹", | |
\ "Staged" : "✚", | |
\ "Untracked" : "✭", | |
\ "Renamed" : "➜", | |
\ "Unmerged" : "═", | |
\ "Deleted" : "✖", | |
\ "Dirty" : "✗", | |
\ "Clean" : "✔︎", | |
\ 'Ignored' : '☒', | |
\ "Unknown" : "?" | |
\ } | |
noremap <C-\> :vsplit <CR> | |
nnoremap <C-p> :Files <CR> | |
nnoremap <leader>p :Buffers <CR> | |
noremap <C-f> :Rg | |
noremap <C-g> :Rg <C-R><C-W><CR> | |
noremap <C-/> <plug>NERDCommenterToggle | |
inoremap <C-/> <plug>NERDCommenterToggle | |
set splitbelow | |
set splitright | |
nnoremap <silent> <A-Down> :m .+1<CR>== | |
nnoremap <silent> <A-Up> :m .-2<CR>== | |
inoremap <silent> <A-Down> <Esc>:m .+1<CR>==gi | |
inoremap <silent> <A-Up> <Esc>:m .-2<CR>==gi | |
vnoremap <silent> <A-Down> :m '>+1<CR>gv=gv | |
vnoremap <silent> <A-Up> :m '<-2<CR>gv=gv | |
nnoremap <silent> <A-Left> :bp<CR> | |
nnoremap <silent> <A-Right> :bn<CR> | |
inoremap <silent> <A-Left> <Esc>:bp<CR> | |
inoremap <silent> <A-Right> <Esc>:bn<CR> | |
nnoremap <silent> <leader>\ :b#<CR> | |
inoremap <silent> <leader>\ <Esc>:b#<CR> | |
nnoremap <silent> <leader><space> :A<CR> | |
noremap <C-J> <C-W><C-J> | |
noremap <C-K> <C-W><C-K> | |
noremap <C-L> <C-W><C-L> | |
noremap <C-H> <C-W><C-H> | |
map <C-B> :NERDTreeToggle<CR> | |
:imap jj <Esc> | |
" GoTo code navigation. | |
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) | |
nmap <silent> rn <Plug>(coc-rename) | |
" Use K to show documentation in preview window. | |
nnoremap <silent> K :call <SID>show_documentation()<CR> | |
" Use `[g` and `]g` to navigate diagnostics | |
nmap <silent> [g <Plug>(coc-diagnostic-prev) | |
nmap <silent> ]g <Plug>(coc-diagnostic-next) | |
" Remap keys for applying codeAction to the current line. | |
nmap <leader>ac <Plug>(coc-codeaction) | |
" Apply AutoFix to problem on the current line. | |
nmap <leader>qf <Plug>(coc-fix-current) | |
" Introduce function text object | |
" NOTE: Requires 'textDocument.documentSymbol' support from the language server. | |
xmap if <Plug>(coc-funcobj-i) | |
xmap af <Plug>(coc-funcobj-a) | |
omap if <Plug>(coc-funcobj-i) | |
omap af <Plug>(coc-funcobj-a) | |
" Use <TAB> for selections ranges. | |
" NOTE: Requires 'textDocument/selectionRange' support from the language server. | |
" coc-tsserver, coc-python are the examples of servers that support it. | |
nmap <silent> <TAB> <Plug>(coc-range-select) | |
xmap <silent> <TAB> <Plug>(coc-range-select) | |
function! s:show_documentation() | |
if (index(['vim','help'], &filetype) >= 0) | |
execute 'h '.expand('<cword>') | |
else | |
call CocAction('doHover') | |
endif | |
endfunction | |
let g:sierra_Midnight=1 | |
"colorscheme onedark | |
"colorscheme gruvbox | |
let ayucolor="mirage" " for dark version of theme | |
colorscheme ayu | |
"let g:gruvbox_contrast_dark='hard' | |
if (has("termguicolors")) | |
set termguicolors | |
endif | |
" sync open file with NERDTree | |
" " Check if NERDTree is open or active | |
function! IsNERDTreeOpen() | |
return exists("t:NERDTreeBufName") && (bufwinnr(t:NERDTreeBufName) != -1) | |
endfunction | |
" Call NERDTreeFind iff NERDTree is active, current window contains a modifiable | |
" file, and we're not in vimdiff | |
function! SyncTree() | |
if &modifiable && IsNERDTreeOpen() && strlen(expand('%')) > 0 && !&diff | |
NERDTreeFind | |
wincmd p | |
endif | |
endfunction | |
" Highlight currently open buffer in NERDTree | |
autocmd BufEnter * call SyncTree() | |
autocmd StdinReadPre * let s:std_in=1 | |
"autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif | |
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif | |
let NERDTreeAutoDeleteBuffer = 1 | |
"let g:blamer_enabled = 1 | |
" set filetypes as typescript.tsx | |
autocmd BufNewFile,BufRead *.js,*.tsx,*.jsx set filetype=typescript.tsx | |
" when running at every change you may want to disable quickfix | |
let g:prettier#quickfix_enabled = 0 | |
let g:prettier#autoformat = 1 | |
let g:prettier#autoformat_require_pragma = 0 | |
"autocmd TextChanged,InsertLeave *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue,*.yaml,*.html PrettierAsync | |
let g:indentLine_char_list = ['│'] | |
function! CocCurrentFunction() | |
return get(b:, 'coc_current_function', '') | |
endfunction | |
let g:lightline = { | |
\ 'colorscheme': 'ayu', | |
\ 'active': { | |
\ 'left': [ [ 'mode', 'paste' ], | |
\ [ 'gitbranch', 'cocstatus', 'currentfunction', 'readonly', 'filename', 'modified' ] ] | |
\ }, | |
\ 'component_function': { | |
\ 'cocstatus': 'coc#status', | |
\ 'currentfunction': 'CocCurrentFunction', | |
\ 'gitbranch': 'FugitiveHead' | |
\ }, | |
\ } | |
command! -bang -nargs=* Rg call fzf#vim#grep("rg --column --line-number --no-heading --color=always --smart-case ".shellescape(<q-args>), 1, {'options': '--delimiter : --nth 4..'}, <bang>0) | |
let g:vimspector_enable_mappings = 'HUMAN' | |
" dark red | |
hi tsxTagName guifg=#E06C75 | |
" orange | |
hi tsxCloseString guifg=#F99575 | |
hi tsxCloseTag guifg=#F99575 | |
hi tsxCloseTagName guifg=#F99575 | |
hi tsxAttributeBraces guifg=#F99575 | |
hi tsxEqual guifg=#F99575 | |
" yellow | |
hi tsxAttrib guifg=#F8BD7F cterm=italic | |
let g:coc_explorer_global_presets = { | |
\ '.vim': { | |
\ 'root-uri': '~/.vim', | |
\ }, | |
\ 'floating': { | |
\ 'position': 'floating', | |
\ }, | |
\ 'floatingLeftside': { | |
\ 'position': 'floating', | |
\ 'floating-position': 'left-center', | |
\ 'floating-width': 50, | |
\ }, | |
\ 'floatingRightside': { | |
\ 'position': 'floating', | |
\ 'floating-position': 'left-center', | |
\ 'floating-width': 50, | |
\ }, | |
\ 'simplify': { | |
\ 'file.child.template': '[selection | clip | 1] [indent][icon | 1] [filename omitCenter 1]' | |
\ } | |
\ } | |
" Use preset argument to open it | |
nmap <leader>ed :CocCommand explorer<CR> | |
nmap <leader>ef :CocCommand explorer --preset floating<CR> | |
" List all presets |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment