Last active
January 1, 2021 00:57
-
-
Save coderek/0ba3718a18ffc718ab6c 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
set runtimepath^=~/.vim runtimepath+=~/.vim/after | |
let &packpath = &runtimepath | |
set nocompatible " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim/ | |
let path='~/vimfiles/bundle' | |
call vundle#begin(path) | |
" alternatively, pass a path where Vundle should install plugins | |
"call vundle#begin('~/some/path/here') | |
set encoding=UTF-8 | |
" let Vundle manage Vundle, required | |
Plugin 'gmarik/Vundle.vim' | |
Plugin 'xolox/vim-misc' | |
Plugin 'scrooloose/nerdtree' | |
" Plugin 'Xuyuanp/nerdtree-git-plugin' | |
Plugin 'dbakker/vim-projectroot' | |
Plugin 'maxmellon/vim-jsx-pretty' | |
Plugin 'mattn/emmet-vim' | |
Plugin 'prettier/vim-prettier' | |
Plugin 'godlygeek/tabular' | |
Plugin 'terryma/vim-multiple-cursors' | |
Plugin 'junegunn/vim-easy-align' | |
Plugin 'tomtom/tlib_vim' | |
Plugin 'altercation/vim-colors-solarized' | |
Plugin 'tpope/vim-surround' | |
Plugin 'bling/vim-airline' | |
Plugin 'vim-airline/vim-airline-themes' | |
Plugin 'rakr/vim-one' | |
Plugin 'jdkanani/vim-material-theme' | |
Plugin 'mileszs/ack.vim' | |
Plugin 'groenewege/vim-less' | |
Plugin 'NLKNguyen/papercolor-theme' | |
Plugin 'franbach/miramare' | |
Plugin 'honza/vim-snippets' | |
Plugin 'bagrat/vim-buffet' | |
Plugin 'editorconfig/editorconfig-vim' | |
Plugin 'gosukiwi/vim-atom-dark' | |
Plugin 'tpope/vim-commentary' | |
Plugin 'preservim/nerdcommenter' | |
Plugin 'chrisbra/Colorizer' | |
Plugin 'moll/vim-bbye' | |
Plugin 'airblade/vim-gitgutter' | |
Plugin 'shmup/vim-sql-syntax' | |
Plugin 'fatih/vim-go' | |
Plugin 'isruslan/vim-es6' | |
Plugin 'tmhedberg/SimpylFold' | |
Plugin 'plasticboy/vim-markdown' | |
Plugin 'junegunn/goyo.vim' | |
Plugin 'junegunn/limelight.vim' | |
Plugin 'davidhalter/jedi-vim' | |
Plugin 'morhetz/gruvbox' | |
Plugin 'joshdick/onedark.vim' | |
Plugin 'sheerun/vim-polyglot' | |
Plugin 'pangloss/vim-javascript' | |
Plugin 'leafgarland/typescript-vim' | |
Plugin 'peitalin/vim-jsx-typescript' | |
Plugin 'hiphish/jinja.vim' | |
Plugin 'wsdjeg/vim-fetch' | |
Plugin 'tpope/vim-fugitive' | |
Plugin 'ctrlpvim/ctrlp.vim' | |
Plugin 'ryanoasis/vim-devicons' | |
Plugin 'stephpy/vim-yaml' | |
" Remove ALL autocommands for current group | |
autocmd! | |
" All of your Plugins must be added before the following line | |
call vundle#end() " required | |
filetype plugin indent on " required | |
syntax on | |
set nonumber | |
set history=700 | |
" With a map leader it's possible to do extra key combinations | |
" like <leader>w saves the current file | |
let mapleader = "," | |
let g:mapleader = "," | |
" Fast saving | |
nmap <leader>w :w!<cr> | |
"Always show current position | |
set ruler | |
" Height of the command bar | |
set cmdheight=2 | |
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable | |
" delays and poor user experience. | |
set updatetime=300 | |
" Don't pass messages to |ins-completion-menu|. | |
set shortmess+=c | |
" Always show the signcolumn, otherwise it would shift the text each time | |
" diagnostics appear/become resolved. | |
if has("patch-8.1.1564") | |
" Recently vim can merge signcolumn and number column into one | |
set signcolumn=number | |
else | |
set signcolumn=yes | |
endif | |
" A buffer becomes hidden when it is abandoned | |
set hid | |
" Configure backspace so it acts as it should act | |
set backspace=eol,start,indent | |
set whichwrap+=<,>,h,l | |
" In many terminal emulators the mouse works just fine, thus enable it. | |
if has('mouse') | |
set mouse=a | |
endif | |
" Ignore case when searching | |
set ignorecase | |
" When searching try to be smart about cases | |
set smartcase | |
" Highlight search results | |
set hlsearch | |
" Makes search act like search in modern browsers | |
set incsearch | |
" Don't redraw while executing macros (good performance config) | |
set lazyredraw | |
" For regular expressions turn magic on | |
set magic | |
" Show matching brackets when text indicator is over them | |
set showmatch | |
" How many tenths of a second to blink when matching brackets | |
set mat=2 | |
" No annoying sound on errors | |
set noerrorbells | |
set novisualbell | |
set t_vb= | |
set tm=500 | |
set list | |
set listchars=tab:>-,trail:- | |
" Add a bit extra margin to the left | |
set foldcolumn=1 | |
" Use Unix as the standard file type | |
set ffs=unix,dos,mac | |
set noeol | |
set nobackup | |
set nowb | |
set noswapfile | |
set nowritebackup | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" => Text, tab and indent related | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Use spaces instead of tabs | |
set expandtab | |
" Be smart when using tabs ;) | |
set smarttab | |
" 1 tab == 4 spaces | |
set shiftwidth=2 | |
set tabstop=2 | |
" Linebreak on 500 characters | |
set nolbr | |
set textwidth=0 | |
set wrapmargin=0 | |
set ai "Auto indent | |
set smartindent " No Smart indent | |
" \*/src, | |
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*, | |
\*/dashboard/static, | |
\*/my_django/static, | |
\*/tmp/*, | |
\*.pyc,*.log, | |
\*.less.css, | |
\*.class, | |
\*_jst.js, | |
\*-templates.js, | |
\*/__pycache__, | |
\*/.DS_Store, | |
\*.pg_dump, | |
\*/.frontend_tests, | |
\*/coverage, | |
\*/public, | |
\*/target, | |
\*/node_modules, | |
\*/storybook-static, | |
let g:vim_markdown_folding_disabled=1 | |
autocmd FileType html,css,jsx,jinja EmmetInstall | |
" Start interactive EasyAlign in visual mode (e.g. vip<Enter>) | |
xmap ga <Plug>(EasyAlign) | |
" Start interactive EasyAlign for a motion/text object (e.g. gaip) | |
nmap ga <Plug>(EasyAlign) | |
" indent json files on save | |
" autocmd BufWritePre *.json %!python -m json.tool | |
set diffopt=vertical | |
set cursorline | |
set colorcolumn=100 | |
let NERDTreeIgnore=[] | |
let NERDTreeShowBookmarks = 1 | |
let NERDTreeRespectWildIgnore = 1 | |
let NERDTreeChDirMode = 2 | |
let g:ctrlp_custom_ignore = 'node_modules\|build\|dist\|tmp' | |
let g:ctrlp_match_window = 'bottom,order:btt,min:1,max:10,results:10' | |
let g:ctrlp_max_depth = 10 | |
let g:ctrlp_open_new_file = 'v' | |
let g:ctrlp_root_markers = ['yarn.lock'] | |
let g:ctrlp_working_path_mode = 'r' | |
let g:ctrlp_by_filename = 0 | |
let g:ctrlp_types = ['mru', 'fil'] | |
let g:ctrlp_user_command = 'fd --type file -H -c never "" %s ' | |
let g:ctrlp_cmd = 'call CallCtrlP()' | |
func! CallCtrlP() | |
if exists('s:called_ctrlp') | |
CtrlPLastMode | |
else | |
let s:called_ctrlp = 1 | |
CtrlPMRU | |
endif | |
endfunc | |
set nowrap | |
nnoremap <Leader>cd :cd %:p:h<CR> | |
let g:easy_align_delimiters = { | |
\ '<': { 'pattern': '<-' }, | |
\ '"': { 'pattern': '"' }, | |
\ } | |
set foldmethod=indent | |
set foldlevel=99 | |
vnoremap // y/<C-R>"<CR> | |
nnoremap <Leader><Leader> :vsplit $MYVIMRC<cr> | |
set splitright | |
set splitbelow | |
nnoremap <Leader>q :Bdelete<CR> | |
nnoremap <Leader>qa :bufdo :Bdelete<CR> | |
set statusline+=%#warningmsg# | |
set statusline+=%* | |
let g:javascript_enable_domhtmlcss = 1 | |
" search word under cursor without jumping to next | |
" nnoremap * *##* | |
function! EditDotFile() | |
let file_name=$HOME . '/.' . input('Edit .') | |
exe 'edit' file_name | |
endfunction | |
nnoremap <leader>nc :NERDTreeClose<CR> | |
nnoremap <leader>nl :nohlsearch<CR> | |
nnoremap <leader>. :call EditDotFile()<CR> | |
let g:signify_vcs_list = [ 'git' ] | |
let g:ackhighlight = 1 | |
set background=dark | |
set t_Co=256 | |
set makeprg="gradle test" | |
set nolist | |
" ctrl slash | |
noremap <C-_> :call Comment()<CR> | |
au BufRead *.md setlocal nonu wrap textwidth=80 | |
" au BufRead *.ts setlocal shiftwidth=2 tabstop=2 | |
" | |
" au BufRead *.js setlocal filetype=typescript | |
set foldcolumn=0 | |
map <Leader>ddd :bufdo bdelete<CR> | |
set isfname+=@-@ " for angular | |
set suffixesadd=.java,.ts,.tsx,.jsx,.py,.js,.d.ts,.go | |
set laststatus=2 " always show status | |
set guitablabel=%t | |
set autoread | |
set backupcopy=yes | |
set guioptions= | |
let g:vue_disable_pre_processors=1 | |
let g:ackprg = "ag --column --ignore node_modules --hidden --ignore .git --ignore .vim --ignore .vscode" | |
hi ColorColumn NONE | |
hi Search cterm=NONE ctermfg=14 ctermbg=8 | |
hi LineNr ctermfg=green | |
hi Visual ctermfg=3 | |
let g:NERDTreeGitStatusIndicatorMapCustom = { | |
\ "Modified" : "✹", | |
\ "Staged" : "✚", | |
\ "Untracked" : "✭", | |
\ "Renamed" : "➜", | |
\ "Unmerged" : "═", | |
\ "Deleted" : "✖", | |
\ "Dirty" : "✗", | |
\ "Clean" : "✔︎", | |
\ 'Ignored' : '☒', | |
\ "Unknown" : "?" | |
\ } | |
" set includeexpr=substitute(v:fname,'@app/\\(.*\\)','\\1','') | |
let g:javascript_plugin_flow = 1 | |
function! OpenBitBucket() | |
let n = line('.') | |
let p = expand('%:p') | |
let r = getcwd() | |
let c = substitute(p, r.'/', '', '') | |
let bbRepo = 'git remote get-url --push origin | sed -e "s/ssh:\/\/[email protected]:7999\/\(.*\)\/\(.*\).git/https:\/\/git.ninjavan.co\/projects\/\1\/repos\/\2\/browse\//g"' | |
let a = system(bbRepo) | |
exe '!open '.trim(a).trim(c).'\#'.n | |
endfunction | |
nmap <leader>O :call OpenBitBucket() <CR><CR> | |
function! MyTabLine() | |
let s = '' | |
let t = tabpagenr() | |
let i = 1 | |
while i <= tabpagenr('$') | |
let buflist = tabpagebuflist(i) | |
let winnr = tabpagewinnr(i) | |
let s .= '%' . i . 'T' | |
let s .= (i == t ? '%1*' : '%2*') | |
let s .= ' ' | |
let s .= i . ')' | |
let s .= ' %*' | |
let s .= (i == t ? '%#TabLineSel#' : '%#TabLine#') | |
let file = bufname(buflist[winnr - 1]) | |
let file = fnamemodify(file, ':p:t') | |
if file == '' | |
let file = '[No Name]' | |
endif | |
let s .= file | |
let i = i + 1 | |
endwhile | |
let s .= '%T%#TabLineFill#%=' | |
let s .= (tabpagenr('$') > 1 ? '%999XX' : 'X') | |
return s | |
endfunction | |
set stal=1 | |
set tabline=%!MyTabLine() | |
hi TabLineFill ctermfg=LightGreen ctermbg=DarkGreen | |
hi TabLine ctermfg=Blue ctermbg=Yellow | |
hi TabLineSel ctermfg=Red ctermbg=Yellow | |
let &t_SI.="\e[5 q" "SI = INSERT mode | |
let &t_SR.="\e[4 q" "SR = REPLACE mode | |
let &t_EI.="\e[1 q" "EI = NORMAL mode (ELSE) | |
nnoremap <C-N> :set number!<CR> | |
"if (has("nvim")) | |
" "For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 > | |
" let $NVIM_TUI_ENABLE_TRUE_COLOR=1 | |
"endif | |
"For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 > | |
"Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd > | |
" < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 > | |
if (has("termguicolors")) | |
set termguicolors | |
endif | |
set nu | |
set shada='100,<1000,s1000,h | |
set clipboard=unnamedplus | |
" Plugin key-mappings. | |
" Note: It must be "imap" and "smap". It uses <Plug> mappings. | |
imap <C-k> <Plug>(neosnippet_expand_or_jump) | |
smap <C-k> <Plug>(neosnippet_expand_or_jump) | |
xmap <C-k> <Plug>(neosnippet_expand_target) | |
" SuperTab like snippets behavior. | |
" Note: It must be "imap" and "smap". It uses <Plug> mappings. | |
"imap <expr><TAB> | |
" \ pumvisible() ? "\<C-n>" : | |
" \ neosnippet#expandable_or_jumpable() ? | |
" \ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>" | |
smap <expr><TAB> neosnippet#expandable_or_jumpable() ? | |
\ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>" | |
" For conceal markers. | |
if has('conceal') | |
set conceallevel=3 concealcursor=niv | |
endif | |
let g:python_host_prog = '/usr/bin/python' | |
let g:python3_host_prog = '/usr/local/bin/python3' | |
au BufRead *.svg :set filetype=html | |
let g:emmet_html5 = 0 | |
let g:neosnippet#snippets_directory='/Users/derekzeng/.snippets/' | |
let g:coc_start_at_startup=0 | |
let g:buffet_use_devicons=1 | |
let g:buffet_always_show_tabline=1 | |
let g:buffet_powerline_separators=1 | |
let g:buffet_show_index=1 | |
let g:webdevicons_enable_nerdtree = 1 | |
let g:webdevicons_conceal_nerdtree_brackets = 1 | |
function! g:BuffetSetCustomColors() | |
" hi! BuffetCurrentBuffer cterm=NONE ctermbg=5 ctermfg=8 guibg=#00FF00 guifg=#000000 | |
hi! BuffetActiveBuffer guifg=#fce8ae | |
hi! BuffetTab guibg=#ffffff | |
hi! BuffetCurrentBuffer guibg=#9bf8fa | |
endfunction | |
let g:buffet_tab_icon = "\uf00a" | |
let g:buffet_left_trunc_icon = "\uf0a8" | |
let g:buffet_right_trunc_icon = "\uf0a9" | |
nmap <leader>1 <Plug>BuffetSwitch(1) | |
nmap <leader>2 <Plug>BuffetSwitch(2) | |
nmap <leader>3 <Plug>BuffetSwitch(3) | |
nmap <leader>4 <Plug>BuffetSwitch(4) | |
nmap <leader>5 <Plug>BuffetSwitch(5) | |
nmap <leader>6 <Plug>BuffetSwitch(6) | |
nmap <leader>7 <Plug>BuffetSwitch(7) | |
nmap <leader>8 <Plug>BuffetSwitch(8) | |
nmap <leader>9 <Plug>BuffetSwitch(9) | |
nmap <leader>0 <Plug>BuffetSwitch(10) | |
noremap <Tab> :bn<CR> | |
noremap <S-Tab> :bp<CR> | |
noremap <Leader><Tab> :Bw<CR> | |
noremap <Leader><S-Tab> :Bw!<CR> | |
noremap <C-t> :tabnew split<CR> | |
colorscheme miramare | |
if has("gui_running") | |
set background=light | |
auto VimEnter * NERDTree hr | |
auto VimEnter * CocStart | |
else | |
set background=dark | |
endif | |
" else | |
Plugin 'iamcco/markdown-preview.nvim', { 'do': 'cd app & yarn install' } | |
Plugin 'Shougo/deoplete.nvim' | |
Plugin 'Shougo/neosnippet.vim' | |
Plugin 'Shougo/neosnippet-snippets' | |
Plugin 'Shougo/context_filetype.vim' | |
Plugin 'neoclide/coc.nvim', {'branch': 'master', 'do': 'yarn install --frozen-lockfile'} | |
let g:coc_enabled_pattern = "pre-employment\\|noah\\|Vault" | |
au BufAdd * let b:coc_enabled=expand("%:p:h")=~ g:coc_enabled_pattern | |
" Use tab for trigger completion with characters ahead and navigate. | |
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by | |
" other plugin before putting this into your config. | |
inoremap <silent><expr> <TAB> | |
\ pumvisible() ? "\<C-n>" : | |
\ <SID>check_back_space() ? "\<TAB>" : | |
\ coc#refresh() | |
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>" | |
function! s:check_back_space() abort | |
let col = col('.') - 1 | |
return !col || getline('.')[col - 1] =~# '\s' | |
endfunction | |
" Use <c-space> to trigger completion. | |
if has('nvim') | |
inoremap <silent><expr> <c-space> coc#refresh() | |
else | |
inoremap <silent><expr> <c-@> coc#refresh() | |
endif | |
" Make <CR> auto-select the first completion item and notify coc.nvim to | |
" format on enter, <cr> could be remapped by other vim plugin | |
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm() | |
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>" | |
" Use `[g` and `]g` to navigate diagnostics | |
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list. | |
nmap <silent> [g <Plug>(coc-diagnostic-prev) | |
nmap <silent> ]g <Plug>(coc-diagnostic-next) | |
" 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) | |
" Use K to show documentation in preview window. | |
nnoremap <silent> K :call <SID>show_documentation()<CR> | |
function! s:show_documentation() | |
if (index(['vim','help'], &filetype) >= 0) | |
execute 'h '.expand('<cword>') | |
elseif (coc#rpc#ready()) | |
call CocActionAsync('doHover') | |
else | |
execute '!' . &keywordprg . " " . expand('<cword>') | |
endif | |
endfunction | |
" Highlight the symbol and its references when holding the cursor. | |
autocmd CursorHold * silent call CocActionAsync('highlight') | |
" Symbol renaming. | |
nmap <leader>rn <Plug>(coc-rename) | |
" Formatting selected code. | |
xmap <leader>f <Plug>(coc-format-selected) | |
nmap <leader>f <Plug>(coc-format-selected) | |
augroup mygroup | |
autocmd! | |
" Setup formatexpr specified filetype(s). | |
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') | |
" Update signature help on jump placeholder. | |
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') | |
augroup end | |
" Applying codeAction to the selected region. | |
" Example: `<leader>aap` for current paragraph | |
xmap <leader>a <Plug>(coc-codeaction-selected) | |
nmap <leader>a <Plug>(coc-codeaction-selected) | |
" Remap keys for applying codeAction to the current buffer. | |
nmap <leader>ac <Plug>(coc-codeaction) | |
" Apply AutoFix to problem on the current line. | |
nmap <leader>qf <Plug>(coc-fix-current) | |
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} | |
" Add `:Format` command to format current buffer. | |
command! -nargs=0 Format :call CocAction('format') | |
" Add `:Fold` command to fold current buffer. | |
command! -nargs=? Fold :call CocAction('fold', <f-args>) | |
" Add `:OR` command for organize imports of the current buffer. | |
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') | |
" Mappings for CoCList | |
" Show all diagnostics. | |
nnoremap <silent><nowait> <space>a :<C-u>CocList diagnostics<cr> | |
" Manage extensions. | |
nnoremap <silent><nowait> <space>e :<C-u>CocList extensions<cr> | |
" Show commands. | |
nnoremap <silent><nowait> <space>c :<C-u>CocList commands<cr> | |
" Find symbol of current document. | |
nnoremap <silent><nowait> <space>o :<C-u>CocList outline<cr> | |
" Search workspace symbols. | |
nnoremap <silent><nowait> <space>s :<C-u>CocList -I symbols<cr> | |
" Do default action for next item. | |
nnoremap <silent><nowait> <space>j :<C-u>CocNext<CR> | |
" Do default action for previous item. | |
nnoremap <silent><nowait> <space>k :<C-u>CocPrev<CR> | |
" Resume latest coc list. | |
nnoremap <silent><nowait> <space>p :<C-u>CocListResume<CR> | |
" Run jest for current project | |
command! -nargs=0 Jest :call CocAction('runCommand', 'jest.projectTest') | |
" Run jest for current file | |
command! -nargs=0 JestCurrent :call CocAction('runCommand', 'jest.fileTest', ['%']) | |
" Run jest for current test | |
nnoremap <leader>te :call CocAction('runCommand', 'jest.singleTest')<CR> | |
" Init jest in current cwd, require global jest command exists | |
command! JestInit :call CocAction('runCommand', 'jest.init') | |
autocmd BufEnter *.{js,jsx,ts,tsx} :syntax sync fromstart | |
autocmd BufLeave *.{js,jsx,ts,tsx} :syntax sync clear | |
let g:coc_global_extensions = [ | |
\ 'coc-tsserver' | |
\ ] | |
let g:coc_global_extensions += ['coc-prettier'] | |
let g:coc_global_extensions += ['coc-eslint'] | |
let b:coc_root_patterns = ["node_modules"] | |
" endif | |
set iskeyword-=- | |
au! BufRead .*rc setlocal filetype=json | |
nnoremap <Leader>n :NERDTreeToggle<CR> | |
function! FoldImport() | |
endfunction | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment