Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install Vundle first -> https://github.com/VundleVim/Vundle.vim
" Install Vundle first:
" git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
"
" Launch vim and run :PluginInstall
" http://stackoverflow.com/questions/10778078/vim-colorscheme-executing-but-not-changing-colors
set t_Co=256
" https://github.com/tpope/vim-pathogen
" execute pathogen#infect()
" syntax on
" filetype plugin indent on
nnoremap <C-A> :ls<CR>:b
" https://github.com/VundleVim/Vundle.vim
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
"******************************************
" http://stackoverflow.com/questions/1694599/how-do-i-get-vims-sh-command-to-source-my-bashrc
set shell=bash\ --login
" http://vim.wikia.com/wiki/Mac_OS_X_clipboard_sharing
" 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>
" https://github.com/ctrlpvim/ctrlp.vim
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
endfunction
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
" https://github.com/scrooloose/nerdtree
"
" 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!
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
" https://robots.thoughtbot.com/vim-splits-move-faster-and-more-naturally
" 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
" http://www.bestofvim.com/tip/auto-reload-your-vimrc/
augroup reload_vimrc " {
autocmd!
autocmd BufWritePost $MYVIMRC source $MYVIMRC
augroup END " }
" RSpec.vim mappings
" https://github.com/thoughtbot/vim-rspec
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