-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc.lsj
264 lines (224 loc) · 8.4 KB
/
vimrc.lsj
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
"colorscheme torte "设置配色方案
"colorscheme murphy
colorscheme desert "常用"
"colorscheme evening "常用"
"colorscheme elflord "常用"
""colorscheme ron
"colorscheme pablo
"colorscheme shine
"colorscheme peachpuff
"colorscheme blue
"set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936
"set termencoding=utf-8
set encoding=utf-8 "编码设置
set langmenu=zh_CN.UTF-8 "可以显示中文,语言设置
"set fileencodings=ucs-bom,utf-8,cp936
"set fileencoding=utf-8
"
if !empty($GOROOT)
set rtp+=$GOROOT/misc/vim
elseif isdirectory('/usr/local/go')
set rtp+=/usr/local/go/misc/vim
end
set nocompatible "去掉讨厌的有关vi一致性模式,避免以前版本的一些bug和局限
" source $VIMRUNTIME/vimrc_example.vim
" source $VIMRUNTIME/mswin.vim
" behave mswin
" source $VIMRUNTIME/ftplugin/man.vim
" source ~/.vim/cscope_maps.vim
" source ~/.vim/cscopePath.vim
" for Linux
set autowrite "自动保存
set noeb " 去掉输入错误的提示声音
set number " 显示行号
set cmdheight=2
colo darkblue
set autoindent " 自动缩进
set smartindent " 为C程序提供自动缩进
set autochdir
set smarttab " 在行和段开始处使用制表符
set tabstop=4 " tabstops of 8 " Tab键的宽度
set softtabstop=4 " 统一缩进为4
set expandtab " 用空格代替制表符tab
set shiftwidth=4 " indents of 8
set textwidth=78 " screen in 80 columns wide, wrap at 78
set backspace=indent,eol,start
set ignorecase "搜索忽略大小写
set hlsearch "搜索逐字符高亮
if version >= 603 " 显示中文帮助
set helplang=cn
set encoding=utf-8
endif
" set mouse=a
set nocp
"filetype off
filetype on " 侦测文件类型
filetype plugin on " 载入文件类型插件
filetype indent on " 不同文件类型采用不同缩进
syntax on " 语法高亮
set showcmd " 输入的命令显示出来,看的清楚些
"set iskeyword+=_,$,@,%,#,- " 带有如下符号的单词不要被换行分割
"set iskeyword+=_,$,@,%,# " 带有如下符号的单词不要被换行分割
"shift + * 进行搜索时,忽略右边的 '='
"shift + * 进行搜索时,忽略右边的 '-'
set isfname-=@,48-57,/,.,-,_,+,,,#,$,%,~,=
set isfname+={,}
noremap <c-down> <c-w>j
noremap <c-up> <c-w>k
noremap <c-left> <c-w>h
noremap <c-right> <c-w>l
set foldenable " 允许折叠
nnoremap <space> @=((foldclosed(line('.')) < 0) ? 'zc' : 'zo')<CR>
" map <esc>
imap jk <Esc>
set timeoutlen=500
"" 跳转到上一次修改处 """
nnoremap gm g;
""调出tabnew"""
nnoremap <C-N> :tabnew<space>
let g:winManagerWindowLayout = "TagList|FileExplorer,BufExplorer"
let g:winManagerWidth = 30
nmap <silent> <F3> :WMToggle<cr>
let g:AutoOpenWinManager = 1
if has("win32")
set guifont=Consolas:h11
endif
" Latex
let g:Tex_DefaultTargetFormat='pdf'
" let g:fencview_autodetect = 1
nnoremap <C-P> :tabp<CR>
nmap M :Man <cword><CR>
noremap <C-T> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q --if0=yes . <CR>
set nocompatible "去掉讨厌的有关vi一致性模式,避免以前版本的一些bug和局限
filetype off
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/vundle
" init vundle
call vundle#begin()
" let Vundle manage Vundle
Plugin 'VundleVim/Vundle.vim'
" let Vundle manage Vundle
" " required!
" Bundle 'gmarik/vundle'
Bundle 'Valloric/YouCompleteMe'
" Bundle 'SirVer/ultisnips'
plugin 'Valloric/YouCompleteMe'
Plugin 'MattesGroeger/vim-bookmarks'
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" All of your Plugins must be added before the following line
call vundle#end() " required
" bookmarks https://github.com/MattesGroeger/vim-bookmarks
highlight BookmarkSign ctermbg=NONE ctermfg=160
highlight BookmarkLine ctermbg=194 ctermfg=NONE
let g:bookmark_sign = '♥'
let g:bookmark_highlight_lines = 1
" for YouCompleteMe
let g:ycm_global_ycm_extra_conf = expand("~/.vim/.ycm_extra_conf.py")
let g:ycm_confirm_extra_conf=0
let g:ycm_complete_in_comments=1
let g:ycm_collect_identifiers_from_comments_and_strings=1
let g:ycm_collect_identifiers_from_tags_files=1
let g:ycm_seed_identifiers_with_syntax=1
" suppress default value
let g:ycm_filetype_blacklist = {'tagbar' : 1,'qf' : 1,'notes' : 1,'unite' : 1,'vimwiki' : 1,}
nnoremap <leader>gl :YcmCompleter GoToDeclaration<CR>
nnoremap <leader>gf :YcmCompleter GoToDefinition<CR>
nnoremap <leader>gg :YcmCompleter GoToDefinitionElseDeclaration<CR>
nnoremap <C-K> :YcmCompleter GoToDefinitionElseDeclaration<CR>
" not working
" function! g:UltiSnips_Complete()
" call UltiSnips_ExpandSnippet()
" if g:ulti_expand_res == 0
" if pumvisible()
" return "\<C-n>"
" else
" call UltiSnips_JumpForwards()
" if g:ulti_jump_forwards_res == 0
" return "\<TAB>"
" endif
" endif
" endif
" return ""
" endfunction
"au BufEnter * exec "inoremap <silent> " . g:UltiSnipsExpandTrigger . " <C-R>=g:UltiSnips_Complete()<cr>"
"let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsExpandTrigger = '<c-e>'
let g:UltiSnipsJumpForwardTrigger = '<c-j>'
let g:UltiSnipsJumpBackwardTrigger = '<c-k>'
let g:UltiSnipsListSnippets = '<c-l>'
"""""""""""""set CtrlP""""""""""""""""
map <F9> :CtrlP<CR>
"""""""""""""set NERDTree""""""""""""""
let NERDChristmasTree=1
let NERDTreeAutoCenter=1
let NERDTreeBookmarksFile=$VIM.'\Data\NerdBookmarks.txt'
let NERDTreeMouseMode=2
let NERDTreeShowBookmarks=1
let NERDTreeShowFiles=1
let NERDTreeShowHidden=1
let NERDTreeShowLineNumbers=1
let NERDTreeWinPos='left'
let NERDTreeWinSize=31
nnoremap f :NERDTreeToggle
map <F7> :NERDTree<CR>
"""""""""""""set Taglist""""""""""""""
nnoremap <silent> <F8> :TlistToggle<CR>
let Tlist_Show_One_File=1 "不同时显示多个文件的tag,只显示当前文件的
let Tlist_Exit_OnlyWindow=1 "如果taglist窗口是最后一个窗口,则退出vim
"let Tlist_Ctags_Cmd="/usr/bin/ctags" "将taglist与ctags关联
let Tlist_Ctags_Cmd="/usr/local/bin/ctags" "将taglist与ctags关联
let Tlist_Use_SingleClick=1 "设置单击tag就跳到tag定义的位置 需要设置mouse=on
"let Tlist_Auto_Open=1 "默认打开Taglis
let Tlist_Sort_Type="name" " Taglist 按照名字进行排序
"let Tlist_File_Fold_Auto_Close=1
" open all plugin
filetype plugin indent on
set completeopt=menuone,menu,longest " 让Vim的补全菜单行为与一般IDE一致(参考VimTip1228)
set completeopt-=preview " 去掉在自动补全之后分割的预览窗口
""""""""""""""set tags"""""""
set tags+=~/.vim/tags/cpp_src/cpp
set tags+=./tags,../tags,../../tags,../../../tags,../../../../tags
" configure tags
set tags+=~/.vim/tags/opencv2/opencv2
set tags+=~/.vim/tags/opencv/opencv
set tags+=~/.vim/tags/ndk_4_8
""""""""""""set OmniCppComplete"""""""""""""
filetype on " 侦测文件类型
filetype plugin on " 载入文件类型插件
filetype indent on " 不同文件类型采用不同缩进
" build tags of your own project with ctrl+f12
map <C-F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
let OmniCpp_GlobalScopeSearch = 1 " 0 or 1
let OmniCpp_NamespaceSearch = 1 " 0 , 1 or 2
let OmniCpp_DisplayMode = 0
let OmniCpp_ShowScopeInAbbr = 1
let OmniCpp_ShowPrototypeInAbbr = 1 " 显示函数参数列表
let OmniCpp_ShowAccess = 1
let OmniCpp_MayCompleteDot = 1
let OmniCpp_MayCompleteArrow = 1
let OmniCpp_MayCompleteScope = 1 " 输入::后自动补全
let OmniCpp_DefaultNamespaces = ["std", "_GLIBCXX_STD"]
au FileType python set omnifunc=pythoncomplete#Complete
"""""superTab configure""""""
let g:SuperTabDefaultCompletionType = "context"
let g:SuperTabMappingForward = "<tab>"
let g:SuperTabMappingBackward= "<Shift-tab>" " 可以通过按Shit+Tab关闭supertab功能
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
" mapping
" inoremap <expr> <C-R> pumvisible()?"\<C-Y>":"\<C-R>"
" 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>"
" color
"highlight Pmenu guibg=darkgrey guifg=black
"highlight PmenuSel guibg=lightgrey guifg=black
""""""""""vim-trailing-whitespace""""""""""""""
"""""""Bundle 'bronson/vim-trailing-whitespace'
"map <leader><space> :FixWhitespace<cr>
map <F5> :FixWhitespace<cr>
""""" remove auto comment function
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
"" Vim jump to the last position when reopening a file
au BufReadPost * exe "normal! g`\""