-
-
Save lvjian700/0c0fc6682b1bc069e808 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 nu | |
set history=500 | |
set autoread | |
set wildmenu | |
" https://github.com/junegunn/vim-plug | |
set nocompatible " be iMproved | |
call plug#begin('~/.vim/plugged') | |
" edited | |
Plug 'tmhedberg/matchit' | |
Plug 'haya14busa/incsearch.vim' | |
Plug 'osyo-manga/vim-over' | |
Plug 'junegunn/vim-easy-align' | |
Plug 'scrooloose/nerdcommenter' | |
Plug 'terryma/vim-expand-region' | |
Plug 'rstacruz/sparkup', {'rtp': 'vim/'} " Plug 'mattn/emmet-vim' Instead of emmet | |
Plug 'vim-scripts/PreserveNoEOL' | |
" searching | |
Plug 'eugen0329/vim-esearch' | |
Plug 'mileszs/ack.vim' | |
" theme | |
Plug 'tomasr/molokai' | |
Plug 'kristijanhusak/vim-hybrid-material' | |
" Navigation | |
Plug 'kien/ctrlp.vim' | |
Plug 'yegappan/mru' | |
Plug 'scrooloose/nerdtree' | |
Plug 'Xuyuanp/nerdtree-git-plugin' | |
" coding | |
Plug 'tpope/vim-surround' | |
"neocomplete | |
Plug 'MarcWeber/vim-addon-mw-utils' | |
Plug 'tomtom/tlib_vim' | |
Plug 'garbas/vim-snipmate' | |
Plug 'honza/vim-snippets' | |
Plug 'Shougo/neocomplete' | |
"Plug 'Shougo/neosnippet' | |
"Plug 'Shougo/neosnippet-snippets' | |
"Plug 'Shougo/neosnippet' | |
"Plug 'Shougo/neosnippet-snippets' | |
" https://github.com/Shougo/deoplete.nvim | |
Plug 'airblade/vim-gitgutter' | |
Plug 'maksimr/vim-jsbeautify' | |
Plug 'wakatime/vim-wakatime' | |
Plug 'tpope/vim-fugitive' | |
Plug 'tpope/vim-sleuth' | |
" ruby | |
Plug 'vim-ruby/vim-ruby' | |
Plug 'tpope/vim-rails' | |
Plug 'jiangmiao/auto-pairs' | |
Plug 'tpope/vim-endwise' | |
"Plug 'tpope/vim-rake' | |
Plug 'lvjian700/vim-rake' | |
Plug 'tpope/vim-projectionist' | |
" vue.js | |
Plug 'posva/vim-vue' | |
"language | |
Plug 'groenewege/vim-less', { 'for' : 'less' } | |
Plug 'slim-template/vim-slim', { 'for' : 'slim' } | |
Plug 'digitaltoad/vim-pug' | |
Plug 'isRuslan/vim-es6' | |
Plug 'junegunn/goyo.vim', { 'for': 'markdown' } | |
autocmd! User goyo.vim echom 'Goyo is now loaded!' | |
Plug 'ekalinin/Dockerfile.vim' | |
"iOS and Swift | |
Plug 'lvjian700/vim-fastlane' | |
Plug 'lvjian700/swift.vim', { 'for': 'swift' } | |
" Protobuffer | |
Plug 'uarun/vim-protobuf' | |
Plug 'jparise/vim-graphql' | |
" UI Improve | |
Plug 'vim-airline/vim-airline' | |
Plug 'vim-airline/vim-airline-themes' | |
Plug 'Shougo/vimproc.vim', { 'do' : 'make' } | |
" Mac Dash.app | |
Plug 'rizzatti/funcoo.vim' | |
Plug 'rizzatti/dash.vim' | |
call plug#end() | |
"encoding setting | |
set enc=utf-8 | |
set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312 | |
set helplang=cn | |
set encoding=utf-8 | |
"""""""""""""""" | |
" set fonts | |
"""""""""""""""" | |
if has("gui_running") | |
set guifont=Anonymous\ Pro:h18 | |
"set guifont=Anonymous\ Pro:h14 | |
"set guifont=Anonymous\ Pro:h16 | |
"set guifont=Anonymous\ Pro:h24 | |
"set guifont=Anonymous\ Pro:h13 | |
endif | |
" show invisable | |
set listchars=tab:>-,trail:- | |
set list | |
"set backup | |
set backupdir-=. | |
set backupdir^=~/tmp,/tmp | |
set backspace=indent,eol,start | |
"indent mode | |
set autoindent | |
set linespace=2 | |
"seach history length | |
set history=50 | |
"show line and column number | |
set ruler | |
"display command | |
set showcmd | |
"searching immediatly | |
set incsearch | |
"""""""""""""""""""""" | |
" Mappings | |
"""""""""""""""""""""" | |
vnoremap p <Esc>:let current_reg=@"<CR>gvs<C-R>=current_reg<CR><Esc> | |
if &t_Co > 2 || has("gui_running") | |
syntax on | |
set hlsearch | |
endif | |
autocmd FileType text setlocal textwidth=80 | |
"""""""""""""""""""""""""" | |
" About Tab | |
"""""""""""""""""""""""""" | |
set expandtab "convert tab to space | |
set smarttab | |
set tabstop=2 "a tab equals 4 space" | |
set shiftwidth=2 | |
set softtabstop=2 | |
autocmd FileType sh setlocal tabstop=2 | |
autocmd FileType sh setlocal shiftwidth=2 | |
autocmd FileType sh setlocal softtabstop=2 | |
autocmd FileType swift setlocal tabstop=2 | |
autocmd FileType swift setlocal shiftwidth=2 | |
autocmd FileType swift setlocal softtabstop=2 | |
autocmd FileType html setlocal tabstop=2 | |
autocmd FileType html setlocal shiftwidth=2 | |
autocmd FileType html setlocal softtabstop=2 | |
autocmd FileType javascript setlocal tabstop=2 | |
autocmd FileType javascript setlocal shiftwidth=2 | |
autocmd FileType javascript setlocal softtabstop=2 | |
au BufNewFile,BufRead *.gradle setf groovy | |
au BufNewFile,BufRead Podfile,*.podspec set filetype=ruby | |
"""""""""""""""""""""""""" | |
" Move between different window | |
"""""""""""""""""""""""""" | |
map <C-j> <C-W>j | |
map <C-k> <C-W>k | |
map <C-h> <C-W>h | |
map <C-l> <C-W>l | |
" vim expand region, like IDEA | |
" https://github.com/terryma/vim-expand-region | |
" Alt + w or Alt + W | |
map K <Plug>(expand_region_expand) | |
" Alt + * move line | |
" http://vim.wikia.com/wiki/Moving_lines_up_or_down | |
nnoremap ∆ :m .+1<CR>== | |
nnoremap ˚ :m .-2<CR>== | |
inoremap ∆ <Esc>:m .+1<CR>==gi | |
inoremap ˚ <Esc>:m .-2<CR>==gi | |
vnoremap ∆ :m '>+1<CR>gv=gv | |
vnoremap ˚ :m '<-2<CR>gv=gv | |
" hightline current line and column | |
au WinLeave * set nocursorline nocursorcolumn | |
au WinEnter * set cursorline cursorcolumn | |
set cursorline cursorcolumn | |
" search and replace | |
nnoremap <Leader>s :%s/\<<C-r><C-w>\>//gc<Left><Left><Left> | |
"""""""""""""""""""""""""" | |
" color theme | |
"""""""""""""""""""""""""" | |
set t_Co=256 | |
"let g:molokai_original = 1 | |
"color molokai | |
" colorscheme hybrid_material | |
set background=dark | |
color hybrid_reverse | |
" incsearch.vim | |
" https://github.com/haya14busa/incsearch.vim | |
map / <Plug>(incsearch-forward) | |
map ? <Plug>(incsearch-backward) | |
map g/ <Plug>(incsearch-stay) | |
map n <Plug>(incsearch-nohl-n) | |
map N <Plug>(incsearch-nohl-N) | |
map * <Plug>(incsearch-nohl-*) | |
map # <Plug>(incsearch-nohl-#) | |
map g* <Plug>(incsearch-nohl-g*) | |
map g# <Plug>(incsearch-nohl-g#) | |
let g:incsearch#auto_nohlsearch = 1 | |
" NerdTree | |
map <F8> :NERDTreeToggle<CR> | |
map <F9> :NERDTreeFind<CR> | |
autocmd StdinReadPre * let s:std_in=1 | |
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif | |
" Aireline | |
set laststatus=2 | |
set ttimeoutlen=50 | |
let g:airline_enable_fugitive=1 | |
let g:airline_section_b='%{fugitive#statusline()}' | |
let g:airline_section_c="%t" | |
let g:airline_section_x="%y" | |
let g:airline_section_y='BN: %{bufnr("%")}' | |
let g:airline_theme = "hybrid" | |
" MRU | |
map <F2> :MRU<cr> | |
let MRU_Max_Entries=1000 | |
let MRU_Exclude_Files = '^/tmp/.*\|^/var/tmp/.*' | |
" when .vimrc is edited, reload it | |
autocmd! bufwritepost .vimrc source ~/.vimrc | |
""""""""""""""""""""""""" | |
" setting ctrlp plugin | |
""""""""""""""""""""""""" | |
set runtimepath^=~/.vim/bundle/ctrlp.vim | |
let g:ctrlp_root_markers = ['.ctrlp'] | |
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,.DS_Store,*~ " MacOSX/Linux | |
set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe " Windows | |
set wildignore+=.classpath,.project,.settings/*,*.jar,*.classes,.idea,lib/,libs/,bin/ " java | |
set wildignore+=*.log,*.log.* | |
set wildignore+=.git,.hg,.svn "ignore git | |
set wildignore+=node_modules/ "node.js | |
set wildignore+=*/build/,target/*,compressed/*,out/* "complie folder | |
set wildignore+=*/Build/,*.xcassets,*.storyboard,*.png,*.jpg,*.gif " iOS project | |
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$' | |
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . -co --exclude-standard', 'find %s -type f'] | |
" Dash.app for mac os | |
nmap <silent> <leader>? <Plug>DashSearch | |
" 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*' | |
""""""""""""""""""""""""""""" | |
" matchit | |
""""""""""""""""""""""""""""""" | |
let g:user_emmet_leader_key='<C-z>' | |
" Start interactive EasyAlign in visual mode (e.g. vipga) | |
xmap ga <Plug>(EasyAlign) | |
" Start interactive EasyAlign for a motion/text object (e.g. gaip) | |
nmap ga <Plug>(EasyAlign) | |
" ESearch configuration | |
" https://github.com/eugen0329/vim-esearch | |
let g:esearch = { | |
\ 'adapter': 'ag', | |
\ 'backend': 'vimproc', | |
\ 'out': 'win', | |
\ 'batch_size': 1000, | |
\ 'use': ['visual', 'hlsearch', 'last'], | |
\} | |
cnoreabbrev Ack Ack! | |
if executable('ag') | |
let g:ackprg = 'ag --vimgrep --smart-case' | |
endi | |
cnoreabbrev ag Ack | |
cnoreabbrev aG Ack | |
cnoreabbrev Ag Ack | |
cnoreabbrev AG Ack | |
" vim-bookmark | |
" https://github.com/MattesGroeger/vim-bookmarks | |
nmap <Leader><Leader> <Plug>BookmarkToggle | |
nmap <Leader>i <Plug>BookmarkAnnotate | |
nmap <Leader>a <Plug>BookmarkShowAll | |
nmap <Leader>j <Plug>BookmarkNext | |
nmap <Leader>k <Plug>BookmarkPrev | |
nmap <Leader>c <Plug>BookmarkClear | |
nmap <Leader>x <Plug>BookmarkClearAll | |
nmap <Leader>kk <Plug>BookmarkMoveUp | |
nmap <Leader>jj <Plug>BookmarkMoveDown | |
nmap <Leader>g <Plug>BookmarkMoveToLine | |
" Javascript | |
function! FormatJSON() | |
%!python -m json.tool 2>/dev/null || echo <buffer> | |
endfunction | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment