set cursorline
set history=1700
set nocompatible "去掉讨厌的有关vi一致性模式,避免以前版本的一些bug和局限
set nu
filetype plugin on
filetype indent on
set autoread
set so=7
set wildmenu
set wildignore=*.o,*~,*.pyc
set wildignore+=.git\*,.hg\*,.svn\*
set ruler
set cmdheight=2
set hid
set backspace=eol,start,indent
set whichwrap+=<,>,h,l
set ignorecase
set smartcase
set hlsearch
set incsearch
set lazyredraw
set magic
set showmatch
set noerrorbells
set novisualbell
set tm=500
set foldcolumn=1
set guioptions-=m " 隐藏菜单栏
set guioptions-=T " 隐藏工具栏
set guioptions-=L " 隐藏左侧滚动条
set guioptions-=r " 隐藏右侧滚动条
set guioptions-=b " 隐藏底部滚动条
set autochdir
syntax enable
autocmd InsertLeave * se nocul " 用浅色高亮当前行
autocmd InsertEnter * se cul " 用浅色高亮当前行
color molokai
if has("gui_running")
set guioptions-=T
set guioptions-=e
set t_Co=256
set guitablabel=%M\ %t
endif
set fileencoding=utf-8
set ffs=unix,dos,mac
set formatoptions+=m
set formatoptions+=B
set nobackup
set nowb
set noswapfile
set mouse=a
set expandtab
set smarttab
set shiftwidth=4
set tabstop=4
set softtabstop=4
set expandtab
set lbr
set tw=500
set ai
set si
set wrap
set viminfo^=%
" set guifont=Liberation\Mono\ 12
set guifont=Courier\ New\ 12
set laststatus=2
set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l
set list lcs=tab:\|\
inoremap ( ()<ESC>i
inoremap { {<CR>}<ESC>o
inoremap [ []<ESC>i
inoremap " ""<ESC>i
inoremap ‘ ‘‘<ESC>i
inoremap ;; <ESC>o
inoremap <C-a> <esc>ggVGm
inoremap <C-s> <esc>:w<CR>i
inoremap <C-v> <esc>"+Pi
inoremap <C-c> <esc>"+Yi
inoremap <C-z> <esc>ui
map <C-s> :w<CR>
map <C-a> ggVG
map <C-c> "+Y
map <C-v> "+P
map <C-z> u
map ff <ESC>:NERDTree<CR>
map ss <ESC>:!google-chrome %<CR>
map fp <ESC>:vsplit<CR>
map cfp <ESC>:split<CR>
map rr <ESC>ysiw
map cc <ESC>gcc
map xx <ESC>gcu
map nn gc
map zd <ESC>zfap
map ll :IndentLinesToggle<CR>
let mapleader = ","
let g:mapleader = ","
let g:Source="/home/wangzhili/wzl/"
let python_highlight_all = 1
let g:author = ‘wangzhili‘
let g:Email = ‘[email protected]‘
let g:html_indent_inctags = "html,body,head,tbody"
let g:html_indent_script1 = "inc"
let g:html_indent_style1 = "inc"
let g:pyflakes_use_quickfix = 0
let g:indentLine_color_gui = ‘#F8F8FF‘
let g:indentLine_char = ‘┆‘
au FileType python syn keyword pythonDecorator True None False self
au BufNewFile,BufRead *.jinja set syntax=htmljinja
au BufNewFile,BufRead *.mako set ft=mako
au FileType python map <buffer> F :set foldmethod=indent<cr>
au FileType python inoremap <buffer> $r return
au FileType python inoremap <buffer> $i import
au FileType python inoremap <buffer> $p print
au FileType python map <buffer> <leader>1 /class
au FileType python map <buffer> <leader>2 /def
au FileType python map <buffer> <leader>C ?class
au FileType python map <buffer> <leader>D ?def
au FileType javascript call JavaScriptFold()
au FileType javascript setl fen
au FileType javascript setl nocindent
au FileType javascript imap <c-t> AJS.log();<esc>hi
au FileType javascript imap <c-a> alert();<esc>hi
au FileType javascript inoremap <buffer> $r return
"回到上次编辑的位置
autocmd BufReadPost *
\ if line("‘\"") > 0 && line("‘\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
"end
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
map e :call Do_OneFileMake()<CR>
function Do_OneFileMake()
exec "w"
if &filetype=="java"
exec "!javac %"
exec "!gnome-terminal -t JAVA -x bash -c \"java %<;rm %<.class;read;\""
endif
if &filetype=="python"
exec "!gnome-terminal -t Python -x bash -c \"python %;read;\""
endif
if &filetype=="sh"
exec "!gnome-terminal -t SH -x bash -c \"sh %; read;\""
endif
if &filetype=="c"
exec "!gnome-terminal -t C -x bash -c \"g++ % -o %<;./%<;rm %<;read;\""
endif
if &filetype=="cpp"
exec "!gnome-terminal -t CPP -x bash -c \"g++ % -o %<;./%<;rm %<;read;\""
endif
if &filetype=="markdown"
exec "!gnome-terminal -t -MD -x bash -c\"submit.sh;read;\""
endif
normal o
exec "c"
endfunction
function InsertPythonComment()
exe ‘normal‘.1.‘G‘
let line = getline(‘.‘)
if line =~ ‘^#!.*$‘ || line =~ ‘^#.*coding:.*$‘
return
endif
normal O
call setline(‘.‘, ‘#!/usr/bin/env python‘)
normal o
call setline(‘.‘, ‘# -*- coding:utf-8 -*-‘)
normal o
call cursor(4, 17)
endfunc
function InsertCommentWhenOpen()
if a:lastline == 1 && !getline(‘.‘)
call InsertPythonComment()
end
endfunc
function CppHeadFlie()
call setline(‘.‘,‘#include<map>‘)
normal o
call setline(‘.‘,‘#include<cmath>‘)
normal o
call setline(‘.‘,‘#include<queue>‘)
normal o
call setline(‘.‘,‘#include<cstdio>‘)
normal o
call setline(‘.‘,‘#include<vector>‘)
normal o
call setline(‘.‘,‘#include<string>‘)
normal o
call setline(‘.‘,‘#include<cstring>‘)
normal o
call setline(‘.‘,‘#include<sstream>‘)
normal o
call setline(‘.‘,‘#include<iostream>‘)
normal o
call setline(‘.‘,‘#include<algorithm>‘)
normal o
call setline(‘.‘,‘using namespace std;‘)
normal o
endfunc
function CallCppFunction()
if a:lastline == 1 && !getline(‘.‘)
call CppHeadFlie()
end
endfunc
function JavaFile()
call setline(‘.‘,‘public class ‘.expand("%<").expand(‘{‘))
normal o
call setline(‘.‘,‘ public static void main(String[] args){‘)
normal o
normal o
call setline(‘.‘,‘ }‘)
normal o
call setline(‘.‘,‘}‘)
call cursor(3,9)
endfunc
function CallJavaFunction()
if a:lastline == 1 && !getline(‘.‘)
call JavaFile()
end
endfunc
au FileType cpp :%call CallCppFunction()
au FileType java :%call CallJavaFunction()
au FileType python :%call InsertCommentWhenOpen()
autocmd FileType python,shell set commentstring=#\ %s " 设置Python注释字符
autocmd FileType mako set cms=##\ %s
set nocompatible
filetype off
filetype plugin indent on
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle "airblade/vim-gitgutter"
Bundle "gregsexton/gitv"
Bundle "tpope/vim-commentary"
Bundle "tpope/vim-surround"
Bundle "Raimondi/delimitMate"
Bundle "mattn/emmet-vim"
Bundle ‘scrooloose/nerdtree‘
Bundle "MarcWeber/vim-addon-mw-utils"
Bundle "tomtom/tlib_vim"
Bundle "garbas/vim-snipmate"
Bundle "honza/vim-snippets"
Bundle ‘pkufranky/VimRepress‘
Bundle ‘hallison/vim-markdown‘
Bundle "MarcWeber/vim-addon-mw-utils"
Bundle "tomtom/tlib_vim"
Bundle "garbas/vim-snipmate"
Bundle "honza/vim-snippets"
Bundle ‘gmarik/vundle‘
Bundle ‘kien/ctrlp.vim‘
Bundle ‘sukima/xmledit‘
Bundle ‘sjl/gundo.vim‘
Bundle ‘jiangmiao/auto-pairs‘
Bundle ‘klen/python-mode‘
Bundle ‘SirVer/ultisnips‘
Bundle ‘scrooloose/syntastic‘
Bundle ‘t9md/vim-quickhl‘
Bundle ‘Lokaltog/vim-powerline‘
Bundle ‘scrooloose/nerdcommenter‘
Bundle ‘hdima/python-syntax‘
Bundle ‘Yggdroot/indentLine‘
Bundle ‘Shougo/neocomplete‘
Bundle ‘kevinw/pyflakes-vim‘
Bundle ‘pangloss/vim-javascript‘
Bundle ‘mathematic.vim‘
inoremap <buffer> <C-X><C-U> <C-X><C-U><C-P>
inoremap <buffer> <C-S-Space> <C-X><C-U><C-P>
autocmd Filetype java setlocal omnifunc=javacomplete#Complete
autocmd Filetype java setlocal completefunc=javacomplete#CompleteParamsInfo
autocmd Filetype java,javascript,jsp inoremap <buffer> . .<C-X><C-O><C-P>
autocmd FileType python setlocal completeopt-=preview
let g:acp_enableAtStartup = 0
let g:neocomplete#enable_at_startup = 1
let g:neocomplete#enable_smart_case = 1
let g:neocomplete#sources#syntax#min_keyword_length = 3
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags