-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
125 lines (112 loc) · 4.11 KB
/
vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
set nu
"dein Scripts-----------------------------
if &compatible
set nocompatible " Be iMproved
endif
" Required:
set rtp+=~/.vim/bundle/repos/github.com/Shougo/dein.vim
" Required:
call dein#begin('~/.vim/bundle')
" Let dein manage dein
" Required:
call dein#add('~/.vim/bundle/repos/github.com/Shougo/dein.vim')
" Add or remove your plugins here like this:
call dein#add('Shougo/neosnippet.vim')
call dein#add('Shougo/neosnippet-snippets')
call dein#add('wsdjeg/dein-ui.vim')
call dein#add('connorholyday/vim-snazzy')
call dein#add('ryanoasis/vim-devicons')
call dein#add('itchyny/lightline.vim')
call dein#add('mhinz/vim-startify')
call dein#add('tpope/vim-surround')
call dein#add('scrooloose/syntastic')
call dein#add('scrooloose/nerdtree')
call dein#add('tiagofumo/vim-nerdtree-syntax-highlight')
call dein#add('tpope/vim-fugitive')
call dein#add('neoclide/coc.nvim', { 'merged': 0 })
call dein#add('josa42/vim-lightline-coc')
call dein#add('sheerun/vim-polyglot')
call dein#add('Xuyuanp/nerdtree-git-plugin')
call dein#add('raimondi/delimitmate')
if !has('nvim')
call dein#add('roxma/nvim-yarp')
call dein#add('roxma/vim-hug-neovim-rpc')
endif
" Required:
call dein#end()
" Required:
filetype plugin indent on
syntax enable
" If you want to install not installed plugins on startup.
if dein#check_install()
call dein#install()
endif
"End dein Scripts-------------------------
"Colorscheme and statusline---------------
colorscheme snazzy
set laststatus=2
" Register the components manually:
let g:lightline = {
\ 'colorscheme': 'snazzy'
\ }
let g:lightline.component_expand = {
\ 'linter_warnings': 'lightline#coc#warnings',
\ 'linter_errors': 'lightline#coc#errors',
\ 'linter_info': 'lightline#coc#info',
\ 'linter_hints': 'lightline#coc#hints',
\ 'linter_ok': 'lightline#coc#ok',
\ 'status': 'lightline#coc#status',
\ }
" Set color to the components:
let g:lightline.component_type = {
\ 'linter_warnings': 'warning',
\ 'linter_errors': 'error',
\ 'linter_info': 'info',
\ 'linter_hints': 'hints',
\ 'linter_ok': 'left',
\ }
" Add the components to the lightline:
let g:lightline.active = {
\ 'left': [[ 'coc_info', 'coc_hints', 'coc_errors', 'coc_warnings', 'coc_ok' ], [ 'coc_status' ]]
\ }
" Use autocmd to force lightline update
autocmd User CocStatusChange,CocDiagnosticChange call lightline#update()
" NERDTree--------------------------------
" Start NERDTree and put the cursor back in the other window.
autocmd VimEnter * NERDTree | wincmd p
" Exit Vim if NERDTree is the only window left.
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() |
\ quit | endif
"CoC-------------------------------------
" Set internal encoding of vim, not needed on neovim, since coc.nvim using some
" unicode characters in the file autoload/float.vim
set encoding=utf-8
" Some servers have issues with backup files.
set nobackup
set nowritebackup
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
" delays and poor user experience.
set updatetime=300
" 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
" Use tab for trigger completion with characters ahead and navigate.
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')
" 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')
command! -nargs=0 Prettier :call CocAction('runCommand', 'prettier.formatFile')