vimrc:
set hlsearch "选中高亮 colorscheme desert "颜色主题 set guifont=Source\ Code\ Pro\ 10 "设置字体 set number "显示行号 "set nowrap "不自动换行 set tabstop=4 "制表符 set expandtab "tab使用空格 set shiftwidth=4 "缩进空格 set autoindent "自动缩进 set cindent "C/C++语言缩进 "set autochdir "自动更改为当前目录 set encoding=utf-8 "设置内部编码方式 set fileencodings=utf-8,gbk "编码自动识别 set foldmethod=indent "代码折叠 set mousemodel=popup "右键弹出菜单 set viminfo= "关闭历史记录 set guioptions-=m "隐藏菜单栏 set guioptions-=T "隐藏工具栏 set guioptions-=r "隐藏右侧滚动条 set guioptions-=L "隐藏左侧滚动条 set makeprg=./Build.sh "设置:make命令 "三种模式下的键映射---<F4>切换源文件/头文件 map <F4> :AV<CR> imap <F4> <ESC>:AV<CR> vmap <F4> <ESC>:AV<CR> "三种模式下的键映射---<F5>一键Build func! Build() exec "wall" exec "make" exec "cw" endfunc map <F5> :call Build()<CR> imap <F5> <ESC>:call Build()<CR> vmap <F5> <ESC>:call Build()<CR> "查找定义Ctrl+g if filereadable("cscope.out") cs add cscope.out endif map <C-g> :cs find g <C-R>=expand("<cword>")<CR><CR> imap <C-g> <ESC>:cs find g <C-R>=expand("<cword>")<CR><CR> vmap <C-g> <ESC>:cs find g <C-R>=expand("<cword>")<CR><CR>
自定义类型高亮:
" My Own DataType syn match cType display "\w\+_p\>" syn match cType display "\w\+_t\>" syn match cType display "\w\+_u\>" " My Own Operators syn match cSpecialCharacter display "[-+/*/%=]" syn match cSpecialCharacter display "[/.]" syn match cSpecialCharacter display "[!<>&|~^]"
快捷键以及命令:
基础版:
代码折叠: zc关闭折叠 zo打开折叠 zR打开所有折叠
多文件浏览: :vsp filename垂直浏览 :sp filename水平浏览
当前目录浏览: :Ve垂直浏览 :Ex水平浏览
撤销: u向后撤销 Ctrl+r向前撤销
复制: y
粘贴: p
剪切: x
查找: :/string向下查找 :?string向上查找
跳转行: numG 1G为文件起始位置 G跳转文件末尾
多窗口切换: Ctrl+w+w