Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 31165c4e5b
Fetching contributors…

Cannot retrieve contributors at this time

477 lines (418 sloc) 13.24 kB
" ----------------------------------------
" Vundle
" ----------------------------------------
set nocompatible " be iMproved
filetype off " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle, required
Bundle 'gmarik/vundle'
" ---------------
" Plugin Bundles
" ---------------
" Navigation
Bundle 'ZoomWin'
Bundle 'wincent/Command-T'
Bundle 'vim-scripts/bufexplorer.zip'
"explore buffer
Bundle 'ctags.vim'
" This fork is required due to remapping ; to :
Bundle 'christoomey/vim-space'
" repeat motions with space
Bundle 'mutewinter/LustyJuggler'
" easily open recent buffers
" UI Additions
Bundle 'mutewinter/vim-indent-guides'
"highlight indent levels
Bundle 'dickeyxxx/status.vim'
"extend the statuslline
Bundle 'scrooloose/nerdtree'
"file explore
Bundle 'mutewinter/ir_black_mod'
"colorscheme
Bundle 'flazz/vim-colorschemes'
"more colorschemes
Bundle 'godlygeek/csapprox'
"gvim colorschemes in console
Bundle 'Rykka/ColorV'
" show colors in vim
" Commands
Bundle 'scrooloose/nerdcommenter'
"comment out stuff
Bundle 'tpope/vim-surround'
"surround quotes etc.
Bundle 'tpope/vim-fugitive'
"git interface
Bundle 'unimpaired.vim'
"map ex commands for quicklist etc
Bundle 'godlygeek/tabular'
"align : = [ > etc.
Bundle 'mileszs/ack.vim'
"search in vim using ack
" Automatic Helpers
Bundle 'xolox/vim-session'
"save open files as a session
Bundle 'Raimondi/delimitMate'
" automatic closing of quotes etc.
Bundle 'scrooloose/syntastic'
" automatic syntax checking
Bundle 'ervandew/supertab'
" tab autocompletion
Bundle 'gregsexton/MatchTag'
" highlight matching html tag
Bundle 'Shougo/neocomplcache'
" autocomplete variable names
" SnipMate and dependencies
Bundle "garbas/vim-snipmate"
" textmate style snippets
Bundle "MarcWeber/vim-addon-mw-utils"
Bundle "tomtom/tlib_vim"
Bundle "snipmate-snippets"
" Language Additions
Bundle 'vim-ruby/vim-ruby'
Bundle 'msanders/cocoa.vim'
Bundle 'tpope/vim-haml'
Bundle 'pangloss/vim-javascript'
Bundle 'kchmck/vim-coffee-script'
Bundle 'itspriddle/vim-jquery'
Bundle 'tpope/vim-rails'
Bundle 'leshill/vim-json'
" Libraries
Bundle 'L9'
Bundle 'tpope/vim-repeat'
filetype plugin indent on " Automatically detect file types. (must turn on after Vundle)
" ----------------------------------------
" Platform Specific Configuration
" ----------------------------------------
if has('gui_macvim')
" MacVim
"set guifont=Menlo\ Regular:h11
set guifont=Inconsolata:h12
" Hide Toolbar in MacVim
if has("gui_running")
set guioptions=egmrt
endif
endif
" ----------------------------------------
" Regular Vim Configuartion (No Plugins Needed)
" ----------------------------------------
" ---------------
" Color
" ---------------
syntax enable
colorscheme ir_black_mod
hi MatchParen guifg=orange guibg=black gui=BOLD ctermfg=white ctermbg=black cterm=NONE
" ---------------
" Backups
" ---------------
set backup
set backupdir=~/.vim/backup
set directory=~/.vim/tmp
" ---------------
" UI
" ---------------
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
endif
set nu " Line numbers on
set nowrap " Line wrapping off
set laststatus=2 " Always show the statusline
set cmdheight=2
" ---------------
" Behaviors
" ---------------
set autoread " Automatically reload changes if detected
set wildmenu " Turn on WiLd menu
set hidden " Change buffer - without saving
set history=768 " Number of things to remember in history.
set cf " Enable error files & error jumping.
set clipboard+=unnamed " Yanks go on clipboard instead.
set autowrite " Writes on make/shell commands
set timeoutlen=350 " Time to wait for a command (after leader for example)
set foldlevelstart=99 " Remove folds
set formatoptions=crql
let g:CommandTMaxFiles=30000
let g:CommandTMaxCachedDirectories=0
set wildignore+=public
" ---------------
" Text Format
" ---------------
set tabstop=2
set backspace=2 " Delete everything with backspace
set shiftwidth=2 " Tabs under smart indent
set cindent
set autoindent
set smarttab
set expandtab
set backspace=2
set cpoptions=aABceFs$
set cul
let g:delimitMate_autoclose = 0
" ---------------
" Searching
" ---------------
set ignorecase " Case insensitive search
set smartcase " Non-case sensitive search
set incsearch
set hlsearch
" ---------------
" Ctags
" ---------------
let Tlist_Ctags_Cmd = '/usr/local/bin/ctags'
let Tlist_Show_One_File = 1
let Tlist_Use_Right_Window = 1
let Tlist_WinWidth = 40
" ---------------
" Visual
" ---------------
set showmatch " Show matching brackets.
set matchtime=2 " How many tenths of a second to blink
set listchars="" " Reset the listchars
set listchars=tab:\ \ " a tab should display as " ", trailing whitespace as "."
set listchars+=trail:. " show trailing spaces as dots
" ---------------
" Sounds
" ---------------
set noerrorbells
set visualbell
set t_vb=
" ---------------
" Mouse
" ---------------
set mousehide " Hide mouse after chars typed
set mouse=a " Mouse in all modes
" Better complete options to speed it up
set complete=.,w,b,u,U
" ----------------------------------------
" Bindings
" ----------------------------------------
" Window Movement
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
" Fixes common typos
command W w
command Q q
map <F1> <Esc>
imap <F1> <Esc>
" Removes doc lookup binding because it's easy to fat finger
nmap K k
vmap K k
" Make line completion easier
imap <C-l> <C-x><C-l>
" Use ; for : in normal and visual mode, less keystrokes
nnoremap ; :
vnoremap ; :
" double percentage sign in command mode is expanded
" to directory of current file - http://vimcasts.org/e/14
cnoremap %% <C-R>=expand('%:h').'/'<cr>
"map 0 to first non whitespace on line
map 0 ^
" Unimpaired configuration
" Bubble single lines
nmap <C-Up> [e
nmap <C-Down> ]e
" Bubble multiple lines
vmap <C-Up> [egv
vmap <C-Down> ]egv
" ---------------
" Leader
" ---------------
" Set leader to ,
let mapleader=","
nmap <silent> <leader>sp :set spell!<CR>
nmap <silent> <leader>ve :tabe ~/.vim/vimrc<CR>
nmap <silent> <leader>v :vsp<CR>
nmap <silent> <leader>s :sp<CR>
nmap <silent> <leader>t :tabnew<CR>
nmap <silent> <leader>c :close<CR>
nmap <silent> <leader>bd :bd<CR>
map <Leader>te :tabe <C-R>=expand("%:p:h") . "/" <CR>
map <Leader>. :ZoomWin<CR>
nnoremap <silent> <D-b> :CommandTBuffer<CR>
nnoremap <silent> <D-f> :CommandTFlush<CR>
" Ack:
map <D-f> :Ack<space>
" Toggle highlightsearch
nnoremap <silent> <Leader>/ :nohlsearch<CR>
vnoremap <silent> <Leader>/ :nohlsearch<CR>
" ----------------------------------------
" Auto Commands
" ----------------------------------------
if has("autocmd")
" No formatting on o key newlines
autocmd BufNewFile,BufEnter * set formatoptions-=o
" No more complaining about untitled documents
autocmd FocusLost silent! :wa
" When editing a file, always jump to the last cursor position.
" This must be after the uncompress commands.
autocmd BufReadPost *
\ if line("'\"") > 1 && line ("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
endif
" ----------------------------------------
" Plugin Configuration
" ----------------------------------------
" ---------------
" SuperTab
" ---------------
" Set these up for cross-buffer completion (something Neocachecompl has a hard
" time with)
let g:SuperTabDefaultCompletionType="<c-x><c-n>"
let g:SuperTabContextDefaultCompletionType="<c-x><c-n>"
" ---------------
" Neocachecompl
" ---------------
let g:neocomplcache_enable_at_startup=1
let g:neocomplcache_enable_auto_select=1 "Select the first entry automatically
let g:neocomplcache_enable_cursor_hold_i=1
let g:neocomplcache_cursor_hold_i_time=300
let g:neocomplcache_auto_completion_start_length=1
" Tab / Shift-Tab to cycle completions
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<S-TAB>"
" Ctrl-K to complete and advance snippet
imap <C-k> <Plug>(neocomplcache_snippets_expand)
smap <C-k> <Plug>(neocomplcache_snippets_expand)
" ---------------
" Lusty Juggler
" ---------------
if has('unix')
" Allows for previous buffer on unix systems without most recent patch level
" that enable LustyJuggler to work
nnoremap <leader>, :e#<CR>
else
nnoremap <leader>, :LustyJugglePrevious<CR>
end
let g:LustyJugglerShowKeys=1 " Show numbers for Lusty Buffers
let g:LustyJugglerSuppressRubyWarning=1
" Make Command / Alt 1-4 change to recent buffers in LustyJuggler
if has('ruby')
if has('mac') || has('macunix') || has('gui_macvim')
nmap <silent><D-1> :ruby LustyJ::profile() {$lusty_juggler.send('choose',2)}<CR>
nmap <silent><D-2> :ruby LustyJ::profile() {$lusty_juggler.send('choose',3)}<CR>
nmap <silent><D-3> :ruby LustyJ::profile() {$lusty_juggler.send('choose',4)}<CR>
nmap <silent><D-4> :ruby LustyJ::profile() {$lusty_juggler.send('choose',5)}<CR>
else
nmap <silent><M-1> :ruby LustyJ::profile() {$lusty_juggler.send('choose',2)}<CR>
nmap <silent><M-2> :ruby LustyJ::profile() {$lusty_juggler.send('choose',3)}<CR>
nmap <silent><M-3> :ruby LustyJ::profile() {$lusty_juggler.send('choose',4)}<CR>
nmap <silent><M-4> :ruby LustyJ::profile() {$lusty_juggler.send('choose',5)}<CR>
endif
end
" ---------------
" Syntastic
" ---------------
let g:syntastic_enable_signs=1
let g:syntastic_auto_loc_list=1
" ---------------
" NERDTree
" ---------------
nnoremap <leader>n :NERDTreeToggle<CR>
nnoremap <leader>nn :NERDTreeToggle<CR>
nnoremap <leader>nf :NERDTreeFind<CR>
let NERDTreeShowBookmarks=1
if has('unix') && !has('gui_macvim')
let NERDTreeDirArrows=0
end
let NERDTreeChDirMode=2 " Change the NERDTree directory to the root node
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
" ---------------
" Hex Highlight
" ---------------
command HexHighlight call HexHighlight()
nnoremap <leader>h :HexHighlight<CR>
" ---------------
" Command T
" ---------------
map <leader>fa :CommandTFlush<cr>\|:CommandT app/admin<cr>
map <leader>fj :CommandTFlush<cr>\|:CommandT app/assets/javascripts<cr>
map <leader>fs :CommandTFlush<cr>\|:CommandT app/assets/stylesheets<cr>
map <leader>fv :CommandTFlush<cr>\|:CommandT app/views<cr>
map <leader>fc :CommandTFlush<cr>\|:CommandT app/controllers<cr>
map <leader>fcc :CommandTFlush<cr>\|:CommandT config<cr>
map <leader>fd :CommandTFlush<cr>\|:CommandT db<cr>
map <leader>fm :CommandTFlush<cr>\|:CommandT app/models<cr>
map <leader>fmm :CommandTFlush<cr>\|:CommandT app/mailers<cr>
map <leader>fh :CommandTFlush<cr>\|:CommandT app/helpers<cr>
map <leader>fl :CommandTFlush<cr>\|:CommandT lib<cr>
map <leader>fo :CommandTFlush<cr>\|:CommandT config/locales<cr>
map <leader>ft :CommandTFlush<cr>\|:CommandT spec<cr>
map <leader>fw :CommandTFlush<cr>\|:CommandT app/workers<cr>
map <leader>fg :CommandTFlush<cr>\|:CommandT vendor/gems/ruby/1.9.1/gems<cr>
map <leader>ff :topleft 100 :split Gemfile<cr>
map <leader>f :CommandTFlush<cr>\|:CommandT<cr>
" http://vimcasts.org/e/14
cnoremap %% <C-R>=expand('%:h').'/'<cr>
map <leader>F :CommandTFlush<cr>\|:CommandT %%<cr>
" ---------------
" Indent Guides
" ---------------
let g:indent_guides_auto_colors=1
let g:indent_guides_enable_on_vim_startup=1
let g:indent_guides_color_change_percent=5
if has('unix') && !has('gui_macvim')
if $TERM == 'xterm-256color'
" Make the guides smaller since they will be crazy visible in 256color mode
let g:indent_guides_guide_size=1
else
" Turn off the guides when 256color mode isn't available
let g:indent_guides_enable_on_vim_startup=0
endif
endif
" ---------------
" Session
" ---------------
let g:session_autosave=0
let g:session_autoload=0
nnoremap <leader>os :OpenSession<CR>
" ---------------
" status.vim
" ---------------
let g:statusline_fugitive=1
let g:statusline_fullpath=0
" Everything must be after Right Separator for BufStat
let g:statusline_order=[
\ 'Filename',
\ 'Encoding',
\ 'Help',
\ 'Filetype',
\ 'Modified',
\ 'Fugitive',
\ 'RVM',
\ 'TabWarning',
\ 'Syntastic',
\ 'Paste',
\ 'ReadOnly',
\ 'RightSeperator',
\ 'CurrentHighlight',
\ 'CursorColumn',
\ 'LineAndTotal',
\ 'FilePercent']
" ---------------
" Tabular
" ---------------
nmap <Leader>t= :Tabularize /=<CR>
vmap <Leader>t= :Tabularize /=<CR>
nmap <Leader>t: :Tabularize /:\zs<CR>
vmap <Leader>t: :Tabularize /:\zs<CR>
nmap <Leader>t, :Tabularize /,\zs<CR>
vmap <Leader>t, :Tabularize /,\zs<CR>
nmap <Leader>t> :Tabularize /=>\zs<CR>
vmap <Leader>t> :Tabularize /=>\zs<CR>
" ---------------
" Vundle
" ---------------
nmap <Leader>bi :BundleInstall<CR>
nmap <Leader>bi! :BundleInstall!<CR>
nmap <Leader>bu :BundleInstall!<CR> " Because this also updates
nmap <Leader>bc :BundleClean<CR>
" ---------------
" Fix Trailing White Space
" ---------------
map <silent><leader>w :%s/\s\+$//e<CR>
command! FixTrailingWhiteSpace :%s/\s\+$//e
Jump to Line
Something went wrong with that request. Please try again.