Skip to content

Instantly share code, notes, and snippets.

@smcabrera
Last active November 15, 2016 17:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smcabrera/ad0b88d77d5c82218bb6f7507ff77aaf to your computer and use it in GitHub Desktop.
Save smcabrera/ad0b88d77d5c82218bb6f7507ff77aaf to your computer and use it in GitHub Desktop.
Some sensible defaults for a .vimrc
"============================================================
"== Vundle Plugin Manager
"============================================================
"found here: https://github.com/VundleVim/Vundle.vim
set rtp+=~/.config/nvim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
"============================================================
"== Plugins: Sensible Defaults
"============================================================
Plugin 'flazz/vim-colorschemes' " Colorschemes
Plugin 'tomasr/molokai' "Colors available by bundle to be cycled through later
Plugin 'scrooloose/nerdcommenter' "To make commenting faster
Plugin 'scrooloose/nerdtree' "File tree
Plugin 'tpope/vim-surround' "Surround texts with tags or quotes
Plugin 'kien/ctrlp.vim' "Fuzzy search (command t is another option)
Plugin 'tpope/vim-repeat' "Repeat plugins like surround
Plugin 'airblade/vim-gitgutter'
Plugin 'mru.vim' " Pulls up a buffer of most recently used files
"============================================================
"== Ruby on Rails
"============================================================
Plugin 'vim-ruby/vim-ruby' "Among other things, these bundles add files to the load path so that you can use gf for jumping between files
Plugin 'tpope/vim-rails' "Rails.vim: incredibly useful plugin for working with rails code
Plugin 'tpope/vim-endwise' "Ends certain structures automatically--like 'end' in ruby
call vundle#end() " required
"============================================================
"== Essential Settings
"============================================================
" Make escape easier:
imap jk <ESC>
set noswapfile
set vb " Turn off beeps
set autoread " If a file is changed outside of vim, automatically reload it without asking
" Fix Splits
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>
" Make spaces when you press tab
set softtabstop=2 shiftwidth=2 expandtab
" Some useful search defaults
set hlsearch " highlight matches--Actually don't--not until I can figure out how to turn them off quickly
set incsearch " incremental searching
set ignorecase " searches are case insensitive...
set smartcase " ... unless they contain at least one capital letter
"Stop showing search results when you hit enter
nnoremap <CR> :nohlsearch<CR>
set backspace =indent,eol,start " Make backspace work as you would expect."
"Some settings for the way undo works
set undofile " Save undo's after file closes
set undodir=~/.vim/undo " where to save undo histories
set undolevels=1000 " How many undos
set undoreload=10000 " number of lines to save for undo
"============================================================
"== Leader Mappings
"============================================================
let mapleader= " "
" ctrl p. Fuzzy finder. This is huge
nmap <leader>p :CtrlP <cr>
nmap <leader>m :MRU
" leader n opens NERDTREE by default
" leader ci toggles NERDCOMMENTER by default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment