Skip to content

Instantly share code, notes, and snippets.

@bliaxiong
Last active September 27, 2016 20:21
Show Gist options
  • Save bliaxiong/d3c2bd278e423083771bca9a2ff50363 to your computer and use it in GitHub Desktop.
Save bliaxiong/d3c2bd278e423083771bca9a2ff50363 to your computer and use it in GitHub Desktop.
set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'kien/ctrlp.vim'
Plugin 'scrooloose/nerdtree.git'
Plugin 'easymotion/vim-easymotion'
Bundle 'chase/vim-ansible-yaml'
Plugin 'nsf/gocode', {'rtp': 'vim/'}
Plugin 'fatih/vim-go'
Plugin 'jiangmiao/auto-pairs'
Plugin 'vim-scripts/tComment'
Plugin 'tpope/vim-eunuch'
Plugin 'tpope/vim-surround'
Plugin 'Yggdroot/indentLine'
Plugin 'Valloric/YouCompleteMe'
Plugin 'vim-ruby/vim-ruby'
Plugin 'tpope/vim-endwise'
Plugin 'scrooloose/syntastic'
Plugin 'ervandew/supertab'
Plugin 'tpope/vim-rails'
Plugin 'drmikehenry/vim-fontsize'
Plugin 'bpdp/vim-java'
Plugin 'tfnico/vim-gradle'
Plugin 'derekwyatt/vim-scala'
Plugin 'artur-shaik/vim-javacomplete2'
Plugin 'Junza/Spink'
call vundle#end() " required
filetype plugin indent on
:inoremap <D-s> <Esc>:w<CR> "" Auto save with ESC
:imap ii <Esc>:w<CR>
:vmap "*yy yyy "" Copy to system clipboard
" javacomplete2
autocmd FileType java setlocal omnifunc=javacomplete#Complete
nmap <F4> <Plug>(JavaComplete-Imports-AddSmart)
imap <F4> <Plug>(JavaComplete-Imports-AddSmart)
nmap <F5> <Plug>(JavaComplete-Imports-Add)
imap <F5> <Plug>(JavaComplete-Imports-Add)
nmap <F6> <Plug>(JavaComplete-Imports-AddMissing)
imap <F6> <Plug>(JavaComplete-Imports-AddMissing)
nmap <F7> <Plug>(JavaComplete-Imports-RemoveUnused)
imap <F7> <Plug>(JavaComplete-Imports-RemoveUnused)
" end javacomplete2
let mapleader=","
noremap <leader>f :CtrlP<CR>
"" Add full file path to your existing statusline
set statusline+=%F
set clipboard=unnamed
set nowrap " don't wrap lines
set tabstop=2 shiftwidth=2 " a tab is two spaces (or set this to 4)
set expandtab " use spaces, not tabs (optional)
syntax on
set nocompatible " We're running Vim, not Vi!
syntax on " Enable syntax highlighting
filetype on " Enable filetype detection
filetype indent on " Enable filetype-specific indenting
filetype plugin on " Enable filetype-specific plugins
"
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
set showcmd " display incomplete commands
set encoding=utf-8
set fileencoding=utf-8
set showmatch " show the matching (){} [] etc
noremap { {}<Left>
inoremap {<CR> {<CR>}<Esc>O
inoremap {{ {
inoremap {} {}
inoremap ( ()<Left>
inoremap <expr> ) strpart(getline('.'), col('.')-1, 1) == ")" ? "\<Right>" : ")"
autocmd WinEnter * call s:CloseIfOnlyNerdTreeLeft()
" Close all open buffers on entering a window if the only buffer that's left is the NERDTree buffer
function! s:CloseIfOnlyNerdTreeLeft()
if exists("t:NERDTreeBufName")
if bufwinnr(t:NERDTreeBufName) != -1
if winnr("$") == 1
q
endif
endif
endif
endfunction
autocmd VimEnter * NERDTree | wincmd p
let mapleader=","
set backspace=indent,eol,start
set history=1000 " remember more commands and search history
set undolevels=1000
"set list
set mouse=a
set number
""set spell
set history=1000
set cursorline
set showmatch
set incsearch
set hlsearch
set ignorecase
set scrolljump=5
set scrolloff=5
set tabstop=4
let g:ansible_options = {'ignore_blank_lines': 0}
"" Go vim
au FileType go nmap <leader>r <Plug>(go-run)
au FileType go nmap <leader>b <Plug>(go-build)
au FileType go nmap <leader>t <Plug>(go-test)
au FileType go nmap <leader>c <Plug>(go-coverage)
"" Go vim syntax highlighting
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_fields = 1
let g:go_highlight_types = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
let g:go_fmt_command = "goimports"
"" Enable goimports to automatically insert import paths instead of gofmt
let g:go_fmt_command = "goimports"
let g:go_fmt_autosave = 0
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
autocmd FileType ruby,eruby let g:rubycomplete_buffer_loading = 1
autocmd FileType ruby,eruby let g:rubycomplete_classes_in_global = 1
autocmd FileType ruby,eruby let g:rubycomplete_rails = 1
" vertical line indentation
let g:indentLine_color_term = 239
let g:indentLine_color_gui = '#09AA08'
let g:indentLine_char = '│'
let g:ycm_semantic_triggers = {'ruby': ['.','::'],'go,java,javascript,typescript': ['.']}
let g:ycm_cache_omnifunc = 1
let g:ycm_disable_for_files_larger_than_kb = 2000
let g:ycm_python_binary_path = '/Users/z001kxv/.pyenv/shims/python'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment