我的博客已迁移到xdoujiang.com请去那边和我交流一、.vimrc配置文件cat .vimrcset backupdir=/root/vimbackupset background=darkcolorscheme desertsyntax onset incsearch if has("autocmd") filetype plugin indent onendifset hlsearchautocmd BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exe "normal g`\"" | \ endif autocmd BufNewFile *.[ch],*.cpp,*.sh,*.java,*.php,*.py exec ":call SetTitle()" autocmd BufNewFile * normal G autocmd BufNewFile *.php normal k autocmd BufWrite *.[ch],*.cpp,*.sh,*.java,*.php,*.py exec ":!ctags -R *" autocmd BufNewFile,BufRead *.py set cinwords=if,elif,else,for,while,try,expect,finally,def,class autocmd BufNewFile,BufRead *.[ch],*.cpp set foldmethod=syntax func SetTitle() if &filetype == 'sh' || &filetype == 'python' call setline(1, "\#--------------------------------------------------") call append(line("."), "\#Author:jimmygong") call append(line(".")+1, "\#Email:jimmygong@taomee.com") call append(line(".")+2, "\#FileName:".expand("%")) call append(line(".")+3, "\#Function: ") call append(line(".")+4, "\#Version:1.0 ") call append(line(".")+5, "\#Created:".strftime("%Y-%m-%d")) call append(line(".")+6, "\#--------------------------------------------------") call append(line(".")+7, "") else call setline(1, "/**") call append(line("."), "--------------------------------------------------") call append(line(".")+1, "Author:jimmygong") call append(line(".")+2, "Email:jimmygong@taomee.com") call append(line(".")+3, "FileName:".expand("%")) call append(line(".")+4, "Function: ") call append(line(".")+5, "Version:1.0 ") call append(line(".")+6, "Created:".strftime("%Y-%m-%d")) call append(line(".")+7, "--------------------------------------------------") call append(line(".")+8, "**/") call append(line(".")+9, "") endif if &filetype == 'php' call append(0, " ") endif if &filetype == 'sh' call append(0, "\#!/bin/bash") elseif &filetype == 'python' call append(0, "\#!/usr/bin/python") call append(1, "\# -*- coding: utf-8 -*-") endif endfunc二、效果图