Last active
August 29, 2015 14:04
-
-
Save compressed/7c3605675e3da0b4ff71 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
set nocompatible " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" let Vundle manage Vundle, required | |
Plugin 'gmarik/Vundle.vim' | |
Plugin 'tComment' | |
Plugin 'aehlke/vim-rename3' | |
" Plugin 'scrooloose/nerdcommenter' | |
Plugin 'ciaranm/detectindent' | |
Plugin 'tomasr/molokai' | |
Plugin 'godlygeek/tabular' | |
Plugin 'tpope/vim-markdown' | |
Plugin 'tommcdo/vim-exchange' | |
Bundle 'wting/rust.vim' | |
Plugin 'honza/dockerfile.vim' | |
Bundle 'mileszs/ack.vim' | |
Plugin 'bling/vim-airline' | |
Plugin 'airblade/vim-gitgutter' | |
Bundle 'terryma/vim-multiple-cursors' | |
Plugin 'fatih/vim-go' | |
Bundle 'xolox/vim-session' | |
Bundle 'xolox/vim-misc' | |
Plugin 'kien/ctrlp.vim' | |
Plugin 'tpope/vim-fugitive' | |
Plugin 'JuliaLang/julia-vim' | |
Plugin 'Valloric/YouCompleteMe' | |
Plugin 'tpope/vim-vinegar' | |
Bundle 'cespare/vim-toml' | |
Plugin 'cstrahan/vim-capnp' | |
" All of your Plugins must be added before the following line | |
call vundle#end() " required | |
set rtp+=~/.vim/bundle/powerline/powerline/bindings/vim | |
filetype plugin indent on " required | |
set omnifunc=syntaxcomplete#Complete "auto complete | |
colorscheme molokai | |
" line numbers | |
set number | |
set backspace=2 "allow deleting any chars in insert mode | |
set laststatus=2 | |
set history=200 | |
set ruler " show the cursor position all the time | |
set showcmd " display incomplete commands | |
set incsearch " do incremental searching | |
set laststatus=2 " Always display the status line | |
set mouse=a " mouse selection | |
" Numbers | |
set number | |
set numberwidth=5 | |
set linebreak " ensure words are wrapped fully, not mid-word | |
" Snippets are activated by Shift+Tab | |
let g:snippetsEmu_key = "<S-Tab>" | |
" Tab completion options | |
"set wildmode=list:longest,list:full | |
set wildmode=longest:full | |
set complete=.,w,t | |
set completeopt=longest,menu,preview | |
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>" | |
inoremap <expr> <C-n> pumvisible() ? '<C-n>' : | |
\ '<C-n><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>' | |
inoremap <expr> <M-,> pumvisible() ? '<C-n>' : | |
\ '<C-x><C-o><C-n><C-p><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>' | |
" open omni completion menu closing previous if open and opening new menu without changing the text | |
inoremap <expr> <C-Space> (pumvisible() ? (col('.') > 1 ? '<Esc>i<Right>' : '<Esc>i') : '') . | |
\ '<C-x><C-o><C-r>=pumvisible() ? "\<lt>C-n>\<lt>C-p>\<lt>Down>" : ""<CR>' | |
" open user completion menu closing previous if open and opening new menu without changing the text | |
inoremap <expr> <S-Space> (pumvisible() ? (col('.') > 1 ? '<Esc>i<Right>' : '<Esc>i') : '') . | |
\ '<C-x><C-u><C-r>=pumvisible() ? "\<lt>C-n>\<lt>C-p>\<lt>Down>" : ""<CR>' | |
set hidden | |
let g:racer_cmd = "/Users/chris/.vim/racer/bin/racer" | |
let $RUST_SRC_PATH="/Users/chris/rust/src" | |
" Softtabs, 2 spaces | |
set tabstop=2 | |
set shiftwidth=2 | |
set expandtab | |
" Switch syntax highlighting on, when the terminal has colors | |
" Also switch on highlighting the last used search pattern. | |
if (&t_Co > 2 || has("gui_running")) && !exists("syntax_on") | |
syntax on | |
endif | |
" paste | |
if &term =~ "xterm.*" | |
let &t_ti = &t_ti . "\e[?2004h" | |
let &t_te = "\e[?2004l" . &t_te | |
function XTermPasteBegin(ret) | |
set pastetoggle=<Esc>[201~ | |
set paste | |
return a:ret | |
endfunction | |
map <expr> <Esc>[200~ XTermPasteBegin("i") | |
imap <expr> <Esc>[200~ XTermPasteBegin("") | |
cmap <Esc>[200~ <nop> | |
cmap <Esc>[201~ <nop> | |
endif | |
" Share OS clipboard | |
set clipboard=unnamed | |
" rm trailing whitespace | |
fun! <SID>StripTrailingWhitespaces() | |
let l = line(".") | |
let c = col(".") | |
%s/\s\+$//e | |
call cursor(l, c) | |
endfun | |
autocmd BufWritePre * :call <SID>StripTrailingWhitespaces() | |
highlight ExtraWhitespace ctermbg=red guibg=red | |
match ExtraWhitespace /\s\+$/ | |
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/ | |
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/ | |
autocmd InsertLeave * match ExtraWhitespace /\s\+$/ | |
autocmd BufWinLeave * call clearmatches() | |
set t_ut= " ensure background color shows correctly under tmux | |
let g:airline_powerline_fonts = 1 " airline use powerline fonts | |
let g:airline_theme='powerlineish' | |
set ttyfast " Smooth redraws | |
set ttimeoutlen=10 " Faster escape sequences | |
augroup FastEscape | |
autocmd! | |
au InsertEnter * set timeoutlen=0 | |
au InsertLeave * set timeoutlen=500 | |
augroup END | |
set updatetime=500 " Update things faster (e.g. GitGutter) | |
set noshowmode " Leave --insert-- to AirLines | |
set noerrorbells " Sound off | |
" Indentation | |
set smartindent | |
set shiftwidth=2 softtabstop=2 tabstop=2 expandtab | |
set cursorline " Highlight active line | |
" Do not search here | |
set wildignore=*/node_modules/* | |
" Set the leader key to , | |
let mapleader = "," | |
" Tab through open buffers | |
noremap <Leader>b :b<space> | |
" Find | |
noremap <Leader>f :find | |
" Search for word under cursor | |
map <leader>s :execute "noautocmd vimgrep /\\<" . expand("<cword>") . "\\>/gj **/*.*" <Bar> cw<CR> | |
let g:session_autoload = 'no' " stop session prompt | |
set nowritebackup " vim was saving file twice, causes problems for file watching | |
function! s:DiffWithSaved() | |
let filetype=&ft | |
diffthis | |
vnew | r # | normal! 1Gdd | |
diffthis | |
exe "setlocal bt=nofile bh=wipe nobl noswf ro ft=" . filetype | |
endfunction | |
com! DiffSaved call s:DiffWithSaved() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment