Chinaunix首页 | 论坛 | 博客
  • 博客访问: 12587
  • 博文数量: 2
  • 博客积分: 75
  • 博客等级: 民兵
  • 技术积分: 25
  • 用 户 组: 普通用户
  • 注册时间: 2009-06-16 13:30
文章分类

全部博文(2)

文章存档

2011年(1)

2009年(1)

我的朋友

分类: LINUX

2009-12-16 14:09:35



"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 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("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif

" ===============================
" Shorcut tKey settings
" ===============================
noremap 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("")


阅读(426) | 评论(0) | 转发(0) |
0

上一篇:没有了

下一篇:perl命令常用选项

给主人留下些什么吧!~~