-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
127 lines (104 loc) · 3.42 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 nocompatible
syntax on
syntax enable
set background=dark
colorscheme solarized
filetype off
filetype indent on
filetype plugin indent on
set expandtab
set tabstop=4
set shiftwidth=4
" 基于缩进或语法进行代码折叠
" set foldmethod=indent
set foldmethod=syntax
" " 启动 vim 时关闭折叠代码
set nofoldenable
set laststatus=2 "show status line
set ruler "show current curosr
set number "show line number
set cursorline "hilight cur line
set cursorcolumn "hilight cur column
set nowrap "forbid line wrap
set ignorecase
set wildmenu
" 禁止光标闪烁
set gcr=a:block-blinkon0
" " 禁止显示滚动条
set guioptions-=l
set guioptions-=L
set guioptions-=r
set guioptions-=R
" " 禁止显示菜单和工具条
set guioptions-=m
set guioptions-=T
" 将外部命令 wmctrl 控制窗口最大化的命令行参数封装成一个 vim 的函数
fun! ToggleFullscreen()
call system("wmctrl -ir " . v:windowid . " -b toggle,fullscreen")
endf
" 全屏开/关快捷键
map <silent> <F11> :call ToggleFullscreen()<CR>
" 启动 vim 时自动全屏
autocmd VimEnter * call ToggleFullscreen()
let mapleader=";"
" FONT SETTING
"set guifont=YaHei\ Consolas\ Hybrid\ 11.5
"PowerLine Setting
let g:Powerline_symbols = 'fancy'
let g:color_coded_enabled = 1
let g:color_coded_filetypes = ['c', 'cpp', ',cc', 'objc']
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'Valloric/YouCompleteMe'
Plugin 'Lokaltog/vim-powerline'
Plugin 'majutsushi/tagbar'
Plugin 'jeaye/color_coded'
Plugin 'scrooloose/nerdtree'
call vundle#end()
" YCM 补全菜单配色
" " 菜单
highlight Pmenu ctermfg=2 ctermbg=3 guifg=#005f87 guibg=#EEE8D5
" " 选中项
highlight PmenuSel ctermfg=2 ctermbg=3 guifg=#AFD700 guibg=#106900
" " 补全功能在注释中同样有效
let g:ycm_complete_in_comments=1
" " 允许 vim 加载 .ycm_extra_conf.py 文件,不再提示
let g:ycm_confirm_extra_conf=0
" " 开启 YCM 标签补全引擎
let g:ycm_collect_identifiers_from_tags_files=1
" " 引入 C++ 标准库tags
set tags+=/data/misc/software/misc./vim/stdcpp.tags
" " YCM 集成 OmniCppComplete 补全引擎,设置其快捷键
inoremap <leader>; <C-x><C-o>
" " 补全内容不以分割子窗口形式出现,只显示补全列表
set completeopt-=preview
" " 从第2个键入字符就开始罗列匹配项
let g:ycm_min_num_of_chars_for_completion=2
" " 禁止缓存匹配项,每次都重新生成匹配项
" let g:ycm_cache_omnifunc=0
" " 语法关键字补全
let g:ycm_seed_identifiers_with_syntax=1
nnoremap <leader>jd :YcmCompleter GoToDeclaration<CR>
" 只能是 #include 或已打开的文件
nnoremap <leader>jr :YcmCompleter GoToDefinition<CR>
" 使用 NERDTree 插件查看工程文件。设置快捷键,速记:file list
nmap <Leader>fl :NERDTreeToggle<CR>
" 设置NERDTree子窗口宽度
let NERDTreeWinSize=32
" 设置NERDTree子窗口位置
let NERDTreeWinPos="right"
" 显示隐藏文件
let NERDTreeShowHidden=1
" NERDTree 子窗口中不显示冗余帮助信息
let NERDTreeMinimalUI=1
" 删除文件时自动删除文件对应 buffer
let NERDTreeAutoDeleteBuffer=1
" 设置 tagbar 子窗口的位置出现在主编辑区的左边
let tagbar_left=1
" " 设置显示/隐藏标签列表子窗口的快捷键。速记:tag list
nnoremap <Leader>tl :TagbarToggle<CR>
" " 设置标签子窗口的宽度
let tagbar_width=32
" " tagbar 子窗口中不显示冗余帮助信息
let g:tagbar_compact=1