vim配置2

sudo vim /etc/vim/vimrc

60 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
61 " 一般设定
62 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
63 " 设定默认解码
64 set fenc=utf-8
65 set fencs=utf-8,usc-bom,euc-jp,gb18030,gbk,gb2312,cp936
66
67 " 中文菜单显示
68 "set fileencodings=utf-8,gb2312,gbk,gb18030
69 "set termencoding=utf-8
70 "set encoding=prc
71
72 " 不要使用vi的键盘模式,而是vim自己的
73 set nocompatible
74
75 " history文件中需要记录的行数
76 set history=100
77
78 " 在处理未保存或只读文件的时候,弹出确认
79 set confirm
80
81 " 与windows共享剪贴板
82 "set clipboard+=unnamed
83
84 " 侦测文件类型
85 filetype on
86
87 " 载入文件类型插件
88 filetype plugin on
89
90 " 为特定文件类型载入相关缩进文件
91 filetype indent on
92
93 " 保存全局变量
94 set viminfo+=!
95
96 " 带有如下符号的单词不要被换行分割
97 set iskeyword+=_,$,@,%,#,-
98
99 " 语法高亮
100 syntax on
101
102 " 高亮字符,让其不受100列限制
103 :highlight OverLength ctermbg=red ctermfg=white guibg=red guifg=white
104 :match OverLength '\%101v.*'
105
106 " 状态行颜色
107 highlight StatusLine guifg=SlateBlue guibg=Yellow
108 highlight StatusLineNC guifg=Gray guibg=White
109
110 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
111 " 文件设置
112 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
113 " 不要备份文件(根据自己需要取舍)
114 set nobackup
115
116 " 不要生成swap文件,当buffer被丢弃的时候隐藏它
117 setlocal noswapfile
118 set bufhidden=hide
119
120 " 字符间插入的像素行数目
121 set linespace=0
122
123 " 增强模式中的命令行自动完成操作
124 set wildmenu
125
126 " 在状态行上显示光标所在位置的行号和列号
127 set ruler
128 set rulerformat=%20(%2*%<%f%=\ %m%r\ %3l\ %c\ %p%%%)
129
130 " 命令行(在状态行下)的高度,默认为1,这里是2
131 set cmdheight=2
132
133 " 使回格键(backspace)正常处理indent, eol, start等
134 set backspace=2
135
136 " 允许backspace和光标键跨越行边界
137 set whichwrap+=<,>,h,l
138
139 " 可以在buffer的任何地方使用鼠标(类似office中在工作区双击鼠标定位)
140 "set mouse=a
141 "set selection=exclusive
142 "set selectmode=mouse,key
143
144 " 启动的时候不显示那个援助索马里儿童的提示
145 set shortmess=atI
146
147 " 通过使用: commands命令,告诉我们文件的哪一行被改变过
148 set report=0
149
150 " 不让vim发出讨厌的滴滴声
151 set noerrorbells
152
153 " 在被分割的窗口间显示空白,便于阅读
154 set fillchars=vert:\ ,stl:\ ,stlnc:\
155
156 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
157 " 搜索和匹配
158 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
159 " 高亮显示匹配的括号
160 set showmatch
161
162 " 匹配括号高亮的时间(单位是十分之一秒)
163 set matchtime=5
164
165 " 在搜索的时候忽略大小写
166 set ignorecase
167
168 " 不要高亮被搜索的句子(phrases)
169 set nohlsearch
170
171 " 在搜索时,输入的词句的逐字符高亮(类似firefox的搜索)
172 set incsearch
173
174 " 输入:set list命令是应该显示些啥?
175 set listchars=tab:\|\ ,trail:.,extends:>,precedes:<,eol:$
176
177 " 光标移动到buffer的顶部和底部时保持3行距离
178 set scrolloff=3
179
180 " 不要闪烁
181 set novisualbell
182
183 " 我的状态行显示的内容(包括文件类型和解码)
184 set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [POS=%l,%v][%p%%]\ %{strftime(\"%d/%m/%y\ -\ %H:%M\")}
185
186 " 总是显示状态行
187 set laststatus=2
188
189 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
190 " 文本格式和排版
191 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
192 " 自动格式化
193 set formatoptions=tcrqn
194
195 " 继承前一行的缩进方式,特别适用于多行注释
196 set autoindent
197
198 "自动补全'Python'代码
199 if has ("autocmd")
200 autocmd FileType python set complete+=k~/.vim/tools/pydiction
201 endif
202 " 为C程序提供自动缩进
203 set smartindent
204
205 " 使用C样式的缩进
206 set cindent
207
208 " 制表符为4
209 set tabstop=2
210
211 " 统一缩进为4
212 set softtabstop=2
213 set shiftwidth=2
214
215 " 不要用空格代替制表符
216 set expandtab
217
218 " 换行
219 set wrap
220
221 " 在行和段开始处使用制表符
222 set smarttab
223
224 " 显示行号
225 set nu
226
227 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
228 " CTags的设定
229 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
230 " 按照名称排序
231 let Tlist_Sort_Type = "name"
232
233 " 在右侧显示窗口
234 let Tlist_Use_Right_Window = 1
235
236 " 压缩方式
237 let Tlist_Compart_Format = 1
238
239 " 如果只有一个buffer,kill窗口也kill掉buffer
240 let Tlist_Exist_OnlyWindow = 1
241
242 " 不要关闭其他文件的tags
243 let Tlist_File_Fold_Auto_Close = 0
244
245 " 不要显示折叠树
246 let Tlist_Enable_Fold_Column = 0

原文地址:https://www.cnblogs.com/daizhuacai/p/2883166.html