-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
209 lines (162 loc) · 6.71 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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
" first install vim-plug to ~/.vim/autoload/
call plug#begin('~/.vim/plugged')
"Plug 'https://github.com/junegunn/vim-github-dashboard.git'
"Plug 'SirVer/ultisnips'
"Plug 'honza/vim-snippets'
"Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
"Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
"Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
""""""""""""""" IDE UI Configuration Plugins """"""""""""
" directory move forth and back
"Plug 'justinmk/vim-dirvish'
" warning front/tail spaces
Plug 'bronson/vim-trailing-whitespace'
" git command line
Plug 'tpope/vim-fugitive'
" column alignment line
Plug 'Yggdroot/indentLine'
" the taskbar
Plug 'itchyny/lightline.vim'
" zoom in/out a window in a tab of vim editor
Plug 'dhruvasagar/vim-zoom'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Plug 'vivien/vim-linux-coding-style'
"""""""""""""""""" Code Searching Plugins """"""""""""""""""""""
" fuzzy search
Plug 'Yggdroot/LeaderF', { 'do': './install.sh' }
" automatically update ctags in the background
Plug 'ludovicchabant/vim-gutentags'
Plug 'skywind3000/gutentags_plus'
" preview of the gtags-scope search ite
" when the cursor is on an item in a list which is generated by
" GscopeFind, we can use <C-p> to open that item in a preview window
" and <C-P> to close the preview window
Plug 'skywind3000/vim-preview'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""" Code Format Configuration Plugins """""""""""
" code fast alignment
Plug 'junegunn/vim-easy-align'
" Tab to Space automatically
" [Hao] disable this since tab problem
" Plug 'vim-scripts/Smart-Tabs'
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""" Code Edit Configuration Plugins """"""""""""""
" grammar check
Plug 'w0rp/ale'
" enhance specific language
Plug 'vim-scripts/c.vim'
Plug 'vim-scripts/a.vim'
Plug 'octol/vim-cpp-enhanced-highlight'
" automatically create non-existing directories for buff
Plug 'pbrisbin/vim-mkdir'
" auto compeletion
Plug 'Valloric/YouCompleteMe', {'do':'./install.py --clang-completer --go-completer'}
" function parameters hint
Plug 'Shougo/echodoc.vim'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""" Code Color Configuration Plugins """""""""""""""
"Plug 'altercation/vim-colors-solarized'
"Plug 'crusoexia/vim-monokai'
call plug#end()
" general settings
set nu
set noshowmode
set tabstop=8
set backspace=2
" set the fold mode
set fdm=indent
"set the color of folded code
:hi Folded guibg=black guifg=grey40 ctermfg=LightGrey ctermbg=DarkGrey
" wrap line when the commit message is too long
set wrap
" show a candidate list when press ctrl+]
set cscopetag
if &diff
colorscheme github
endif
set colorcolumn=81
:hi ColorColumn ctermbg=darkgrey guibg=darkgrey
" -----------------------------LeaderF settings--------------------------
let g:Lf_WindowPosition = 'left'
"let g:Lf_PreviewInPopup = 1
"let g:Lf_ShortcutF = '<C-P>'
"let g:Lf_ShortcutB = '<C-B>'
noremap <leader>m :LeaderfFunction!<cr>
" vim-linux-coding-style
" options will be applied only if "/linux/" or "/kernel" is in buffer's path.
let g:linuxsty_patterns = [ "/linux/", "/kernel/" ]
" lightline settings
set laststatus=2
" remember to do: export TERM=xterm-256color in .zshrc
if !has('gui_running')
set t_Co=256
endif
let g:lightline = {
\ 'colorscheme': 'PaperColor_dark',
\ }
" ----------gutentags.vim configuration-----------------------------------
" gutentags will automatically generate/update tags asyncally in the background
" gutentags can use ctags and/or gtags to generate tags
" here I comment all ctags config since I just use gtags, gtags support c/c++
" that's good enough for me
"yum install -y global-ctags
set tags=./.tags;,.tags
" with pygments, gtags can use ctags as a front end to support more languages.
"let $GTAGSLABEL = 'pygments'
" this is not neccessary
"let $GTAGSCONF = '/etc/gtags.conf'
" this is to set the mark of a project, so that gutentags know this is
" a project to generate tags
let g:gutentags_project_root = ['.git','.root','.svn','.hg','.project']
" the name of the tag file
"let g:gutentags_ctags_tagfile = '.tags'
" oepn the config to support ctags and gtags at the same time
let g:gutentags_modules = []
if executable('ctags')
let g:gutentags_modules += ['ctags']
endif
if executable('gtags-cscope') && executable('gtags')
let g:gutentags_modules += ['gtags_cscope']
endif
" store the ctags/gtags file in ~/workspace/.cache/tags directory to avoid
" polluting the project directory
let g:gutentags_cache_dir = expand('~/workspace/.cache/tags')
" configure ctags
"let g:gutentags_ctags_extra_args = []
"let g:gutentags_ctags_extra_args = ['--fields=+niazS', '--extra=+q']
"let g:gutentags_ctags_extra_args += ['--c++-kinds=+px']
"let g:gutentags_ctags_extra_args += ['--c-kinds=+px']
" add this line if using universal ctags
"let g:gutentags_ctags_extra_args += ['--output-format=e-ctags']
" forbidden gutentags to load gtags database automatically to avoid
" multiple projects' databases mess up with each other.
" the gtags database loading and switching will be done by
" gutentags-plus automatically.
let g:gutentags_auto_add_gtags_cscope = 0
let g:gutentags_define_advanced_commands = 1
" ----------gutentags-plus configuration-----------------------------------
" change focus to quickfix window after search (optional).
let g:gutentags_plus_switch = 1
"You can disable the default keymaps by:
let g:gutentags_plus_nomap = 1
"and define your new maps like:
noremap <silent> <leader>gs :GscopeFind s <C-R><C-W><cr>
noremap <silent> <leader>gg :GscopeFind g <C-R><C-W><cr>
noremap <silent> <leader>gc :GscopeFind c <C-R><C-W><cr>
noremap <silent> <leader>gt :GscopeFind t <C-R><C-W><cr>
noremap <silent> <leader>ge :GscopeFind e <C-R><C-W><cr>
noremap <silent> <leader>gf :GscopeFind f <C-R>=expand("<cfile>")<cr><cr>
noremap <silent> <leader>gi :GscopeFind i <C-R>=expand("<cfile>")<cr><cr>
noremap <silent> <leader>gd :GscopeFind d <C-R><C-W><cr>
noremap <silent> <leader>ga :GscopeFind a <C-R><C-W><cr>
noremap <silent> <leader>gz :GscopeFind z <C-R><C-W><cr>
"----------vim-preview configuration-----------------------------------------
"P for preview, p for close
autocmd FileType qf nnoremap <silent><buffer> p :PreviewQuickfix<cr>
autocmd FileType qf nnoremap <silent><buffer> P :PreviewClose<cr>
"----------last cursor place configuration-----------------------------------
" Uncomment the following to have Vim jump to the last position when
" reopening a file
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif