Created
April 18, 2016 10:03
-
-
Save CMGS/f0f9481923d54e8a5fcef31b7e9c21e9 to your computer and use it in GitHub Desktop.
vimrc
This file contains 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 autoindent | |
set hlsearch | |
set background=dark | |
set backspace=indent,eol,start | |
set cin | |
set encoding=utf-8 | |
let &termencoding=&encoding | |
" 设置文字编码自动识别 | |
set fileencodings=ucs-bom,utf-8,gbk,big5 | |
set ambiwidth=double | |
set formatoptions+=mM | |
"不在单词中间断行 | |
set lbr | |
"打开断行模块对亚洲语言支持 | |
set fo+=mb | |
set fileformat=unix | |
set guioptions-=r | |
set history=50 | |
set ignorecase | |
set nobackup | |
set nocompatible | |
set noic | |
set noswapfile | |
set nowrap | |
set nowrapscan | |
set nu | |
set ruler | |
set shiftwidth=4 | |
set showcmd | |
set showmatch | |
set expandtab | |
set softtabstop=4 | |
set tabstop=4 | |
set list | |
set listchars=tab:>-,trail:- | |
set mouse=a | |
"set clipboard=unnamed | |
syntax on | |
" GUI options | |
set guioptions-=r | |
set guioptions-=R | |
set guioptions-=L | |
let mapleader="," | |
" vundle | |
filetype off | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" plugins | |
Plugin 'VundleVim/Vundle.vim' | |
Plugin 'FuzzyFinder' | |
Plugin 'L9' | |
Plugin 'mileszs/ack.vim' | |
Plugin 'SuperTab' | |
Plugin 'wting/rust.vim' | |
Plugin 'VST' | |
Plugin 'klen/python-mode' | |
Plugin 'plasticboy/vim-markdown' | |
Plugin 'ekalinin/Dockerfile.vim' | |
Plugin 'tomasr/molokai' | |
Plugin 'tpope/vim-fugitive' | |
Plugin 'fatih/vim-go' | |
Plugin 'Shougo/neocomplete.vim' | |
Plugin 'ervandew/supertab' | |
Plugin 'dgryski/vim-godef' | |
Plugin 'Raimondi/delimitMate' | |
Plugin 'nsf/gocode', {'rtp': 'vim/'} | |
call vundle#end() | |
filetype plugin indent on | |
nmap bk :b# <cr> | |
" Go | |
let g:go_fmt_command = "goimports" | |
au FileType go nmap gob <Plug>(go-build) | |
au FileType go nmap gor :GoRun %<cr> | |
au FileType go nmap got <Plug>(go-test) | |
au FileType go nmap godoc <Plug>(go-doc) | |
au FileType go nmap vgodoc <Plug>(go-doc-vertical) | |
" Python | |
" map <silent><leader>d :!python -m pdb %<ENTER> | |
let g:pymode = 1 | |
let g:pymode_doc = 1 | |
let g:pymode_trim_whitespaces = 1 | |
let g:pymode_rope = 0 | |
let g:pymode_folding = 0 | |
let g:pymode_doc_bind = 'K' | |
let g:pymode_run_bind = "<silent><leader>p" | |
" pylint | |
let g:pymode_lint_on_fly = 0 | |
let g:pymode_lint_on_write = 1 | |
nmap <silent> <leader>l :PymodeLint<cr> | |
nmap <silent> <leader>8 :PymodeLintAuto<cr> | |
autocmd BufNewFile setup.py 0r ~/.vim/template/python/setup.py | |
autocmd BufNewFile *.py 0r ~/.vim/template/python/pythonconfig.py | |
" Complete | |
" Disable AutoComplPop. | |
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 = 2 | |
let g:neocomplete#lock_buffer_name_pattern = '\*ku\*' | |
" Define dictionary. | |
let g:neocomplete#sources#dictionary#dictionaries = { | |
\ 'default' : '', | |
\ 'vimshell' : $HOME.'/.vimshell_hist', | |
\ 'scheme' : $HOME.'/.gosh_completions' | |
\ } | |
" Define keyword. | |
if !exists('g:neocomplete#keyword_patterns') | |
let g:neocomplete#keyword_patterns = {} | |
endif | |
let g:neocomplete#keyword_patterns['default'] = '\h\w*' | |
" Plugin key-mappings. | |
inoremap <expr><C-g> neocomplete#undo_completion() | |
inoremap <expr><C-l> neocomplete#complete_common_string() | |
" Recommended key-mappings. | |
" <CR>: close popup and save indent. | |
inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR> | |
function! s:my_cr_function() | |
return neocomplete#close_popup() . "\<CR>" | |
" For no inserting <CR> key. | |
"return pumvisible() ? neocomplete#close_popup() : "\<CR>" | |
endfunction | |
" <TAB>: completion. | |
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>" | |
" <C-h>, <BS>: close popup and delete backword char. | |
inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>" | |
inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>" | |
inoremap <expr><C-y> neocomplete#close_popup() | |
inoremap <expr><C-e> neocomplete#cancel_popup() | |
" Enable omni completion. | |
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 | |
" Enable heavy omni completion. | |
if !exists('g:neocomplete#sources#omni#input_patterns') | |
let g:neocomplete#sources#omni#input_patterns = {} | |
endif | |
"let g:neocomplete#sources#omni#input_patterns.php = '[^. \t]->\h\w*\|\h\w*::' | |
"let g:neocomplete#sources#omni#input_patterns.c = '[^.[:digit:] *\t]\%(\.\|->\)' | |
"let g:neocomplete#sources#omni#input_patterns.cpp = '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::' | |
" For perlomni.vim setting. | |
" https://github.com/c9s/perlomni.vim | |
let g:neocomplete#sources#omni#input_patterns.perl = '\h\w*->\h\w*\|\h\w*::' | |
" Git | |
nmap <silent> <leader>g :Gcommit<cr> | |
" WinManager | |
" let g:winManagerWindowLayout='BufExplorer|FileExplorer' | |
" nmap <silent> <leader>w :WMToggle<cr> | |
" nmap <silent> <leader>wb :FirstExplorerWindow<cr> | |
" nmap <silent> <leader>wl :BottomExplorerWindow<cr> | |
" BufExplorej | |
let g:bufExplorerDefaultHelp=0 | |
let g:bufExplorerSortBy='mru' | |
let g:bufExplorerSplitRight=0 | |
let g:bufExplorerSplitVertical=1 | |
let g:bufExplorerSplitVertSize = 30 | |
let g:bufExplorerUseCurrentWindow=1 | |
autocmd BufWinEnter \[Buf\ List\] setl nonumber | |
" delimitMate | |
let delimitMate_nesting_quotes = ['"','`'] | |
let delimitMate_jump_expansion = 1 | |
let delimitMate_expand_space = 1 | |
let delimitMate_expand_cr = 1 | |
" python doc string require this | |
au FileType python let b:delimitMate_expand_inside_quotes = 1 | |
au FileType python let b:delimitMate_nesting_quotes = ['"', "'"] | |
" Paste toggle - when pasting something in, don't indent. | |
" set pastetoggle=<leader>v | |
" Molokai | |
set t_Co=256 | |
colorscheme molokai | |
" For fuzzyfinder | |
map <leader>r :FufFile<CR> | |
map <D-r> :FufFile<CR> | |
map <D-d> :FufDir<CR> | |
"a leading space allows a recursive search | |
let g:fuf_abbrevMap = { | |
\ "^ " : [ "**/", ], | |
\ } | |
" For macvim | |
if has("gui_macvim") | |
" Map shortcuts for tab operations | |
nmap <D-1> 1gt | |
nmap <D-2> 2gt | |
nmap <D-3> 3gt | |
nmap <D-4> 4gt | |
nmap <D-5> 5gt | |
nmap <D-6> 6gt | |
nmap <D-7> 7gt | |
nmap <D-8> 8gt | |
nmap <D-9> 9gt | |
set guitablabel=[%N]%m%r%h%w%f | |
let macvim_hig_shift_movement = 1 | |
set macmeta | |
" Set font for MacVIM | |
"set guifont=YaHei\ Consolas\ Hybrid:h16 | |
set guifont=Panic\ Sans:h18 | |
" Use transparent background | |
" if &background == "dark" | |
" hi normal guibg=black | |
" set transparency=15 | |
" endif | |
set transparency=5 | |
endif | |
" Windows split | |
map <c-j> <c-w>j | |
map <c-k> <c-w>k | |
map <c-l> <c-w>l | |
map <c-h> <c-w>h | |
map <c-d> <c-w>q | |
nmap <leader>n <c-w>v | |
nmap <leader>N <c-w>s | |
" Ack searching | |
nmap <leader>a <Esc>:Ack! | |
" Vimrc | |
nmap <leader>s :source ~/.vimrc<cr> | |
nmap <leader>e :e ~/.vimrc<cr> | |
" Clean | |
nmap <silent> <Leader>c :pclose <bar> ccl <bar> lcl<cr> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment