Created
October 15, 2016 17:01
-
-
Save siawyoung/f87075bced70944480c5f5199ed54cb2 to your computer and use it in GitHub Desktop.
My vimrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if !has('nvim') | |
set nocompatible | |
endif | |
set hidden | |
syntax on | |
filetype off | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#rc() | |
" Let Vundle manage Vundle | |
Bundle 'gmarik/Vundle.vim' | |
"""Colour scheme"N" | |
Plugin 'jacoborus/tender' | |
Bundle 'tpope/vim-sensible' | |
Bundle 'tpope/vim-surround' | |
Bundle 'tpope/vim-fugitive' | |
Bundle 'tpope/vim-sleuth' | |
Plugin 'vim-airline/vim-airline' | |
Plugin 'vim-airline/vim-airline-themes' | |
Bundle 'scrooloose/syntastic' | |
Bundle 'myint/syntastic-extras' | |
Bundle 'scrooloose/nerdtree' | |
Bundle 'jistr/vim-nerdtree-tabs' | |
Bundle 'kien/ctrlp.vim' | |
Bundle 'tacahiroy/ctrlp-funky' | |
Bundle 'rking/ag.vim' | |
Bundle 'nvie/vim-flake8' | |
Bundle 'Raimondi/delimitMate' | |
Plugin 'ntpeters/vim-better-whitespace' | |
Plugin 'airblade/vim-gitgutter' | |
Plugin 'scrooloose/nerdcommenter' | |
Plugin 'Valloric/YouCompleteMe' | |
Plugin 'terryma/vim-expand-region' | |
" Enable to copy to clipboard for operations like yank, delete, change and put | |
" http://stackoverflow.com/questions/20186975/vim-mac-how-to-copy-to-clipboard-without-pbcopy | |
if has('unnamedplus') | |
set clipboard^=unnamed | |
set clipboard^=unnamedplus | |
endif | |
" This enables us to undo files even if you exit Vim. | |
if has('persistent_undo') | |
set undofile | |
set undodir=~/.config/vim/tmp/undo// | |
endif | |
" Quick ESC | |
imap jj <ESC> | |
" Map leader to Space | |
let mapleader = "\<Space>" | |
" Map <leader>w to save file | |
nnoremap <Leader>w :w<CR> | |
""" General settings""" | |
""""""""""""""""""""""" | |
" set cursor to line | |
set cursorline | |
" Convert tabs to spaces | |
set expandtab | |
set modelines=0 | |
set clipboard=unnamed | |
set encoding=utf-8 | |
set wrap | |
set number | |
set nowritebackup | |
set noswapfile | |
set nobackup | |
" highlight search result | |
set hlsearch | |
set ignorecase | |
set smartcase | |
" escape to cancel search | |
nnoremap <silent> <Esc> :nohlsearch<Bar>:echo<CR> | |
" remove whitespace on save | |
autocmd BufWritePre * :%s/\s\+$//e | |
""" Plugin specific settings""" | |
""""""""""""""""""""""""""""""" | |
"airline | |
let g:airline_left_sep='' | |
let g:airline_right_sep='' | |
let g:airline_section_z='' | |
" NERDTree | |
" Open NERDTree automatically on startup | |
autocmd StdinReadPre * let s:std_in=1 | |
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif | |
" Toggle NERDTree with Ctrl-N | |
map <C-n> :NERDTreeToggle<CR> | |
" Ctrl-P | |
" Make Ctrl-P much faster by using git/silver searcher for autocompletion | |
" Also ignores files in gitignore | |
let g:ctrlp_use_caching = 0 | |
if executable('ag') | |
set grepprg=ag\ --nogroup\ --nocolor | |
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' | |
else | |
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . -co --exclude-standard', 'find %s -type f'] | |
let g:ctrlp_prompt_mappings = { | |
\ 'AcceptSelection("e")': ['<space>', '<cr>', '<2-LeftMouse>'], | |
\ } | |
endif | |
" vim-expand-region | |
" Use v and C-v to increase and decrease region expansion | |
vmap v <Plug>(expand_region_expand) | |
vmap <C-v> <Plug>(expand_region_shrink) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment