百度空间 | 百度首页 
 
查看文章
 
正是改道,我的gvim配置文件
2006-10-06 19:42
" 项目: gvim 配置文件
" 作者: yonsan
" 安装: sudo apt-get install vim-gtk
" 用法: 将本文件(.vimrc)拷贝到$HOME/

" 使用 murphy 调色板
" set nocompatible
" 设定文件浏览器目录为当前目录
set bsdir=buffer
set autochdir
" 设置编码
set enc=utf-8
" 设置文件编码
set fenc=utf-8
" 设置文件编码检测类型及支持格式
set fencs=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
" 指定菜单语言
set langmenu=zh_CN.UTF-8
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
" 设置语法高亮度
set syn=cpp
"显示行号
set nu!
" 查找结果高亮度显示
set hlsearch
" tab宽度
set tabstop=4
set cindent shiftwidth=4
set autoindent shiftwidth=4
" C/C++注释
set comments=://
" 修正自动C式样注释功能 <2005/07/16>
set comments=s1:/*,mb:*,ex0:/
" 增强检索功能
set tags=./tags,./../tags,./**/tags
" 保存文件格式
set fileformats=unix,dos
" 键盘操作
map <Up> gk
map <Down> gj
" 命令行高度
set cmdheight=1
" 中文帮助
if version > 603
set helplang=cn
:colorscheme desert
let Tlist_Use_Right_Window=1
let Tlist_File_Fold_Auto_Close=1
"""""""""""使用cscope
if has("cscope")
set csprg=/usr/bin/cscope
set csto=0
set cst
set nocsverb
" add any database in current directory
if filereadable("cscope.out")
cs add cscope.out
" else add database pointed to by environment
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
set csverb
set cscopetag
set cscopequickfix=s-,g-,c-,d-,t-,e-,f-,i-
endif
endi
"=============================================================================
" General settings
"=============================================================================

set nocp
set ru
set cin
set sm
set ai
set sw=4
set ts=4
set et
set cino=:0g0t0(sus
set lbr
set hls
set backspace=indent,eol,start
set whichwrap=b,s,<,>,[,]
set fo+=mB
set selectmode=
set mousemodel=popup
set keymodel=
set selection=inclusive

" for gdbvim
set noshowcmd

" Encoding settings
if has("multi_byte")
     " Set fileencoding priority
     if getfsize(expand("%")) > 0
         set fileencodings=ucs-bom,utf-8,cp936,big5,euc-jp,euc-kr,latin1
     else
         set fileencodings=cp936,big5,euc-jp,euc-kr,latin1
     endif

     " CJK environment detection and corresponding setting
     if v:lang =~ "^zh_CN"
         " Use cp936 to support GBK, euc-cn == gb2312
         set encoding=cp936
         set termencoding=cp936
         set fileencoding=cp936
     elseif v:lang =~ "^zh_TW"
         " cp950, big5 or euc-tw
         " Are they equal to each other?
         set encoding=big5
         set termencoding=big5
         set fileencoding=big5
     elseif v:lang =~ "^ko"
         " Copied from someone's dotfile, untested
         set encoding=euc-kr
         set termencoding=euc-kr
         set fileencoding=euc-kr
     elseif v:lang =~ "^ja_JP"
         " Copied from someone's dotfile, unteste
         set encoding=euc-jp
         set termencoding=euc-jp
         set fileencoding=euc-jp
     endif
     " Detect UTF-8 locale, and replace CJK setting if needed
     if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
         set encoding=utf-8
         set termencoding=utf-8
         set fileencoding=utf-8
     endif
else
     echoerr "Sorry, this version of (g)vim was not compiled with multi_byte"
endif

" Cursor movement
nnoremap <Down> gj
nnoremap <Up> gk
vnoremap <Down> gj
vnoremap <Up> gk
inoremap <Down> <C-o>gj
inoremap <Up> <C-o>gk

nnoremap <End> g$
nnoremap <Home> g0
vnoremap <End> g$
vnoremap <Home> g0
inoremap <End> <C-o>g$
inoremap <Home> <C-o>g0

nmap <C-F4> :confirm bd<CR>
vmap <C-F4> <ESC>:confirm bd<Enter>
omap <C-F4> <ESC>:confirm bd<Enter>
map! <C-F4> <ESC>:confirm bd<Enter>

" Move lines
nmap <C-Down> :<C-u>move .+1<CR>
nmap <C-Up> :<C-u>move .-2<CR>

imap <C-Down> <C-o>:<C-u>move .+1<CR>
imap <C-Up> <C-o>:<C-u>move .-2<CR>

vmap <C-Down> :move '>+1<CR>gv
vmap <C-Up> :move '<-2<CR>gv

" Toggle line number
nmap <C-F12> :set nu!<CR>
imap <C-F12> <C-o>:set nu!<CR>

" Toggle spell check
" For VIM7 only
nmap <C-F11> :set spell!<CR>
imap <C-F11> <C-o>:set spell!<CR>

syntax on
if (has("gui_running"))
     set nowrap
     set guioptions+=b
     colo desert
else
     set wrap
     colo   desert
endif

" ============================================================================
" Plugins settings
" ============================================================================

" Sketch
command -nargs=0 ToggleSketch call ToggleSketch()

" WinManager
" let g:winManagerWindowLayout = "FileExplorer"

" Tlist
let Tlist_Use_Right_Window=1
let Tlist_File_Fold_Auto_Close=1

" A
let g:alternateNoDefaultAlternate=1
" VIM7 doesn't support this.
"let g:alternateExtensions_{"aspx"} = "aspx.cs,aspx.CS"
"let g:alternateExtensions_{"aspx.cs"} = "aspx,ASPX"

" LateXSuite
filetype plugin on
set grepprg=grep\ -nH\ $*

" Viki
let g:vikiNameSuffix=".viki"
augr viki
au!
au BufRead,BufNewFile *.viki set filetype=viki
augr END

"=============================================================================
" Functions
"=============================================================================

function TextWork()
     set nocin
     set nosm
     set noai
     set tw=78
     set sw=8
     set ts=8
     set nowrap
endfunction

function NoTextWork()
     set cin
     set sm
     set ai
     set tw=0
     set sw=4
     set ts=4
     if (!has("gui_running"))
         set wrap
     endif
endfunction

function CodeWork()
     call NoTextWork()
     WManager
     Tlist
endfunction

function TimeStamp()
     let curposn= SaveWinPosn()
     %s/\$Date: 2006-10-06 14:53:06$")/ge
     %s/Last Change: 2006-10-06 14:53:06
     %s/Last Modified: 2006-10-06 14:53:06
     call RestoreWinPosn(curposn)
endfunction

function AutoTimeStamp()
     augr tagdate
     au!
     au BufWritePre,FileWritePre * call TimeStamp()
     augr END
endfunction
call AutoTimeStamp()

function NoAutoTimeStamp()
     augr tagdate
     au!
     augr END
endfunction

"=============================================================================
" Commands
"=============================================================================

command -nargs=0 TextWork call TextWork()
command -nargs=0 NoTextWork call NoTextWork()
command -nargs=0 CodeWork call CodeWork()
command -nargs=0 TimeStamp call TimeStamp()
command -nargs=0 AutoTimeStamp call AutoTimeStamp()
command -nargs=0 NoAutoTimeStamp call NoAutoTimeStamp()

"=============================================================================
" Platform dependent settings
"=============================================================================

"-----------------------------------------------------------------------------
" Common
"-----------------------------------------------------------------------------

" Calender
let g:calendar_diary="/home/messiah/document/diary"

" Spell Check
" VIM7 supports built-in spell check.
"function SpellCheck()
"     !aspell --lang=en -c %
"endfunction
"command -nargs=0 SpellCheck call SpellCheck()

" Mail Template
function MailWork()
     0r ~/document/text/mailtemp.txt
     %s/%%date%%/\=strftime("%Y-%m-%d")/ge
     %s/%%cursor%%//ge
     call TextWork()
endfunction
command -nargs=0 MailWork call MailWork()

" Use kittiemake as the default compiler
function Kittie()
     set makeprg=kittiemake
endfunction
command -nargs=0 Kittie call Kittie()

" Don't use kittiemake as the default compiler
function NoKittie()
     set makeprg=make
endfunction
command -nargs=0 NoKittie call NoKittie()

"-----------------------------------------------------------------------------
" Win32
"-----------------------------------------------------------------------------

"if (has("gui_running"))
"     set guifont=新宋体:h9:cGB2312
"endif

" For LaTeX Suite
"let g:Tex_CompileRule_dvi="latex -src-specials -interaction=nonstopmode $*"
"set shellslash

" For tee
"set shellpipe=2>&1\|\ tee

" VimTweak
"if (has("gui_running"))
"     command -nargs=1 SetAlpha call libcallnr("vimtweak.dll",
"         \"SetAlpha", <args>)
"     command -nargs=0 TopMost call libcallnr("vimtweak.dll",
"         \"EnableTopMost", 1)
"     command -nargs=0 NoTopMost call libcallnr("vimtweak.dll",
"         \"EnableTopMost", 0)
"endif

"-----------------------------------------------------------------------------
" Linux
"-----------------------------------------------------------------------------

"For LaTeX Suite
"function RemoteLaTeX()
"     let g:Tex_ViewRule_dvi="xdvi -editor 'gvim --servername \""
"         \.expand("%:p")."\" --remote-silent'"
"     augr remotelatex
"     au!
"     augr END
"endfunction

"augr remotelatex
"au!
"au BufRead * call RemoteLaTeX()
"augr END

let g:Tex_CompileRule_dvi
     \="latex -src-specials -interaction=nonstopmode $*"
let g:Tex_ViewRule_dvi
     \="xdvi -editor 'gvim --servername latex-suite --remote-silent'"

if (has("gui_running"))
     set guifont=Bitstream\ Vera\ Sans\ Mono\ 9
     source $VIMRUNTIME/delmenu.vim
     source $VIMRUNTIME/menu.vim
endif


类别:计算机 | 添加到搜藏 | 浏览() | 评论 (0)
 
最近读者:
 
网友评论:
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
验证码: 请点击后输入四位验证码,字母不区分大小写
      

     

©2009 Baidu