Created
June 19, 2013 10:58
-
-
Save liuzhe0223/5813470 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible " be iMproved | |
filetype off " required! | |
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#rc() | |
Bundle 'gmarik/vundle' | |
Bundle 'rails.vim' | |
Bundle 'c.vim' | |
Bundle 'python.vim' | |
"Bundle 'https://github.com/ervandew/supertab.git' | |
Bundle 'git://github.com/scrooloose/nerdtree.git' | |
Bundle 'git://github.com/mattn/zencoding-vim.git' | |
Bundle 'git://github.com/tpope/vim-rails.git' | |
Bundle 'git://github.com/kien/ctrlp.vim.git' | |
Bundle 'vim-ruby' | |
Bundle 'vim-coffee-script' | |
Bundle 'git://github.com/Yggdroot/indentLine.git' | |
Bundle 'https://github.com/vim-scripts/Auto-Pairs.git' | |
Bundle 'https://github.com/vim-scripts/pythoncomplete.git' | |
Bundle 'https://github.com/Shougo/neocomplcache.git' | |
Bundle 'https://github.com/vim-scripts/snipMate.git' | |
autocmd FileType python set ft=python.django " For SnipMate | |
autocmd FileType html set ft=htmldjango.html " For SnipMate | |
let g:neocomplcache_enable_at_startup = 1 | |
let g:neocomplcache_enable_smart_case = 1 | |
syntax enable | |
filetype indent on | |
au BufRead,BufNewFile *.go set filetype=go | |
set nu | |
set enc=Chinese tenc=UTF-8 | |
set encoding=utf-8 | |
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1 | |
set shiftwidth=4 | |
set tabstop=4 | |
let NERDTreeIgnore = ['\.pyc$'] "忽略python的字节码文件 | |
autocmd vimenter * if !argc() | NERDTree | endif | |
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif | |
inoremap jj <ESC> | |
"vimim | |
let g:vimim_plugin = '~/.vim/bundle/VimIM/plugin' | |
imap <C-\> <C-_> | |
let g:rsenseHome = "/opt/rsense-0.3" | |
let g:rsenseUseOmniFunc = 1 | |
map <F8> :call FormartSrc()<CR> | |
"定义FormartSrc() | |
func FormartSrc() | |
exec "w" | |
if &filetype == 'c' | |
exec "!astyle --style=ansi --one-line=keep-statements -a --suffix=none %" | |
elseif &filetype == 'cpp' || &filetype == 'hpp' | |
exec "r !astyle --style=ansi --one-line=keep-statements -a --suffix=none %> /dev/null 2>&1" | |
elseif &filetype == 'perl' | |
exec "!astyle --style=gnu --suffix=none %" | |
elseif &filetype == 'py'||&filetype == 'python' | |
exec "r !pydent % > /dev/null 2>&1" | |
elseif &filetype == 'java' | |
exec "!astyle --style=java --suffix=none %" | |
elseif &filetype == 'jsp' | |
exec "!astyle --style=gnu --suffix=none %" | |
elseif &filetype == 'xml' | |
exec "!astyle --style=gnu --suffix=none %" | |
endif | |
exec "e! %" | |
endfunc | |
"结束定义FormartSrc | |
map <F12> :call RunSrc()<CR> | |
"定义FormartSrc() | |
func RunSrc() | |
exec "w" | |
if &filetype == 'c' | |
exec "!astyle --style=ansi --one-line=keep-statements -a --suffix=none %" | |
elseif &filetype == 'cpp' || &filetype == 'hpp' | |
exec "r !astyle --style=ansi --one-line=keep-statements -a --suffix=none %> /dev/null 2>&1" | |
elseif &filetype == 'perl' | |
exec "!astyle --style=gnu --suffix=none %" | |
elseif &filetype == 'py'||&filetype == 'python' | |
exec "!python %" | |
elseif &filetype == 'java' | |
exec "!astyle --style=java --suffix=none %" | |
endif | |
exec "e! %" | |
endfunc | |
"结束定义FormartSrc | |
" | |
nnoremap <C-h> <C-w>h | |
nnoremap <C-j> <C-w>j | |
nnoremap <C-k> <C-w>k | |
nnoremap <C-l> <C-w>l | |
" python filetype | |
function HeaderPython() | |
call setline(1, "#!/usr/bin/env python2") | |
call append(1, "# -*- coding: utf-8 -*-") | |
call append(2, "# Pw @ " . strftime('%Y-%m-%d %T', localtime())) | |
normal G | |
normal o | |
normal o | |
endf | |
autocmd bufnewfile *.py call HeaderPython() | |
"python tab | |
:set ts=4 | |
:set expandtab | |
:%retab!% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment