Chinaunix首页 | 论坛 | 博客
  • 博客访问: 583765
  • 博文数量: 69
  • 博客积分: 2204
  • 博客等级: 大尉
  • 技术积分: 808
  • 用 户 组: 普通用户
  • 注册时间: 2009-10-11 22:37
个人简介

..微笑着看着杯中的花茶一片片撑开.. ..透明的花瓣里水破开的声音很轻微..

文章分类

全部博文(69)

文章存档

2018年(1)

2017年(2)

2016年(10)

2015年(8)

2014年(6)

2013年(6)

2012年(4)

2011年(8)

2010年(12)

2009年(12)

分类: LINUX

2009-11-20 11:20:37

初用VIM不怎么会配置它的配置文件,所以在网上搜到了一篇号称史上最强的配置文件。拿回来用后发现并不是最适合自己的配置文件。看来只有适合自己的配置文件才是最强的配置文件。我对里面暂时做了一点点小改动。改动如下:

1.注释掉了方向键的映射,原文件中将方向键的左、右、下三个键映射了一些功能,看不懂,暂时也没用上。但是自己更习惯用方向键而不是H、J、K、L。虽然可能用H、J、K、L更好,但我要一点一点适应,在没适应前还是上下左右来的更方便,毕竟我用它工作,而不是专门练习如何用它。

2.添加了set ve=all。主要是自己用列模式的时候,大多数时间各行是不一样长的,为了能从长短不一的各行中选择某几列(主要中间可能有空的元素,在块模式时有时是无法选择的)。所以还是设置了all模式。

3.颜色配置全改为了zellner。喜欢这个配色。呵呵。

4.原始文件里有两段判断苹果系统的程序块,会导致报错,我也不用苹果系统,所以去掉了。也不报错了。

这里很多配置都还没研究明白,还得慢慢学习,不适合自己的功能还得慢慢到更改。今天先记到这里。有更改了再补充。:)

by banban
2009-11-20

5.打开了备份文件的功能。包括保留原始文件。毕竟有点保险还是好的。这只是我自己的习惯。

6.部分注释修改为中文。

7.去掉了一些mac下的功能。

by banban
2010-03-22

配置文件如下:

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"          _
"      __ | \
"     /   | /
"     \__ | \
" by Amix -
"
" Maintainer: Amir Salihefendic
" Version: 2.7
" Last Change: 12/10/06 00:09:21
"
" Sections:
" ----------------------
" General
" Colors and Fonts
" Fileformats
" VIM userinterface
"    Statusline
" Visual
" Moving around and tabs
" General Autocommands
" Parenthesis/bracket expanding
" General Abbrevs
" Editing mappings etc.
" Command-line config
" Buffer realted
" Files and backups
" Folding
" Text options
"    Indent
" Spell checking
" Plugin configuration
"    Yank ring
"    File explorer
"    Minibuffer
"    Tag list (ctags) - not used
"    LaTeX Suite things
" Filetype generic
"    Todo
"    VIM
"    HTML related
"    Ruby & PHP section
"    Python section
"    Cheetah section
"    Vim section
"    Java section
"    JavaScript section
"    C mappings
"    SML
"    Scheme bindings
" Snippets
"    Python
"    javaScript
" Cope
" MISC
"
"  Tip:
"   If you find anything that you can't understand than do this:
"   help keyword OR helpgrep keywords
"  Example:
"   Go into command-line mode and type helpgrep nocompatible, ie.
"   :helpgrep nocompatible
"   then press c to see the results, or :botright cw
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" General
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Get out of VI's compatible mode..
set nocompatible

"Sets how many lines of history VIM har to remember
set history=400

"Enable filetype plugin
filetype plugin on
filetype indent on

"Set to auto read when a file is changed from the outside
set autoread

"Have the mouse enabled all the time:
set mouse=a

"Set mapleader
let mapleader = ","
let g:mapleader = ","

"Fast saving
nmap w :w!
nmap f :find

"Fast reloading of the .vimrc
map s :source ~/vim_local/vimrc
"Fast editing of .vimrc
map e :e! ~/vim_local/vimrc
"When .vimrc is edited, reload it
autocmd! bufwritepost vimrc source ~/vim_local/vimrc
"set 've'
:se ve=all

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Colors and Fonts
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Enable syntax hl
syntax enable

"Set font to Monaco 10pt
"if MySys() == "mac"
"  set gfn=Bitstream\ Vera\ Sans\ Mono:h14
"  set nomacatsui
"  set termencoding=macroman
"elseif MySys() == "linux"
"  set gfn=Monospace\ 11
"endif

if has("gui_running")
  set guioptions-=T
  let psc_style='cool'
  colorscheme zellner
else
  set background=dark
  colorscheme zellner
endif

"Some nice mapping to switch syntax (useful if one mixes different languages in one file)
map 1 :set syntax=cheetah
map 2 :set syntax=xhtml
map 3 :set syntax=python
map 4 :set ft=javascript
map $ :syntax sync fromstart

autocmd BufEnter * :syntax sync fromstart

"Highlight current
if has("gui_running")
  set cursorline
  hi cursorline guibg=#333333
  hi CursorColumn guibg=#333333
endif

"Omni menu colors
hi Pmenu guibg=#333333
hi PmenuSel guibg=#555555 guifg=#ffffff


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Fileformats
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Favorite filetypes
set ffs=unix,dos,mac

nmap fd :se ff=dos
nmap fu :se ff=unix



"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" VIM userinterface
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Set 7 lines to the curors - 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

"Do not redraw, when running macros.. lazyredraw
set lz

"Change buffer - without saving
set hid

"Set backspace
set backspace=eol,start,indent

"Bbackspace and cursor keys wrap to
set whichwrap+=<,>,h,l

"Ignore case when searching
set ignorecase
set incsearch

"Set magic on
set magic

"No sound on errors.
set noerrorbells
set novisualbell
set t_vb=

"show matching bracets
set showmatch

"How many tenths of a second to blink
set mat=2

"Highlight search things
set hlsearch

  """"""""""""""""""""""""""""""
  " Statusline
  """"""""""""""""""""""""""""""
  "Always hide the statusline
  set laststatus=2

  function! CurDir()
     let curdir = substitute(getcwd(), '/Users/amir/', "~/", "g")
     return curdir
  endfunction

  "Format the statusline
  set statusline=\ %F%m%r%h\ %w\ \ CWD:\ %r%{CurDir()}%h\ \ \ Line:\ %l/%L:%c



""""""""""""""""""""""""""""""
" Visual
""""""""""""""""""""""""""""""
" From an idea by Michael Naumann
function! VisualSearch(direction) range
  let l:saved_reg = @"
  execute "normal! vgvy"
  let l:pattern = escape(@", '\\/.*$^~[]')
  let l:pattern = substitute(l:pattern, "\n$", "", "")
  if a:direction == 'b'
    execute "normal ?" . l:pattern . "^M"
  else
    execute "normal /" . l:pattern . "^M"
  endif
  let @/ = l:pattern
  let @" = l:saved_reg
endfunction

"Basically you press * or # to search for the current selection !! Really useful
vnoremap * :call VisualSearch('f')
vnoremap # :call VisualSearch('b')


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Moving around and tabs
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Map space to / and c-space to ?
map /
map ?

"Smart way to move btw. windows
map j
map k
map h
map l

"Actually, the tab does not switch buffers, but my arrows
"Bclose function ca be found in "Buffer related" section
map bd :Bclose
"map bd
"Use the arrows to something usefull
"map :bn
"map :bp

"Tab configuration
map tn :tabnew %
map te :tabedit
map tc :tabclose
map tm :tabmove
try
  set switchbuf=usetab
  set stal=2
catch
endtry

"Moving fast to front, back and 2 sides ;)
imap $a
imap 0i
imap $a
imap 0i


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" General Autocommands
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Switch to current dir
map cd :cd %: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


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" General Abbrevs
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"My information
iab xdate =strftime("%d/%m/%y %H:%M:%S")
iab xname Amir Salihefendic


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Editing mappings etc.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Remap VIM 0
map 0 ^

"Move a line of text using control
nmap mz:m+`z
nmap mz:m-2`z
vmap :m'>+`mzgv`yo`z
vmap :m'<-2`>my`
"if MySys() == "mac"
"  nmap
"  nmap
"  vmap
"  vmap
"endif

func! DeleteTrailingWS()
  exe "normal mz"
  %s/\s\+$//ge
  exe "normal `z"
endfunc
autocmd BufWrite *.py :call DeleteTrailingWS()

set completeopt=menu

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Command-line config
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
func! Cwd()
  let cwd = getcwd()
  return "e " . cwd
endfunc

func! DeleteTillSlash()
  let g:cmd = getcmdline()
  if MySys() == "linux" || MySys() == "mac"
    let g:cmd_edited = substitute(g:cmd, "\\(.*\[/\]\\).*", "\\1", "")
  else
    let g:cmd_edited = substitute(g:cmd, "\\(.*\[\\\\]\\).*", "\\1", "")
  endif
  if g:cmd == g:cmd_edited
    if MySys() == "linux" || MySys() == "mac"
      let g:cmd_edited = substitute(g:cmd, "\\(.*\[/\]\\).*/", "\\1", "")
    else
      let g:cmd_edited = substitute(g:cmd, "\\(.*\[\\\\\]\\).*\[\\\\\]", "\\1", "")
    endif
  endif
  return g:cmd_edited
endfunc

func! CurrentFileDir(cmd)
  return a:cmd . " " . expand("%:p:h") . "/"
endfunc

"Smart mappings on the command line
cno $h e ~/
cno $d e ~/Desktop/
cno $j e ./

cno $q eDeleteTillSlash()

cno $c e eCurrentFileDir("e")

cno $tc eCurrentFileDir("tabnew")
cno $th tabnew ~/
cno $td tabnew ~/Desktop/

"Bash like
cnoremap    
cnoremap    
cnoremap    


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Buffer realted
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Fast open a buffer by search for a name
map :sb

"Open a dummy buffer for paste
map q :e ~/buffer

"Restore cursor to file position in previous editing session
set viminfo='10,\"100,:20,%,n~/.viminfo
au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif

" Buffer - reverse everything ... :)
map ggVGg?

" Don't close window, when deleting a buffer
command! Bclose call BufcloseCloseIt()

function! BufcloseCloseIt()
   let l:currentBufNum = bufnr("%")
   let l:alternateBufNum = bufnr("#")

   if buflisted(l:alternateBufNum)
     buffer #
   else
     bnext
   endif

   if bufnr("%") == l:currentBufNum
     new
   endif

   if buflisted(l:currentBufNum)
     execute("bdelete! ".l:currentBufNum)
   endif
endfunction


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Files and backups
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Turn backup off
set nobackup
set nowb
set noswapfile


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Folding
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Enable folding, I find it very useful
set nofen
set fdl=0


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Text options
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set expandtab
set shiftwidth=2

map t2 :set shiftwidth=2
map t4 :set shiftwidth=4
au FileType html,python,vim,javascript setl shiftwidth=2
au FileType html,python,vim,javascript setl tabstop=2
au FileType java setl shiftwidth=4
au FileType java setl tabstop=4

set smarttab
set lbr
set tw=500

   """"""""""""""""""""""""""""""
   " Indent
   """"""""""""""""""""""""""""""
   "Auto indent
   set ai

   "Smart indet
   set si

   "C-style indeting
   set cindent

   "Wrap lines
   set wrap


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Spell checking
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
map sn ]s
map sp [s
map sa zg
map s? z=


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Plugin configuration
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
   """"""""""""""""""""""""""""""
   " Vim Grep
   """"""""""""""""""""""""""""""
   let Grep_Skip_Dirs = 'RCS CVS SCCS .svn'
   let Grep_Cygwin_Find = 1

   """"""""""""""""""""""""""""""
   " Yank Ring
   """"""""""""""""""""""""""""""
   map y :YRShow

   """"""""""""""""""""""""""""""
   " File explorer
   """"""""""""""""""""""""""""""
   "Split vertically
   let g:explVertical=1

   "Window size
   let g:explWinSize=35

   let g:explSplitLeft=1
   let g:explSplitBelow=1

   "Hide some files
   let g:explHideFiles='^\.,.*\.class$,.*\.swp$,.*\.pyc$,.*\.swo$,\.DS_Store$'

   "Hide the help thing..
   let g:explDetailedHelp=0


   """"""""""""""""""""""""""""""
   " Minibuffer
   """"""""""""""""""""""""""""""
   let g:miniBufExplModSelTarget = 1
   let g:miniBufExplorerMoreThanOne = 2
   let g:miniBufExplModSelTarget = 0
   let g:miniBufExplUseSingleClick = 1
   let g:miniBufExplMapWindowNavVim = 1
   let g:miniBufExplVSplit = 25
   let g:miniBufExplSplitBelow=1

   let g:bufExplorerSortBy = "name"

   autocmd BufRead,BufNew :call UMiniBufExplorer


   """"""""""""""""""""""""""""""
   " Tag list (ctags) - not used
   """"""""""""""""""""""""""""""
   "let Tlist_Ctags_Cmd = "/sw/bin/ctags-exuberant"
   "let Tlist_Sort_Type = "name"
   "let Tlist_Show_Menu = 1
   "map t :Tlist


   """"""""""""""""""""""""""""""
   " LaTeX Suite things
   """"""""""""""""""""""""""""""
   set grepprg=grep\ -nH\ $*
   let g:Tex_DefaultTargetFormat="pdf"
   let g:Tex_ViewRule_pdf='xpdf'

   "Bindings
   autocmd FileType tex map :w! :silent! call Tex_RunLaTeX()

   "Auto complete some things ;)
   autocmd FileType tex inoremap $i \indent
   autocmd FileType tex inoremap $* \cdot
   autocmd FileType tex inoremap $i \item
   autocmd FileType tex inoremap $m \[\]O


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Filetype generic
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
   """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
   " Todo
   """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
   au BufNewFile,BufRead *.todo so ~/vim_local/syntax/amido.vim

   """"""""""""""""""""""""""""""
   " VIM
   """"""""""""""""""""""""""""""
   autocmd FileType vim map :w!:source %


   """"""""""""""""""""""""""""""
   " 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


   """"""""""""""""""""""""""""""
   " Ruby & PHP section
   """"""""""""""""""""""""""""""
   autocmd FileType ruby map :w!:!ruby %
   autocmd FileType php compiler php
   autocmd FileType php map cd:w:make %


   """"""""""""""""""""""""""""""
   " Python section
   """"""""""""""""""""""""""""""
   "Run the current buffer in python - ie. on leader+space
   au FileType python so ~/vim_local/syntax/python.vim
   autocmd FileType python map :w!:!python %
   autocmd FileType python so ~/vim_local/plugin/python_fold.vim

   "Set some bindings up for 'compile' of python
   autocmd FileType python set makeprg=python\ -c\ \"import\ py_compile,sys;\ sys.stderr=sys.stdout;\ py_compile.compile(r'%')\"
   autocmd FileType python set efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m

   "Python iMaps
   au FileType python set cindent
   au FileType python inoremap $r return
   au FileType python inoremap $s self
   au FileType python inoremap $c ####kla
   au FileType python inoremap $i import
   au FileType python inoremap $p print
   au FileType python inoremap $d """"""O

   "Run in the Python interpreter
   function! Python_Eval_VSplit() range
     let src = tempname()
     let dst = tempname()
     execute ": " . a:firstline . "," . a:lastline . "w " . src
     execute ":!python " . src . " > " . dst
     execute ":pedit! " . dst
   endfunction
   au FileType python vmap :call Python_Eval_VSplit()

   """"""""""""""""""""""""""""""
   " Cheetah section
   """""""""""""""""""""""""""""""
   autocmd FileType cheetah set ft=xml
   autocmd FileType cheetah set syntax=cheetah

   """""""""""""""""""""""""""""""
   " Vim section
   """""""""""""""""""""""""""""""
   autocmd FileType vim set nofen

   """""""""""""""""""""""""""""""
   " Java section
   """""""""""""""""""""""""""""""
   au FileType java inoremap System.out.println();hi

   "Java comments
   autocmd FileType java source ~/vim_local/macros/jcommenter.vim
   autocmd FileType java let b:jcommenter_class_author='Amir Salihefendic (amix@amix.dk)'
   autocmd FileType java let b:jcommenter_file_author='Amir Salihefendic (amix@amix.dk)'
   autocmd FileType java map :call JCommentWriter()

   "Abbr'z
   autocmd FileType java inoremap $pr private
   autocmd FileType java inoremap $r return
   autocmd FileType java inoremap $pu public
   autocmd FileType java inoremap $i import
   autocmd FileType java inoremap $b boolean
   autocmd FileType java inoremap $v void
   autocmd FileType java inoremap $s String

   "Folding
   function! JavaFold()
     setl foldmethod=syntax
     setl foldlevelstart=1
     syn region foldBraces start=/{/ end=/}/ transparent fold keepend extend
     syn match foldImports /\(\n\?import.\+;\n\)\+/ transparent fold

     function! FoldText()
       return substitute(getline(v:foldstart), '{.*', '{...}', '')
     endfunction
     setl foldtext=FoldText()
   endfunction
   au FileType java call JavaFold()
   au FileType java setl fen

   au BufEnter *.sablecc,*.scc set ft=sablecc

   """"""""""""""""""""""""""""""
   " JavaScript section
   """""""""""""""""""""""""""""""
   au FileType javascript so ~/vim_local/syntax/javascript.vim
   function! JavaScriptFold()
     setl foldmethod=syntax
     setl foldlevelstart=1
     syn region foldBraces start=/{/ end=/}/ transparent fold keepend extend

     function! FoldText()
       return substitute(getline(v:foldstart), '{.*', '{...}', '')
     endfunction
     setl foldtext=FoldText()
   endfunction
   au FileType javascript call JavaScriptFold()
   au FileType javascript setl fen

   au FileType javascript imap console.log();hi
   au FileType javascript imap alert();hi
   au FileType javascript setl nocindent
   au FileType javascript inoremap $r return

   au FileType javascript inoremap $d //////ka
   au FileType javascript inoremap $c /****/ka


   """"""""""""""""""""""""""""""
   " HTML
   """""""""""""""""""""""""""""""
   au FileType html,cheetah set ft=xml
   au FileType html,cheetah set syntax=html


   """"""""""""""""""""""""""""""
   " C mappings
   """""""""""""""""""""""""""""""
   autocmd FileType c map :w:!gcc %


   """""""""""""""""""""""""""""""
   " SML
   """""""""""""""""""""""""""""""
   autocmd FileType sml map cd:w:!sml %


   """"""""""""""""""""""""""""""
   " Scheme bidings
   """"""""""""""""""""""""""""""
   autocmd BufNewFile,BufRead *.scm map cd:w:!petite %
   autocmd BufNewFile,BufRead *.scm inoremap (pretty-print )i
   autocmd BufNewFile,BufRead *.scm vnoremap `>a)`


   """"""""""""""""""""""""""""""
   " SVN section
   """""""""""""""""""""""""""""""
   map :new:read !svn diff:set syntax=diff buftype=nofilegg


""""""""""""""""""""""""""""""
" Snippets
"""""""""""""""""""""""""""""""
   "You can use to goto the next <++> - it is pretty smart ;)

   """""""""""""""""""""""""""""""
   " Python
   """""""""""""""""""""""""""""""
   autocmd FileType python inorea cfun =IMAP_PutTextWithMovement("def <++>(<++>):\n<++>\nreturn <++>")
   autocmd FileType python inorea cclass =IMAP_PutTextWithMovement("class <++>:\n<++>")
   autocmd FileType python inorea cfor =IMAP_PutTextWithMovement("for <++> in <++>:\n<++>")
   autocmd FileType python inorea cif =IMAP_PutTextWithMovement("if <++>:\n<++>")
   autocmd FileType python inorea cifelse =IMAP_PutTextWithMovement("if <++>:\n<++>\nelse:\n<++>")


   """""""""""""""""""""""""""""""
   " JavaScript
   """""""""""""""""""""""""""""""
   autocmd FileType cheetah,html,javascript inorea cfun =IMAP_PutTextWithMovement("function <++>(<++>) {\n<++>;\nreturn <++>;\n}")
   autocmd filetype cheetah,html,javascript inorea cfor =IMAP_PutTextWithMovement("for(<++>; <++>; <++>) {\n<++>;\n}")
   autocmd FileType cheetah,html,javascript inorea cif =IMAP_PutTextWithMovement("if(<++>) {\n<++>;\n}")
   autocmd FileType cheetah,html,javascript inorea cifelse =IMAP_PutTextWithMovement("if(<++>) {\n<++>;\n}\nelse {\n<++>;\n}")


   """""""""""""""""""""""""""""""
   " HTML
   """""""""""""""""""""""""""""""
   autocmd FileType cheetah,html inorea cahref =IMAP_PutTextWithMovement('<++>')
   autocmd FileType cheetah,html inorea cbold =IMAP_PutTextWithMovement('<++>')
   autocmd FileType cheetah,html inorea cimg =IMAP_PutTextWithMovement('<++>')
   autocmd FileType cheetah,html inorea cpara =IMAP_PutTextWithMovement('

<++>

')
   autocmd FileType cheetah,html inorea ctag =IMAP_PutTextWithMovement('<<++>><++>>')
   autocmd FileType cheetah,html inorea ctag1 =IMAP_PutTextWithMovement("<<++>><++>>")


   """""""""""""""""""""""""""""""
   " Java
   """""""""""""""""""""""""""""""
   autocmd FileType java inorea cfun =IMAP_PutTextWithMovement("public<++> <++>(<++>) {\n<++>;\nreturn <++>;\n}")
   autocmd FileType java inorea cfunpr =IMAP_PutTextWithMovement("private<++> <++>(<++>) {\n<++>;\nreturn <++>;\n}")
   autocmd FileType java inorea cfor =IMAP_PutTextWithMovement("for(<++>; <++>; <++>) {\n<++>;\n}")
   autocmd FileType java inorea cif =IMAP_PutTextWithMovement("if(<++>) {\n<++>;\n}")
   autocmd FileType java inorea cifelse =IMAP_PutTextWithMovement("if(<++>) {\n<++>;\n}\nelse {\n<++>;\n}")
   autocmd FileType java inorea cclass =IMAP_PutTextWithMovement("class <++> <++> {\n<++>\n}")
   autocmd FileType java inorea cmain =IMAP_PutTextWithMovement("public static void main(String[] argv) {\n<++>\n}")


   "Presse c-q insted of space (or other key) to complete the snippet
   imap


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Cope
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"For Cope
map :noh

"Orginal for all
map n :cn
map p :cp
map c :botright cw 10
map :q:botright cw 10


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" MISC
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Remove the Windows ^M
noremap m mmHmt:%s///ge'tzt'm

"Paste toggle - when pasting something in, don't indent.
set pastetoggle=

"Remove indenting on empty lines
map :%s/\s*$//g:noh''

"Super paste
inoremap :set pastemui+mv'uV'v=:set nopaste

"A function that inserts links & anchors on a TOhtml export.
" Notice:
" Syntax used is:
" Link
" Anchor
function! SmartTOHtml()
   TOhtml
   try
    %s/"\s\+\*> \(.\+\)\1<\/a>    %s/"\(-\|\s\)\+\*> \(.\+\)\2<\/a>    %s/"\s\+=> \(.\+\)\1<\/a>   catch
   endtry
   exe ":write!"
   exe ":bd"
endfunction


-----------------------------------------------------------------------------------
               新修改的文件
-----------------------------------------------------------------------------------

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"                         VIM配置文件                                            
"
"              本文件修改自Amix的配置文件,局部做了修改。
"
"                             斑斑
"
"                          2010-03-22
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 通用
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"取消于VI的兼容模式
set nocompatible

"设定最多的历史记录数目
set history=400

"打开文件类型插件
filetype plugin on
filetype indent on

"当文件在外界被修改,重新加载
set autoread

"鼠标一直可用
set mouse=a

"设置mapleader
let mapleader = ","
let g:mapleader = ","

"快速保存
nmap w :w!
nmap f :find

"快速重新加载.vimrc
map s :source ~/.vimrc
"快速编辑.vimrc
map e :e! ~/.vimrc
"当.vimrc配置文件修改时,重新加载
autocmd! bufwritepost vimrc source ~/.vimrc
"设定可视化块模式的全选模式
set ve=all
"设定查找自动完成词汇的文件夹
set dictionary+=/usr/share/dict/perl

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 颜色和字体
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"开启语法高亮
syntax enable
"设置配色方案
if has("gui_running")  "当使用GVIM时
  set guioptions-=T
  let psc_style='cool'
  colorscheme default
else                   "当使用VIM时
  set background=dark
  colorscheme zellner
endif

"一些不错的映射来切换语法规则(在一个文件中混有不同种语言时很有用)
map 1 :set syntax=perl
map 2 :set syntax=xhtml
map 3 :set syntax=python
map 4 :set ft=javascript
map $ :syntax sync fromstart

autocmd BufEnter * :syntax sync fromstart

"通用的高亮设置
if has("gui_running")
  set cursorline
  hi cursorline guibg=#333333
  hi CursorColumn guibg=#333333
endif

"全部菜单颜色
hi Pmenu guibg=#333333
hi PmenuSel guibg=#555555 guifg=#ffffff

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 文件格式
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"常用文件格式
set ffs=unix,dos

nmap fd :se ff=dos
nmap fu :se ff=unix

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" VIM 用户界面
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Set 7 lines to the curors - when moving vertical..
set so=7

"开启 WiLd 菜单
set wildmenu

"一直显示当前位置
set ruler

"命令行高度为2
set cmdheight=2

"显示行号
set nu

"不刷新,当运行 macros.. lazyredraw
set lz

"改变 buffer - 不保存
set hid

"设置 backspace
set backspace=eol,start,indent

"Bbackspace and cursor keys wrap to
set whichwrap+=<,>,h,l

"搜索时忽略大小写
set ignorecase
set incsearch

"开启magic
set magic

"关闭报错声音
set noerrorbells
set novisualbell
set t_vb=

"显示匹配的括号
set showmatch

"How many tenths of a second to blink
set mat=2

"高亮显示搜索结果
set hlsearch

  """"""""""""""""""""""""""""""
  " 状态栏
  """"""""""""""""""""""""""""""
  "总是隐藏状态栏
  set laststatus=2

  function! CurDir()
     let curdir = substitute(getcwd(), '/Users/amir/', "~/", "g")
     return curdir
  endfunction

  "格式话
  set statusline=\ %F%m%r%h\ %w\ \ CWD:\ %r%{CurDir()}%h\ \ \ Line:\ %l/%L:%c

""""""""""""""""""""""""""""""
" 图形
""""""""""""""""""""""""""""""
" From an idea by Michael Naumann
function! VisualSearch(direction) range
  let l:saved_reg = @"
  execute "normal! vgvy"
  let l:pattern = escape(@", '\\/.*$^~[]')
  let l:pattern = substitute(l:pattern, "\n$", "", "")
  if a:direction == 'b'
    execute "normal ?" . l:pattern . "^M"
  else
    execute "normal /" . l:pattern . "^M"
  endif
  let @/ = l:pattern
  let @" = l:saved_reg
endfunction

"Basically you press * or # to search for the current selection !! Really useful
vnoremap * :call VisualSearch('f')
vnoremap # :call VisualSearch('b')


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 移动和标签
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Map space to / and c-space to ?
map /
map ?

"Smart way to move btw. windows
map j
map k
map h
map l

"Actually, the tab does not switch buffers, but my arrows
"Bclose function ca be found in "Buffer related" section
map bd :Bclose
"map bd
"Use the arrows to something usefull
"map :bn
"map :bp

"Tab configuration
map tn :tabnew %
map te :tabedit
map tc :tabclose
map tm :tabmove
try
  set switchbuf=usetab
  set stal=2
catch
endtry

"Moving fast to front, back and 2 sides ;)
imap $a
imap 0i
imap $a
imap 0i


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" General Autocommands
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Switch to current dir
map cd :cd %: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


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" General Abbrevs
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"My information
iab xdate =strftime("%d/%m/%y %H:%M:%S")
iab xname Amir Salihefendic


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Editing mappings etc.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Remap VIM 0
map 0 ^

"Move a line of text using control
nmap mz:m+`z
nmap mz:m-2`z
vmap :m'>+`mzgv`yo`z
vmap :m'<-2`>my`
func! DeleteTrailingWS()
  exe "normal mz"
  %s/\s\+$//ge
  exe "normal `z"
endfunc
autocmd BufWrite *.py :call DeleteTrailingWS()

set completeopt=menu

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 命令行设置
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
func! Cwd()
  let cwd = getcwd()
  return "e " . cwd
endfunc

func! DeleteTillSlash()
  let g:cmd = getcmdline()
  if MySys() == "linux" || MySys() == "mac"
    let g:cmd_edited = substitute(g:cmd, "\\(.*\[/\]\\).*", "\\1", "")
  else
    let g:cmd_edited = substitute(g:cmd, "\\(.*\[\\\\]\\).*", "\\1", "")
  endif
  if g:cmd == g:cmd_edited
    if MySys() == "linux" || MySys() == "mac"
      let g:cmd_edited = substitute(g:cmd, "\\(.*\[/\]\\).*/", "\\1", "")
    else
      let g:cmd_edited = substitute(g:cmd, "\\(.*\[\\\\\]\\).*\[\\\\\]", "\\1", "")
    endif
  endif
  return g:cmd_edited
endfunc

func! CurrentFileDir(cmd)
  return a:cmd . " " . expand("%:p:h") . "/"
endfunc

"Smart mappings on the command line
cno $h e ~/
cno $d e ~/Desktop/
cno $j e ./

cno $q eDeleteTillSlash()

cno $c e eCurrentFileDir("e")

cno $tc eCurrentFileDir("tabnew")
cno $th tabnew ~/
cno $td tabnew ~/Desktop/

"Bash like
cnoremap    
cnoremap    
cnoremap    


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Buffer realted
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Fast open a buffer by search for a name
map :sb

"Open a dummy buffer for paste
map q :e ~/buffer

"Restore cursor to file position in previous editing session
set viminfo='10,\"100,:20,%,n~/.viminfo
au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif

" Buffer - reverse everything ... :)
map ggVGg?

" Don't close window, when deleting a buffer
command! Bclose call BufcloseCloseIt()

function! BufcloseCloseIt()
   let l:currentBufNum = bufnr("%")
   let l:alternateBufNum = bufnr("#")

   if buflisted(l:alternateBufNum)
     buffer #
   else
     bnext
   endif

   if bufnr("%") == l:currentBufNum
     new
   endif

   if buflisted(l:currentBufNum)
     execute("bdelete! ".l:currentBufNum)
   endif
endfunction


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 文件及其备份
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"关闭备份文件
"set nobackup
"set nowb
"set noswapfile
"开启备份文件       
set backup          
set writebackup     
set backupext=.bak  
set backupdir=~/Temp
"保留原始文件       
set patchmode=.orig 

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 折叠
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"启用折叠
set nofen
set fdl=0


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 文本选项
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set expandtab
set shiftwidth=2

map t2 :set shiftwidth=2
map t4 :set shiftwidth=4
au FileType html,python,vim,javascript setl shiftwidth=2
au FileType html,python,vim,javascript setl tabstop=2
au FileType java setl shiftwidth=4
au FileType java setl tabstop=4

set smarttab
set lbr
set tw=500

   """"""""""""""""""""""""""""""
   " 缩进
   """"""""""""""""""""""""""""""
   "Auto indent
   set ai

   "Smart indet
   set si

   "C-style indeting
   set cindent

   "Wrap lines
   set wrap


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 拼写检查
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
map sn ]s
map sp [s
map sa zg
map s? z=


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 插件配置
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
   """"""""""""""""""""""""""""""
   " Vim Grep
   """"""""""""""""""""""""""""""
   let Grep_Skip_Dirs = 'RCS CVS SCCS .svn'
   let Grep_Cygwin_Find = 1

   """"""""""""""""""""""""""""""
   " Yank Ring
   """"""""""""""""""""""""""""""
   map y :YRShow

   """"""""""""""""""""""""""""""
   " File explorer
   """"""""""""""""""""""""""""""
   "Split vertically
   let g:explVertical=1

   "Window size
   let g:explWinSize=35

   let g:explSplitLeft=1
   let g:explSplitBelow=1

   "Hide some files
   let g:explHideFiles='^\.,.*\.class$,.*\.swp$,.*\.pyc$,.*\.swo$,\.DS_Store$'

   "Hide the help thing..
   let g:explDetailedHelp=0


   """"""""""""""""""""""""""""""
   " Minibuffer
   """"""""""""""""""""""""""""""
   let g:miniBufExplModSelTarget = 1
   let g:miniBufExplorerMoreThanOne = 2
   let g:miniBufExplModSelTarget = 0
   let g:miniBufExplUseSingleClick = 1
   let g:miniBufExplMapWindowNavVim = 1
   let g:miniBufExplVSplit = 25
   let g:miniBufExplSplitBelow=1

   let g:bufExplorerSortBy = "name"

   autocmd BufRead,BufNew :call UMiniBufExplorer


   """"""""""""""""""""""""""""""
   " Tag list (ctags) - not used
   """"""""""""""""""""""""""""""
   "let Tlist_Ctags_Cmd = "/sw/bin/ctags-exuberant"
   "let Tlist_Sort_Type = "name"
   "let Tlist_Show_Menu = 1
   "map t :Tlist


   """"""""""""""""""""""""""""""
   " LaTeX Suite things
   """"""""""""""""""""""""""""""
   set grepprg=grep\ -nH\ $*
   let g:Tex_DefaultTargetFormat="pdf"
   let g:Tex_ViewRule_pdf='xpdf'

   "Bindings
   autocmd FileType tex map :w! :silent! call Tex_RunLaTeX()

   "Auto complete some things ;)
   autocmd FileType tex inoremap $i \indent
   autocmd FileType tex inoremap $* \cdot
   autocmd FileType tex inoremap $i \item
   autocmd FileType tex inoremap $m \[\]O

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"  文件类型通用
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
   """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
   " Todo
   """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
   au BufNewFile,BufRead *.todo so ~/vim_local/syntax/amido.vim

   """"""""""""""""""""""""""""""
   " VIM
   """"""""""""""""""""""""""""""
   autocmd FileType vim map :w!:source %


   """"""""""""""""""""""""""""""
   " 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


   """"""""""""""""""""""""""""""
   " Ruby & PHP section
   """"""""""""""""""""""""""""""
   autocmd FileType ruby map :w!:!ruby %
   autocmd FileType php compiler php
   autocmd FileType php map cd:w:make %


   """"""""""""""""""""""""""""""
   " Python section
   """"""""""""""""""""""""""""""
   "Run the current buffer in python - ie. on leader+space
   au FileType python so ~/vim_local/syntax/python.vim
   autocmd FileType python map :w!:!python %
   autocmd FileType python so ~/vim_local/plugin/python_fold.vim

   "Set some bindings up for 'compile' of python
   autocmd FileType python set makeprg=python\ -c\ \"import\ py_compile,sys;\ sys.stderr=sys.stdout;\ py_compile.compile(r'%')\"
   autocmd FileType python set efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m

   "Python iMaps
   au FileType python set cindent
   au FileType python inoremap $r return
   au FileType python inoremap $s self
   au FileType python inoremap $c ####kla
   au FileType python inoremap $i import
   au FileType python inoremap $p print
   au FileType python inoremap $d """"""O

   "Run in the Python interpreter
   function! Python_Eval_VSplit() range
     let src = tempname()
     let dst = tempname()
     execute ": " . a:firstline . "," . a:lastline . "w " . src
     execute ":!python " . src . " > " . dst
     execute ":pedit! " . dst
   endfunction
   au FileType python vmap :call Python_Eval_VSplit()

   """"""""""""""""""""""""""""""
   " Cheetah section
   """""""""""""""""""""""""""""""
   autocmd FileType cheetah set ft=xml
   autocmd FileType cheetah set syntax=cheetah

   """""""""""""""""""""""""""""""
   " Vim section
   """""""""""""""""""""""""""""""
   autocmd FileType vim set nofen

   """""""""""""""""""""""""""""""
   " Java section
   """""""""""""""""""""""""""""""
   au FileType java inoremap System.out.println();hi

   "Java comments
   autocmd FileType java source ~/vim_local/macros/jcommenter.vim
   autocmd FileType java let b:jcommenter_class_author='Amir Salihefendic (amix@amix.dk)'
   autocmd FileType java let b:jcommenter_file_author='Amir Salihefendic (amix@amix.dk)'
   autocmd FileType java map :call JCommentWriter()

   "Abbr'z
   autocmd FileType java inoremap $pr private
   autocmd FileType java inoremap $r return
   autocmd FileType java inoremap $pu public
   autocmd FileType java inoremap $i import
   autocmd FileType java inoremap $b boolean
   autocmd FileType java inoremap $v void
   autocmd FileType java inoremap $s String

   "Folding
   function! JavaFold()
     setl foldmethod=syntax
     setl foldlevelstart=1
     syn region foldBraces start=/{/ end=/}/ transparent fold keepend extend
     syn match foldImports /\(\n\?import.\+;\n\)\+/ transparent fold

     function! FoldText()
       return substitute(getline(v:foldstart), '{.*', '{...}', '')
     endfunction
     setl foldtext=FoldText()
   endfunction
   au FileType java call JavaFold()
   au FileType java setl fen

   au BufEnter *.sablecc,*.scc set ft=sablecc

   """"""""""""""""""""""""""""""
   " JavaScript section
   """""""""""""""""""""""""""""""
   au FileType javascript so ~/vim_local/syntax/javascript.vim
   function! JavaScriptFold()
     setl foldmethod=syntax
     setl foldlevelstart=1
     syn region foldBraces start=/{/ end=/}/ transparent fold keepend extend

     function! FoldText()
       return substitute(getline(v:foldstart), '{.*', '{...}', '')
     endfunction
     setl foldtext=FoldText()
   endfunction
   au FileType javascript call JavaScriptFold()
   au FileType javascript setl fen

   au FileType javascript imap console.log();hi
   au FileType javascript imap alert();hi
   au FileType javascript setl nocindent
   au FileType javascript inoremap $r return

   au FileType javascript inoremap $d //////ka
   au FileType javascript inoremap $c /****/ka


   """"""""""""""""""""""""""""""
   " HTML
   """""""""""""""""""""""""""""""
   au FileType html,cheetah set ft=xml
   au FileType html,cheetah set syntax=html


   """"""""""""""""""""""""""""""
   " C mappings
   """""""""""""""""""""""""""""""
   autocmd FileType c map :w:!gcc %


   """""""""""""""""""""""""""""""
   " SML
   """""""""""""""""""""""""""""""
   autocmd FileType sml map cd:w:!sml %


   """"""""""""""""""""""""""""""
   " Scheme bidings
   """"""""""""""""""""""""""""""
   autocmd BufNewFile,BufRead *.scm map cd:w:!petite %
   autocmd BufNewFile,BufRead *.scm inoremap (pretty-print )i
   autocmd BufNewFile,BufRead *.scm vnoremap `>a)`


   """"""""""""""""""""""""""""""
   " SVN section
   """""""""""""""""""""""""""""""
   map :new:read !svn diff:set syntax=diff buftype=nofilegg


""""""""""""""""""""""""""""""
" Snippets
"""""""""""""""""""""""""""""""
   "You can use to goto the next <++> - it is pretty smart ;)

   """""""""""""""""""""""""""""""
   " Python
   """""""""""""""""""""""""""""""
   autocmd FileType python inorea cfun =IMAP_PutTextWithMovement("def <++>(<++>):\n<++>\nreturn <++>")
   autocmd FileType python inorea cclass =IMAP_PutTextWithMovement("class <++>:\n<++>")
   autocmd FileType python inorea cfor =IMAP_PutTextWithMovement("for <++> in <++>:\n<++>")
   autocmd FileType python inorea cif =IMAP_PutTextWithMovement("if <++>:\n<++>")
   autocmd FileType python inorea cifelse =IMAP_PutTextWithMovement("if <++>:\n<++>\nelse:\n<++>")


   """""""""""""""""""""""""""""""
   " JavaScript
   """""""""""""""""""""""""""""""
   autocmd FileType cheetah,html,javascript inorea cfun =IMAP_PutTextWithMovement("function <++>(<++>) {\n<++>;\nreturn <++>;\n}")
   autocmd filetype cheetah,html,javascript inorea cfor =IMAP_PutTextWithMovement("for(<++>; <++>; <++>) {\n<++>;\n}")
   autocmd FileType cheetah,html,javascript inorea cif =IMAP_PutTextWithMovement("if(<++>) {\n<++>;\n}")
   autocmd FileType cheetah,html,javascript inorea cifelse =IMAP_PutTextWithMovement("if(<++>) {\n<++>;\n}\nelse {\n<++>;\n}")


   """""""""""""""""""""""""""""""
   " HTML
   """""""""""""""""""""""""""""""
   autocmd FileType cheetah,html inorea cahref =IMAP_PutTextWithMovement('<++>')
   autocmd FileType cheetah,html inorea cbold =IMAP_PutTextWithMovement('<++>')
   autocmd FileType cheetah,html inorea cimg =IMAP_PutTextWithMovement('<++>')
   autocmd FileType cheetah,html inorea cpara =IMAP_PutTextWithMovement('

<++>

')
   autocmd FileType cheetah,html inorea ctag =IMAP_PutTextWithMovement('<<++>><++>>')
   autocmd FileType cheetah,html inorea ctag1 =IMAP_PutTextWithMovement("<<++>><++>>")


   """""""""""""""""""""""""""""""
   " Java
   """""""""""""""""""""""""""""""
   autocmd FileType java inorea cfun =IMAP_PutTextWithMovement("public<++> <++>(<++>) {\n<++>;\nreturn <++>;\n}")
   autocmd FileType java inorea cfunpr =IMAP_PutTextWithMovement("private<++> <++>(<++>) {\n<++>;\nreturn <++>;\n}")
   autocmd FileType java inorea cfor =IMAP_PutTextWithMovement("for(<++>; <++>; <++>) {\n<++>;\n}")
   autocmd FileType java inorea cif =IMAP_PutTextWithMovement("if(<++>) {\n<++>;\n}")
   autocmd FileType java inorea cifelse =IMAP_PutTextWithMovement("if(<++>) {\n<++>;\n}\nelse {\n<++>;\n}")
   autocmd FileType java inorea cclass =IMAP_PutTextWithMovement("class <++> <++> {\n<++>\n}")
   autocmd FileType java inorea cmain =IMAP_PutTextWithMovement("public static void main(String[] argv) {\n<++>\n}")


   "Presse c-q insted of space (or other key) to complete the snippet
   imap


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Cope
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"For Cope
map :noh

"Orginal for all
map n :cn
map p :cp
map c :botright cw 10
map :q:botright cw 10


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 混合
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"去除windows中的^M
noremap m mmHmt:%s///ge'tzt'm

"Paste toggle - when pasting something in, don't indent.
set pastetoggle=

"去除空行中的缩进
map :%s/\s*$//g:noh''

"超级粘贴
inoremap :set pastemui+mv'uV'v=:set nopaste

"A function that inserts links & anchors on a TOhtml export.
" Notice:
" Syntax used is:
" Link
" Anchor
function! SmartTOHtml()
   TOhtml
   try
    %s/"\s\+\*> \(.\+\)\1<\/a>    %s/"\(-\|\s\)\+\*> \(.\+\)\2<\/a>    %s/"\s\+=> \(.\+\)\1<\/a>   catch
   endtry
   exe ":write!"
   exe ":bd"
endfunction
阅读(1513) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~