免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 885 | 回复: 0

my ~/.vimrc [复制链接]

论坛徽章:
0
发表于 2009-12-16 14:09 |显示全部楼层

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" General
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"For ctags, then it can find the 'tags' file even not in current directory
set tags=tags;/
"Get out of VI's compatible mode..
set nocompatible
"Sets how many lines of history VIM har to remember
set history=400
"Set to auto read when a file is changed from the outside
set autoread
"Have the mouse enabled all the time:
"when you need to copy from vim, maybe you have to ':set mouse=' first
set mouse=a
"Show all of the characters.
"set list
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Colors and Fonts
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Enable syntax highlight
syntax on
"if has("gui_running")
  "set guioptions-=T
  "let psc_style='cool'
  "colorscheme default
"else
  set background=dark
  colorscheme delek
  "colorscheme elflord
  "colorscheme default
"endif
"Highlights current editing line.
"if has("gui_running")
set cursorline
autocmd InsertLeave * se nocul
autocmd InsertEnter * se cul
"endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" VIM userinterface
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Set 7 lines to the curors away from the border- when moving vertical..
set so=7
"Turn on WiLd menu
set wildmenu
"Always show current position
set ruler
"The commandbar is 2 high
set cmdheight=2
"Show line number
set nu
"Set backspace
set backspace=eol,start,indent
"Bbackspace and cursor keys wrap to
set whichwrap+=,h,l
"show matching bracets
set showmatch
"How many tenths of a second to blink
set mat=2
"Highlight search things
set hlsearch
"imediately show the search result
set is
"set hide unsaved buf
set hidden
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Folding
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Enable folding, I find it very useful
set foldmethod=marker
"set nofen
set fdl=0
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Text options
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"set expandtab
set shiftwidth=2
set ambiwidth=double
set smarttab
"Set Tab=4 spaces
"set ts=4
"set ss=4
set lbr
set tw=500
set selection=inclusive
   """"""""""""""""""""""""""""""
   " Indent
   """"""""""""""""""""""""""""""
   "Auto indent
   "set ai
   "Set auto indent width = 4 spaces
   set sw=4
   "Smart indet
   "set si
   "C-style indenting
   set cindent  "usage: select codes, press '=' key, the codes will autoindenting
   "Wrap lines
   set wrap
"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
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" General Autocommands
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Switch to current dir
"map cd :lcd %:p:h
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Parenthesis/bracket expanding
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
vnoremap $1 `>a)`
")
vnoremap $2 `>a]`
vnoremap $3 `>a}`
vnoremap $$ `>a"`
vnoremap $q `>a'`
vnoremap $w `>a"`
"Map auto complete of (, ", ', [
inoremap $1 ():let leavechar=")"i
inoremap $2 []:let leavechar="]"i
inoremap $4 {o}:let leavechar="}"O
inoremap $3 {}:let leavechar="}"i
inoremap $q '':let leavechar="'"i
inoremap $w "":let leavechar='"'i
au BufNewFile,BufRead *.\(vim\)\@! inoremap " "":let leavechar='"'i
au BufNewFile,BufRead *.\(txt\)\@! inoremap ' '':let leavechar="'"i
imap  :exec "normal f" . leavechara
imap  :exec "normal f" . leavechara
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"plugins
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Tlist
if &diff
  let Tlist_Auto_Open=0 "don't auto pen when compare two files
else
  let Tlist_Auto_Open=1 "auto pen Tlist when open a file
endif
let Tlist_Use_Right_Window=1
let Tlist_Auto_Update=1
let Tlist_File_Fold_Auto_Close=1
"auto close Tlist when exiting file.
"display the tags for only the current active buffer
"let Tlist_Show_One_File = 1
let Tlist_Exit_OnlyWindow = 1
  "set 'TagList' in the 'winManagerWindowLayout'
  "let winManagerWindowLayout = 'FileExplorer|TagList'
  "creates a normal mode mapping for the  key to toggle the taglist window.
nnoremap   :TlistToggle
"Using the taglist plugin with the winmanager plugin
let winManagerWindowLayout = 'FileExplorer|TagList'
"winmanager
let loaded_winmanager = 1
"cscope
:set csprg=/usr/local/bin/cscope
":cscope add /home/alvin_lou/bhr/bhr-4.7-524/cscope/cscope.out
":set CSCOPE_DB=/home/alvin_lou/bhr/bhr-4.7-524/cscope
"export CSCOPE_DB
""""""""""""""""""""""""""""""
" HTML related
""""""""""""""""""""""""""""""
" HTML entities - used by xml edit plugin
let xml_use_xhtml = 1
let xml_no_auto_nesting = 1
"To HTML
let html_use_css = 1
let html_number_lines = 0
let use_xhtml = 1
" ===================================================
" Remember last edit location and jump there exactly.
" ===================================================
au BufReadPost * if line("'\"") > 0|if line("'\"")  j
noremap  k
noremap  h
noremap  l
noremap  l
map wr :set wrap
nmap  :copen
nmap  :cclose
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" cscope setting
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if has("cscope")
    set csprg=/usr/bin/cscope
    set csto=1
    set cst
    set nocsverb
    " add any database in current directory
    if filereadable("cscope.out")
    cs add cscope.out
    endif
    set csverb
endif
nmap s :cs find s =expand("")
nmap g :cs find g =expand("")
nmap c :cs find c =expand("")
nmap t :cs find t =expand("")
nmap e :cs find e =expand("")
nmap f :cs find f =expand("")
nmap i :cs find i ^=expand("")$
nmap d :cs find d =expand("")
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/99081/showart_2122814.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP