DSP

Configurations of Vim/GVim of dsp

2019-07-13 16:08发布

Linux环境写到用户主目录下的.vimrc文件(没有则新建),Windows环境则为GVim安装目录下的_vimrc(没有则新建),内容如下: 1 "分上下两屏 2 "sp 3 4 "分左右两屏 5 "vs 6 7 "显示行号 8 set number 9 10 "显示命令 11 set showcmd 12 13 "突出显示当前行 14 set cursorline 15 16 "在显示当前模式 17 set showmode 18 19 "空格键映射成“:” 20 nmap : 21 22 "打开语法高亮 23 syn on 24 syntax enable 25 26 "tab键占4个字符 27 set smarttab 28 set expandtab 29 set tabstop=4 30 set shiftwidth=4 31 32 "隐藏菜单栏 33 set guioptions-=m 34 35 "隐藏工具栏 36 set guioptions-=T 37 38 "去掉欢迎界面 39 "set shortmess=atI 40 41 "在右下角显示光标所在的行数等信息 42 set ruler 43 44 "当文件在外部被修改时,自动重新读取 45 set autoread 46 47 "可以在没有保存的情况下切换buffer 48 "set hid 49 50 "增强模式中的命令行自动完成操作 51 set wildmenu 52 53 "在所有模式下都允许使用鼠标,还可以是n,v,i,c等 54 set mouse=n 55 56 "文件类型检测 此命令相当于:filetype on 、filetype plugin on 、filetype indent on 三条命令 57 filetype plugin indent on 58 59 "关闭兼容模式 compatible,若启用兼容模式,则某些自定义的选项将失效。去掉讨厌的有关vi一致性模式,避免以前版本的一些bug和局限 60 set nocompatible 61 62 "退格键和方向键可以换行 63 set whichwrap+=<,>,h,l 64 65 "增量式搜索 66 set incsearch 67 68 "高亮搜索 nohlsearch 69 set hlsearch 70 71 "搜索时忽略大小写 72 set ignorecase 73 74 "设置魔术 大有用处:与正则表达式相关 75 set magic 76 77 "显示匹配的括号 78 set showmatch 79 80 "关闭备份 81 set nobackup 82 83 "与上一起,用于关闭备份 84 set nowb 85 86 "vim记住的历史操作的数量,默认的是20 87 set history=999 88 89 "不使用swp文件,注意,错误退出后无法恢复 90 set noswapfile 91 92 "在breakat字符处而不是最后一个字符处断行 93 set lbr 94 95 "恢复上次文件打开位置 96 set viminfo='10,"100,:20,%,n~/.viminfo 97 98 "设置光标形状为"|" 99 set gcr=n-v-c:ver25-Cursor/lCursor,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor/lCursor 100 101 "显示状态栏 102 set laststatus=0 103 highlight StatusLine ctermfg=blue ctermbg=white 104 105 "GUI行号颜 {MOD} 106 highlight LineNr guifg=gray 107 highlight LineNr guibg=white 108 109 "控制台下行号颜 {MOD} 110 highlight LineNr ctermfg=gray 111 highlight LineNr ctermbg=NONE 112 113 "高亮显示 114 "set hlsearch 115 set nohlsearch "不高亮显示 116 117 "行高亮 118 set cursorline 119 hi CursorLine cterm=bold guibg=#EAF4FF 120 "hi CursorLine cterm=none ctermbg=blue ctermfg=none guibg=LightBlue guifg=none 121 122 "列高亮 123 "set cursorcolumn 124 "hi CursorColumn cterm=none ctermbg=white ctermfg=blue guibg=lightblue guifg=none 125 126 "设置字符编码 127 set encoding=utf8 128 set fileencodings=utf8,gb2312,gb18030,ucs-bom,latin1 129 130 "字体设置 131 if(has("gui_running")) 132 set guifont=Source Code Pro 11 133 endif 134 135 "设置Right margin 136 "set colorcolumn=99 137 highlight colorcolumn ctermbg=255 guibg=#FAFCFF 138 set colorcolumn=99 139 let &colorcolumn=join(range(99,999),",") 140 141 "若用了:set indent,:set ai 等自动缩进,想用退格键将字段缩进的删掉,必须设置这个选项。否则不响应。 142 set backspace=eol,start,indent 143 144 "自动缩进 或者 set ai 145 set autoindent 146 147 "智能缩进 或者 set si 148 set smartindent 149 150 "设置CC++风格方式来处理程序的缩进结构 151 set cindent 152 153 "C语言注释为灰 {MOD}(置于最后) 154 hi Comment ctermfg=gray 155 hi Comment guifg=gray 156 157 "vim 控制台cterm、ctermbg、ctermfg可选颜 {MOD}代码 158 "烟灰 {MOD}: 255 159 "淡紫 {MOD}: 189 160 "淡紫 {MOD}: 225 161 "浅蓝紫 {MOD}: 153 162 "品红: 224 163 "蓝 {MOD}: 117 164 "淡天蓝 {MOD}: 195 165 "绿 {MOD}: 49 166 "浅黛绿 {MOD}: 152 167 "浅嫩绿 {MOD}: 194 168 "蛋黄 {MOD}: 223 169 "浅黄 {MOD}: 230 170 "Black 171 "DarkBlue 172 "DarkGreen 173 "DarkCyan 174 "DarkRed 175 "DarkMagenta 176 "Brown, DarkYellow 177 "LightGray, LightGrey, Gray, Grey 178 "DarkGray, DarkGrey 179 "Blue, LightBlue 180 "Green, LightGreen 181 "Cyan, LightCyan 182 "Red, LightRed 183 "Magenta, LightMagenta 184 "Yellow, LightYellow 185 "White   OK哒~