Skip to content

Instantly share code, notes, and snippets.

@OscarGodson
Created February 21, 2013 21:49

Revisions

  1. OscarGodson created this gist Feb 21, 2013.
    141 changes: 141 additions & 0 deletions .vimrc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,141 @@
    set nocompatible

    " Let me copy from VIM to OS X
    set clipboard+=unnamed

    " Ctrl+p plugin
    set runtimepath^=~/.vim/bundle/ctrlp.vim

    " Spell checking, yo
    set spell spelllang=en_us

    " Auto refresh this vimrc upon save
    au! BufWritePost .vimrc source %

    let &t_Co=256

    "Color syntaxing of course
    syntax on

    " Tabs with ctrl+t
    noremap <C-t> :tabnew<CR>
    " Change tab name in Terminal
    set title

    " We use Git now, people
    set nobackup
    set noswapfile

    " Don't close buffers
    set hidden

    "Don't wrap lines
    set nowrap

    " Backspace all the things
    set backspace=indent,eol,start

    " Make alt+backspace work
    "imap <A-BS> <C-w>

    " Auto-format comment blocks
    set formatoptions+=r

    "colorscheme molokai
    :colors molokai

    "Lots of undo history... just in case
    set history=700

    "Set to auto read when a file is changed from the outside
    set autoread

    "highlight the current line
    set cul

    "auto indent
    set autoindent
    "set smartindent
    set copyindent

    " ignore case in search
    set ignorecase

    " display indentation guides
    set list
    set listchars=tab:\.\
    highlight ExtraWhitespace ctermbg=red guibg=red
    match ExtraWhitespace /\s\+$/


    " convert spaces to tabs when reading file
    " autocmd! bufreadpost * set noexpandtab | retab! 2

    " convert tabs to spaces before writing file
    " autocmd! bufwritepre * set expandtab | retab! 2

    " convert spaces to tabs after writing file (to show guides again)
    " autocmd! bufwritepost * set noexpandtab | retab! 2

    " Coloring for JSON
    autocmd BufNewFile,BufRead *.json set ft=javascript

    " Coloring for Less
    autocmd BufNewFile,BufRead *.less set ft=css

    " When pasting, dont indent
    nnoremap <F2> :set invpaste paste?<CR>
    set pastetoggle=<F2>
    set showmode

    "Soft tabs FTW
    set expandtab
    set smarttab

    "Size of the (soft) tabs
    set shiftwidth=2
    set softtabstop=2

    "Show line numbers
    set number

    "Set line number colors to something other than that god awful orange
    hi LineNr ctermfg=234 ctermbg=black

    "set color of the highlighted line
    hi CursorLine term=none cterm=none ctermbg=235

    " hi SpecialKey ctermfg=59 guifg=59

    "Change the color of the matching brackets
    hi MatchParen cterm=bold ctermfg=white ctermbg=161

    hi Visual ctermbg=53

    "Keep at least 5 lines of space above and below and then left and right
    set scrolloff=5
    set sidescrolloff=5

    "Scrolling with your mouse!
    set ttymouse=xterm2
    set mouse=a

    " highlight search terms
    set hlsearch

    " show search matches as you type"
    set incsearch

    let g:molokai_original = 1

    " ejs code colors
    au BufNewFile,BufRead *.ejs set filetype=html

    " Expanding words
    iab func function

    " Make sure my code doesn't get too long
    set colorcolumn=85

    imap {<cr> {<cr>}<c-o>O