set nocompatible
set noswapfile
set nobackup
set nowritebackup
"行号{
set nu!
"}
"设置字体{
"set guifont=Courier\ New:h10:cANSI "Consolas:h10:cANSI
set guifont=Consolas:h9:cANSI
"}
"设置编码{
set encoding=utf-8
"set fileencodings=utf-8,chinese
set termencoding=utf-8
if has("win32")
set fileencoding=chinese
else
set fileencoding=utf-8
endif
language messages zh_CN.utf-8 "解决consle输出乱码
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
"}
behave mswin
set guioptions-=m
set guioptions-=T
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
"设置配色方案{
colorscheme molokai "evening molokai solarized molokai github lucius desert
"}
"tab{
set tabstop=4
set expandtab
"}
"path{
set path=./
"}
"ctrlp{
let g:ctrlp_cmd = 'CtrlP'
set wildignore+=*/Build-vc90/*,*.o,*.exe,*.git,*.pdb,*.bak,*.so,*.a
let g:ctrlp_by_filename = 1 " only lookup file name
let g:ctrlp_max_height = 15
let g:ctrlp_clear_cache_on_exit = 0
let g:ctrlp_cache_dir = $HOME.'/.ctrlp/cache/'
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn)$',
\ 'file': '\v\.(exe|so|dll|bak|gds)$',
\ 'link': 'SOME_BAD_SYMBOLIC_LINKS',
\ }
"}
"ctags{
set tags=tags;
set autochdir
nnoremap <silent> <F12> :A<CR>
":set grepprg=grep\ -nri
""""""""""""""""""""""""""""""
" Tag list (ctags)
""""""""""""""""""""""""""""""
if has("win32") "设定windows系统中ctags程序的位置
let Tlist_Ctags_Cmd = 'ctags'
else "设定windows系统中ctags程序的位置
let Tlist_Ctags_Cmd = '/usr/bin/ctags'
endif
let Tlist_Show_One_File = 1 "不同时显示多个文件的tag,只显示当前文件的
let Tlist_Exit_OnlyWindow = 1 "如果taglist窗口是最后一个窗口,则退出vim
let Tlist_Use_Right_Window = 1 "在右侧窗口中显示taglist窗口
let Tlist_File_Fold_Auto_Close=1 "让不被编辑的文件的方法列表自动折叠起来
let Tlist_Show_Menu=1 "显示taglist菜单
let Tlist_Auto_Open=0 "启动vim自动启动TagList
"}
map <C-F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q.<CR>
syntax enable
" for vim-fugitive plugin{
set statusline=%<%f\ %h%m%r%{fugitive#statusline()}%=%-14.(%l,%c%V%)\ %P
" Added 16-Jun-2011: auto-cleans fugitive buffers From
" http://vimcasts.org/episodes/fugitive-vim-browsing-the-git-object-database/
autocmd BufReadPost fugitive://* set bufhidden=delete
"}
"
let g:ag_prg="ag.exe --column"
let g:ctrlsf_ackprg = 'ag'
let g:ctrlsf_auto_close = 0
let g:ctrlsf_context = '-B 5 -A 3'
set ruler " show the cursor position all the time
set laststatus=2 " make the last line where the status is two lines deep so you can see status always
set backspace=indent,eol,start " make that backspace key work the way it should
set nocompatible " vi compatible is LAME
set background=dark " Use colours that work well on a dark background (Console is usually black)
set showmode " show the current mode
syntax on " turn syntax highlighting on by default
"{ gvim chinese-normal but vim not
set termencoding=cp936
"}
"
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1
set t_Co=256
分享我的gvim配置
最新推荐文章于 2023-06-27 10:20:29 发布