Created
July 20, 2015 12:49
-
-
Save thomaswhyyou/ba7b5b325f14c82f5c01 to your computer and use it in GitHub Desktop.
vimrc
This file contains hidden or 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
" ================ Vundle Config ====================== | |
set nocompatible | |
filetype off | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
Plugin 'gmarik/Vundle.vim' | |
Plugin 'altercation/vim-colors-solarized' | |
Plugin 'kien/ctrlp.vim' | |
Plugin 'scrooloose/nerdtree' | |
Plugin 'scrooloose/nerdcommenter' | |
Plugin 'tpope/vim-surround' | |
Plugin 'sjl/gundo.vim' | |
Plugin 'bling/vim-airline' | |
Plugin 'bling/vim-bufferline' | |
Plugin 'tpope/vim-fugitive' | |
Plugin 'powerline/fonts' | |
Plugin 'airblade/vim-gitgutter' | |
Plugin 'scrooloose/syntastic' | |
" Plugin 'klen/python-mode' | |
" Plugin 'terryma/vim-multiple-cursors' | |
call vundle#end() | |
" Brief help | |
" :PluginList - lists configured plugins | |
" :PluginInstall - installs plugins; append `!` to update or just | |
" :PluginUpdate | |
" :PluginSearch foo - searches for foo; append `!` to refresh local cache | |
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal | |
" | |
" see :h vundle for more details or wiki for FAQ | |
" Put your non-Plugin stuff after this line | |
" ================ General Config ==================== | |
" space as leader | |
:map <space> <leader> | |
set autoread " auto read when a file is changed from outside | |
set history=1000 " store lots of :cmdline history | |
set clipboard=unnamed " yank and paste with the system clipboard | |
" strip all trailing whitespace at save | |
fun! <SID>StripTrailingWhitespaces() | |
let l = line(".") | |
let c = col(".") | |
%s/\s\+$//e | |
call cursor(l, c) | |
endfun | |
autocmd BufWritePre * :call <SID>StripTrailingWhitespaces() | |
" ================ Colors & Fonts ==================== | |
syntax on " enable syntax processing | |
set background=dark " colorscheme | |
colorscheme solarized " colorscheme | |
set encoding=utf8 " Set utf8 as standard encoding and en_US as the standard language | |
set ffs=unix,dos,mac " Use Unix as the standard file type | |
" ================ User Interface ==================== | |
set number " show line numbers | |
set showcmd " show command in bottom bar | |
set cursorline " highlight current line | |
set wildmenu " visual autocomplete for command menu | |
set wildmode=longest,list,full | |
set lazyredraw " redraw only when we need to | |
set showmatch " highlight matching [{()}] | |
set mat=2 " how many tenths of a second to blink when matching brackets | |
set scrolloff=7 " set 7 lines to the cursor - when moving vertically using j/k | |
set colorcolumn=81 " line length marker | |
set laststatus=2 " always show statusline | |
set ruler " show where you are | |
set backspace=2 " sane backspace | |
set backspace=indent,eol,start " sane backspace | |
set whichwrap+=<,>,h,l " sane backspace | |
" Enable basic mouse behavior such as resizing buffers. | |
set mouse=a | |
if exists('$TMUX') " Support resizing in tmux | |
set ttymouse=xterm2 | |
endif | |
" move vertically by visual line (for wrapped lines) | |
nnoremap j gj | |
nnoremap k gk | |
" move to beginning/end of line | |
nnoremap <leader>b ^ | |
nnoremap <leader>e $ | |
" highlight last inserted text | |
nnoremap gV `[v`] | |
" ================ Tab & Indent ====================== | |
filetype plugin indent on " file-type based indentation | |
set expandtab " tabs are spaces | |
set smarttab " be smart when using tabs | |
set tabstop=4 " number of visual spaces per TAB | |
set softtabstop=4 " number of spaces in tab when editing | |
set shiftwidth=4 " number of spaces to use for each step of (auto)indent | |
set autoindent " autoindent | |
set smartindent " smartindent | |
:set paste " turn on paste option for disable autoindent when pasting | |
set list listchars=tab:\ \ ,trail:· " display tabs spaces visually | |
set nowrap " don't wrap line | |
" ================ Searching ======================== | |
set incsearch " search as characters are entered | |
set hlsearch " highlight matches | |
set ignorecase " ignore case when searching | |
set smartcase " be smart when searching | |
set magic " for regex turn magic on | |
" use white color for search highlight | |
highlight search cterm=NONE ctermfg=black ctermbg=white | |
" turn off search highlight | |
nnoremap <leader>/ :nohlsearch<CR> | |
" ================ Folding ========================== | |
set nofoldenable " dont fold by default | |
set foldnestmax=3 " 3 nested fold max | |
set foldmethod=indent " fold based on indent level (or: marker, expr, syntax, diff) | |
" CUSTOM CONFIGURATION - BACKUPS | |
set backup | |
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp | |
set backupskip=/tmp/*,/private/tmp/* | |
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp | |
set writebackup | |
" ================ Plugin =========================== | |
" toggle gundo | |
nnoremap <leader>u :GundoToggle<CR> | |
" toggle NERDTree | |
noremap <leader>n :NERDTreeToggle<CR> | |
let g:NERDSpaceDelims=1 | |
" CtrlP settings | |
let g:ctrlp_match_window = 'bottom,order:ttb' | |
let g:ctrlp_switch_buffer = 0 | |
let g:ctrlp_working_path_mode = 0 | |
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 | |
" AIRLINE | |
let g:airline_theme='powerlineish' " look powerline ish | |
" let g:airline_powerline_fonts=1 " auto populate g:airline_symbols dictionary with the powerline symbols. | |
" BUFFERLINE | |
" bufferline statusline integration | |
let g:bufferline_echo = 0 | |
autocmd VimEnter * | |
\ let &statusline='%{bufferline#refresh_status()}' | |
\ .bufferline#get_status_string() | |
let g:bufferline_modified = '[+]' | |
" TMUX | |
" fix cursor | |
if exists('$TMUX') | |
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\" | |
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\" | |
else | |
let &t_SI = "\<Esc>]50;CursorShape=1\x7" | |
let &t_EI = "\<Esc>]50;CursorShape=0\x7" | |
endif | |
" CUSTOM CONFIGURATION - OTHER | |
" insert empty line | |
nmap <S-Enter> O<Esc> | |
nmap <CR> o<Esc> | |
" save session | |
nnoremap <leader>s :mksession<CR> | |
" toggle line number | |
nnoremap <leader>l :set number!<CR> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment