Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 8427111180
Fetching contributors…

Cannot retrieve contributors at this time

executable file 440 lines (353 sloc) 11.996 kb
filetype off
call pathogen#runtime_append_all_bundles()
filetype plugin indent on
set nocompatible
set shell=/bin/zsh
set fileformats=unix,mac,dos
" Security
set modelines=0
" Tabs/spaces
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
" Basic options
set encoding=utf-8
set scrolloff=3
set autoindent
set showmode
set showcmd
set hidden
set wildmenu
set wildmode=list:longest
set visualbell
set cursorline
set ttyfast
set ruler
set backspace=indent,eol,start
set laststatus=2
set number
" Leader
let mapleader = ","
" Version 7.3 and up only
if v:version > 730
set undofile
set undoreload=10000
set colorcolumn=85
function! g:ToggleNuMode()
if(&rnu == 1)
set nu
else
set rnu
endif
endfunc
nnoremap <leader>l :call g:ToggleNuMode()<cr>
endif
" Status line
set statusline=%F%m%r%h%w%=(%{&ff}/%Y)\ (line\ %l\/%L,\ col\ %c)
" Backups
set backupdir=~/.vim/tmp/backup// " backups
set directory=~/.vim/tmp/swap// " swap files
set backup " enable backups
" Make Y not dumb
nnoremap Y y$
" Searching
nnoremap / /\v
vnoremap / /\v
set ignorecase
set smartcase
set incsearch
set showmatch
set hlsearch
set gdefault
map <leader><space> :noh<cr>
runtime macros/matchit.vim
nmap <tab> %
vmap <tab> %
" Soft/hard wrapping
"set wrap
"set textwidth=79
"set formatoptions=qrn1
" Use the same symbols as TextMate for tabstops and EOLs
"set list
"set listchars=tab:▸\ ,eol:¬
" Color scheme (terminal)
syntax on
set background=dark
colorscheme molokai
" NERD Tree
map <F2> :NERDTreeToggle<cr>
let NERDTreeIgnore=['.vim$', '\~$', '.*\.pyc$', 'pip-log\.txt$']
" Use the damn hjkl keys
nnoremap <up> <nop>
nnoremap <down> <nop>
nnoremap <left> <nop>
nnoremap <right> <nop>
" And make them fucking work, too.
nnoremap j gj
nnoremap k gk
" Easy buffer navigation
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
map <leader>w <C-w>v<C-w>l
" Folding
set foldlevelstart=0
nnoremap <Space> za
vnoremap <Space> za
noremap <leader>ft Vatzf
function! MyFoldText()
let line = getline(v:foldstart)
let nucolwidth = &fdc + &number * &numberwidth
let windowwidth = winwidth(0) - nucolwidth - 3
let foldedlinecount = v:foldend - v:foldstart
" expand tabs into spaces
let onetab = strpart(' ', 0, &tabstop)
let line = substitute(line, '\t', onetab, 'g')
let line = strpart(line, 0, windowwidth - 2 -len(foldedlinecount))
let fillcharcount = windowwidth - len(line) - len(foldedlinecount) - 4
return line . '' . repeat(" ",fillcharcount) . foldedlinecount . '' . ' '
endfunction
set foldtext=MyFoldText()
" Fuck you, help key.
"set fuoptions=maxvert,maxhorz
"inoremap <F1> <ESC>:set invfullscreen<CR>a
"nnoremap <F1> :set invfullscreen<CR>
"vnoremap <F1> :set invfullscreen<CR>
" Fuck you too, manual key
nnoremap K <nop>
" Remap ; to function as :
" nnoremap ; :
" REMOVED BECAUSE ; repeats f, F, t, T commands
" Various syntax stuff
au BufNewFile,BufRead *.less set filetype=less
au BufRead,BufNewFile *.scss set filetype=scss
au BufRead,BufNewFile *.confluencewiki set filetype=confluencewiki
au BufRead,BufNewFile *.confluencewiki set wrap linebreak nolist
au BufNewFile,BufRead *.m*down set filetype=markdown
au BufNewFile,BufRead *.m*down nnoremap <leader>1 yypVr=
au BufNewFile,BufRead *.m*down nnoremap <leader>2 yypVr-
au BufNewFile,BufRead *.m*down nnoremap <leader>3 I### <ESC>
au BufNewFile,BufRead *.vim set foldmethod=marker
" Sort CSS
map <leader>S ?{<CR>jV/^\s*\}?$<CR>k:sort<CR>:noh<CR>
" Clean whitespace
map <leader>W :%s/\s\+$//<cr>:let @/=''<CR>
" Ack
map <leader>a :Ack
" Yankring
nnoremap <silent> <leader>y :YRShow<cr>
let g:yankring_history_dir = '$HOME/.vim'
" Formatting, TextMate-style
map <leader>q gqip
nmap <leader>m :make<cr>
" Google's JSLint
au BufNewFile,BufRead *.js set makeprg=gjslint\ %
au BufNewFile,BufRead *.js set errorformat=%-P-----\ FILE\ \ :\ \ %f\ -----,Line\ %l\\,\ E:%n:\ %m,%-Q,%-GFound\ %s,%-GSome\ %s,%-Gfixjsstyle%s,%-Gscript\ can\ %s,%-G
" TESTING GOAT APPROVES OF THESE LINES
au BufNewFile,BufRead test_*.py set makeprg=nosetests\ --machine-out\ --nocapture
au BufNewFile,BufRead test_*.py set shellpipe=2>&1\ >/dev/null\ \|\ tee
au BufNewFile,BufRead test_*.py set errorformat=%f:%l:\ %m
au BufNewFile,BufRead test_*.py nmap <Leader>N :make<cr>
nmap <silent> <leader>ff :QFix<cr>
nmap <leader>fn :cn<cr>
nmap <leader>fp :cp<cr>
command -bang -nargs=? QFix call QFixToggle(<bang>0)
function! QFixToggle(forced)
if exists("g:qfix_win") && a:forced == 0
cclose
unlet g:qfix_win
else
copen 10
let g:qfix_win = bufnr("$")
endif
endfunction
" TODO: Put this in filetype-specific files
au BufNewFile,BufRead *.less set foldmethod=marker
au BufNewFile,BufRead *.less set foldmarker={,}
au BufNewFile,BufRead *.less set nocursorline
au BufRead,BufNewFile /etc/nginx/conf/* set ft=nginx
au BufRead,BufNewFile /etc/nginx/sites-available/* set ft=nginx
au BufRead,BufNewFile /usr/local/etc/nginx/sites-available/* set ft=nginx
au BufNewFile,BufRead *.js set foldmethod=marker
au BufNewFile,BufRead *.js set foldmarker={,}
" Easier linewise reselection
map <leader>v V`]
" HTML tag closing
inoremap <C-_> <Space><BS><Esc>:call InsertCloseTag()<cr>a
" Faster Esc
"inoremap <ESC> <nop>
inoremap jk <ESC>
" Scratch
nmap <leader><tab> :Sscratch<cr><C-W>x<C-j>:resize 15<cr>
" Make selecting inside an HTML tag less dumb
nnoremap Vit vitVkoj
nnoremap Vat vatV
" Diff
nmap <leader>d :!hg diff %<cr>
" Rainbows!
nmap <leader>R :RainbowParenthesesToggle<CR>
" Edit vim stuff.
nnoremap <leader>ev <C-w>s<C-w>j<C-w>L:e $MYVIMRC<cr>
nnoremap <leader>es <C-w>s<C-w>j<C-w>L:e ~/.vim/snippets/<cr>
" Sudo to write
cmap w!! w !sudo tee % >/dev/null
" Easy filetype switching
nnoremap _dt :set ft=htmldjango<CR>
nnoremap _jt :set ft=htmljinja<CR>
nnoremap _cw :set ft=confluencewiki<CR>
nnoremap _pd :set ft=python.django<CR>
" Python docs
nnoremap <leader>P :Pydoc<space>
" HALP
nnoremap _wtfcw :!open 'http://confluence.atlassian.com/renderer/notationhelp.action?section=all'<cr>
" VCS Stuff
let VCSCommandMapPrefix = "<leader>h"
" Disable useless HTML5 junk
let g:event_handler_attributes_complete = 0
let g:rdfa_attributes_complete = 0
let g:microdata_attributes_complete = 0
let g:atia_attributes_complete = 0
" Save when losing focus
au FocusLost * :wa
" Stop it, hash key
inoremap # X<BS>#
" Cram tests
au BufNewFile,BufRead *.t set filetype=cram
let cram_fold=1
autocmd Syntax cram setlocal foldlevel=1
" Show syntax highlighting groups for word under cursor
nmap <C-S> :call SynStack()<CR>
function! SynStack()
if !exists("*synstack")
return
endif
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
endfunc
" Tags!
let Tlist_Ctags_Cmd = "/usr/local/bin/ctags"
let Tlist_WinWidth = 50
let Tlist_Show_One_File = 1
map <F4> :TlistToggle<cr>
map <leader>T :!/usr/local/bin/ctags --exclude='**/ckeditor' -R . $(test -f .venv && echo ~/lib/virtualenvs/`cat .venv`)<CR>
" Rope and Bike.
"let g:bike_exceptions=1
"source $HOME/.vim/sadness/sadness.vim
"let ropevim_enable_shortcuts = 0
"let ropevim_guess_project = 1
"noremap <leader>rr :RopeRename<CR>
"vnoremap <leader>rm :RopeExtractMethod<CR>
"noremap <leader>roi :RopeOrganizeImports<CR>
" Gundo
nnoremap <F5> :GundoToggle<CR>
let g:gundo_debug = 1
let g:gundo_preview_bottom = 1
" Shortcut for square brackets
onoremap id i[
onoremap ad a[
" Next ()
vnoremap <silent> inb :<C-U>normal! f(vib<cr>
onoremap <silent> inb :<C-U>normal! f(vib<cr>
vnoremap <silent> anb :<C-U>normal! f(vab<cr>
onoremap <silent> anb :<C-U>normal! f(vab<cr>
vnoremap <silent> in( :<C-U>normal! f(vi(<cr>
onoremap <silent> in( :<C-U>normal! f(vi(<cr>
vnoremap <silent> an( :<C-U>normal! f(va(<cr>
onoremap <silent> an( :<C-U>normal! f(va(<cr>
" Next {}
vnoremap <silent> inB :<C-U>normal! f{viB<cr>
onoremap <silent> inB :<C-U>normal! f{viB<cr>
vnoremap <silent> anB :<C-U>normal! f{vaB<cr>
onoremap <silent> anB :<C-U>normal! f{vaB<cr>
vnoremap <silent> in{ :<C-U>normal! f{vi{<cr>
onoremap <silent> in{ :<C-U>normal! f{vi{<cr>
vnoremap <silent> an{ :<C-U>normal! f{va{<cr>
onoremap <silent> an{ :<C-U>normal! f{va{<cr>
" Next []
vnoremap <silent> ind :<C-U>normal! f[vi[<cr>
onoremap <silent> ind :<C-U>normal! f[vi[<cr>
vnoremap <silent> and :<C-U>normal! f[va[<cr>
onoremap <silent> and :<C-U>normal! f[va[<cr>
vnoremap <silent> in[ :<C-U>normal! f[vi[<cr>
onoremap <silent> in[ :<C-U>normal! f[vi[<cr>
vnoremap <silent> an[ :<C-U>normal! f[va[<cr>
onoremap <silent> an[ :<C-U>normal! f[va[<cr>
" Next <>
vnoremap <silent> in< :<C-U>normal! f<vi<<cr>
onoremap <silent> in< :<C-U>normal! f<vi<<cr>
vnoremap <silent> an< :<C-U>normal! f<va<<cr>
onoremap <silent> an< :<C-U>normal! f<va<<cr>
" Next ''
vnoremap <silent> in' :<C-U>normal! f'vi'<cr>
onoremap <silent> in' :<C-U>normal! f'vi'<cr>
vnoremap <silent> an' :<C-U>normal! f'va'<cr>
onoremap <silent> an' :<C-U>normal! f'va'<cr>
" Next ""
vnoremap <silent> in" :<C-U>normal! f"vi"<cr>
onoremap <silent> in" :<C-U>normal! f"vi"<cr>
vnoremap <silent> an" :<C-U>normal! f"va"<cr>
onoremap <silent> an" :<C-U>normal! f"va"<cr>
" Skipreturn
inoremap <c-cr> <esc>A<cr>
inoremap <s-cr> <esc>A:<cr>
au BufNewFile,BufRead *.html nnoremap <s-cr> vit<esc>a<cr><esc>vito<esc>i<cr><esc>
" From old .vimrc
set cf " enable error files and error jumping
:map <F3> :w !texcount.pl -brief %<CR>
inoreabbrev lorem Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
" Mappings
map <right> <ESC>:bn<RETURN> " right arrow (normal mode) switches buffers (excluding minibuf)
map <left> <ESC>:bp<RETURN> " left arrow (normal mode) switches buffers (excluding minibuf)
map <up> <ESC>:NERDTree<RETURN><ESC><C-W><C-W> " up arrow (normal mode) brings up a file list
map <down> <ESC>:w<RETURN> " down arrow (normal mode) brings up the buffer list
map <A-i> i <ESC>r " alt-i (normal mode) inserts a single char, and then switches back to normal
map <F2> <ESC>ggVG:call SuperRetab()<left>
map <F12> ggVGg? " encrypt the file (toggle)
"" HTML Filetype Settings
let g:do_xhtml_mappings = 'yes'
filetype plugin indent on
"" Custom Functions
" Select range, then hit :SuperRetab($width) - by p0g and FallingCow
function! SuperRetab(width) range
silent! exe a:firstline . ',' . a:lastline . 's/\v%(^ *)@<= {'. a:width .'}/\t/g'
endfunction
"" Haskell Mode
" use ghc functionality for haskell files
au Bufenter *.hs compiler ghc
let g:ghc = "/usr/bin/ghc"
"" Configure browser for haskell_doc.vim
let g:haddock_browser = "open"
let g:haddock_browser_callformat = "%s %s"
" Solarized stuff
let g:solarized_termcolors=16
colorscheme solarized
function! ToggleBackground()
if (g:solarized_style=="dark")
let g:solarized_style="light"
colorscheme solarized
else
let g:solarized_style="dark"
colorscheme solarized
endif
endfunction
command! Togbg call ToggleBackground()
nnoremap <F6> :call ToggleBackground()<CR>
inoremap <F6> <ESC>:call ToggleBackground()<CR>a
vnoremap <F6> <ESC>:call ToggleBackground()<CR>
map <F8> :set nowrap! < CR>
" Some GUI/CLI only settings
if has("gui_running")
set go-=T
set bg=dark
hi normal guibg=black
set transp=8
else
set bg=light
endif
" unicodeswitch.vim
let g:ucs_encode_html = 1
" prevent vim-R from turning _ into <-
let vimrplugin_underscore = 0
" for simplenote.vim
source ~/.simplenoterc
Jump to Line
Something went wrong with that request. Please try again.