vim配置

来源:互联网 发布:mysql truncate所有表 编辑:程序博客网 时间:2024/06/15 05:24

一、在用户目录中添加配置文件.vimrc

$vi ~/.vimrc

输入以下配置:
set nocompatible 不使用vi默认键盘布局
set number 显示行号
set autoindent 自动对齐
set smartindent 智能对齐
set showmatch 括号匹配模式
set ruler 显示状态行
set incsearch          
set tabstop=4 tab键为4个空格
set shiftwidth=4
set softtabstop=4
set cindent C语言格式对齐
set nobackup 不要备份文件
syntax on 语法高亮

上面的中文就不用了,保存退出就OK了,vi立刻生效

二、自动提示功能:
1、使用ctrl+o ctrl+p键
2、http://www.vim.org/scripts/script.php?script_id=3252
http://www.vim.org/scripts/script.php?script_id=1879
下载上面的2个插件,并把autoload和plugin目录的文件拷贝到安装目录下
Windows:安装目录/vim/vim73

Linux:/usr/share/vim/vim73


三、修改函数的颜色

在vim/vim73/syntax目录下的c.vim和cpp.vim文件末尾添加:

syn match cFunction "\<[a-zA-Z_][a-zA-Z_0-9]*\>[^()]*)("me=e-2
syn match cFunction "\<[a-zA-Z_][a-zA-Z_0-9]*\>\s*("me=e-1
hi cFunction gui=NONE guifg=#33a33

原创粉丝点击