"*************************************** *****
"_ Vimrc/_ gvimrc for Windows
"By douboer
"*************************************** *****
"
"Echo" loading _ vimrc ..."
"
Set nocompatible
Source $ vimruntime/vimrc_example.vim
Source $ vimruntime/mswin. Vim
Behave mswin
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
Silent execute '! "C: \ Vim \ vim70 \ diff"-a'. Opt. V: fname_in. '. V: fname_new.'> '. V: fname_out
Endfunction
"
"Display of different Chinese Encoding
"Supports both GBK and UTF-8 Encoding
"
"Set fileencoding = gb18030
"Set fileencodings = UTF-8, gb18030, UTF-16, big5
Set fileencodings = ucs-bom, UTF-8, cp936
Set fileencoding = UTF-8
Set encoding = cp936 "set encoding = UTF-8
Cd c: \ Users \ Administrator \ Desktop
"Cd d: \ Vim
"
"Set Font
"
Set guifont = consolas: H20: cansi
"
"Maximize startup and set the color scheme
"
"Winsize 1024 768
AU guienter * simalt ~ X
Colorscheme darkblue
"
"Auto indent
"
Set autoindent
"
"Set Tab to 4 spaces
"
Set Ts = 4
Set expandtab
Set shiftwidth = 4
Set cinoptions => 4, E0, N0, F0, {0,} 0, ^ 0,: S, = s, l0, GS, HS, PS, ts, + S, c3, C0, (2 S, us,
\ U0, w0, M0, J0,) 20, * 30
"
"Set cindent
"
"
"Show file type menu
"
Let do_syntax_sel_menu = 1 | runtime! Synmenu. Vim | aunmenu & syntax. & show \ filetypes \ In \ menu
"
"Set syntax
"
"If & filetype! = 'Javacc'
"Setlocal filetype = javacc
"Endif
"Set syntax = javacc
"Cal setsyn (" CPP ")
"Cal setsyn (" VB ")
"Cal setsyn (" Perl ")
"Cal setsyn (" awk ")
"
"Put the backup file in the specified directory
"
Set backupdir = c: \ TMP
"
"No warning sound or visual warning
"
Set VB t_vb =
"
"Disable SWF swap file
"
Setlocal noswapfile
"
"Display row number
"
Set number
"
"Hide Toolbar
"
"See: Help 'guioptions'
"
Set guioptions-= T
"Set guioptions-= m
"
"Status bar, showing the number of bytes, number of columns, number of rows, current row, and other information
"
Set statusline = % F % m % R % H % w \ [format = % {& ff}] \ [type = % Y] \ [ASCII = \ % 03.3b] \ [hex = \ % 02.2b] \ [Pos = % 04l, % 04 V] [% P %] \ [Len = % L]
Set laststatus = 2 "always show the status line
"
"Auto-comments for // and /**/
"Setlocal comments = So: * \-, MO: * \, Exo: */, S1:/*, MB: *, EX :*/,://
"
"Disable auto-comments //
"Setlocal comments = So: * \-, MO: * \, Exo: */, S1:/*, MB: *, EX: */, F ://
"
"Disable auto-comments for // and /**/
"
"Setlocal comments = So: * \-, MO: * \, Exo: */, S1 :/*
Setlocal comments = ""
Set tags = c: \ Users \ Administrator \ Desktop \ Vim \ tags
"Compile a single file
Map <F5>: Call do_onefilemake () <CR>
Function do_onefilemake ()
If expand ("%: P: H ")! = Getcwd ()
Echohl warningmsg | echo "fail to make! This file is not in the current Dir! Press <F7> to redirect to the Dir of this file. "| echohl none
Return
Endif
Let sourcefileename = expand ("%: t ")
If (sourcefileename = "" | (& filetype! = "CPP" & filetype! = "C "))
Echohl warningmsg | echo "fail to make! Please select the right file! "| Echohl none
Return
Endif
Let deletedspacefilename = substitute (sourcefileename, '','', 'G ')
If strlen (deletedspacefilename )! = Strlen (sourcefileename)
Echohl warningmsg | echo "fail to make! Please delete the spaces in the filename! "| Echohl none
Return
Endif
If & filetype = "C"
If G: iswindows = 1
Set makeprg = GCC \-O \ % <. exe \ %
Else
Set makeprg = GCC \-O \ % <\ %
Endif
Elseif & filetype = "CPP"
If G: iswindows = 1
Set makeprg = g ++ \-O \ % <. exe \ %
Else
Set makeprg = g ++ \-O \ % <\ %
Endif
"Elseif & filetype =" CS"
"Set makeprg = CSC \/nologo \/out: % <. exe \ %
Endif
If (G: iswindows = 1)
Let outfilename = substitute (sourcefileename, '\ (\. [^.] * \)', '.exe ', 'G ')
Let toexename = outfilename
Else
Let outfilename = substitute (sourcefileename, '\ (\. [^.] * \)', '', 'G ')
Let toexename = outfilename
Endif
If filereadable (outfilename)
If (G: iswindows = 1)
Let outdeletedsuccess = Delete (getcwd (). "\". outfilename)
Else
Let outdeletedsuccess = Delete ("./". outfilename)
Endif
If (outdeletedsuccess! = 0)
Set makeprg = make
Echohl warningmsg | echo "fail to make! I cannot delete the ". outfilename | echohl none
Return
Endif
Endif
Execute "Silent make"
Set makeprg = make
Execute "Normal :"
If filereadable (outfilename)
If (G: iswindows = 1)
Execute "! ". Toexename
Else
Execute "!. /". Toexename
Endif
Endif
Execute "Copen"
Endfunction
"Make settings
Map <F6>: Call do_make () <CR>
Map <c-F6>: silent make clean <CR>
Function do_make ()
Set makeprg = make
Execute "Silent make"
Execute "Copen"
Endfunction
Cd f: \ Vim