Skip to content

Instantly share code, notes, and snippets.

@csgavino
Last active December 21, 2015 18:59
Show Gist options
  • Save csgavino/6351486 to your computer and use it in GitHub Desktop.
Save csgavino/6351486 to your computer and use it in GitHub Desktop.
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'altercation/vim-colors-solarized'
Plugin 'cakebaker/scss-syntax.vim'
Plugin 'christoomey/vim-tmux-navigator'
Plugin 'digitaltoad/vim-jade'
Plugin 'guns/vim-clojure-static'
Plugin 'jgdavey/tslime.vim'
Plugin 'kchmck/vim-coffee-script'
Plugin 'kien/ctrlp.vim'
Plugin 'kien/rainbow_parentheses.vim'
Plugin 'mileszs/ack.vim'
Plugin 'pangloss/vim-javascript'
Plugin 'plasticboy/vim-markdown'
Plugin 'scrooloose/nerdtree'
Plugin 'thoughtbot/vim-rspec'
" Bundle 'tpope/vim-bundler'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-haml'
Plugin 'tpope/vim-rails'
Plugin 'tpope/vim-surround'
Plugin 'vim-ruby/vim-ruby'
call vundle#end()
syntax on
filetype plugin indent on
" Autoload edited files
set autoread
" Don't create .swp
set noswapfile
" Softabs 2 spaces
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
" Set relative number
set rnu
set numberwidth=4
" Current position
set ruler
" Don't need to type full text
set incsearch
" Ignores cases
set ignorecase
set smartcase
" Use %s/foo/bar/g as default
" set gdefault
" Shows context
set scrolloff=2
set wildmenu
set wildmode=list:longest,full
" Don't jump to start of line when scrolling
set nostartofline
" Don't highlight search results
set nohlsearch
" Toggles highlight search
" map <leader>/ :set hlsearch! hlsearch?<CR>
" set hlsearch
" map <leader>/ :nohlsearch<CR>
set nobackup
" Ctrlp
set wildignore+=*/tmp/*,*.so,*.swp,*.zip
let g:ctrlp_custom_ignore = { 'dir': '\.git$\|\.hg$\|\.svn$\|\.yardoc\|public\/images\|public\/system\|data\|log\|tmp$', 'file': '\.exe$\|\.so$\|\.dat$' }
let g:ctrlp_working_path_mode = 'ra'
" Use tabs when editing haml files
"au FileType haml setlocal noexpandtab tabstop=4 softtabstop=4 shiftwidth=4
"au FileType jade setlocal noexpandtab tabstop=4 softtabstop=4 shiftwidth=4
map <C-n> :NERDTreeToggle<CR>
" Ctrl-n (auto complete) navigation
inoremap <expr> <C-j> pumvisible() ? "\<C-N>" : "\<C-j>"
inoremap <expr> <C-k> pumvisible() ? "\<C-P>" : "\<C-k>"
" Windows navigation
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
set splitbelow
set splitright
set t_Co=256
" set background=dark
colorscheme twilight256
" colorscheme grb256
" colorscheme solarized
set foldlevelstart=20
" Sets the theme
set guifont=Monaco:h12
" Removes top toolbar
set guioptions-=T
" Removes right hand scrollbar
set guioptions-=r
" Removes left hand scrollbar
set go-=L
" Displays <% %> correctly
au User Rails let b:surround_{char2nr('-')} = "<% \r %>"
" Puts a $ marker for the end of words/lines in cw/c$ commands
set cpoptions+=$
" Sets the status bar
" set statusline=%F
" set laststatus=2
" Always show filename in the status bar
set ls=2
" http://stevelosh.com/blog/2010/09/coming-home-to-vim/
set undofile
" Auto save when you lose focus
au FocusLost * :wa
" http://stackoverflow.com/questions/3776117/vim-what-is-the-difference-between-the-remap-noremap-nnoremap-and-vnoremap-ma
let mapleader = ","
" Strip all white space with ,W
nnoremap <leader>W :%s/\s\+$//<cr>:let @/=''<CR>
" Trigger ack with ,a
nnoremap <leader>a :Ack
" Edit vimrc quickly
nnoremap <leader>ev :vsplit $MYVIMRC<cr>
" Source vimrc quickly
nnoremap <leader>sv :source $MYVIMRC<cr>
" Create a new tab
" nnoremap <leader>t :tabnew<cr>
" Only
nnoremap <leader>o :only<cr>
" Close tab
nnoremap <leader>c :tabclose<cr>
" https://github.com/ggreer/the_silver_searcher
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 --ignore-dir bin --ignore-dir log -g ""'
" Use Ag in Ack.vim
let g:ackprg = 'ag --nogroup --nocolor --column --ignore-dir log --ignore-dir bin'
endif
" https://github.com/plasticboy/vim-markdown
let g:vim_markdown_folding_disabled=1
" Set tags default path
set tags=./tags;
" Display extra whitespace
set list listchars=tab:»·,trail:·
" 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>
" let g:rspec_command = 'call Send_to_Tmux("rspec {spec}\n")'
" let g:rspec_command = '!rspec --drb {spec}'
let g:rspec_command = '!rspec {spec}'
" Fixes ^[O delay http://cache.preserve.io/8x2nmg9c/index.html
set timeout timeoutlen=5000 ttimeoutlen=100
set autowrite
" https://github.com/kien/rainbow_parentheses.vim
" au VimEnter * RainbowParenthesesToggle
" au Syntax * RainbowParenthesesLoadRound
" au Syntax * RainbowParenthesesLoadSquare
" au Syntax * RainbowParenthesesLoadBraces
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment