Skip to content

Instantly share code, notes, and snippets.

@medicalwei
Created October 1, 2018 01:36
Show Gist options
  • Save medicalwei/656d82239b3cc352456c9353c674aa54 to your computer and use it in GitHub Desktop.
Save medicalwei/656d82239b3cc352456c9353c674aa54 to your computer and use it in GitHub Desktop.
" goodbye vi
set nocompatible
" plug
filetype off
call plug#begin('~/.vim/plugged')
" Git
Plug 'tpope/vim-fugitive'
" Theme
Plug 'bling/vim-airline'
Plug 'altercation/vim-colors-solarized'
" Snippets / Autocomplete
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
Plug 'scrooloose/syntastic'
Plug 'Valloric/YouCompleteMe', { 'do': 'python install.py --go-completer --js-completer' }
" Tags
Plug 'majutsushi/tagbar'
" Indent guide
"Plug 'nathanaelkane/vim-indent-guides'
" Formatting
Plug 'sbdchd/neoformat'
" Golang
Plug 'fatih/vim-go'
" Flatbuffers
Plug 'dcharbon/vim-flatbuffers'
" Javascript
Plug 'othree/yajs.vim'
" File search
Plug 'ctrlpvim/ctrlp.vim'
Plug 'mileszs/ack.vim'
" Po
Plug 'vim-scripts/po.vim--gray'
call plug#end()
" basic config
filetype plugin indent on
syntax on
set fileencodings=ucs-bom,utf-8,big5,default,latin1
set autoindent smartindent
set smarttab
set incsearch
set number
set wildmenu
set tabstop=8
set shiftwidth=8
set mouse=a
set t_Co=256
set exrc
set secure
set colorcolumn=80
set formatoptions+=m " CJK linebreak
" tab settings
au FileType c,cpp,asm set cindent tabstop=8 shiftwidth=8
au FileType ruby set tabstop=2 shiftwidth=2 expandtab
au FileType python set tabstop=4 shiftwidth=4 expandtab
au FileType cs set tabstop=4 shiftwidth=4 expandtab
au FileType php set noexpandtab tabstop=4 shiftwidth=4 expandtab
au FileType java set tabstop=4 shiftwidth=4 expandtab
au FileType html,xml,xslt,jade set tabstop=2 shiftwidth=2
au FileType css,scss,less,stylus set tabstop=2 shiftwidth=2 expandtab
au FileType html,xml,xslt,jade set tabstop=2 shiftwidth=2
au FileType javascript,coffee,json set tabstop=2 shiftwidth=2
au FileType css,scss,less,stylus set tabstop=2 shiftwidth=2
au FileType markdown,text set tabstop=2 shiftwidth=2 expandtab linebreak
au FileType tex set spell spelllang=en_us wrap autochdir
au FileType go set cindent tabstop=8 shiftwidth=8
au FileType lua set cindent tabstop=2 shiftwidth=2 expandtab
" keyboard remapping
map Q gq
" clipboard
set clipboard=unnamedplus
" --- PLUGIN SETTINGS ---
" airline
set laststatus=2
let g:airline#extensions#whitespace#enabled = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
" solarized
if $TERM != "linux" || has("gui_gtk2")
set background=light
let g:solarized_hitrail=1
:call togglebg#map("")
colorscheme solarized
else
colorscheme evening
endif
" youcompleteme
let g:UltiSnipsExpandTrigger="<c-j>"
" vim-go
"let g:go_fmt_command = "goimports"
" neoformat
let g:neoformat_enabled_go = ['goimports']
let g:neoformat_enabled_javascript = ['prettier']
let g:neoformat_try_formatprg = 1
autocmd FileType javascript set formatprg=prettier\ --stdin
augroup fmt
autocmd!
autocmd BufWritePre * Neoformat
augroup END
" syntastic
let g:syntastic_enable_signs=1
let g:syntastic_go_checkers = ['go', 'govet']
let g:syntastic_sh_checkers = ['checkbashisms']
let g:syntastic_javascript_checkers = ['eslint']
" tagbar
map <F11> :TagbarToggle<CR>
" indent-lines
"let g:indent_guides_auto_colors = 1
"au VimEnter * IndentGuidesEnable
" ctrlp
let g:ctrlp_max_files=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment