Last active
July 17, 2020 06:45
-
-
Save xcodebuild/dc1b81f0fe9341b12b7cbd7c3ab3b536 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
call plug#begin('~/.vim/plugged') | |
Plug 'junegunn/vim-easy-align' | |
Plug 'preservim/nerdtree' | |
Plug 'Shougo/vimproc.vim', {'do' : 'make'} | |
Plug 'ctrlpvim/ctrlp.vim' | |
Plug 'sickill/vim-monokai' | |
Plug 'fisadev/vim-ctrlp-cmdpalette' | |
Plug 'neoclide/jsonc.vim' | |
Plug 'Yggdroot/indentLine' | |
Plug 'Chiel92/vim-autoformat' | |
Plug 'preservim/nerdcommenter' | |
Plug 'tpope/vim-sleuth' | |
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } | |
Plug 'junegunn/fzf.vim' | |
Plug 'vim-airline/vim-airline' | |
Plug 'vim-airline/vim-airline-themes' | |
Plug 'Shougo/unite.vim' | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
call plug#end() | |
set mouse=a | |
set nu | |
let g:ctrlp_cmdpalette_execute = 1 | |
" enable true color | |
set termguicolors | |
let g:NERDTreeMouseMode=3 | |
syntax on | |
set numberwidth=7 | |
colorscheme monokai | |
let g:numbers_exclude = ['tagbar', 'gundo', 'minibufexpl', 'nerdtree'] | |
"" indent | |
" Use spaces instead of tabs | |
set expandtab | |
" Be smart when using tabs ;) | |
set smarttab | |
" 1 tab == 4 spaces | |
set shiftwidth=4 | |
set tabstop=4 | |
" Linebreak on 500 characters | |
set lbr | |
set tw=500 | |
set ai "Auto indent | |
set si "Smart indent | |
set wrap "Wrap lines | |
let g:airline#extensions#tabline#enabled = 1 | |
let g:airline_powerline_fonts = 1 | |
" 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>" | |
set clipboard=unnamed | |
function! s:check_back_space() abort | |
let col = col('.') - 1 | |
return !col || getline('.')[col - 1] =~# '\s' | |
endfunction | |
" Use <c-space> to trigger completion. | |
inoremap <silent><expr> <c-space> coc#refresh() | |
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current | |
" position. Coc only does snippet and additional edit on confirm. | |
" <cr> could be remapped by other vim plugin, try `:verbose imap <CR>`. | |
if exists('*complete_info') | |
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>" | |
else | |
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>" | |
endif | |
let g:fzf_commands_expect = 'enter' | |
" Formatting selected code. | |
xmap <space>ff <Plug>(coc-format-selected) | |
nmap <sapce>ff <Plug>(coc-format-selected) | |
noremap <space><space> :Commands<CR> | |
vnoremap <space><space> :<C-u>Commands<CR> | |
noremap <space>pf :GFiles --cached --others --exclude-standard<CR> | |
noremap <space>bb :Buffers<CR> | |
noremap <space>ss :BLines<CR> | |
noremap <space>sp :Ag<CR> | |
noremap <space>ft :NERDTreeToggle<CR> | |
noremap <space>;; :NERDCommenterToggle<CR> | |
nnoremap <space>;; :call NERDComment(0,"toggle")<CR> | |
vnoremap <space>;; :call NERDComment(0,"toggle")<CR> | |
command OpenVimRC :execute "normal! \<esc>:edit ~/.vimrc<cr>" | |
command GotoDefinition :call feedkeys("\<Plug>(coc-definition)") | |
command GotoImplementation :call feedkeys("\<Plug>(coc-implementation)") | |
command ReNameSymbol :call feedkeys("\<Plug>(coc-rename)") | |
command FormatSelected :call feedkeys("\<Plug>(coc-format-selected)") | |
augroup myvimrc | |
au! | |
au BufWritePost .vimrc,_vimrc,vimrc,.gvimrc,_gvimrc,gvimrc so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif | |
augroup END | |
function! InitNERDTree() | |
call NERDTreeAddMenuItem({'text': '(s)earch in directory', 'shortcut': 's', 'callback': 'NERDTreeSearchInDirectory'}) | |
endfunction | |
command InitNERDTreeCmd call InitNERDTree() | |
let g:fzf#vim#default_layout = {'down': '~40%'} | |
autocmd VimEnter * InitNERDTreeCmd | |
function! s:ag_in(...) | |
call fzf#vim#ag(join(a:000[1:], ' '), extend({'dir': a:1}, g:fzf#vim#default_layout)) | |
endfunction | |
function! NERDTreeSearchInDirectory() | |
let curFileNode = g:NERDTreeFileNode.GetSelected() | |
let path = curFileNode.path.str() | |
call s:ag_in(path) | |
endfunction | |
set backup | |
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp | |
set backupskip=/tmp/*,/private/tmp/* | |
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp | |
set writebackup | |
autocmd BufRead,BufNewFile tsconfig.json set filetype=jsonc | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment