Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Install Vundle first ->
" Install Vundle first:
" git clone ~/.vim/bundle/Vundle.vim
" Launch vim and run :PluginInstall
set t_Co=256
" execute pathogen#infect()
" syntax on
" filetype plugin indent on
nnoremap <C-A> :ls<CR>:b
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()
Plugin 'VundleVim/Vundle.vim'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'Xuyuanp/nerdtree-git-plugin'
Plugin 'ervandew/supertab'
Plugin 'jgdavey/tslime.vim'
Plugin 'ntpeters/vim-better-whitespace'
Plugin 'tpope/vim-bundler'
Plugin 'kchmck/vim-coffee-script'
Plugin 'tpope/vim-endwise'
Plugin 'tpope/vim-fugitive'
Plugin 'airblade/vim-gitgutter'
Plugin 'tpope/vim-haml'
Plugin 'tpope/vim-rails'
Plugin 'thoughtbot/vim-rspec'
Plugin 'tpope/vim-sensible'
Plugin 'christoomey/vim-tmux-navigator'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
set shell=bash\ --login
" set clipboard=unnamed
" Remap ESC
imap jk <Esc>
imap kj <Esc>
" Stop closing my windows VIM!!!
"nnoremap <C-W>O :echo "sucker"<CR>
"nnoremap <C-W>o :echo "sucker"<CR>
"nnoremap <C-W><C-O> :echo "sucker"<CR>
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_working_path_mode = 'ra'
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux
set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe " Windows
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
set foldmethod=syntax
set foldlevel=1
set foldnestmax=10
" Open all folds by default
set nofoldenable
" Find files recursively
set path=.,/usr/include,,**
" Ignore case when searching
set ignorecase
let mapleader=","
" Use <SPACE> to insert a single character
nnoremap <Space> i_<Esc>r
" Use ack instead of grep
"set grepprg=ack
" Grep with vendor dir
function! GrepWithVendor(...)
grep --noignore-dir=vendor a:000
command! -nargs=* Grepv call GrepWithVendor(<f-args>)
set number
set tabstop=2 shiftwidth=2
set smarttab
set expandtab
set splitright
set splitbelow
set hidden
nnoremap <Tab> :bnext<CR>
nnoremap <S-Tab> :bprevious<CR>
set mouse=a
let g:NERDtreeMouseMode = 3
"let g:NERDtreeDirArrows = 0
let g:NERDTreeWinSize = 40
" How can I open a NERDTree automatically when vim starts up if no files were specified?
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" How can I close vim if the only window left open is a NERDTree?
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
nmap <Leader>n :NERDTreeFind<CR>
nmap <Leader>m :NERDTreeToggle<CR>
" Highlight current active window
augroup NrHighlight
autocmd WinLeave * set nocursorline
autocmd WinEnter,BufRead * set cursorline
augroup END
hi CursorLine cterm=bold
hi LineNr ctermfg=DarkGrey guifg=#9e9e9e ctermbg=233 guibg=#121212
hi StatusLine ctermfg=Yellow guifg=#ffffff ctermbg=239 guibg=#4e4e4e cterm=bold gui=bold
hi StatusLineNC ctermfg=249 guifg=#b2b2b2 ctermbg=237 guibg=#3a3a3a cterm=none gui=none
" Easier splits navigtion
" We can use different key mappings for easy navigation between splits to save
" a keystroke. So instead of ctrl-w then j, it’s just ctrl-j:
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" Auto-Reload Your Vimrc
augroup reload_vimrc " {
autocmd BufWritePost $MYVIMRC source $MYVIMRC
augroup END " }
" RSpec.vim mappings
map <Leader>t :call RunCurrentSpecFile()<CR>
map <Leader>s :call RunNearestSpec()<CR>
map <Leader>l :call RunLastSpec()<CR>
map <Leader>a :call RunAllSpecs()<CR>
" Run Bundler for specs
" let g:rspec_command = \"SPEC={spec} && (cd `git rev-parse --show-toplevel` && bundle exec rspec $SPEC && unset SPEC)"
let g:rspec_command = 'call Send_to_Tmux("!bundle exec rspec -I . {spec}")'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment