Skip to content

Instantly share code, notes, and snippets.

@dhilst
Last active December 5, 2016 23:22
Show Gist options
  • Save dhilst/975e36919d1107c83f3f311f10be71d5 to your computer and use it in GitHub Desktop.
Save dhilst/975e36919d1107c83f3f311f10be71d5 to your computer and use it in GitHub Desktop.
syntax on
set background=dark
set laststatus=2
set smartindent
set autoindent
set modeline
set nocompatible
" execute pathogen#infect()
" Remember somethings
" http://vim.wikia.com/wiki/Restore_cursor_to_file_position_in_previous_editing_session
set viminfo='10,\"100,:20,%,n~/.viminfo
" cscope
if has("cscope")
nmap <C-C>s :scs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-C>g :scs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-C>c :scs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-C>t :scs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-C>e :scs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-C>f :scs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-C>i :scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-C>d :scs find d <C-R>=expand("<cword>")<CR><CR>
nmap <C-C><C-S> :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-C><C-G> :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-C><C-C> :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-C><C-T> :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-C><C-E> :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-C><C-F> :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-C><C-I> :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-C><C-D> :cs find d <C-R>=expand("<cword>")<CR><CR>
endif
set omnifunc=syntaxcomplete#Complete
" jump to last position when opening a file
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
if has("gui_running")
colorscheme desert
endif
set exrc
set secure
" Vundle: https://github.com/VundleVim/Vundle.vim
set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'mattn/webapi-vim'
Plugin 'mattn/gist-vim'
"Plugin 'artur-shaik/vim-javacomplete2'
"Plugin 'airblade/vim-rooter'
"Plugin 'JalaiAmitahl/maven-compiler.vim' " This conflicts with eclim
Plugin 'scrooloose/nerdtree'
Plugin 'Valloric/YouCompleteMe'
Plugin 'SirVer/ultisnips'
Plugin 'honza/vim-snippets'
Plugin 'ervandew/supertab'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
map <F2> :NERDTree<CR>
"Omni func setup http://vim.wikia.com/wiki/Omni_completion
filetype plugin on
autocmd Filetype c setlocal omnifunc=ccomplete#Complete
" autocmd Filetype java setlocal omnifunc=javacomplete#Complete
" let g:JavaComplete_JavaviLogfileDirectory = $HOME
let g:EclimCompletionMethod = 'omnifunc'
autocmd! BufWritePost *.java :JavaImportOrganize
autocmd! Filetype mvn_pom,xml nnoremap == :%!xmllint --format -<CR>
autocmd! Filetype java set ts=4 sw=4 noet
" make YCM compatible with UltiSnips (using supertab)
let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
let g:SuperTabDefaultCompletionType = '<C-n>'
" better key bindings for UltiSnipsExpandTrigger
let g:UltiSnipsExpandTrigger = "<tab>"
let g:UltiSnipsJumpForwardTrigger = "<tab>"
let g:UltiSnipsJumpBackwardTrigger = "<s-tab>"
inoremap <silent> {<cr> {<c-r>=UltiSnips#Anon("\n\t$1\n}")<cr>
call UltiSnips#AddSnippetWithPriority("ime", "${1:public} ${2:void} ${3:method}(${4:arg1});", "Java interface method snippet", "i", "java", 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment