Skip to content

Instantly share code, notes, and snippets.

@langhorst
Created October 25, 2011 22:11
Show Gist options
  • Save langhorst/1314514 to your computer and use it in GitHub Desktop.
Save langhorst/1314514 to your computer and use it in GitHub Desktop.
Justin's VIM Setup
" My .vimrc, by Justin Langhorst.
" This is adapted from Steve Francia's personal .vimrc:
" http://spf13.com/post/ultimate-vim-config
" Setup Pathogen bundle support
" the next two lines ensure that the ~/.vim/bundle/ system works
runtime! autoload/pathogen.vim
silent! call pathogen#runtime_append_all_bundles()
" Basics
set nocompatible " must come before any other options setting
" General
filetype plugin indent on " automatically detect file types
syntax on " syntax highlighting
set mouse=a " automatically enable mouse usage
scriptencoding utf-8
set autowrite " write contents of file if modified
set shortmess+=filmnrxoOtT " abbrev. of messages (avoid 'hit enter')
set history=1000 " store a ton of history (default is 20)
" Directories
set backup
set backupdir=$HOME/.vimbackup//
set directory=$HOME/.vimswap//
set viewdir=$HOME/.vimviews//
silent execute '!mkdir -p $HOME/.vimbackup'
silent execute '!mkdir -p $HOME/.vimswap'
silent execute '!mkdir -p $HOME/.vimviews'
au BufWinLeave * silent! mkview " make vim save view state
au BufWinEnter * silent! loadview " make vim load view state
" Formatting
set nowrap " wrap long lines
set autoindent " indent at the same level as previous line
set shiftwidth=2 " use indents of 2 spaces
set expandtab " tabs are spaces
set tabstop=2 " an indentation every 2 columns
" Vim UI
set background=dark " assume a dark background
color solarized " load a colorscheme
set showmode " display the current mode
set cursorline " highlight current line
"hi cursorline guibg=#333333 " highlight bg color of current line
"hi CursorColumn guibg=#333333 " highlight cursor
if has('cmdline_info')
set ruler " show the ruler
set rulerformat=%30(%=\:b%n%y%m%r%w\ %l,%c%V\ %P%) " a ruler on steroids
set showcmd " show partial commands in status line and selected characters/lines in visual mode
endif
if has('statusline')
set laststatus=1 " show statusline only if there are >1 windows
set statusline=%<%f\ %h%m%r%{fugitive#statusline()}%=%-14.(%l,%c%V%)\ %P " a statusline on steroids
endif
set backspace=indent,eol,start " backspace for dummys
set linespace=0 " no extra spaces between rows
set nu " line numbers on
set showmatch " show matching brackets/paranthesis
set incsearch " find as you type search
set hlsearch " highlight search terms
set ignorecase " case insensitive search
set smartcase " case sensitive when uppercase present
set wildmenu " show list instead of just completing
set wildmode=list:longest,full " command <Tab> completion, list matches, then longest common part, then all
set whichwrap=b,s,h,l,<,>,[,] " backspace and cursor keys wrap
set scrolljump=5 " lines to scroll when cursor leaves screen
set scrolloff=3 " minimum lines to keep above and below cursor
"set foldenable " auto fold code
"set gdefault " the /g flag on :s substitutions by default
" Key Mappings
nmap <leader>ff :FufCoverageFile **/<CR>
nmap <leader>l :set list!<CR>
nmap <leader>nt :NERDTree<CR>
" Syntax Highlighting
au BufNewFile,BufRead *.{md,mkd,mark,markdown}
\ if &ft ==# '^\%(conf\|modula2\)$' |
\ set ft=markdown |
\ else |
\ set ft=markdown |
\ endif
" Use the same symbols as TextMate for tabstops and EOLs
set listchars=tab:▸\ ,eol:¬
checksyntax
colorsamplerpack
fugitive
fuzzyfinder
matchit
nerdcommenter
nerdtree
opa
snipmate.vim
surround
vim-coffee-script
vim-colors-solarized
vim-handlebars
vim-l9
vim-preview
vim-scala
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment