原创 linux下vimrc配置文件 for开发者

原创 linux下vimrc配置文件 for开发者

无双 无双小站mushuang.forumer.com loveunix.net http://mushuang.forumer.com/index.php?showtopic=61 set nocompatible syntax on filetype plugin indent on let Tlist_Ctags_Cmd = '/usr/bin/ctags' let Tlist_WinWidth=25 set backupdir=/tmp set dir=/tmp "set guifont=-misc-fixed-medium-r-normal-*-16-120-100-100-c-90-gb2312.1980-0 set guifont=FixedsysTTF:h16 "如果没有这个字体那就不要加 set tabstop=8 "colorscheme blue "在gvim下可以看到有多少coloscheme colorscheme ps_color "如果没有 那修改成desert 我觉得这个也不错 set wmnu "按tab时可以显示出匹配命令 set sw=4 " shiftwidth set softtabstop=4 set et " expandtab set wm=8 " wrapmargin set bs=2 " backspace set ru " ruler set ic " ignorecase "忽略大小写 但是输入中有大写的话不忽略 set is " incsearch set scs " smartcase: override the 'ic' when searching set magic " if search pattern contains uppercase char set vb t_vb= " set visual bell and disable screen flash set backup " enable backup and define the backup file set backupext=.bak set hlsearch " hlsearch " allow backspacing over everything in " the insert mode set backspace=indent,eol,start set dir=/tmp " 设置swap文件的目录上面 set backupdir=/tmp "设置备份文件的目录上面 我不喜欢看到每个目录下都有备份 因为一般备份用不到 " some nice options for cindenting by FOLKE "set cinoptions={.5s,+.5s,t0,n-2,p2s,(03s,=.5s,>1s,=1s,:1s " ---------------------------------------------------------------- " $Id: .vimrc.html,v 1.3 2003/06/16 23:29:15 thouveni Exp $ " " " Download " " ---------------------------------------------------------------- " ----------------------------------------------------------- " {{{ 1. General setup " ----------------------------------------------------------- " Active les plugins et les indeantaions par type de fichier " Quand on tape un ), vim montre furtivement le ( correspondant. set showmatch " ??? use full featured format-options. see "help fo-table for help set formatoptions=tcrqn2 " define what are comments set com& " reset to default set com^=sr:*\ -,mb:*\ \ ,el:*/ com^=sr://\ -,mb://\ \ ,el:/// " Ajoute une marge ????gauche pour afficher les +/- des replis set foldcolumn=2 "set cinoptions=:.5s,>1s,p0,t0,(0,g2 " :.5s = indent case statements 1/2 shiftwidth " >1s = indent 1 shiftwidth " p0 = indent function definitions 0 spaces " t0 = indent function return type 0 spaces " (0 = indent from unclosed parantheses " g2 = indent C++ scope resolution 2 spaces "set cinwords=if,else,while,do,for,switch,case " Which keywords should indent set formatoptions=tcqor " t=text, c=comments, q=format with "gq", o,r=autoinsert comment leader "set cindent " indent on cinwords " }}} " ----------------------------------------------------------- " {{{ 3. Searching, Substituting " ----------------------------------------------------------- " !!! use 'g'-flag when substituting (subst. all matches in that line, not only first) " to turn off, use g (why is there no -g ?) " set gdefault " ----------------------------------------------------------- " {{{ 4. Statusline, Menu " ----------------------------------------------------------- " ignore some files for filename completion set wildignore=*.o,*.r,*.so,*.sl,*.tar,*.tgz " some filetypes got lower priority set su=.h,.bak,~,.o,.info,.swp,.obj " remember last 2000 typed commands set hi=2000 " show cursor position below each window set ruler " shows the current status (insert, visual, ...) in statusline set showmode " use shortest messages set shm=a " show always statusline of last window set laststatus=2 " }}} " ----------------------------------------------------------- " {{{ 5. window handling " ----------------------------------------------------------- " focus follows mouse set mousef " minimal number of lines used for the current window set wh=1 " minimal number of lines used for any window set wmh=0 " make all windows the same size when adding/removing windows set noequalalways "a new window is put below the current one set splitbelow " }}} " ----------------------------------------------------------- " {{{ 6. file, backup, path " ----------------------------------------------------------- set path+=.,./include,../include,/usr/include,/usr/include/**,/usr/X11R6/include,/usr/local/include " change to directory of current file automatically autocmd BufEnter * lcd %:p:h " }}} set diffexpr=MyDiff() function MyDiff() let opt = '' if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif silent execute '!diff -a ' . opt . '"' . v:fname_in . '" "' . v:fname_new . '" > "' . v:fname_out . '"' endfunction "自动完成的 iab #i #include iab #d #define " Date/Time stamps " %a - Day of the week " %b - Month " %d - Day of the month " %Y - Year " %H - Hour " %M - Minute " %S - Seconds " %Z - Time Zone iab YDATETIME <c-r>=strftime(": %a %b %d, %Y %H:%M:%S")<cr> map ,L mz1G/Last modified:/e<Cr>CYDATETIME<Esc>`z map ,date :let @z=strftime("%A %b %d, %Y")<Cr>"zpa map ,time :let @z=strftime("%H:%M:%S %Z")<Cr>"zpa nnoremap <silent> <F3> :Tlist<CR> " Make <F8> diff the current buffer with it's file on disk. nmap <F8> :w !diff -w -B -c5 -p - % >tmp.diff<CR>:sp tmp.diff<CR> " Window Manager. 下面的插件到vim.sf.net上下载 分别是taglist "winmanager unmap <F1> nn <F1> :Tlist<CR> nn <F2> :WMToggle<CR> nn <F3> zO nn <F4> zC nn <F5> zR nn <F6> zM "下面是设置自动folder的 而且是根据写C代码设置的 如果你不喜欢使用folder那么可以省略掉 folder就是vs.net里面的折行功能 au BufReadPost *.c,*.cpp syn region myFold start="{" end="}" transparent fold au BufReadPost *.c,*.cpp syn sync fromstart au BufReadPost *.c,*.cpp set foldmethod=syntax "set foldlevel=0
支持一下。