Skip to content

Instantly share code, notes, and snippets.

@vinceyuan
Created May 30, 2016
Embed
What would you like to do?
My vim configuration
execute pathogen#infect()
syntax on
filetype plugin indent on
set number
set rnu
set tabstop=4 shiftwidth=4 smarttab
colorscheme molokai
set cursorline " Highlight current cursor line
set autoread " Auto reload when file changed by other programs
" Set tab spaces by file type
autocmd Filetype html setlocal ts=2 sw=2 expandtab
autocmd Filetype ruby setlocal ts=2 sw=2 expandtab
autocmd Filetype css setlocal ts=2 sw=2 expandtab
autocmd Filetype javascript setlocal ts=2 sw=2 expandtab
" Put all ext~ .swp .un~ files in the following folders
" Using double trailing slashes in the path tells vim to enable a feature
" where it avoids name collisions.
set backupdir=~/.vim/backup//
set directory=~/.vim/swap//
set undodir=~/.vim/undo//
" Copy selection to OS X clipboard
set clipboard=unnamed
" Auto-close preview window (autocomplete)
autocmd CompleteDone * pclose
" set <Leader> ; (default is \)
let mapleader=";"
" ----------Key bindings-----------
" Switch window
nmap <Leader>wh <C-w>h
nmap <Leader>wj <C-w>j
nmap <Leader>wk <C-w>k
nmap <Leader>wl <C-w>l
" Go to (definition)
nmap <Leader>gd :YcmCompleter GoTo<CR>
" Save and make
nmap <Leader>m :wa<CR>:make<CR><CR>:cw<CR><CR>
nmap <F2> :YcmRestartServer<CR>
nmap <F7> :NERDTreeToggle<CR>
nmap <F8> :TagbarToggle<CR>
"--------------Plugin Settings--------------
" vim-go
let g:go_disable_autoinstall = 0
" Enable goimports when save file
let g:go_fmt_command = "goimports"
" tagbar
let g:tagbar_type_go = {
\ 'ctagstype' : 'go',
\ 'kinds' : [
\ 'p:package',
\ 'i:imports:1',
\ 'c:constants',
\ 'v:variables',
\ 't:types',
\ 'n:interfaces',
\ 'w:fields',
\ 'e:embedded',
\ 'm:methods',
\ 'r:constructor',
\ 'f:functions'
\ ],
\ 'sro' : '.',
\ 'kind2scope' : {
\ 't' : 'ctype',
\ 'n' : 'ntype'
\ },
\ 'scope2kind' : {
\ 'ctype' : 't',
\ 'ntype' : 'n'
\ },
\ 'ctagsbin' : 'gotags',
\ 'ctagsargs' : '-sort -silent'
\ }
" YouCompleteMe
"Do not ask when starting vim
let g:ycm_confirm_extra_conf = 0
let g:ycm_server_use_vim_stdout = 0
let g:ycm_server_keep_logfiles = 1
let g:ycm_server_log_level = 'debug'
"let g:ycm_path_to_python_interpreter = '/usr/local/bin/python'
" airline
let g:airline_left_sep=''
let g:airline_right_sep=''
" vim-jsx
" Enable in .js files
let g:jsx_ext_required = 0
" syntastic
" Use eslint to check syntax for js and jsx
let g:syntastic_javascript_checkers = ['eslint']
" Passive mode for some types of files
let g:syntastic_mode_map = { 'passive_filetypes': ['go'] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment