Skip to content

Instantly share code, notes, and snippets.

@htfy96
Created September 27, 2015 03:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save htfy96/abc3f45f1e69e186e8e6 to your computer and use it in GitHub Desktop.
Save htfy96/abc3f45f1e69e186e8e6 to your computer and use it in GitHub Desktop.
set nocompatible
set shell=/bin/bash
if &term =~ '^\(xterm\|screen\)$' && $COLORTERM == 'gnome-terminal'
set t_Co=256
endif
filetype on
filetype plugin on
set autoindent
set number
set nocompatible
filetype off " required
" set the runtime path to include Vundle and initialize
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
Bundle 'VundleVim/Vundle.vim'
" The following are examples of different formats supported.
" Keep Bundle commands between vundle#begin/end.
" plugin on GitHub repo
Bundle 'tpope/vim-fugitive'
Bundle 'octol/vim-cpp-enhanced-highlight'
Bundle 'Mizuchi/STL-Syntax'
Bundle 'hallison/vim-markdown'
Bundle 'skammer/vim-css-color'
Bundle 'vim-scripts/Perfect-Dark'
Bundle 'bling/vim-airline'
Bundle 'mhinz/vim-startify'
Bundle 'majutsushi/tagbar'
Bundle 'Shougo/neocomplete.vim'
Bundle 'scrooloose/nerdtree'
Bundle 'scrooloose/nerdcommenter'
Bundle 'tpope/vim-unimpaired'
Bundle 'Shougo/vimshell.vim'
Bundle 'xuhdev/SingleCompile'
Bundle 'scrooloose/syntastic'
Bundle 'Valloric/YouCompleteMe'
Bundle 'artur-shaik/vim-javacomplete2'
Bundle 'Shougo/vimproc.vim'
Bundle 'easymotion/vim-easymotion'
Bundle 'othree/html5.vim'
Bundle 'pangloss/vim-javascript'
Bundle 'JulesWang/css.vim'
Bundle 'mattn/jscomplete-vim'
Bundle 'rking/ag.vim'
Bundle 'wincent/command-t'
Bundle 'mattn/webapi-vim'
Bundle 'mattn/gist-vim'
Bundle 'vim-scripts/Loupe'
Bundle 'ntpeters/vim-airline-colornum'
Bundle 'gastonsimone/vim-dokumentary'
Bundle 'EinfachToll/DidYouMean'
Bundle 'tpope/vim-surround'
Plugin 'ctrlpvim/ctrlp.vim'
Bundle 'godlygeek/csapprox'
Bundle 'tpope/vim-rails'
Bundle 'vim-ruby/vim-ruby'
Bundle 'KabbAmine/zeavim.vim'
Bundle 'mustache/vim-mustache-handlebars'
Bundle 'def-lkb/vimbufsync'
Bundle 'atweiden/merlin.vim'
Bundle 'mxw/vim-jsx'
Bundle 'Shougo/neosnippet'
Bundle 'Shougo/neosnippet-snippets'
Bundle 'mattn/emmet-vim'
call vundle#end() " required
syntax on
set cursorline
set lines=45 columns=160
" detect file type
filetype on
filetype indent plugin on
colorscheme PerfectDark
" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
set background=dark
" Uncomment the following to have Vim jump to the last position when
" reopening a file
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
"have Vim load indentation rules and plugins according to the detected filetype
filetype plugin indent on
endif
" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
set autowrite
set autoindent
set smartindent
set tabstop=4
set smarttab
set softtabstop=4
set noexpandtab!
set cindent
set cinoptions={0,1s,t0,n-2,p2s,(03s,=.5s,>1s,=1s,:1s
set showmatch
set linebreak
set whichwrap=b,s,<,>,[,]
set hidden " Hide buffers when they are abandoned
set mouse=a
set number
set history=50 " set command history to 50
set laststatus=2
set ruler
set showcmd
set showmode
"--find setting--
set incsearch
set hlsearch
set guifont=CamingoCode\ 11
let NERDTreeMinimalUI=1
let NERDTreeWinSize=25
"Note: This option must set it in .vimrc(_vimrc). NOT IN .gvimrc(_gvimrc)!
" Disable AutoComplPop.
let g:acp_enableAtStartup = 0
" Use neocomplete.
let g:neocomplete#enable_at_startup = 1
let g:neocomplete#enable_auto_close_preview = 1
" Use smartcase.
let g:neocomplete#enable_smart_case = 1
" Set minimum syntax keyword length.
let g:neocomplete#sources#syntax#min_keyword_length = 3
let g:neocomplete#lock_buffer_name_pattern = '\*ku\*'
" Define dictionary.
let g:neocomplete#sources#dictionary#dictionaries = {
\ 'default' : '',
\ 'vimshell' : $HOME.'/.vimshell_hist',
\ 'scheme' : $HOME.'/.gosh_completions'
\ }
if !exists('g:neocomplete#force_omni_input_patterns')
let g:neocomplete#force_omni_input_patterns = {}
endif
let g:neocomplete#force_omni_input_patterns.ruby = '[^. *\t]\.\w*\|\h\w*::'
autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete
let g:rubycomplete_classes_in_global = 1
let g:rubycomplete_rails = 1
let g:rubycomplete_load_gemfile = 1
" Define keyword.
if !exists('g:neocomplete#keyword_patterns')
let g:neocomplete#keyword_patterns = {}
endif
let g:neocomplete#keyword_patterns['default'] = '\h\w*'
" Bundle key-mappings.
inoremap <expr><C-g> neocomplete#undo_completion()
inoremap <expr><C-l> neocomplete#complete_common_string()
" Recommended key-mappings.
" <CR>: close popup and save indent.
inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
function! s:my_cr_function()
return neocomplete#close_popup() . "\<CR>"
" For no inserting <CR> key.
"return pumvisible() ? neocomplete#close_popup() : "\<CR>"
endfunction
" <TAB>: completion.
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" <C-h>, <BS>: close popup and delete backword char.
inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>"
inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>"
inoremap <expr><C-y> neocomplete#close_popup()
inoremap <expr><C-e> neocomplete#cancel_popup()
" Close popup by <Space>.
inoremap <expr><Space> pumvisible() ? neocomplete#close_popup() : "\<Space>"
" For cursor moving in insert mode(Not recommended)
inoremap <expr><Left> neocomplete#close_popup() . "\<Left>"
inoremap <expr><Right> neocomplete#close_popup() . "\<Right>"
inoremap <expr><Up> neocomplete#close_popup() . "\<Up>"
inoremap <expr><Down> neocomplete#close_popup() . "\<Down>"
" Or set this.
let g:neocomplete#enable_cursor_hold_i = 1
" Or set this.
"let g:neocomplete#enable_insert_char_pre = 1
" AutoComplPop like behavior.
"let g:neocomplete#enable_auto_select = 1
" Shell like behavior(not recommended).
"set completeopt+=longest
"let g:neocomplete#enable_auto_select = 1
"let g:neocomplete#disable_auto_complete = 1
"inoremap <expr><TAB> pumvisible() ? "\<Down>" : "\<C-x>\<C-u>"
" Enable omni completion.
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
autocmd FileType java setlocal omnifunc=javacomplete#Complete
" Enable heavy omni completion.
if !exists('g:neocomplete#sources#omni#input_patterns')
let g:neocomplete#sources#omni#input_patterns = {}
endif
"let g:neocomplete#sources#omni#input_patterns.php = '[^. \t]->\h\w*\|\h\w*::'
"let g:neocomplete#sources#omni#input_patterns.c = '[^.[:digit:] *\t]\%(\.\|->\)'
"let g:neocomplete#sources#omni#input_patterns.cpp = '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::'
" For perlomni.vim setting.
" https://github.com/c9s/perlomni.vim
let g:neocomplete#sources#omni#input_patterns.perl = '\h\w*->\h\w*\|\h\w*::'
let g:neocomplete#enable_insert_char_pre = 1
set guioptions=Pra
let g:vimshell_split_command = "vsplit"
let g:vimshell_popup_command = "vsplit"
let g:ycm_confirm_extra_conf = 0
let g:SingleCompile_showquickfixiferror = 1
let g:SingleCompile_silentcompileifshowquickfix = 1
" Key maps
noremap <F2> :NERDTreeToggle<cr>
inoremap <F2> <C-o>:NERDTreeToggle<cr>
noremap <F3> :VimShellPop<cr>
inoremap <F3> <C-o>:VimShellPop<cr>
noremap <F8> :Tagbar<cr>
inoremap <F8> <C-o>:Tagbar<cr>
noremap <F9> :SCCompile<cr>
inoremap <F9> <C-o>:SCCompile<cr>
noremap <S-F9> :make<cr>
inoremap <S-F9> <C-o>:make<cr>
noremap <C-F9> :SCCompileRun<cr>
inoremap <C-F9> <C-o>:SCCompileRun<cr>
noremap <F5> :!gnome-terminal -e 'bash -c %:p:r;read -p'<cr><cr>
inoremap <F5> <C-o>:!gnome-terminal -e 'bash -c %:p:r;read -p'<cr><cr>
noremap <C-F5> :!gnome-terminal -e 'bash -c "gdb %:p:r"'<cr><cr>
inoremap <C-F5> <C-o>:!gnome-terminal -e 'bash -c "gdb %:p:r"'<cr><cr>
noremap <F6> mpggvG$"+y`p
inoremap <F6> <C-o>mpggvG$"+y`p
noremap <A-n> :cnext<cr>
inoremap <A-n> <C-o>:cnext<cr>
noremap <A-p> :cprev<cr>
inoremap <A-p> <C-o>:cprev<cr>
noremap <A-h> :lcd %:h<cr>
inoremap <A-h> <left>
inoremap <A-j> <Down>
inoremap <A-k> <Up>
inoremap <A-l> <Right>
set viminfo='100,n$HOME/.vim/files/info/viminfo
let g:syntastic_check_on_open = 1
let g:jsx_ext_required = 0
" Plugin key-mappings.
imap <C-k> <Plug>(neosnippet_expand_or_jump)
smap <C-k> <Plug>(neosnippet_expand_or_jump)
xmap <C-k> <Plug>(neosnippet_expand_target)
" SuperTab like snippets behavior.
"imap <expr><TAB>
" \ pumvisible() ? "\<C-n>" :
" \ neosnippet#expandable_or_jumpable() ?
" \ "\<TAB>" : "\<Plug>(neosnippet_expand_or_jump)"
smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
let g:ycm_filetype_whitelist = { 'cpp' : 1, 'c' : 1, 'python' : 1}
" For conceal markers.
if has('conceal')
set conceallevel=2 concealcursor=niv
endif
autocmd BufEnter * lcd %:h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment