Skip to content

Instantly share code, notes, and snippets.

@jeremywrowe
Created August 30, 2015 18:09
Show Gist options
  • Save jeremywrowe/91298f09678d91d243b7 to your computer and use it in GitHub Desktop.
Save jeremywrowe/91298f09678d91d243b7 to your computer and use it in GitHub Desktop.
vim config
set nocompatible
set shell=/bin/bash
if filereadable(expand("~/.vimrc.bundles"))
source ~/.vimrc.bundles
endif
if (&t_Co > 2 || has("gui_running")) && !exists("syntax_on")
syntax on
endif
set background=dark
color monokai
let mapleader = " "
let g:maplocalleader = ';'
set backspace=2
set nobackup
set nowritebackup
set history=50
set ruler
set showcmd
set incsearch
set laststatus=2
set autowrite
set noswapfile
set hidden
filetype plugin indent on
set tabstop=2
set shiftwidth=2
set shiftround
set expandtab
"set list listchars=tab:»·,trail:·
function! <SID>StripTrailingWhitespaces()
let _s=@/
let l = line(".")
let c = col(".")
%s/\s\+$//e
let @/=_s
call cursor(l, c)
endfunction
nnoremap <Left> :echoe "Use h"<CR>
nnoremap <Right> :echoe "Use l"<CR>
nnoremap <Up> :echoe "Use k"<CR>
nnoremap <Down> :echoe "Use j"<CR>
nnoremap <Leader>t :call RunCurrentSpecFile()<CR>
nnoremap <Leader>s :call RunNearestSpec()<CR>
nnoremap <Leader>l :call RunLastSpec()<CR>
let g:rspec_command = "spring rspec {spec}"
nnoremap <Leader>r :RunInInteractiveShell<space>
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
nmap <leader>tn :tabnext<CR>
nmap <leader>tc :tabnew<CR>
nmap <leader>b :BufExplorer<CR>
nmap <leader>tr :let g:rspec_command = "Dispatch rspec {spec}"
nmap <leader>tre :let g:rspec_command = "Dispatch zeus rspec {spec}"<cr>
nmap <leader>a :A<CR>
nmap <C-s> :w<CR>
nmap <Up><Up> :cope<CR>
nmap <Down><Down> :ccl<CR>
nnoremap <silent> <leader>ss :call <SID>StripTrailingWhitespaces()<CR>
set diffopt+=vertical
set exrc
set secure
set nowrap
set number
set foldmethod=indent
set foldnestmax=5
set nofoldenable
set foldlevel=1
set hlsearch
set cursorline
nmap <leader>p :b#<CR>
nmap <leader><leader> :b#<CR>
" Insert a hash rocket with <c-l>
imap <c-l> <space>=><space>
runtime macros/matchit.vim
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" PROMOTE VARIABLE TO RSPEC LET
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! PromoteToLet()
:normal! dd
" :exec '?^\s*it\>'
:normal! P
:.s/\(\w\+\) = \(.*\)$/let(:\1) { \2 }/
:normal ==
endfunction
:command! PromoteToLet :call PromoteToLet()
:map <leader>p :PromoteToLet<cr>
" Wrap Markdown files at 80 Characters
au BufRead,BufNewFile *.md setlocal textwidth=80
map <leader>h :noh<cr>
nnoremap \ :Ag<SPACE>
map <leader>n :NERDTreeToggle<cr>
if executable('ag')
" Use ag over grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
" ag is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 0
endif
if has("gui_running")
set guifont=PragmataPro:h18
endif
if &compatible
set nocompatible
endif
filetype off
set rtp+=~/.vim/bundle/Vundle.vim/
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
" General Stuff
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-repeat'
Plugin 'tpope/vim-dispatch'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-endwise'
Plugin 'rking/ag.vim'
Plugin 'scrooloose/nerdcommenter'
Plugin 'triglav/vim-visual-increment'
Plugin 'scrooloose/nerdtree'
Plugin 'ngmy/vim-rubocop'
Plugin 'wookiehangover/jshint.vim'
Plugin 'kien/ctrlp.vim'
Plugin 'vim-scripts/AnsiEsc.vim'
Plugin 'vim-scripts/Align'
Plugin 'editorconfig/editorconfig-vim'
Plugin 'Raimondi/delimitMate'
Plugin 'tpope/vim-projectionist'
" Rails
Plugin 'tpope/vim-rails'
Plugin 'thoughtbot/vim-rspec'
" Languages
Plugin 'nono/vim-handlebars'
Plugin 'elixir-lang/vim-elixir'
Plugin 'kchmck/vim-coffee-script'
Plugin 'zah/nimrod.vim'
Plugin 'elzr/vim-json'
" Snippets
Plugin 'MarcWeber/vim-addon-mw-utils'
Plugin 'tomtom/tlib_vim'
Plugin 'garbas/vim-snipmate'
Plugin 'jeremywrowe/vim-snippets'
" Themes
Plugin 'chriskempson/vim-tomorrow-theme'
Plugin 'sickill/vim-monokai'
call vundle#end()
filetype on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment