-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
184 lines (142 loc) · 6.13 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible "be iMproved, required
filetype on "required 检测文件类型
filetype indent on "required 根据文件类型,选择不同的缩进
filetype plugin on "required 启用插件
set autoindent " always set autoindenting on 自动缩进
" indent C++ autoindent private public keyword
" set cindent
" set cinoptions
set smartindent
set expandtab
set tabstop=4
set shiftwidth=4
set history=100 " keep 100 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incretmental searching
set hlsearch
set showmode
set foldmethod=syntax
" 取消补全内容以分割子窗口形式出现,只显示补全列表
set completeopt=longest,menu
syntax enable
" 定义快捷键的前缀,即<Leader>
" let mapleader="\"
" inoremap jk <ESC><ESC>
" 打tag
" --c++-kinds=+p : Adds prototypes in the database for C/C++ files.
"--fields=+iaS : Adds inheritance (i), access (a) and function
" signatures (S) information.
"--extra=+q : Adds context to the tag name. Note: Without this
" option, the script cannot get class members.
nnoremap<leader>tg :!ctags -R --fields=+aS --extra=+q<CR>
" ======= for coc ====
let g:coc_global_extension = [
\ 'coc-json',
\ 'coc-vimlsp',
\ 'coc-vetur',
\ 'coc-jedi',
\ 'coc-yaml',
\ 'coc-tsserver',
\ 'coc-html',
\ 'coc-yank',
\ 'coc-sql',
\ 'coc-snippets',
\ 'coc-rust-analyzer']
" 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
" TextEdit might fail if hidden is not set.
set hidden
hi Pmenu ctermfg=black ctermbg=DarkGreen
hi PmenuSel ctermfg=white ctermbg=DarkGreen
hi CocErrorSign ctermfg=red guibg=red
hi CocErrorfloat ctermfg=white ctermbg=red
hi CocInfoSign ctermfg=blue
hi CocInfofloat ctermfg=white ctermbg=blue
hi CocWarningSign ctermfg=white ctermbg=yellow
" I have trIEd all of the below,but to no avail
" hi CocHighlightText ctermfg=black ctermbg=DarkGreen
" hi CocHintSign ctermfg=black ctermbg=DarkGreen
" hi CocHintHighlight ctermfg=black ctermbg=DarkGreen
" hi CocHintVirtualText ctermfg=black
" 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)
" =====
let g:omni_sql_no_default_maps = 1
" =========== for airline ========:
let g:airline#extensions#languageclient#enabled = 1
let airline#extensions#languageclient#error_symbol = 'E:'
let airline#extensions#languageclient#warning_symbol = 'W:'
let airline#extensions#languageclient#show_line_numbers = 1
let airline#extensions#languageclient#open_lnum_symbol = '(L'
let airline#extensions#languageclient#close_lnum_symbol = ')'
let g:airline#extensions#ale#enabled = 1
let g:airline#extensions#tabline#enabled = 1
" let g:airline#extensions#tabline#fnamemod = ':t'
" let g:airline#extensions#tabline#show_buffers = 1
let g:airline#extensions#tabline#exclude_preview = 1
" let airline#extensions#tabline#disable_refresh = 1
" let g:airline#extensions#tabline#buffer_min_count = 0
let g:airline#extensions#tabline#show_buffers = 0
let g:airline#extensions#tabline#show_tabs = 1
let g:airline_section_error = '%{airline#util#wrap(airline#extensions#coc#get_error(),0)}'
let g:airline_section_warning = '%{airline#util#wrap(airline#extensions#coc#get_warning(),0)}'
" GitGutter Git辅助插件
let g:gitgutter_enabled = 0 " 默认不开启
let g:gitgutter_signs = 0 " 默认不开启提示
let g:gitgutter_highlight_lines = 0 " 默认不高亮行
let g:gitgutter_sign_added = '+' " 自定义新增指示符
let g:gitgutter_sign_modified = '>' " 自定义修改指示符
let g:gitgutter_sign_removed = '-' " 自定义删除指示符
let g:gitgutter_sign_modified_removed = '->' " 自定义既修改又删除指示符
" ===== vim-go ====
let g:go_template_autocreate = 0
call plug#begin('~/.vim/plugged')
" The default plugin directory will be as follows:
" - Vim (Linux/macOS): '~/.vim/plugged'
" - Vim (Windows): '~/vimfiles/plugged'
" - Neovim (Linux/macOS/Windows): stdpath('data') . '/plugged'
" You can specify a custom plugin directory by passing it as the argument
" - e.g. `call plug#begin('~/.vim/plugged')`
" - Avoid using standard Vim directory names like 'plugin'
" Make sure you use single quotes
" Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
" Plug 'junegunn/vim-easy-align'
" Any valid git URL is allowed
" Plug 'https://github.com/junegunn/vim-github-dashboard.git'
" Multiple Plug commands can be written in a single line using | separators
" Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
" On-demand loading
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
" Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
" Using a non-default branch
" Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
" Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
Plug 'fatih/vim-go', { 'tag': '*' }
" Plugin options
" Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
" Plugin outside ~/.vim/plugged with post-update hook
" Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
" Plug 'junegunn/fzf.vim'
" Unmanaged plugin (manually installed and updated)
" Plug '~/my-prototype-plugin'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'airblade/vim-gitgutter'
Plug 'vim-airline/vim-airline'
Plug 'liuchengxu/vista.vim'
Plug 'godlygeek/tabular'
Plug 'tpope/vim-markdown'
Plug 'rust-lang/rust.vim'
" Initialize plugin system
call plug#end()
filetype plugin indent on " required