保存一下自己的gVim配置,方便以后重装:
_vimrc文件设置
set nocompatible source $VIMRUNTIME/vimrc_example.vim source $VIMRUNTIME/mswin.vim behave mswin set number set tabstop=4 set softtabstop=4 set shiftwidth=4 set expandtab set autoindent set number set guifont=Consolas:h11 colorscheme desert set tags=tags; set autochdir set writebackup set nobackup au GUIEnter * simalt ~x set fileencodings=gbk,utf-8,ucs-bom,cp936,gb18030,big5,euc-jp,euc-kr,latin1 nn <silent><F3> :exec("NERDTree ".expand('%:h'))<CR> nn <silent><F5> :Grep -r<CR> map <silent><leader>tl :TlistToogle<cr> map <F4> :NERDTreeToggle<CR> map <F6> :tabnew<CR>:exec("NERDTree ".expand('%:h'))<CR>:Tlist<CR>:copen<CR> autocmd BufRead *.py nmap <F9> :!python %<CR> autocmd vimenter * NERDTree autocmd vimenter * Tlist autocmd vimenter * copen set diffexpr=MyDiff() function MyDiff() let opt = '-a --binary ' if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif let arg1 = v:fname_in if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif let arg2 = v:fname_new if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif let arg3 = v:fname_out if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif let eq = '' if $VIMRUNTIME =~ ' ' if &sh =~ '\<cmd' let cmd = '""' . $VIMRUNTIME . '\diff"' let eq = '"' else let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"' endif else let cmd = $VIMRUNTIME . '\diff' endif silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq endfunction let Tlist_Use_Right_Window = 1 let Tlist_Show_One_File = 1 let Tlist_Auto_Update = 1 let Tlist_File_Fold_Auto_Close=1 let Tlist_WinWidth=40
配置c/c++也很简单,不需要自己写makefile,下载个cvim解压到vimfiles文件夹覆盖就可以了,当然电脑要先搭建gcc/g++(如果安装了集成minGW的codeblocks,直接配置环境变量就可以了)。
一些常用到的指令:
:Grep -ir 关键字 #搜索当前目录关键字的内容 i-忽略大小写 r-递归搜索
:vsp #将一个文件分两列显示
:数字+[hjkl] #跳数字长度的操作
:find dir/filename #快速打开filename文件,支持tab补全