Skip to content

Instantly share code, notes, and snippets.

@supershabam
Created August 25, 2014 22:24
Show Gist options
  • Save supershabam/855c6ccb4753657e18d3 to your computer and use it in GitHub Desktop.
Save supershabam/855c6ccb4753657e18d3 to your computer and use it in GitHub Desktop.
set nocompatible " be iMproved
filetype off " required!
set rtp+=~/.vim/bundle/Vundle.vim/
call vundle#begin()
" let Vundle manage Vundle
" required!
Plugin 'gmarik/Vundle.vim'
" Languages
Plugin 'IndentAnything'
Plugin 'pangloss/vim-javascript'
Plugin 'kchmck/vim-coffee-script'
Plugin 'tpope/vim-commentary'
Plugin 'slim-template/vim-slim'
Plugin 'kien/rainbow_parentheses.vim'
Plugin 'tpope/vim-markdown'
Plugin 'fatih/vim-go'
Plugin 'nsf/gocode', {'rtp': 'vim/'}
Plugin 'rodjek/vim-puppet'
" Ruby
Plugin 'vim-ruby/vim-ruby'
Plugin 'tpope/vim-rbenv'
Plugin 'tpope/vim-rails.git'
Plugin 'tpope/vim-endwise'
Plugin 'tpope/vim-bundler'
" Clojure
Plugin 'tpope/vim-classpath'
Plugin 'tpope/vim-fireplace'
Plugin 'guns/vim-clojure-static'
Plugin 'vim-scripts/paredit.vim'
" Syntax
Plugin 'kana/vim-textobj-indent'
Plugin 'kana/vim-textobj-user'
Plugin 'nelstrom/vim-textobj-rubyblock'
" Text Manipulation
Plugin 'tpope/vim-surround'
Plugin 'ervandew/supertab'
Plugin 'godlygeek/tabular'
" Colors
Plugin 'chriskempson/base16-vim'
" Navigation
Plugin 'tpope/vim-vinegar'
Plugin 'kien/ctrlp.vim'
" Search
Plugin 'mileszs/ack.vim'
Plugin 'tpope/vim-repeat'
" Other Utilities
Plugin 'tpope/vim-dispatch'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-unimpaired'
Plugin 'Rename'
Plugin 'bling/vim-airline'
call vundle#end()
filetype plugin indent on
syntax on
" paredit
" let g:paredit_mode = 0
" Thanks http://stevelosh.com/blog/2010/09/coming-home-to-vim/
set ttyfast
set wildmenu
set number
set ruler
set mouse=a
set encoding=utf-8
" whitespace
set nowrap
set list
set backspace=indent,eol,start
" ugh folding
set nofoldenable
" line numbers
if exists('&relativenumber')
set relativenumber
augroup WindowRNU
auto!
auto BufWinEnter,WinEnter,FocusGained * setlocal relativenumber
auto WinLeave,FocusLost * setlocal number
augroup END
endif
" List chars
set listchars=""
set listchars=tab:\ \
set listchars+=trail:☹
" Remap leader to comma
let mapleader = ","
" More sane searching
nnoremap / /\v
vnoremap / /\v
set ignorecase
set smartcase
set incsearch
set showmatch
set hlsearch
" <leader><space> clears search
nnoremap <leader><space> :noh<cr>
" <leader><leader> toggles between files
nnoremap <leader><leader> <c-^>
" redraw
nnoremap <leader>f :redraw!<cr>
" git (fugitive)
nnoremap <leader>g :Gstatus<cr>
" generate tags
nnoremap <leader>tg :!ctags -f ._tags -R<cr>
" close all buffers
nnoremap <leader>bd :bd *<c-a><cr>
" status line
set laststatus=2
" ruby syntax seems really slow lately
let ruby_no_expensive=1
" autocomplete:
" http://robots.thoughtbot.com/post/27041742805/vim-you-complete-me
set complete=.,b,u,]
set wildmode=longest,list:longest
set completeopt=menu,preview
" show colored column at 80 and 100
set colorcolumn=80,100
" Disable arrow keys
"nnoremap <up> <nop>
"nnoremap <down> <nop>
"nnoremap <left> <nop>
"nnoremap <right> <nop>
"inoremap <up> <nop>
"inoremap <down> <nop>
"inoremap <left> <nop>
"inoremap <right> <nop>
" j and k move by screen lines
nnoremap j gj
nnoremap k gk
" I never really want to hit F1
inoremap <F1> <ESC>
nnoremap <F1> <ESC>
vnoremap <F1> <ESC>
" chord to get out of insert mode
inoremap jj <ESC>
inoremap jk <ESC>
inoremap jww <C-o>:w<cr>
" <leader>v selects text that was just pasted
nnoremap gV `[v`]
set pastetoggle=<F2>
" <leader>vs opens a vertical split window and switches to it
nnoremap <leader>vs <C-w>v<C-w>l
" moving among splits
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" tab defaults
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
set autoindent
" tab specifics
autocmd FileType go setlocal noexpandtab
" sane split directions
set splitright
set splitbelow
" omg no beeps or crazy flashes
set noerrorbells
set novisualbell
" auto load changed files
set autoread
" assume /g on substitutions
set gdefault
" set the terminal's title
set title
" backups
set nobackup
set nowritebackup
set tags=./tmp/tags,./tags,tags,._tags
set backupdir=~/.vim/_backup//
set directory=~/.vim/_temp//
" fuzzy matching settings
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*
" Insert the current directory into a command-line path
cmap <C-P> <C-R>=expand("%:p:h") . "/"<cr>
" ctrlp tweaks
let g:ctrlp_working_path_mode = 0 " don't manage working directory
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . -co --exclude-standard', 'find %s -type f']
" clojure tweaks
au VimEnter * RainbowParenthesesToggle
au Syntax * RainbowParenthesesLoadRound
au Syntax * RainbowParenthesesLoadSquare
au Syntax * RainbowParenthesesLoadBraces
" clojure execution
nmap <leader>E :Eval<cr>
nmap <leader>e :%Eval<cr>
" run ruby tests
function! RunRubyTest(testcmd)
execute("!bundle exec " . a:testcmd . " " . expand("%p"))
endfunction
function! RunRubyTestCurrentLine(testcmd)
execute("!bundle exec " . a:testcmd . " " . expand("%p") . ":" . line("."))
endfunction
nmap <leader>tr :call RunRubyTest("rspec -Ispec")<cr>
nmap <leader>tR :call RunRubyTestCurrentLine("rspec -Ispec")<cr>
nmap <leader>TR :call RunRubyTestCurrentLine("rspec -Ispec")<cr>
nmap <leader>tm :call RunRubyTest("ruby -Itest")<cr>
" opening lines with same indentation
function! MoveLine(open_motion, post_motion)
let cols=col('.')
execute "normal! D" . a:open_motion
let next_cols=col('.')
let delta_cols=cols-next_cols
if(delta_cols > 0)
execute "normal! " . delta_cols . "A "
endif
execute "normal! p" . a:post_motion
endfunction
map <Leader>o :call MoveLine('o', 'k')<CR>
map <Leader>O :call MoveLine('O', 'j')<CR>
" Bubble single lines (uses unimpaired.vim)
nmap <S-Up> [e
nmap <S-Down> ]e
" Bubble multiple lines
vmap <S-Up> [egv
vmap <S-Down> ]egv
" Use the OS clipboard by default
if has('mac')
set clipboard=unnamed
endif
" Search Dash for word under cursor
function! SearchDash()
let s:browser = "/usr/bin/open"
let s:wordUnderCursor = expand("<cword>")
let s:url = "dash://".s:wordUnderCursor
let s:cmd ="silent ! " . s:browser . " " . s:url
execute s:cmd
redraw!
endfunction
map <leader>d :call SearchDash()<CR>
" Tabularize
nmap <Leader>a= :Tabularize /=<CR>
vmap <Leader>a= :Tabularize /=<CR>
nmap <Leader>a{ :Tabularize /{<CR>
vmap <Leader>a{ :Tabularize /{<CR>
nmap <Leader>a: :Tabularize /:\zs<CR>
vmap <Leader>a: :Tabularize /:\zs<CR>
nmap <Leader>a, :Tabularize /,\zs<CR>
vmap <Leader>a, :Tabularize /,\zs<CR>
nmap <Leader>a> :Tabularize /=><CR>
vmap <Leader>a> :Tabularize /=><CR>
nmap <Leader>a\| :Tabularize /\|<CR>
vmap <Leader>a\| :Tabularize /\|<CR>
" disable fetching of binaries
let g:go_disable_autoinstall = 1
let g:go_fmt_fail_silently = 1
" powerline fonts
" https://github.com/Lokaltog/powerline-fonts
let g:airline_powerline_fonts = 1
set t_Co=256
if &term =~ '256color'
" Disable Background Color Erase (BCE) so that color schemes
" work properly when Vim is used inside tmux and GNU screen.
" See also http://snk.tuxfamily.org/log/vim-256color-bce.html
set t_ut=
endif
let base16colorspace=256
colorscheme base16-railscasts
set background=dark
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment