Skip to content

Instantly share code, notes, and snippets.

@tcmacdonald
Last active October 6, 2015 00:08
Show Gist options
  • Save tcmacdonald/2901217 to your computer and use it in GitHub Desktop.
Save tcmacdonald/2901217 to your computer and use it in GitHub Desktop.
.vimrc
set nocompatible " be iMproved
filetype off " required!
call pathogen#infect()
if has("gui_macvim")
" let Vundle manage Vundle
" set rtp+=~/.vim/bundle/vundle/
" call vundle#rc()
" Bundle 'gmarik/vundle'
" required!
" Bundle 'Valloric/YouCompleteMe'
" set colorscheme
colorscheme snappy
endif
filetype plugin indent on
if &t_Co > 2 || has("gui_running")
" switch syntax highlighting on, when the terminal has colors
syntax on
endif
if has("autocmd")
" remember last position
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal g'\"" | endif
endif
" 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 -g ""'
" ag is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 0
endif
" bind K to grep word under cursor
nnoremap K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR>
set guifont=Bitstream\ Vera\ Sans\ Mono:h14
" set the type-face
set nowrap " don't wrap lines
set tabstop=2 " a tab is four spaces
set shiftwidth=2 " number of spaces to use for autoindenting
set expandtab
set backspace=indent,eol,start
" allow backspacing over everything in insert mode
set autoindent " always set autoindenting on
set copyindent " copy the previous indentation on autoindenting
set number " always show line numbers
set shiftround " use multiple of shiftwidth when indenting with '<' and '>'
set showmatch " set show matching parenthesis
set ignorecase " ignore case when searching
set smartcase " ignore case if search pattern is all lowercase,
" case-sensitive otherwise
set smarttab " insert tabs on the start of a line according to
" shiftwidth, not tabstop
set hlsearch " highlight search terms
set incsearch " show search matches as you type
set history=1000 " remember more commands and search history
set undolevels=1000 " use many muchos levels of undo
set wildignore=*.swp,*.bak,*.pyc,*.class
set title " change the terminal's title
set visualbell " don't beep
set noerrorbells " don't beep
set nobackup
set noswapfile
set list
set listchars=tab:>.,trail:.,extends:#,nbsp:.
" invisible characters
set pastetoggle=<F2> " paste mode
"folding settings
set modifiable " cold-folding
set foldmethod=syntax " fold based on indent
set foldnestmax=10 " deepest fold is 10 levels
set nofoldenable " dont fold by default
set foldlevel=1 " this is just what i use
set noignorecase
" NERDTREE settings
nmap <silent> <C-D> :NERDTreeToggle<CR>
" Hashrocket cleanup
nmap <leader>rh :%s/\v:(\w+) \=\>/\1:/g<cr>
nmap <leader>hr :%s/\v(\w*):\s/:\1 \=\> /g<cr>
" Whitespace cleanup
nmap <leader>ws :%s/\s\+$//e<cr>
au Filetype html,xml,xsl,eruby,eco source ~/.vim/autoload/closetag.vim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment