Last active
July 15, 2017 09:56
-
-
Save CMGS/7810fd252d5283bb0a3efad53d5a1718 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 hidden | |
"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 'VST' | |
Plugin 'L9' | |
Plugin 'mileszs/ack.vim' | |
Plugin 'wting/rust.vim' | |
Plugin 'klen/python-mode' | |
Plugin 'plasticboy/vim-markdown' | |
Plugin 'ekalinin/Dockerfile.vim' | |
Plugin 'tomasr/molokai' | |
Plugin 'tpope/vim-fugitive' | |
Plugin 'fatih/vim-go' | |
Plugin 'Valloric/YouCompleteMe' | |
Plugin 'Raimondi/delimitMate' | |
Plugin 'romainl/vim-qf' | |
call vundle#end() | |
filetype plugin indent on | |
" Go | |
let g:go_fmt_command = "goimports" | |
let g:go_def_mode = "godef" | |
au FileType go nmap <Leader>t <Plug>(go-def-stack) | |
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_rope_completion = 1 | |
let g:pymode_rope_completion_on_dot = 1 | |
let g:pymode_rope_autoimport_import_after_complete = 0 | |
let g:pymode_rope_goto_definition_bind = '' | |
let g:pymode_rope_goto_definition_cmd = 'new' | |
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 | |
"让Vim的补全菜单行为与一般IDE一致(参考VimTip1228) | |
set completeopt=longest,menu | |
" YouCompleteMe { | |
nnoremap <C-c>g :YcmCompleter GoTo<CR> | |
nnoremap K :YcmCompleter GetDoc<CR> | |
"let g:ycm_python_binary_path = '/usr/local/bin/python3' | |
let g:ycm_gocode_binary_path = "/Users/CMGS/.go/bin/gocode" | |
let g:ycm_godef_binary_path = "/Users/CMGS/.go/bin/godef" | |
let g:ycm_goto_buffer_command = 'vertical-split' | |
let g:ycm_key_list_select_completion = ['<TAB>', '<DOWN>'] | |
let g:ycm_key_list_previous_completion = ['<S-TAB>', '<UP>'] | |
"let g:ycm_key_invoke_completion = '<SPACE>' | |
"let g:ycm_key_list_select_completion = ['j', '<Down>'] | |
"let g:ycm_key_list_previous_completion = ['k', '<Up>'] | |
let g:ycm_autoclose_preview_window_after_completion=1 | |
let g:ycm_min_num_identifier_candidate_chars = 2 | |
" good for writing python comments | |
let g:ycm_complete_in_comments = 1 | |
"let g:ycm_complete_in_strings = 1 | |
" python built-in function & keywords completion | |
let g:ycm_seed_identifiers_with_syntax = 1 | |
let g:ycm_collect_identifiers_from_comments_and_strings = 1 | |
let g:ycm_collect_identifiers_from_tags_files = 1 | |
let g:ycm_filetype_blacklist = { | |
\ 'tagbar' : 1, | |
\ 'qf' : 1, | |
\ 'notes' : 1, | |
\ 'unite' : 1, | |
\ 'text' : 1, | |
\ 'vimwiki' : 1, | |
\ 'pandoc' : 1, | |
\ 'infolog' : 1, | |
\ 'mail' : 1 | |
\} | |
" } | |
" Git | |
nmap <silent> <leader>g :Gcommit<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 = { | |
\ "^ " : [ "**/", ], | |
\ } | |
nnoremap <C-N> :bn<CR> | |
nnoremap <C-P> :bp<CR> | |
" 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> |
Author
CMGS
commented
Jul 15, 2017
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment