forked from yubo/home
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.vimrc
287 lines (243 loc) · 7.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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
set nocompatible " be iMproved
set nu
set encoding=utf-8
filetype off " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#begin()
"vim插件管理
Bundle 'gmarik/vundle'
"Bundle 'Lokaltog/vim-powerline'
"Bundle 'Lokaltog/vim-easymotion'
Bundle 'tpope/vim-fugitive'
"Bundle 'L9'
"Bundle 'FuzzyFinder'
Bundle 'fatih/vim-go'
Bundle 'majutsushi/tagbar.git'
"Bundle 'Valloric/YouCompleteMe'
Bundle 'jistr/vim-nerdtree-tabs.git'
Bundle 'scrooloose/nerdtree.git'
Bundle 'vim-scripts/AutoClose'
"Bundle 'SirVer/ultisnips'
"Bundle 'honza/vim-snippets'
"Bundle 'tpope/vim-surround'
"Bundle 'plasticboy/vim-markdown.git'
"Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}
"Bundle 'scrooloose/syntastic'
Bundle 'bling/vim-airline'
"Bundle 'tpope/vim-rails.git'
Plugin 'powerline/fonts'
Plugin 'vim-airline/vim-airline-themes'
call vundle#end() " required
filetyp plugin indent on " required!
" see :h vundle for more details or wiki for FAQ
" NOTE: comments after Bundle commands are not allowed.
"打开高亮
syntax enable
syntax on
""set fdm=syntax
""key maps
"map <C-T> :tabnew<CR>
map <C-N> :tabnext<CR>
map <C-P> :tabpre<CR>
"共享剪贴板数据
set clipboard+=unnamed
""""
"go相关的配置
let g:fencview_autodetect=1
let g:go_disable_autoinstall = 0
let g:neocomplete#enable_at_startup = 1
let g:go_fmt_command = "goimports"
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_structs = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
let g:godef_split=3
au FileType go nmap ds <Plug>(go-def-split)
au FileType go nmap dv <Plug>(go-def-vertical)
au FileType go nmap dt <Plug>(go-def-tab)
"vim-airline
let g:airline_powerline_fonts = 1
let g:airline_theme='term'
let g:airline_powerline_fonts=0
""let g:airline#extensions#tabline#enabled = 1
let g:airline_left_sep=''
let g:airline_right_sep=''
let g:airline_section_c = '%t'
let g:airline_section_x = '%{strlen(&ft) ? &ft : "Noft"}%{&bomb ? " BOM" : ""}'
let g:airline_section_y = '%{&fileformat} %{(&fenc == "" ? &enc : &fenc)}'
let g:airline_section_z = '%2l:%-1v/%L'
"markdown
let g:vim_markdown_frontmatter=1
"全局设置
set shell=/bin/bash
set hlsearch
set mouse=a
set cuc cul "这个就是十字架
set incsearch
set autoindent
set smartindent
set showmatch
set ruler
set wrap
set softtabstop=4
set ts=4
set expandtab
set shiftwidth=4
set ignorecase "大小写敏感
set ignorecase "大小写敏感
setlocal noswapfile
set bufhidden=hide
"颜色方案
"https://github.com/tomasr/molokai/
"文件放到~/.vim/colors/molokai.vim
colorscheme molokai
"""""""solarized相关设置
colorscheme solarized
let g:solarized_termtrans=1
let g:solarized_termcolors=256
let g:solarized_contrast="high"
let g:solarized_visibility="high"
"""""""""""""""""""""""
if has('gui_running')
colorscheme molokai
set background=dark
set transparency=5
"set lines=60
"set columns=190
set guifont=Monaco:h12
set t_Co=256
else
set background=dark
endif
" 设置NerdTree
map <C-c> :NERDTreeToggle<CR>
"autocmd VimEnter * NERDTree
let NERDChristmasTree=1
let NERDTreeAutoCenter=1
let NERDTreeMouseMode=2
let NERDTreeShowFiles=1
let NERDTreeShowHidden=1
let NERDTreeShowLineNumbers=1
let NERDTreeWinPos='left'
let NERDTreeWinSize=31
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
let NERDTreeIgnore = ['\.swp','\.pyc', '\.mod\.c', '\.o', '\.ko', '\.a', '\.so', 'CMakeFiles', '\.cmake', 'CMakeCache.txt']
"}}}
"
let g:syntastic_cpp_compiler_options = ' -std=c++11'
" YCM{{{
" youcompleteme 默认tab s-tab 和自动补全冲突
" let g:ycm_key_list_select_completion=['<c-n>']
" let g:ycm_key_list_select_completion = ['<Down>']
" let g:ycm_key_list_previous_completion=['<c-p>']
" let g:ycm_key_list_previous_completion = ['<Up>']
set completeopt=longest,menu "让Vim的补全菜单行为与一般IDE一致(参考VimTip1228)
let g:ycm_confirm_extra_conf = 0 "关闭加载.ycm_extra_conf.py提示
let g:ycm_complete_in_comments = 1 "在注释输入中也能补全
let g:ycm_complete_in_strings = 1 "在字符串输入中也能补全
let g:ycm_seed_identifiers_with_syntax = 1 " 语言关键字补全, 不过python关键字都很短,所以,需要的自己打开
let g:ycm_min_num_of_chars_for_completion = 1 " 从第2个键入字符就开始罗列匹配项
let g:ycm_collect_identifiers_from_tags_files = 1 " 开启 YCM 基于标签引擎
let g:ycm_collect_identifiers_from_comments_and_strings = 1 " 注释和字符串中的文字也会被收入补全
let g:ycm_warning_symbol = '>>'
let g:ycm_error_symbol = '->'
let g:ycm_global_ycm_extra_conf = '~/.vim/.ycm_extra_conf.py'
nnoremap <leader>gh :YcmCompleter GoToDeclaration<CR>
nnoremap <leader>gf :YcmCompleter GoToDefinition<CR>
nnoremap <leader>gg :YcmCompleter GoToDefinitionElseDeclaration<CR>
" mapping
inoremap <expr> <CR> pumvisible()?"\<C-Y>":"\<CR>"
inoremap <expr> <C-J> pumvisible()?"\<PageDown>\<C-N>\<C-P>":"\<C-X><C-O>"
inoremap <expr> <C-K> pumvisible()?"\<PageUp>\<C-P>\<C-N>":"\<C-K>"
inoremap <expr> <C-U> pumvisible()?"\<C-E>":"\<C-U>"
" YCM settings
"ctags tagbar相关配置
let g:tagbar_type_go = {
\ 'ctagstype' : 'go',
\ 'kinds' : [
\ 'p:package',
\ 'i:imports:1',
\ 'c:constants',
\ 'v:variables',
\ 't:types',
\ 'n:interfaces',
\ 'w:fields',
\ 'e:embedded',
\ 'm:methods',
\ 'r:constructor',
\ 'f:functions'
\ ],
\ 'sro' : '.',
\ 'kind2scope' : {
\ 't' : 'ctype',
\ 'n' : 'ntype'
\ },
\ 'scope2kind' : {
\ 'ctype' : 't',
\ 'ntype' : 'n'
\ },
\ 'ctagsbin' : 'gotags',
\ 'ctagsargs' : '-sort -silent'
\ }
nmap <CR> :TagbarToggle<CR>
"autocmd BufReadPost *.cpp,*.c,*.h,*.hpp,*.cc,*.cxx,*.go,*.py,*.txt call tagbar#autoopen()
"ctags
"let Tlist_Ctags_Cmd="/usr/local/bin/ctags"
"let Tlist_Show_One_File = 1
"let Tlist_Exit_OnlyWindow = 1
"let Tlist_Use_Left_Window = 0
"let Tlist_Sort_Type = 'name'
"let Tlist_Auto_Open = 1
"let Tlist_Auto_Update = 1
"let Tlist_WinWidth = 25
"let Tlist_Use_Right_Window= 1
"let Tlist_File_Fold_Auto_Close=1
"屏蔽掉讨厌的F1键
inoremap <F1> <ESC>
nnoremap <F1> <ESC>
vnoremap <F1> <ESC>
"取消粘贴缩进
nmap <leader>p :set paste<CR>
nmap <leader>pp :set nopaste<CR>
"插入模式下移动
inoremap <c-e> <right>
inoremap <c-w> <left>
"去掉左右两边的滚动条
set go-=r
set go-=L
"快捷键
nnoremap nw <C-W><C-W>
" set mapleader
let mapleader=','
" python 的配置
autocmd FileType python set omnifunc=pythoncomplete#Complete
"自动添加文件头
function HeaderPython()
call setline(1, "#!/usr/bin/env python")
call append(1, "# -*- coding:utf-8 -*-")
call append(2, "#Author : GaoJiasheng")
call append(3, "#" . strftime('%Y-%m-%d %T', localtime()))
normal G
normal o
normal o
endf
autocmd bufnewfile *.py call HeaderPython()
" UltiSnips 的 tab 键与 YCM 冲突,重新设定
let g:UltiSnipsSnippetDirectories=['UltiSnips']
let g:UltiSnipsSnippetsDir = '~/.vim/bundle/vim-snippets/UltiSnips'
let g:UltiSnipsExpandTrigger="<leader><tab>"
let g:UltiSnipsJumpForwardTrigger="<leader><tab>"
let g:UltiSnipsJumpBackwardTrigger="<leader><s-tab>""
" easy motion 配置
"map <Leader>ef <Plug>(easymotion-lineforward)
"map <Leader>eb <Plug>(easymotion-linebackward)
"map <Leader><Leader>d <Plug>(easymotion-j)
"map <Leader><Leader>t <Plug>(easymotion-k)
"map / <Plug>(easymotion-sn)
"omap / <Plug>(easymotion-tn)
"map n <Plug>(easymotion-next)
"map N <Plug>(easymotion-prev)
"let g:EasyMotion_smartcase = 1
"let g:EasyMotion_startofline = 0 " keep cursor column when JK motion"
syntax on