Skip to content

Instantly share code, notes, and snippets.

@priancho
Last active March 26, 2019 10:39
Show Gist options
  • Save priancho/910fb97442ee0937fc34e9dd2343ab6d to your computer and use it in GitHub Desktop.
Save priancho/910fb97442ee0937fc34e9dd2343ab6d to your computer and use it in GitHub Desktop.
.vimrc
" Install Vim > 7.4.1578+ for YouCompleteMe
" $ sudo curl -L https://copr.fedorainfracloud.org/coprs/mcepl/vim8/repo/epel-7/mcepl-vim8-epel-7.repo -o /etc/yum.repos.d/mcepl-vim8-epel-7.repo
" $ sudo yum update vim*
" Install from source if you use CentOS 6.x
" $ git clone https://github.com/vim/vim.git
" $ cd vim
" $ ./configure --prefix=/usr --with-features=huge --enable-rubyinterp --enable-pythoninterp
" $ make; sudo make install
"
" Install Python 2.7 or > 3.4 for YouCompleteMe
" # In case of installing Python 2.7 for a single user.
" $ wget https://repo.continuum.io/archive/Anaconda2-5.1.0-Linux-x86_64.sh
" $ bash Anaconda2-5.1.0-Linux-x86_64.sh
"
" * Install Plug-Vim:
" $ curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
set nocompatible
set nu
set autoindent
set tabstop=4
set shiftwidth=4
set expandtab
set hlsearch
" Set background so colorscheme take it into consideration
set background=dark
" Use evening colorscheme for vimdiff
if &diff
colorscheme evening
endif
" Make highlight search more visible
hi Search ctermbg=LightCyan
hi Search ctermfg=Black
call plug#begin('~/.vim/plugged')
" Make sure you use single quotes
Plug 'junegunn/vim-easy-align'
Plug 'kien/rainbow_parentheses.vim'
Plug 'ervandew/supertab'
Plug 'https://github.com/bronson/vim-visual-star-search.git'
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
Plug 'halostatue/vim-zoom-win'
Plug 'altercation/vim-colors-solarized'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'google/vim-colorscheme-primary'
Plug 'google/vim-codefmt'
Plug 'google/vim-maktaba'
Plug 'google/vim-glaive'
" Python
Plug 'nvie/vim-flake8'
Plug 'hynek/vim-python-pep8-indent'
" Scala
Plug 'derekwyatt/vim-scala'
call plug#end()
" Start interactive EasyAlign in visual mode (e.g. vipga)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
xmap ga <Plug>(EasyAlign)
nmap ga <Plug>(EasyAlign)
" Use the following python for autocomplete
let g:ycm_python_binary_path = '/home/hccho/anaconda2/bin/python'
let g:ycm_autoclose_preview_window_after_insertion = 1
let g:ycm_autoclose_preview_window_after_completion = 1
" Shortcut
let mapleader = ","
nmap <leader>tt :NERDTreeToggle<cr>
nmap <leader>tw :NERDTree %<cr>
" Google opensource Vim plugins
syntax enable
"set t_Co=256
"set background=dark
"colorscheme primary
augroup autoformat_settings
autocmd FileType bzl AutoFormatBuffer buildifier
autocmd FileType c,cpp,proto,javascript AutoFormatBuffer clang-format
autocmd FileType dart AutoFormatBuffer dartfmt
autocmd FileType go AutoFormatBuffer gofmt
autocmd FileType gn AutoFormatBuffer gn
autocmd FileType html,css,json AutoFormatBuffer js-beautify
autocmd FileType java AutoFormatBuffer google-java-format
" autocmd FileType python AutoFormatBuffer yapf " Disable auto-apply
" Alternative: autocmd FileType python AutoFormatBuffer autopep8
augroup END
autocmd VimEnter * NERDTree
autocmd VimEnter * wincmd p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment