# HG changeset patch # User Steve Losh # Date 1334345013 14400 # Node ID 7af578f732ed645a5d1db89382de94d8de69afef # Parent 611c23c4a5542ee4c2e9fb3d8e8690bb7c95b91c move diff -r 611c23c4a554 -r 7af578f732ed .ackrc --- a/.ackrc Fri Apr 13 15:13:59 2012 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ ---smart-case ---type-set -log=.log ---type-set -django=.py,.html ---type-set -less=.less ---type-set -vim=.vim ---type-set -puppet=.pp ---type-set -fe=.html,.js,.less ---type-set -fea=.html,.js,.less,.css ---type-set -docs=.markdown,.md,.mdown,.rst ---ignore-dir=public/media/cache ---ignore-dir=public/static/cache ---ignore-dir=build/html ---ignore-dir=docs/build ---ignore-dir=migrations diff -r 611c23c4a554 -r 7af578f732ed .ctags --- a/.ctags Fri Apr 13 15:13:59 2012 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ ---python-kinds=cfm ---javascript-kinds=cm ---fields=-s - ---languages=-html - ---exclude=flowplayer ---exclude=*.min.js ---exclude=jquery.*.js ---exclude=jquery-*.js ---exclude=.hg ---exclude=.ropeproject ---exclude=libs ---exclude=build ---exclude=dist ---exclude=user-data ---exclude=venv ---exclude=static-cache ---exclude=closure-library - ---langmap=Lisp:+.clj diff -r 611c23c4a554 -r 7af578f732ed .gitconfig --- a/.gitconfig Fri Apr 13 15:13:59 2012 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -[user] - name = Steve Losh - email = steve@stevelosh.com - -[core] - pager = cat - editor = vim - excludesfile = /Users/sjl/.gitignore - -[alias] - l = log -16 --color=always --all --topo-order --pretty='format:%Cgreen%h%Creset %s%Cred%d%Creset %C(black bold)(by %an)%Creset' - ll = log --color=always --all --topo-order --pretty='format:%Cgreen%h%Creset %s%Cred%d%Creset %C(black bold)(by %an)%Creset' - gl = log -10 --color=always --all --graph --topo-order --pretty='format:%Cgreen%h%Creset %s %C(black bold)(by %an)%Creset%C(yellow bold)%d%Creset%n' - gll = log --color=always --all --graph --topo-order --pretty='format:%Cgreen%h%Creset %s %C(black bold)(by %an)%Creset%C(yellow bold)%d%Creset%n' - - pull = pull --ff-only - merge = merge --no-ff - up = merge --ff-only - - ci = commit - cm = commit -m - - d = diff - di = diff --cached - - co = checkout - id = rev-parse - - stat = status - st = status - - unstage = reset HEAD - uns = reset HEAD - - currentbranch = !git branch --contains HEAD | grep '*' | tr -s ' ' | cut -d ' ' -f2 - fo = fetch origin - fu = fetch upstream - po = push origin - lo = pull origin - mo = !git merge --no-ff origin/`git currentbranch` - uo = !git merge --ff-only origin/`git currentbranch` - - addremove = !git add . && git add -u - addrem = !git addremove - -[push] - default = current - -[color] - branch = auto - diff = auto - interactive = auto - status = auto - -[difftool "Kaleidoscope"] - cmd = ksdiff-wrapper git \"$LOCAL\" \"$REMOTE\" - -[difftool] - prompt = false - -[diff] - tool = Kaleidoscope - -[merge] - tool = threesome - -[mergetool "threesome"] - cmd = "mvim -f $BASE $LOCAL $REMOTE $MERGED -c 'ThreesomeInit'" - trustExitCode = true -[web] - browser = open diff -r 611c23c4a554 -r 7af578f732ed .hgrc --- a/.hgrc Fri Apr 13 15:13:59 2012 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,266 +0,0 @@ -[ui] -username = Steve Losh -editor = vim -commitsubrepos = False -ignore = ~/.hgignore - -[extensions] -transplant = -graphlog = -record = -bookmarks = -rebase = -purge = -mq = -patchbomb = -extdiff = -color = -parentrevspec = -schemes = -progress = -fetch = -prompt = ~/lib/dotfiles/mercurial/hg-prompt/prompt.py -histedit = ~/lib/dotfiles/mercurial/histedit/hg_histedit.py -hggit = ~/.hg-git/hggit - -[progress] -delay = 1.0 - -[web] -cacerts = /etc/hg-dummy-cert.pem - -[schemes] -webf = ssh://sjl@sjl.webfactional.com/repos/ -bbs = ssh://hg@bitbucket.org/ -bbss = ssh://hg@bitbucket.org/sjl/ -bbsd = ssh://hg@bitbucket.org/dwaiter/ -gh = git://github.com/ -ghs = git+ssh://git@github.com/ -cb = ssh://hg@codebasehq.com/ -cbdw = ssh://hg@codebasehq.com/dwaiter/ -cbsl = ssh://hg@codebasehq.com/stevelosh/ -dwd = ssh://hg@bitbucket.org/dwaiter/ -nyh = ssh://sjl@gotham.nyhacker.org/ -dl = ssh://hg@hg.dwaiter.com:38038/ -mirr = ssh://hg@dwaiter.com:38038/mirror/ -gc = https://code.google.com/p/ - -[diff] -git = True -unified = 5 - -[extdiff] -cmd.vd = mvim -opts.vd = -c 'set lines=70' -c 'set columns=240' -f '+next' '+execute "DirDiff" argv(0) argv(1)' -cmd.ksdiff = /usr/local/bin/ksdiff-wrapper -opts.ksdiff = hg -cmd.dd = diffuse -opts.dd = - -[merge-tools] -threesome.executable = mvim -threesome.args = -f $base $local $other $output -c 'ThreesomeInit' -threesome.premerge = keep -threesome.priority = 1 - -keepthat.executable = sh -keepthat.args = -c 'cp "$local" "$output.original" && cp "$other" "$output"' -keepthat.premerge = True - -keepthis.executable = sh -keepthis.args = -c 'cp "$other" "$output.incoming" && cp "$local" "$output"' -keepthis.premerge = True - -[email] -method = smtp -from = Steve Losh - -[smtp] -host = smtp.gmail.com -port = 587 -username = steve@stevelosh.com -tls = True - -[color] -status.modified = cyan -status.added = green -status.removed = red -status.deleted = yellow bold underline -status.unknown = magenta bold underline -status.ignored = black bold -diff.diffline = none -diff.extended = cyan -diff.file_a = red -diff.file_b = green -diff.hunk = yellow bold -diff.deleted = red -diff.inserted = green -diff.changed = white -diff.trailingwhitespace = white_background - -[bookmarks] -track.current = True - -[defaults] -rebase = --keepbranches -addremove = --similarity 100 - -[alias] -# Nudge: just push the current branch. -nudge = push --branch . - -# Some useful little aliases. -st = status -SC -? = summary -fdiff = diff -U 10000000000000 -qfdiff = qdiff -U 10000000000000 - -# Push the qparent revision (mnemonic: q push parent). -qpp = push -r qparent - -# Merge with default. -md = merge default - -# Commit message shortcuts. -cm = commit -m -cus = commit -m 'Update subrepository state.' -cuf = commit -m 'Update fixtures.' -I '**fixtures**.json' -cmm = commit -m 'Merge.' -cws = commit -m 'Whitespace.' - -# Merge shortcuts. -mergelocal = !$HG --config ui.merge=internal:local merge $@ -mergeother = !$HG --config ui.merge=internal:other merge $@ -mergefail = !$HG --config ui.merge=internal:fail merge $@ - -# Shortcuts to resolve merge conflicts by taking one side or the other. -takelocal = !"$HG" revert --rev 'p1()' $@ && "$HG" resolve -m $@ -takeother = !"$HG" revert --rev 'p2()' $@ && "$HG" resolve -m $@ - -# Diff. -d = diff -p --color=auto - -# Run a colored diff and pipe it to less. -dl = !"$HG" diff -p --color=always | less -R - -# Kaleidoscope -# Mnemonics: "kaleidoscope diff" and "kaleidoscope show" -kd = !/opt/local/bin/hg ksdiff $@ -ks = !/opt/local/bin/hg ksdiff -c $@ - -# Log shortcuts -------------------------------------------------------------------- -# -# Each of these can be used with -v to add a bit more info. - -# Datelog: short, pretty hg log with dates. -dlog = log --style=$HOME/lib/dotfiles/mercurial/templates/map-cmdline.dlog -_ = dlog -l15 -__ = _ -l100000000 -o_ = outgoing -n --style=$HOME/lib/dotfiles/mercurial/templates/map-cmdline.dlog -i_ = incoming -n --style=$HOME/lib/dotfiles/mercurial/templates/map-cmdline.dlog - -# Shortlog: short, pretty hg log. -slog = log --style=$HOME/lib/dotfiles/mercurial/templates/map-cmdline.slog -. = slog -l15 -.. = . -l100000000 -o. = outgoing -n --style=$HOME/lib/dotfiles/mercurial/templates/map-cmdline.slog -i. = incoming -n --style=$HOME/lib/dotfiles/mercurial/templates/map-cmdline.slog - -# Short graphlog: short, pretty hg log with a graph. -sglog = glog --style=$HOME/lib/dotfiles/mercurial/templates/map-cmdline.sglog -, = sglog -l7 -,, = , -l100000000 -o, = outgoing --graph --style=$HOME/lib/dotfiles/mercurial/templates/map-cmdline.sglog -i, = incoming --graph --style=$HOME/lib/dotfiles/mercurial/templates/map-cmdline.sglog - - -# hg n . -- show a summary of rev . without diff. -# hg show . -- show a summary of rev . with diff. -nlog = log --style=$HOME/lib/dotfiles/mercurial/templates/map-cmdline.nlog -n = nlog -vr -show = nlog --color=always -vpr - -# Simple glog command that doesn't look bad and doesn't require my CLI templates. -gl = glog -l10 --template='\033[0;33m{rev}\033[0m {desc|firstline|strip} \033[0;35m{branches}\033[0m \033[0;33m{tags}\033[0m\n\033[1;30m({date|age} by {author|person})\033[0m\n\n' - -# Make a new repo with some sensible defaults. -mkrepo = !$HG init $1 && cd $1 && \ - echo 'syntax: glob' > .hgignore && \ - echo '' >> .hgignore && \ - echo '.DS_Store' >> .hgignore && \ - echo '*.pyc' >> .hgignore && \ - echo '*.swp' >> .hgignore && \ - echo '*.swo' >> .hgignore && \ - echo '*.un~' >> .hgignore && \ - echo '.ropeproject' >> .hgignore && \ - echo 'tags' >> .hgignore && \ - echo "[paths]\n" >> .hg/hgrc - -# Empty the current MQ patch. -qempty = !$HG qrefresh -X `$HG root` - -# Commit under any applied MQ patches, and go back to where you were after doing so. -# `hg ciunder` will use `$EDITOR` to get the commit message -# `hg cmunder 'message'` takes it on the command line -ciunder = !HG_CUR_PATCH=`$HG qtop --color=never` && \ - $HG qnew temp-for-under && \ - $HG qpop -a && \ - $HG qpush --move temp-for-under && \ - $HG qrefresh -e && \ - $HG qfinish temp-for-under && \ - $HG qpush $HG_CUR_PATCH -cmunder = !HG_CUR_PATCH=`$HG qtop --color=never` && \ - $HG qnew temp-for-under && \ - $HG qpop -a && \ - $HG qpush --move temp-for-under && \ - $HG qrefresh -m "$@" && \ - $HG qfinish temp-for-under && \ - $HG qpush $HG_CUR_PATCH - -# Edit the current repo's hgrc file. -erc = !$EDITOR `$HG root`/.hg/hgrc - -# Simple bug/todo tracking -# Idea from Justin: http://gist.github.com/464871 -# Install t first: http://bitbucket.org/sjl/t/ -bug = !~/lib/t/t.py --task-dir="`$HG root`" --list=BUGS $@ -todo = !~/lib/t/t.py --task-dir="`$HG root`" --list=TODO $@ - -# Easily add ignore patterns to .hgignore and commit. -ignore = ![ -n "$@" ] && echo '$@' >> `$HG root`/.hgignore && \ - $HG commit `$HG root`/.hgignore -Am 'Add "$@" to .hgignore.' - -# Show in MacVim -vshow = !$HG show $@ | mvim -c ':AnsiEsc' -c 'setlocal buftype=nofile' - - -# Ack for non-ignored files -ack = !$HG locate "set:not ignored()" | xargs ack $@ -grep-wdir = !$HG locate "set:not ignored()" | xargs grep $@ - -# Run hg commands on all subrepos at once. -subs = !"$HG" debugsub | grep '^path' | cut -d' ' -f2 | xargs -n1 -I SUB $HG -R "`$HG root`/SUB" $@ -psubs = !"$HG" debugsub | grep '^path' | cut -d' ' -f2 | parallel -j10 -I SUB $HG -R "`$HG root`/SUB" $@ - -# Run shell commands on all subrepos at once. -subscmd = !"$HG" debugsub | grep '^path' | cut -d' ' -f2 | xargs -n1 -I SUB sh -c "cd `$HG root`/SUB && $@" -psubscmd = !"$HG" debugsub | grep '^path' | cut -d' ' -f2 | parallel -j10 -I SUB sh -c "cd `$HG root`/SUB && $@" - -# Run a command on a subrepo: -# -# hg sub SUBREPO_REGEX ...command and arguments... -# -# The SUBREPO_REGEX should be a regex that will let grep match one and only one of -# the subrepos in .hgsub. For example: -# -# $ cat .hgsub -# bundled/foo = ... -# bundled/bar = ... -# -# $ hg sub fo root -# .../bundled/foo -# $ hg sub ar status -m -# M lol.py -sub = !grep = "`$HG root`/.hgsub" | cut -d' ' -f1 | grep "$1" | tr -d '\n ' | xargs -0 -I SUB $HG -R SUB $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14 $15 $16 $17 $18 $19 $20 - -# Local settings -%include ~/.hgrc_local diff -r 611c23c4a554 -r 7af578f732ed .offlineimaprc --- a/.offlineimaprc Fri Apr 13 15:13:59 2012 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -[general] -ui = TTY.TTYUI -accounts = SteveLosh -pythonfile=~/.mutt/offlineimap.py - -[Account SteveLosh] -localrepository = SteveLosh-Local -remoterepository = SteveLosh-Remote - -[Repository SteveLosh-Local] -type = Maildir -localfolders = ~/.mail/steve-stevelosh.com - -[Repository SteveLosh-Remote] -type = Gmail -remoteuser = steve@stevelosh.com -remotepasseval = get_keychain_pass(account="steve@stevelosh.com", server="imap.gmail.com") -realdelete = no -nametrans = lambda folder: re.sub('.*Drafts$', 'drafts', - re.sub('.*Sent Mail$', 'sent', - re.sub('.*Starred$', 'flagged', - re.sub('.*Trash$', 'trash', - re.sub('.*All Mail$', 'archive', - folder))))) -folderfilter = lambda folder: folder not in ['[Gmail]/Trash', - 'Nagios', - 'Flask', - '[Gmail]/Important', - '[Gmail]/Spam', - ] diff -r 611c23c4a554 -r 7af578f732ed .pentadactylrc --- a/.pentadactylrc Fri Apr 13 15:13:59 2012 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -"1.0b3 (created: 2010/11/06 12:31:35) - -highlight Hint font-size: 14px; background: rgba(210,1,133,0.8) !important; border: 2px solid rgb(165,1,105); padding: 4px; border-radius: 3px; font-weight: bold; margin-left: -25px; color: white; font-family: Helvetica; line-height:1em; -highlight HintActive background: rgba(145,197,43,0.8) !important; -highlight HintElem background: rgba(255, 209, 20, 0.7) !important; -highlight StatusLine -moz-appearance: none !important; font-weight: bold; background: transparent !important; border: 0px !important; min-height: 22px !important; text-shadow: none !important; font: normal 16px/1 'Menlo' !important; padding: 3px 0px 3px 5px !important; -highlight CmdLine padding: 1px !important; font: normal 16px 'Menlo' !important; -highlight CmdOutput font: normal 14px 'Menlo' !important; -highlight CompItem font: normal 14px 'Menlo' !important; - -highlight Find background: #d6c149; color: #000; - -set runtimepath=/Users/sjl/.pentadactyl -set editor='/usr/local/bin/mvim -f + ' -set followhints=1 -set showtabline=multitab -set showstatuslinks=command - -set mapleader=',' - -" FASTER PLEASE -nnoremap j 3j -nnoremap k 3k - -" Go to the second input field. -" Useful for skipping over search fields, etc. -nnoremap gI 2gi - -" I never use marks, but always use quickmarks. -nnoremap "'" go -nnoremap '"' gn - -" Switch tabs with parens -nnoremap ) :tn -nnoremap ( :tp - -" Finally I can overwrite the stupid fucking Firebug toggling correctly. -" nnoremap -" nnoremap - -" Console toggle -nnoremap -inoremap - -" Inspect element toggle -nnoremap -inoremap - -" Shift is hard. -nnoremap ; : - -" YES YES YES REMOVE THE IDIOCY -nnoremap - -" Highlight all search matches, not just the first. -set hlfind - -" Clear search highlighting and normal highlighting. -nnoremap :noh - -" Shut up. -javascript dactyl.beep = function() { return false; } diff -r 611c23c4a554 -r 7af578f732ed .urlview --- a/.urlview Fri Apr 13 15:13:59 2012 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -COMMAND open %s diff -r 611c23c4a554 -r 7af578f732ed .zshrc --- a/.zshrc Fri Apr 13 15:13:59 2012 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -export ZSH="$HOME/lib/oh-my-zsh" -export ZSH_THEME="prose" -export DISABLE_AUTO_UPDATE="true" -export OH_MY_ZSH_DEBUG="true" -plugins=(command-coloring pip fabric lein redis-cli vagrant) - -#test -f "$HOME/src/hgd/hd" && export OH_MY_ZSH_HG="$HOME/src/hgd/hd" || export OH_MY_ZSH_HG='hg' - -source $ZSH/oh-my-zsh.sh - - -# Custom options ------------------------------------------------------------- -unsetopt promptcr - -# Useful aliases ------------------------------------------------------------- -alias j='z' -alias fab='fab -i ~/.ssh/stevelosh' -alias oldgcc='export CC=/usr/bin/gcc-4.0' -alias tm='tmux -u2' -alias c='clear' -alias bp='bpython' - -export DISABLE_AUTO_TITLE="true" - -# Environment variables ------------------------------------------------------ -export EDITOR='vim' -export PATH="$HOME/.gem/ruby/1.8/bin:${PATH}" -export PATH="$HOME/bin:${PATH}" -export PATH="$HOME/lib/dotfiles/bin:${PATH}" -export PATH="$HOME/bin:/usr/local/bin:/usr/local/sbin:/opt/local/bin:$PATH" -export PATH="/opt/subversion/bin:${PATH}" -export PATH="/usr/local/Cellar/ruby/1.9.2-p290/bin:${PATH}" -export GREP_OPTIONS='--color=auto' -export HISTSIZE=1000 -export HISTFILESIZE=1000 -export HISTCONTROL=erasedups -export COMMAND_MODE=unix2003 -export RUBYOPT=rubygems -export CLASSPATH="$CLASSPATH:/usr/local/Cellar/clojure-contrib/1.2.0/clojure-contrib.jar" - -# Python variables ----------------------------------------------------------- -export PIP_DOWNLOAD_CACHE="$HOME/.pip/cache" -export PYTHONSTARTUP="$HOME/.pythonrc.py" -export WORKON_HOME="${HOME}/lib/virtualenvs" -export PATH="${PATH}:/Developer/usr/bin/" -export PATH="${PATH}:/usr/local/share/python/" -export PATH="${PATH}:$HOME/.lein/bin" -export PYTHONPATH="$PYTHONPATH:/usr/local/Cellar/python/2.7.1/lib/python2.7/site-packages" -export PYTHONPATH="$PYTHONPATH:/usr/local/lib/python2.7.1/site-packages" -export PYTHONPATH="$PYTHONPATH:/usr/local/lib/python2.7/site-packages" -export PYTHONPATH="$PYTHONPATH:/usr/local/lib/python2.6/site-packages" -export VEW_PATH="$HOME/lib/python/virtualenvwrapper/virtualenvwrapper.sh" -export PYTHONPATH="$HOME/lib/python/see:$PYTHONPATH" -export NODE_PATH="$NODE_PATH:/usr/local/lib/node:/usr/local/lib/node_modules" - -# Mercurial variables -------------------------------------------------------- -export PATH="$HOME/lib/hg/hg-stable:$PATH" -export PYTHONPATH="$HOME/lib/hg/hg-stable:$PYTHONPATH" - -# Extra ---------------------------------------------------------------------- -source `brew --prefix`/etc/profile.d/z.sh - -# Pre-Prompt Command --------------------------------------------------------- -function precmd () { - z --add "$(pwd -P)" -} - -# Local Settings ------------------------------------------------------------- -if [[ -s $HOME/.zshrc_local ]] ; then source $HOME/.zshrc_local ; fi - -# Emacs... ------------------------------------------------------------------- -alias e='emacsclient -nc .' diff -r 611c23c4a554 -r 7af578f732ed ackrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ackrc Fri Apr 13 15:23:33 2012 -0400 @@ -0,0 +1,22 @@ +--smart-case +--type-set +log=.log +--type-set +django=.py,.html +--type-set +less=.less +--type-set +vim=.vim +--type-set +puppet=.pp +--type-set +fe=.html,.js,.less +--type-set +fea=.html,.js,.less,.css +--type-set +docs=.markdown,.md,.mdown,.rst +--ignore-dir=public/media/cache +--ignore-dir=public/static/cache +--ignore-dir=build/html +--ignore-dir=docs/build +--ignore-dir=migrations diff -r 611c23c4a554 -r 7af578f732ed bin/bootstrap.sh --- a/bin/bootstrap.sh Fri Apr 13 15:13:59 2012 -0400 +++ b/bin/bootstrap.sh Fri Apr 13 15:23:33 2012 -0400 @@ -4,6 +4,8 @@ set -e +echo "prerequisites: python git pip dulwich" + function ensure_link { test -L "$HOME/$2" || ln -s "$HOME/$1" "$HOME/$2" } @@ -13,8 +15,8 @@ mkdir -p ~/bin mkdir -p ~/src -test -d ~/.hg-git/ || clone "bb://durin42/hg-git/" "$HOME/.hg-git" -test -d ~/.hg-git/dulwich || git clone "git://github.com/jelmer/dulwich.git" "$HOME/lib/dulwich" +test -d ~/.hg-git/ || hg clone "bb://durin42/hg-git/" "$HOME/.hg-git" +test -d ~/lib/dulwich || git clone "git://github.com/jelmer/dulwich.git" "$HOME/lib/dulwich" ensure_link "lib/dulwich" "lib/hg/hg-stable/dulwich" test -d ~/lib/dotfiles || hg clone http://bitbucket.org/sjl/dotfiles ~/lib/dotfiles @@ -28,9 +30,14 @@ ensure_link "lib/dotfiles/ackrc" ".ackrc" ensure_link "lib/dotfiles/zsh" "lib/oh-my-zsh/custom" ensure_link "lib/dotfiles/zshrc" ".zshrc" +ensure_link "lib/dotfiles/weechat" ".weechat" +ensure_link "lib/dotfiles/urlview" ".urlview" +ensure_link "lib/dotfiles/pentadactylrc" ".pentadactylrc" +ensure_link "lib/dotfiles/offlineimaprc" ".offlineimaprc" +ensure_link "lib/dotfiles/mutt" ".mutt" +ensure_link "lib/dotfiles/dotjs" ".js" +ensure_link "lib/dotfiles/dotcss" ".css" +ensure_link "lib/dotfiles/hgignore" ".hgignore" +ensure_link "lib/dotfiles/ctags" ".ctags" -hg clone "bb://sjl/hg-prompt/" "$HOME/lib/dotfiles/mercurial/hg-prompt" -hg clone "bb://ccaughie/hgcollapse/" "$HOME/lib/dotfiles/mercurial/hgcollapse" -hg clone "bb://durin42/histedit/" "$HOME/lib/dotfiles/mercurial/histedit" - - +echo completed diff -r 611c23c4a554 -r 7af578f732ed ctags --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ctags Fri Apr 13 15:23:33 2012 -0400 @@ -0,0 +1,21 @@ +--python-kinds=cfm +--javascript-kinds=cm +--fields=-s + +--languages=-html + +--exclude=flowplayer +--exclude=*.min.js +--exclude=jquery.*.js +--exclude=jquery-*.js +--exclude=.hg +--exclude=.ropeproject +--exclude=libs +--exclude=build +--exclude=dist +--exclude=user-data +--exclude=venv +--exclude=static-cache +--exclude=closure-library + +--langmap=Lisp:+.clj diff -r 611c23c4a554 -r 7af578f732ed gitconfig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gitconfig Fri Apr 13 15:23:33 2012 -0400 @@ -0,0 +1,71 @@ +[user] + name = Steve Losh + email = steve@stevelosh.com + +[core] + pager = cat + editor = vim + excludesfile = /Users/sjl/.gitignore + +[alias] + l = log -16 --color=always --all --topo-order --pretty='format:%Cgreen%h%Creset %s%Cred%d%Creset %C(black bold)(by %an)%Creset' + ll = log --color=always --all --topo-order --pretty='format:%Cgreen%h%Creset %s%Cred%d%Creset %C(black bold)(by %an)%Creset' + gl = log -10 --color=always --all --graph --topo-order --pretty='format:%Cgreen%h%Creset %s %C(black bold)(by %an)%Creset%C(yellow bold)%d%Creset%n' + gll = log --color=always --all --graph --topo-order --pretty='format:%Cgreen%h%Creset %s %C(black bold)(by %an)%Creset%C(yellow bold)%d%Creset%n' + + pull = pull --ff-only + merge = merge --no-ff + up = merge --ff-only + + ci = commit + cm = commit -m + + d = diff + di = diff --cached + + co = checkout + id = rev-parse + + stat = status + st = status + + unstage = reset HEAD + uns = reset HEAD + + currentbranch = !git branch --contains HEAD | grep '*' | tr -s ' ' | cut -d ' ' -f2 + fo = fetch origin + fu = fetch upstream + po = push origin + lo = pull origin + mo = !git merge --no-ff origin/`git currentbranch` + uo = !git merge --ff-only origin/`git currentbranch` + + addremove = !git add . && git add -u + addrem = !git addremove + +[push] + default = current + +[color] + branch = auto + diff = auto + interactive = auto + status = auto + +[difftool "Kaleidoscope"] + cmd = ksdiff-wrapper git \"$LOCAL\" \"$REMOTE\" + +[difftool] + prompt = false + +[diff] + tool = Kaleidoscope + +[merge] + tool = threesome + +[mergetool "threesome"] + cmd = "mvim -f $BASE $LOCAL $REMOTE $MERGED -c 'ThreesomeInit'" + trustExitCode = true +[web] + browser = open diff -r 611c23c4a554 -r 7af578f732ed hgrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hgrc Fri Apr 13 15:23:33 2012 -0400 @@ -0,0 +1,266 @@ +[ui] +username = Steve Losh +editor = vim +commitsubrepos = False +ignore = ~/.hgignore + +[extensions] +transplant = +graphlog = +record = +bookmarks = +rebase = +purge = +mq = +patchbomb = +extdiff = +color = +parentrevspec = +schemes = +progress = +fetch = +prompt = ~/lib/dotfiles/mercurial/hg-prompt/prompt.py +histedit = ~/lib/dotfiles/mercurial/histedit/hg_histedit.py +hggit = ~/.hg-git/hggit + +[progress] +delay = 1.0 + +[web] +cacerts = /etc/hg-dummy-cert.pem + +[schemes] +webf = ssh://sjl@sjl.webfactional.com/repos/ +bbs = ssh://hg@bitbucket.org/ +bbss = ssh://hg@bitbucket.org/sjl/ +bbsd = ssh://hg@bitbucket.org/dwaiter/ +gh = git://github.com/ +ghs = git+ssh://git@github.com/ +cb = ssh://hg@codebasehq.com/ +cbdw = ssh://hg@codebasehq.com/dwaiter/ +cbsl = ssh://hg@codebasehq.com/stevelosh/ +dwd = ssh://hg@bitbucket.org/dwaiter/ +nyh = ssh://sjl@gotham.nyhacker.org/ +dl = ssh://hg@hg.dwaiter.com:38038/ +mirr = ssh://hg@dwaiter.com:38038/mirror/ +gc = https://code.google.com/p/ + +[diff] +git = True +unified = 5 + +[extdiff] +cmd.vd = mvim +opts.vd = -c 'set lines=70' -c 'set columns=240' -f '+next' '+execute "DirDiff" argv(0) argv(1)' +cmd.ksdiff = /usr/local/bin/ksdiff-wrapper +opts.ksdiff = hg +cmd.dd = diffuse +opts.dd = + +[merge-tools] +threesome.executable = mvim +threesome.args = -f $base $local $other $output -c 'ThreesomeInit' +threesome.premerge = keep +threesome.priority = 1 + +keepthat.executable = sh +keepthat.args = -c 'cp "$local" "$output.original" && cp "$other" "$output"' +keepthat.premerge = True + +keepthis.executable = sh +keepthis.args = -c 'cp "$other" "$output.incoming" && cp "$local" "$output"' +keepthis.premerge = True + +[email] +method = smtp +from = Steve Losh + +[smtp] +host = smtp.gmail.com +port = 587 +username = steve@stevelosh.com +tls = True + +[color] +status.modified = cyan +status.added = green +status.removed = red +status.deleted = yellow bold underline +status.unknown = magenta bold underline +status.ignored = black bold +diff.diffline = none +diff.extended = cyan +diff.file_a = red +diff.file_b = green +diff.hunk = yellow bold +diff.deleted = red +diff.inserted = green +diff.changed = white +diff.trailingwhitespace = white_background + +[bookmarks] +track.current = True + +[defaults] +rebase = --keepbranches +addremove = --similarity 100 + +[alias] +# Nudge: just push the current branch. +nudge = push --branch . + +# Some useful little aliases. +st = status -SC +? = summary +fdiff = diff -U 10000000000000 +qfdiff = qdiff -U 10000000000000 + +# Push the qparent revision (mnemonic: q push parent). +qpp = push -r qparent + +# Merge with default. +md = merge default + +# Commit message shortcuts. +cm = commit -m +cus = commit -m 'Update subrepository state.' +cuf = commit -m 'Update fixtures.' -I '**fixtures**.json' +cmm = commit -m 'Merge.' +cws = commit -m 'Whitespace.' + +# Merge shortcuts. +mergelocal = !$HG --config ui.merge=internal:local merge $@ +mergeother = !$HG --config ui.merge=internal:other merge $@ +mergefail = !$HG --config ui.merge=internal:fail merge $@ + +# Shortcuts to resolve merge conflicts by taking one side or the other. +takelocal = !"$HG" revert --rev 'p1()' $@ && "$HG" resolve -m $@ +takeother = !"$HG" revert --rev 'p2()' $@ && "$HG" resolve -m $@ + +# Diff. +d = diff -p --color=auto + +# Run a colored diff and pipe it to less. +dl = !"$HG" diff -p --color=always | less -R + +# Kaleidoscope +# Mnemonics: "kaleidoscope diff" and "kaleidoscope show" +kd = !/opt/local/bin/hg ksdiff $@ +ks = !/opt/local/bin/hg ksdiff -c $@ + +# Log shortcuts -------------------------------------------------------------------- +# +# Each of these can be used with -v to add a bit more info. + +# Datelog: short, pretty hg log with dates. +dlog = log --style=$HOME/lib/dotfiles/mercurial/templates/map-cmdline.dlog +_ = dlog -l15 +__ = _ -l100000000 +o_ = outgoing -n --style=$HOME/lib/dotfiles/mercurial/templates/map-cmdline.dlog +i_ = incoming -n --style=$HOME/lib/dotfiles/mercurial/templates/map-cmdline.dlog + +# Shortlog: short, pretty hg log. +slog = log --style=$HOME/lib/dotfiles/mercurial/templates/map-cmdline.slog +. = slog -l15 +.. = . -l100000000 +o. = outgoing -n --style=$HOME/lib/dotfiles/mercurial/templates/map-cmdline.slog +i. = incoming -n --style=$HOME/lib/dotfiles/mercurial/templates/map-cmdline.slog + +# Short graphlog: short, pretty hg log with a graph. +sglog = glog --style=$HOME/lib/dotfiles/mercurial/templates/map-cmdline.sglog +, = sglog -l7 +,, = , -l100000000 +o, = outgoing --graph --style=$HOME/lib/dotfiles/mercurial/templates/map-cmdline.sglog +i, = incoming --graph --style=$HOME/lib/dotfiles/mercurial/templates/map-cmdline.sglog + + +# hg n . -- show a summary of rev . without diff. +# hg show . -- show a summary of rev . with diff. +nlog = log --style=$HOME/lib/dotfiles/mercurial/templates/map-cmdline.nlog +n = nlog -vr +show = nlog --color=always -vpr + +# Simple glog command that doesn't look bad and doesn't require my CLI templates. +gl = glog -l10 --template='\033[0;33m{rev}\033[0m {desc|firstline|strip} \033[0;35m{branches}\033[0m \033[0;33m{tags}\033[0m\n\033[1;30m({date|age} by {author|person})\033[0m\n\n' + +# Make a new repo with some sensible defaults. +mkrepo = !$HG init $1 && cd $1 && \ + echo 'syntax: glob' > .hgignore && \ + echo '' >> .hgignore && \ + echo '.DS_Store' >> .hgignore && \ + echo '*.pyc' >> .hgignore && \ + echo '*.swp' >> .hgignore && \ + echo '*.swo' >> .hgignore && \ + echo '*.un~' >> .hgignore && \ + echo '.ropeproject' >> .hgignore && \ + echo 'tags' >> .hgignore && \ + echo "[paths]\n" >> .hg/hgrc + +# Empty the current MQ patch. +qempty = !$HG qrefresh -X `$HG root` + +# Commit under any applied MQ patches, and go back to where you were after doing so. +# `hg ciunder` will use `$EDITOR` to get the commit message +# `hg cmunder 'message'` takes it on the command line +ciunder = !HG_CUR_PATCH=`$HG qtop --color=never` && \ + $HG qnew temp-for-under && \ + $HG qpop -a && \ + $HG qpush --move temp-for-under && \ + $HG qrefresh -e && \ + $HG qfinish temp-for-under && \ + $HG qpush $HG_CUR_PATCH +cmunder = !HG_CUR_PATCH=`$HG qtop --color=never` && \ + $HG qnew temp-for-under && \ + $HG qpop -a && \ + $HG qpush --move temp-for-under && \ + $HG qrefresh -m "$@" && \ + $HG qfinish temp-for-under && \ + $HG qpush $HG_CUR_PATCH + +# Edit the current repo's hgrc file. +erc = !$EDITOR `$HG root`/.hg/hgrc + +# Simple bug/todo tracking +# Idea from Justin: http://gist.github.com/464871 +# Install t first: http://bitbucket.org/sjl/t/ +bug = !~/lib/t/t.py --task-dir="`$HG root`" --list=BUGS $@ +todo = !~/lib/t/t.py --task-dir="`$HG root`" --list=TODO $@ + +# Easily add ignore patterns to .hgignore and commit. +ignore = ![ -n "$@" ] && echo '$@' >> `$HG root`/.hgignore && \ + $HG commit `$HG root`/.hgignore -Am 'Add "$@" to .hgignore.' + +# Show in MacVim +vshow = !$HG show $@ | mvim -c ':AnsiEsc' -c 'setlocal buftype=nofile' - + +# Ack for non-ignored files +ack = !$HG locate "set:not ignored()" | xargs ack $@ +grep-wdir = !$HG locate "set:not ignored()" | xargs grep $@ + +# Run hg commands on all subrepos at once. +subs = !"$HG" debugsub | grep '^path' | cut -d' ' -f2 | xargs -n1 -I SUB $HG -R "`$HG root`/SUB" $@ +psubs = !"$HG" debugsub | grep '^path' | cut -d' ' -f2 | parallel -j10 -I SUB $HG -R "`$HG root`/SUB" $@ + +# Run shell commands on all subrepos at once. +subscmd = !"$HG" debugsub | grep '^path' | cut -d' ' -f2 | xargs -n1 -I SUB sh -c "cd `$HG root`/SUB && $@" +psubscmd = !"$HG" debugsub | grep '^path' | cut -d' ' -f2 | parallel -j10 -I SUB sh -c "cd `$HG root`/SUB && $@" + +# Run a command on a subrepo: +# +# hg sub SUBREPO_REGEX ...command and arguments... +# +# The SUBREPO_REGEX should be a regex that will let grep match one and only one of +# the subrepos in .hgsub. For example: +# +# $ cat .hgsub +# bundled/foo = ... +# bundled/bar = ... +# +# $ hg sub fo root +# .../bundled/foo +# $ hg sub ar status -m +# M lol.py +sub = !grep = "`$HG root`/.hgsub" | cut -d' ' -f1 | grep "$1" | tr -d '\n ' | xargs -0 -I SUB $HG -R SUB $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14 $15 $16 $17 $18 $19 $20 + +# Local settings +%include ~/.hgrc_local diff -r 611c23c4a554 -r 7af578f732ed offlinimaprc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/offlinimaprc Fri Apr 13 15:23:33 2012 -0400 @@ -0,0 +1,30 @@ +[general] +ui = TTY.TTYUI +accounts = SteveLosh +pythonfile=~/.mutt/offlineimap.py + +[Account SteveLosh] +localrepository = SteveLosh-Local +remoterepository = SteveLosh-Remote + +[Repository SteveLosh-Local] +type = Maildir +localfolders = ~/.mail/steve-stevelosh.com + +[Repository SteveLosh-Remote] +type = Gmail +remoteuser = steve@stevelosh.com +remotepasseval = get_keychain_pass(account="steve@stevelosh.com", server="imap.gmail.com") +realdelete = no +nametrans = lambda folder: re.sub('.*Drafts$', 'drafts', + re.sub('.*Sent Mail$', 'sent', + re.sub('.*Starred$', 'flagged', + re.sub('.*Trash$', 'trash', + re.sub('.*All Mail$', 'archive', + folder))))) +folderfilter = lambda folder: folder not in ['[Gmail]/Trash', + 'Nagios', + 'Flask', + '[Gmail]/Important', + '[Gmail]/Spam', + ] diff -r 611c23c4a554 -r 7af578f732ed pentadactylrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pentadactylrc Fri Apr 13 15:23:33 2012 -0400 @@ -0,0 +1,62 @@ +"1.0b3 (created: 2010/11/06 12:31:35) + +highlight Hint font-size: 14px; background: rgba(210,1,133,0.8) !important; border: 2px solid rgb(165,1,105); padding: 4px; border-radius: 3px; font-weight: bold; margin-left: -25px; color: white; font-family: Helvetica; line-height:1em; +highlight HintActive background: rgba(145,197,43,0.8) !important; +highlight HintElem background: rgba(255, 209, 20, 0.7) !important; +highlight StatusLine -moz-appearance: none !important; font-weight: bold; background: transparent !important; border: 0px !important; min-height: 22px !important; text-shadow: none !important; font: normal 16px/1 'Menlo' !important; padding: 3px 0px 3px 5px !important; +highlight CmdLine padding: 1px !important; font: normal 16px 'Menlo' !important; +highlight CmdOutput font: normal 14px 'Menlo' !important; +highlight CompItem font: normal 14px 'Menlo' !important; + +highlight Find background: #d6c149; color: #000; + +set runtimepath=/Users/sjl/.pentadactyl +set editor='/usr/local/bin/mvim -f + ' +set followhints=1 +set showtabline=multitab +set showstatuslinks=command + +set mapleader=',' + +" FASTER PLEASE +nnoremap j 3j +nnoremap k 3k + +" Go to the second input field. +" Useful for skipping over search fields, etc. +nnoremap gI 2gi + +" I never use marks, but always use quickmarks. +nnoremap "'" go +nnoremap '"' gn + +" Switch tabs with parens +nnoremap ) :tn +nnoremap ( :tp + +" Finally I can overwrite the stupid fucking Firebug toggling correctly. +" nnoremap +" nnoremap + +" Console toggle +nnoremap +inoremap + +" Inspect element toggle +nnoremap +inoremap + +" Shift is hard. +nnoremap ; : + +" YES YES YES REMOVE THE IDIOCY +nnoremap + +" Highlight all search matches, not just the first. +set hlfind + +" Clear search highlighting and normal highlighting. +nnoremap :noh + +" Shut up. +javascript dactyl.beep = function() { return false; } diff -r 611c23c4a554 -r 7af578f732ed urlview --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/urlview Fri Apr 13 15:23:33 2012 -0400 @@ -0,0 +1,1 @@ +COMMAND open %s diff -r 611c23c4a554 -r 7af578f732ed vim/.vimrc --- a/vim/.vimrc Fri Apr 13 15:13:59 2012 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1668 +0,0 @@ -" .vimrc -" Author: Steve Losh -" Source: http://bitbucket.org/sjl/dotfiles/src/tip/vim/ -" -" This file changes a lot. I'll try to document pieces of it whenever I have -" a few minutes to kill. - -" Preamble ---------------------------------------------------------------- {{{ - -filetype off -call pathogen#runtime_append_all_bundles() -filetype plugin indent on -set nocompatible - -" }}} -" Basic options ----------------------------------------------------------- {{{ - -set encoding=utf-8 -set modelines=0 -set autoindent -set showmode -set showcmd -set hidden -set visualbell -set ttyfast -set ruler -set backspace=indent,eol,start -set nonumber -set norelativenumber -set laststatus=2 -set history=1000 -set undofile -set undoreload=10000 -set list -set listchars=tab:▸\ ,eol:¬,extends:❯,precedes:❮ -set shell=/bin/bash -set lazyredraw -set matchtime=3 -set showbreak=↪ -set splitbelow -set splitright -set fillchars=diff:⣿,vert:│ -set autowrite -set shiftround -set autoread -set title -set linebreak -set dictionary=/usr/share/dict/words -set spellfile=~/.vim/custom-dictionary.utf-8.add -set colorcolumn=+1 - -" Time out on key codes but not mappings. -" Basically this makes terminal Vim work sanely. -set notimeout -set ttimeout -set ttimeoutlen=10 - -" Make Vim able to edit crontab files again. -set backupskip=/tmp/*,/private/tmp/*" - -" Better Completion -set completeopt=longest,menuone,preview - -" Save when losing focus -au FocusLost * :silent! wall - -" Resize splits when the window is resized -au VimResized * :wincmd = - -" Cursorline {{{ -" Only show cursorline in the current window and in normal mode. - -augroup cline - au! - au WinLeave * set nocursorline - au WinEnter * set cursorline - au InsertEnter * set nocursorline - au InsertLeave * set cursorline -augroup END - -" }}} -" cpoptions+=J, dammit {{{ - -" Something occasionally removes this. If I manage to find it I'm going to -" comment out the line and replace all its characters with 'FUCK'. -augroup twospace - au! - au BufRead * :set cpoptions+=J -augroup END - -" }}} -" Trailing whitespace {{{ -" Only shown when not in insert mode so I don't go insane. - -augroup trailing - au! - au InsertEnter * :set listchars-=trail:⌴ - au InsertLeave * :set listchars+=trail:⌴ -augroup END - -" }}} -" Wildmenu completion {{{ - -set wildmenu -set wildmode=list:longest - -set wildignore+=.hg,.git,.svn " Version control -set wildignore+=*.aux,*.out,*.toc " LaTeX intermediate files -set wildignore+=*.jpg,*.bmp,*.gif,*.png,*.jpeg " binary images -set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest " compiled object files -set wildignore+=*.spl " compiled spelling word lists -set wildignore+=*.sw? " Vim swap files -set wildignore+=*.DS_Store " OSX bullshit - -set wildignore+=*.luac " Lua byte code - -set wildignore+=migrations " Django migrations -set wildignore+=*.pyc " Python byte code - -set wildignore+=*.orig " Merge resolution files - -" Clojure/Leiningen -set wildignore+=classes -set wildignore+=lib - -" }}} -" Line Return {{{ - -" Make sure Vim returns to the same line when you reopen a file. -" Thanks, Amit -augroup line_return - au! - au BufReadPost * - \ if line("'\"") > 0 && line("'\"") <= line("$") | - \ execute 'normal! g`"zvzz' | - \ endif -augroup END - -" }}} -" Tabs, spaces, wrapping {{{ - -set tabstop=8 -set shiftwidth=4 -set softtabstop=4 -set expandtab -set wrap -set textwidth=80 -set formatoptions=qrn1 -set colorcolumn=+1 - -" }}} -" Backups {{{ - -set undodir=~/.vim/tmp/undo// " undo files -set backupdir=~/.vim/tmp/backup// " backups -set directory=~/.vim/tmp/swap// " swap files -set backup " enable backups -set noswapfile " It's 2012, Vim. - -" }}} -" Leader {{{ - -let mapleader = "," -let maplocalleader = "\\" - -" }}} -" Color scheme {{{ - -syntax on -set background=dark -let g:badwolf_html_link_underline = 0 -colorscheme badwolf - -" Highlight VCS conflict markers -match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$' - -" }}} - -" }}} -" Abbreviations ----------------------------------------------------------- {{{ - -function! EatChar(pat) - let c = nr2char(getchar(0)) - return (c =~ a:pat) ? '' : c -endfunction - -function! MakeSpacelessIabbrev(from, to) - execute "iabbrev ".a:from." ".a:to."=EatChar('\\s')" -endfunction - -call MakeSpacelessIabbrev('sl/', 'http://stevelosh.com/') -call MakeSpacelessIabbrev('bb/', 'http://bitbucket.org/') -call MakeSpacelessIabbrev('bbs/', 'http://bitbucket.org/sjl/') -call MakeSpacelessIabbrev('gh/', 'http://github.com/') -call MakeSpacelessIabbrev('ghs/', 'http://github.com/sjl/') - -iabbrev ldis ಠ_ಠ -iabbrev lsad ಥ_ಥ -iabbrev lhap ಥ‿ಥ - -iabbrev sl@ steve@stevelosh.com -iabbrev vrcf `~/.vimrc` file - -inoremap a a* -inoremap b b* -inoremap g g* -inoremap d d* -inoremap e e* -inoremap l l* -inoremap y y* -inoremap h h* -inoremap m m* -inoremap r r* -inoremap p p* -inoremap f f* - -" }}} -" Convenience mappings ---------------------------------------------------- {{{ - -" Fuck you, help key. -noremap :set invfullscreen -inoremap :set invfullscreena - -" Stop it, hash key. -inoremap # X# - -" Kill window -nnoremap K :q - -" Unfuck my screen -nnoremap u :syntax sync fromstart:redraw! - -" System clipboard interaction -" From https://github.com/henrik/dotfiles/blob/master/vim/config/mappings.vim -noremap y "*y -noremap p :set paste"*p:set nopaste -noremap P :set paste"*P:set nopaste - -" I constantly hit "u" in visual mode when I mean to "y". Use "gu" for those rare occasions. -" From https://github.com/henrik/dotfiles/blob/master/vim/config/mappings.vim -vnoremap u -vnoremap gu u - -" For some reason ctags refuses to ignore Python variables, so I'll just hack -" the tags file with sed and strip them out myself. -" -" Sigh. -nnoremap :silent !/usr/local/bin/ctags -R . && sed -i .bak -E -e '/^[^ ]+ [^ ]+.py .+v$/d' tags:redraw! - -" Highlight Group(s) -nnoremap :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' - \ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" - \ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">" - -" Clean trailing whitespace -nnoremap w mz:%s/\s\+$//:let @/=''`z - -" Send visual selection to gist.github.com as a private, filetyped Gist -" Requires the gist command line too (brew install gist) -" vnoremap G :w !gist -p -t %:e \| pbcopy -" vnoremap UG :w !gist -p \| pbcopy - -" Send visual selection to paste.stevelosh.com -vnoremap :w !curl -sF 'sprunge=<-' 'http://paste.stevelosh.com' \| tr -d '\n ' \| pbcopy && open `pbpaste` - -" Make backspace work sanely in visual mode -vnoremap x - -" Select entire buffer -vnoremap vaa ggvGg_ -vnoremap Vaa ggVG - -" Change case -inoremap gUiwea - -" Emacs bindings in command line mode -cnoremap -cnoremap - -" Diffoff -nnoremap D :diffoff! - -" Formatting, TextMate-style -nnoremap Q gqip -vnoremap Q gq - -" Easier linewise reselection -nnoremap V V`] - -" Keep the cursor in place while joining limes -nnoremap J mzJ`z - -" Split line (sister to [J]oin lines) -" The normal use of S is covered by cc, so don't worry about shadowing it. -nnoremap S imwgk:silent! s/\v +$//:noh`w - -" HTML tag closing -inoremap :call InsertCloseTag()a - -" Less chording -nnoremap ; : - -" Cmdheight switching -nnoremap 1 :set cmdheight=1 -nnoremap 2 :set cmdheight=2 - -" Source -vnoremap S y:execute @@:echo 'Sourced selection.' -nnoremap S ^vg_y:execute @@:echo 'Sourced line.' - -" Marks and Quotes -noremap ' ` -noremap æ ' -noremap ` - -" Select (charwise) the contents of the current line, excluding indentation. -" Great for pasting Python lines into REPLs. -nnoremap vv ^vg_ - -" Sudo to write -cnoremap w!! w !sudo tee % >/dev/null - -" Typos -command! -bang E e -command! -bang Q q -command! -bang W w -command! -bang QA qa -command! -bang Qa qa -command! -bang Wa wa -command! -bang WA wa -command! -bang Wq wq -command! -bang WQ wq - -" I suck at typing. -nnoremap = == -vnoremap - = - -" Toggle paste -set pastetoggle= - -" Toggle [i]nvisible characters -nnoremap i :set list! - -" Drag Lines {{{ - -" and to drag lines in any mode -noremap ∆ :m+ -noremap ˚ :m-2 -inoremap ∆ :m+ -inoremap ˚ :m-2 -vnoremap ∆ :m'>+gv -vnoremap ˚ :m-2gv - -" }}} -" Easy filetype switching {{{ - -nnoremap _md :set ft=markdown -nnoremap _hd :set ft=htmldjango -nnoremap _jt :set ft=htmljinja -nnoremap _js :set ft=javascript -nnoremap _cw :set ft=confluencewiki -nnoremap _pd :set ft=python.django -nnoremap _d :set ft=diff - -" }}} -" Insert Mode Completion {{{ - -inoremap -inoremap -inoremap - -" }}} -" Quick editing {{{ - -nnoremap ev :vsplit $MYVIMRC -nnoremap es :vsplit ~/.vim/snippets/ -nnoremap ed :vsplit ~/.vim/custom-dictionary.utf-8.add -nnoremap eo :vsplit ~/Dropbox/Org4j -nnoremap eh :vsplit ~/.hgrc -nnoremap ep :vsplit ~/.pentadactylrc -nnoremap em :vsplit ~/.mutt/muttrc -nnoremap ez :vsplit ~/lib/dotfiles/zsh4j -nnoremap ek :vsplit ~/lib/dotfiles/keymando/keymandorc.rb -nnoremap et :vsplit ~/.tmux.conf - -" }}} - -" }}} -" Searching and movement -------------------------------------------------- {{{ - -" Use sane regexes. -nnoremap / /\v -vnoremap / /\v - -set ignorecase -set smartcase -set incsearch -set showmatch -set hlsearch -set gdefault - -set scrolloff=3 -set sidescroll=1 -set sidescrolloff=10 - -set virtualedit+=block - -noremap :noh:call clearmatches() - -runtime macros/matchit.vim -map % - -" Made D behave -nnoremap D d$ - -" Don't move on * -nnoremap * * - -" Keep search matches in the middle of the window. -nnoremap n nzzzv -nnoremap N Nzzzv - -" Same when jumping around -nnoremap g; g;zz -nnoremap g, g,zz - -" Easier to type, and I never use the default behavior. -noremap H ^ -noremap L $ -vnoremap L g_ - -" Heresy -inoremap I -inoremap A - -" Open a Quickfix window for the last search. -nnoremap ? :execute 'vimgrep /'.@/.'/g %':copen - -" Ack for the last search. -nnoremap / :execute "Ack! '" . substitute(substitute(substitute(@/, "\\\\<", "\\\\b", ""), "\\\\>", "\\\\b", ""), "\\\\v", "", "") . "'" - -" Fix linewise visual selection of various text objects -nnoremap VV V -nnoremap Vit vitVkoj -nnoremap Vat vatV -nnoremap Vab vabV -nnoremap VaB vaBV - -" Toggle "keep current line in the center of the screen" mode -nnoremap C :let &scrolloff=999-&scrolloff - -" Directional Keys {{{ - -" It's 2012. -noremap j gj -noremap k gk -noremap gj j -noremap gk k - -" Easy buffer navigation -noremap h -noremap j -noremap k -noremap l - -noremap v v - -" }}} -" Highlight word {{{ - -nnoremap hh :execute 'match InterestingWord1 /\<\>/' -nnoremap h1 :execute 'match InterestingWord1 /\<\>/' -nnoremap h2 :execute '2match InterestingWord2 /\<\>/' -nnoremap h3 :execute '3match InterestingWord3 /\<\>/' - -" }}} -" Visual Mode */# from Scrooloose {{{ - -function! s:VSetSearch() - let temp = @@ - norm! gvy - let @/ = '\V' . substitute(escape(@@, '\'), '\n', '\\n', 'g') - let @@ = temp -endfunction - -vnoremap * :call VSetSearch()// -vnoremap # :call VSetSearch()?? - -" }}} -" List navigation {{{ - -nnoremap :cprevzvzz -nnoremap :cnextzvzz -nnoremap :lprevzvzz -nnoremap :lnextzvzz - -" }}} - -" }}} -" Folding ----------------------------------------------------------------- {{{ - -set foldlevelstart=0 - -" Space to toggle folds. -nnoremap za -vnoremap za - -" Make zO recursively open whatever top level fold we're in, no matter where the -" cursor happens to be. -nnoremap zO zCzO - -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) - return line . '…' . repeat(" ",fillcharcount) . foldedlinecount . '…' . ' ' -endfunction " }}} -set foldtext=MyFoldText() - -" }}} -" Filetype-specific ------------------------------------------------------- {{{ - -" C {{{ - -augroup ft_c - au! - au FileType c setlocal foldmethod=syntax -augroup END - -" }}} -" Clojure {{{ - -let g:slimv_leader = '\' -let g:slimv_keybindings = 2 - -augroup ft_clojure - au! - - au FileType clojure call TurnOnClojureFolding() - au FileType clojure compiler clojure - au FileType clojure setlocal report=100000 - - au BufWinEnter SLIMV.REPL setlocal nolist - au BufNewFile,BufReadPost SLIMV.REPL setlocal nowrap foldlevel=99 - au BufNewFile,BufReadPost SLIMV.REPL nnoremap A GA - au BufNewFile,BufReadPost SLIMV.REPL nnoremap R :emenu REPL. - - " Fix the eval mappings. - au FileType clojure nnoremap ef :call SlimvEvalExp() - au FileType clojure nnoremap ee :call SlimvEvalDefun() - - " And the inspect mapping. - au FileType clojure nmap \i \di - - " Indent top-level form. - au FileType clojure nmap = v((((((((((((=% -augroup END - -" }}} -" Clojurescript {{{ - -augroup ft_clojurescript - au! - - au BufNewFile,BufRead *.cljs set filetype=clojurescript - au FileType clojurescript call TurnOnClojureFolding() - - " Indent top-level form. - au FileType clojurescript nmap = v((((((((((((=% -augroup END - -" }}} -" Confluence {{{ - -augroup ft_c - au! - - au BufRead,BufNewFile *.confluencewiki setlocal filetype=confluencewiki - - " Wiki pages should be soft-wrapped. - au FileType confluencewiki setlocal wrap linebreak nolist -augroup END - -" }}} -" Cram {{{ - -let cram_fold=1 - -augroup ft_cram - au! - - au BufNewFile,BufRead *.t set filetype=cram - au Syntax cram setlocal foldlevel=1 -augroup END - -" }}} -" CSS and LessCSS {{{ - -augroup ft_css - au! - - au BufNewFile,BufRead *.less setlocal filetype=less - - au Filetype less,css setlocal foldmethod=marker - au Filetype less,css setlocal foldmarker={,} - au Filetype less,css setlocal omnifunc=csscomplete#CompleteCSS - au Filetype less,css setlocal iskeyword+=- - - " Use S to sort properties. Turns this: - " - " p { - " width: 200px; - " height: 100px; - " background: red; - " - " ... - " } - " - " into this: - - " p { - " background: red; - " height: 100px; - " width: 200px; - " - " ... - " } - au BufNewFile,BufRead *.less,*.css nnoremap S ?{jV/\v^\s*\}?$k:sort:noh - - " Make { insert a pair of brackets in such a way that the cursor is correctly - " positioned inside of them AND the following code doesn't get unfolded. - au BufNewFile,BufRead *.less,*.css inoremap { {}.kA -augroup END - -" }}} -" Django {{{ - -augroup ft_django - au! - - au BufNewFile,BufRead urls.py setlocal nowrap - au BufNewFile,BufRead urls.py normal! zR - au BufNewFile,BufRead dashboard.py normal! zR - au BufNewFile,BufRead local_settings.py normal! zR - - au BufNewFile,BufRead admin.py setlocal filetype=python.django - au BufNewFile,BufRead urls.py setlocal filetype=python.django - au BufNewFile,BufRead models.py setlocal filetype=python.django - au BufNewFile,BufRead views.py setlocal filetype=python.django - au BufNewFile,BufRead settings.py setlocal filetype=python.django - au BufNewFile,BufRead settings.py setlocal foldmethod=marker - au BufNewFile,BufRead forms.py setlocal filetype=python.django - au BufNewFile,BufRead common_settings.py setlocal filetype=python.django - au BufNewFile,BufRead common_settings.py setlocal foldmethod=marker -augroup END - -" }}} -" Firefox {{{ - -augroup ft_firefox - au! - au BufRead,BufNewFile ~/Library/Caches/*.html setlocal buftype=nofile -augroup END - -" }}} -" Fish {{{ - -augroup ft_fish - au! - - au BufNewFile,BufRead *.fish setlocal filetype=fish -augroup END - -" }}} -" Haskell {{{ - -augroup ft_haskell - au! - au BufEnter *.hs compiler ghc -augroup END - -" }}} -" HTML and HTMLDjango {{{ - -let g:html_indent_tags = ['p', 'li'] - -augroup ft_html - au! - - au BufNewFile,BufRead *.html setlocal filetype=htmldjango - au FileType html,jinja,htmldjango setlocal foldmethod=manual - - " Use f to fold the current tag. - au FileType html,jinja,htmldjango nnoremap f Vatzf - - " Use t to fold the current templatetag. - au FileType html,jinja,htmldjango nmap t viikojozf - - " Smarter pasting - au FileType html,jinja,htmldjango nnoremap p :YRPaste 'p'v`]=`] - au FileType html,jinja,htmldjango nnoremap P :YRPaste 'P'v`]=`] - au FileType html,jinja,htmldjango nnoremap π :YRPaste 'p' - au FileType html,jinja,htmldjango nnoremap ∏ :YRPaste 'P' - - " Indent tag - au FileType html,jinja,htmldjango nnoremap = Vat= - - " Django tags - au FileType jinja,htmldjango inoremap {%%} - - " Django variables - au FileType jinja,htmldjango inoremap {{}} -augroup END - -" }}} -" Java {{{ - -augroup ft_java - au! - - au FileType java setlocal foldmethod=marker - au FileType java setlocal foldmarker={,} -augroup END - -" }}} -" Javascript {{{ - -augroup ft_javascript - au! - - au FileType javascript setlocal foldmethod=marker - au FileType javascript setlocal foldmarker={,} - - " Make { insert a pair of brackets in such a way that the cursor is correctly - " positioned inside of them AND the following code doesn't get unfolded. - au Filetype javascript inoremap { {}.kA -augroup END - -" }}} -" Lisp {{{ - -augroup ft_lisp - au! - au FileType lisp call TurnOnLispFolding() -augroup END - -" }}} -" Mail {{{ - -augroup ft_mail - au! - - au Filetype mail setlocal spell -augroup END - -" }}} -" Markdown {{{ - -augroup ft_markdown - au! - - au BufNewFile,BufRead *.m*down setlocal filetype=markdown - - " Use 1/2/3 to add headings. - au Filetype markdown nnoremap 1 yypVr= - au Filetype markdown nnoremap 2 yypVr- - au Filetype markdown nnoremap 3 I### -augroup END - -" }}} -" Nginx {{{ - -augroup ft_nginx - au! - - 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 BufRead,BufNewFile vhost.nginx set ft=nginx - - au FileType nginx setlocal foldmethod=marker foldmarker={,} -augroup END - -" }}} -" OrgMode {{{ - -augroup ft_org - au! - - au Filetype org nmap Q vahjgq - au Filetype org setlocal nolist -augroup END - -" }}} -" Pentadactyl {{{ - -augroup ft_pentadactyl - au! - au BufNewFile,BufRead .pentadactylrc set filetype=pentadactyl - au BufNewFile,BufRead ~/Library/Caches/TemporaryItems/pentadactyl-*.tmp set nolist wrap linebreak columns=100 colorcolumn=0 -augroup END - -" }}} -" Puppet {{{ - -augroup ft_puppet - au! - - au Filetype puppet setlocal foldmethod=marker - au Filetype puppet setlocal foldmarker={,} -augroup END - -" }}} -" Python {{{ - -augroup ft_python - au! - - " au FileType python setlocal omnifunc=pythoncomplete#Complete - au FileType python setlocal define=^\s*\\(def\\\\|class\\) - au FileType python compiler nose - au FileType man nnoremap :q - - " Jesus tapdancing Christ, built-in Python syntax, you couldn't let me - " override this in a normal way, could you? - au FileType python if exists("python_space_error_highlight") | unlet python_space_error_highlight | endif - - " Jesus, Python. Five characters of punctuation for a damn string? - au FileType python inoremap _(u'') - - au FileType python inoremap """""" -augroup END - -" }}} -" QuickFix {{{ - -augroup ft_quickfix - au! - au Filetype qf setlocal colorcolumn=0 nolist nocursorline nowrap tw=0 -augroup END - -" }}} -" ReStructuredText {{{ - -augroup ft_rest - au! - - au Filetype rst nnoremap 1 yypVr= - au Filetype rst nnoremap 2 yypVr- - au Filetype rst nnoremap 3 yypVr~ - au Filetype rst nnoremap 4 yypVr` -augroup END - -" }}} -" Ruby {{{ - -augroup ft_ruby - au! - au Filetype ruby setlocal foldmethod=syntax -augroup END - -" }}} -" Vagrant {{{ - -augroup ft_vagrant - au! - au BufRead,BufNewFile Vagrantfile set ft=ruby -augroup END - -" }}} -" Vim {{{ - -augroup ft_vim - au! - - au FileType vim setlocal foldmethod=marker - au FileType help setlocal textwidth=78 - au BufWinEnter *.txt if &ft == 'help' | wincmd L | endif -augroup END - -" }}} - -" }}} -" Plugin settings --------------------------------------------------------- {{{ - -" Ack {{{ - -nnoremap a :Ack! - -" }}} -" Autoclose {{{ - -nmap x ToggleAutoCloseMappings - -" }}} -" Clam {{{ - -nnoremap ! :Clam -vnoremap ! :ClamVisual -let g:clam_autoreturn = 1 -let g:clam_debug = 1 - -" }}} -" Commentary {{{ - -nmap c CommentaryLine -xmap c Commentary - -augroup plugin_commentary - au! - au FileType htmldjango setlocal commentstring={#\ %s\ #} - au FileType clojurescript setlocal commentstring=;\ %s -augroup END - -" }}} -" Ctrl-P {{{ - -let g:ctrlp_dont_split = 'NERD_tree_2' -let g:ctrlp_jump_to_buffer = 0 -let g:ctrlp_map = ',' -let g:ctrlp_working_path_mode = 0 -let g:ctrlp_match_window_reversed = 1 -let g:ctrlp_split_window = 0 -let g:ctrlp_max_height = 20 -let g:ctrlp_extensions = ['tag'] - -let g:ctrlp_prompt_mappings = { -\ 'PrtSelectMove("j")': ['', '', ''], -\ 'PrtSelectMove("k")': ['', '', ''], -\ 'PrtHistory(-1)': [''], -\ 'PrtHistory(1)': [''], -\ 'ToggleFocus()': [''], -\ } - -let ctrlp_filter_greps = "". - \ "egrep -iv '\\.(" . - \ "jar|class|swp|swo|log|so|o|pyc|jpe?g|png|gif|mo|po" . - \ ")$' | " . - \ "egrep -v '^(\\./)?(" . - \ "deploy/|lib/|classes/|libs/|deploy/vendor/|.git/|.hg/|.svn/|.*migrations/" . - \ ")'" - -let my_ctrlp_user_command = "" . - \ "find %s '(' -type f -or -type l ')' -maxdepth 15 -not -path '*/\\.*/*' | " . - \ ctrlp_filter_greps - -let my_ctrlp_git_command = "" . - \ "cd %s && git ls-files | " . - \ ctrlp_filter_greps - -let g:ctrlp_user_command = ['.git/', my_ctrlp_git_command, my_ctrlp_user_command] - -nnoremap . :CtrlPTag - -" }}} -" Easymotion {{{ - -let g:EasyMotion_do_mapping = 0 - -nnoremap f :call EasyMotion#F(0, 0) -onoremap f :call EasyMotion#F(0, 0) -vnoremap f :call EasyMotion#F(1, 0) - -nnoremap F :call EasyMotion#F(0, 1) -onoremap F :call EasyMotion#F(0, 1) -vnoremap F :call EasyMotion#F(1, 1) - -onoremap t :call EasyMotion#T(0, 0) -onoremap T :call EasyMotion#T(0, 1) - -" }}} -" Fugitive {{{ - -nnoremap gd :Gdiff -nnoremap gs :Gstatus -nnoremap gw :Gwrite -nnoremap ga :Gadd -nnoremap gb :Gblame -nnoremap gco :Gcheckout -nnoremap gci :Gcommit -nnoremap gm :Gmove -nnoremap gr :Gremove -nnoremap gl :Shell git gl -18:wincmd \| - -augroup ft_fugitive - au! - - au BufNewFile,BufRead .git/index setlocal nolist -augroup END - -" "Hub" -nnoremap H :Gbrowse -vnoremap H :Gbrowse - -" }}} -" Gundo {{{ - -nnoremap :GundoToggle - -let g:gundo_debug = 1 -let g:gundo_preview_bottom = 1 -let g:gundo_tree_statusline = "Gundo" -let g:gundo_preview_statusline = "Gundo Preview" - -" }}} -" Haskellmode {{{ - -let g:haddock_browser = "open" -let g:haddock_browser_callformat = "%s %s" -let g:ghc = "/usr/local/bin/ghc" - -" }}} -" HTML5 {{{ - -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 - -" }}} -" Linediff {{{ - -vnoremap l :Linediff -nnoremap L :LinediffReset - -" }}} -" Lisp (built-in) {{{ - -let g:lisp_rainbow = 1 - -" }}} -" Makegreen {{{ - -nnoremap \| :call MakeGreen('') - -" }}} -" NERD Tree {{{ - -noremap :NERDTreeToggle -inoremap :NERDTreeToggle - -augroup ps_nerdtree - au! - - au Filetype nerdtree setlocal nolist - au Filetype nerdtree nnoremap K :q -augroup END - -let NERDTreeHighlightCursorline = 1 -let NERDTreeIgnore = ['.vim$', '\~$', '.*\.pyc$', 'pip-log\.txt$', 'whoosh_index', - \ 'xapian_index', '.*.pid', 'monitor.py', '.*-fixtures-.*.json', - \ '.*\.o$', 'db.db', 'tags.bak'] - -let NERDTreeMinimalUI = 1 -let NERDTreeDirArrows = 1 - -" }}} -" OrgMode {{{ - -let g:org_plugins = ['ShowHide', '|', 'Navigator', 'EditStructure', '|', 'Todo', 'Date', 'Misc'] - -let g:org_todo_keywords = ['TODO', '|', 'DONE'] - -let g:org_debug = 1 - -" }}} -" Powerline {{{ - -let g:Powerline_symbols = 'fancy' -let g:Powerline_cache_enabled = 1 -" let g:Powerline_colorscheme = 'badwolf' - -" }}} -" Python-Mode {{{ - -let g:pymode_doc = 1 -let g:pymode_doc_key = 'ds' -let g:pydoc = 'pydoc' -let g:pymode_syntax = 1 -let g:pymode_syntax_all = 0 -let g:pymode_syntax_builtin_objs = 1 -let g:pymode_syntax_print_as_function = 0 -let g:pymode_syntax_space_errors = 0 -let g:pymode_run = 0 -let g:pymode_lint = 0 -let g:pymode_breakpoint = 0 -let g:pymode_utils_whitespaces = 0 -let g:pymode_virtualenv = 0 -let g:pymode_folding = 0 - -let g:pymode_options_indent = 0 -let g:pymode_options_fold = 0 -let g:pymode_options_other = 0 - -let g:pymode_rope = 1 -let g:pymode_rope_global_prefix = "R" -let g:pymode_rope_local_prefix = "r" -let g:pymode_rope_auto_project = 1 -let g:pymode_rope_enable_autoimport = 0 -let g:pymode_rope_autoimport_generate = 1 -let g:pymode_rope_autoimport_underlineds = 0 -let g:pymode_rope_codeassist_maxfixes = 10 -let g:pymode_rope_sorted_completions = 1 -let g:pymode_rope_extended_complete = 1 -let g:pymode_rope_autoimport_modules = ["os", "shutil", "datetime"] -let g:pymode_rope_confirm_saving = 1 -let g:pymode_rope_vim_completion = 1 -let g:pymode_rope_guess_project = 1 -let g:pymode_rope_goto_def_newwin = 0 -let g:pymode_rope_always_show_complete_menu = 0 - -" }}} -" Scratch {{{ - -command! ScratchToggle call ScratchToggle() - -function! ScratchToggle() - if exists("w:is_scratch_window") - unlet w:is_scratch_window - exec "q" - else - exec "normal! :Sscratch\\J:resize 13\" - let w:is_scratch_window = 1 - endif -endfunction - -nnoremap :ScratchToggle - -" }}} -" SLIMV {{{ - -let g:slimv_repl_name = 'SLIMV.REPL' -let g:slimv_repl_split = 4 -let g:slimv_repl_syntax = 0 -let g:slimv_repl_wrap = 0 - -" Use a swank command that works, and doesn't require new app windows. -let g:slimv_swank_clojure = '!dtach -n /tmp/dtach-swank.sock -r winch lein swank' - -" }}}} -" Sparkup {{{ - -let g:sparkupNextMapping = '' - -"}}} -" Supertab {{{ - -let g:SuperTabDefaultCompletionType = "" -let g:SuperTabLongestHighlight = 1 - -"}}} -" Syntastic {{{ - -let g:syntastic_enable_signs = 1 -let g:syntastic_check_on_open = 1 -let g:syntastic_disabled_filetypes = ['html', 'rst'] -let g:syntastic_stl_format = '[%E{%e Errors}%B{, }%W{%w Warnings}]' -let g:syntastic_jsl_conf = '$HOME/.vim/jsl.conf' - -" }}} -" Threesome {{{ - -let g:threesome_leader = "-" - -let g:threesome_initial_mode = "grid" - -let g:threesome_initial_layout_grid = 1 -let g:threesome_initial_layout_loupe = 0 -let g:threesome_initial_layout_compare = 0 -let g:threesome_initial_layout_path = 0 - -let g:threesome_initial_diff_grid = 1 -let g:threesome_initial_diff_loupe = 0 -let g:threesome_initial_diff_compare = 0 -let g:threesome_initial_diff_path = 0 - -let g:threesome_initial_scrollbind_grid = 0 -let g:threesome_initial_scrollbind_loupe = 0 -let g:threesome_initial_scrollbind_compare = 0 -let g:threesome_initial_scrollbind_path = 0 - -let g:threesome_wrap = "nowrap" - -" }}} -" tslime {{{ - -let g:tslime_ensure_trailing_newlines = 1 -let g:tslime_normal_mapping = 't' -let g:tslime_visual_mapping = 't' -let g:tslime_vars_mapping = 'T' - -" }}} -" VimClojure {{{ - -let vimclojure#HighlightBuiltins = 1 -let vimclojure#ParenRainbow = 1 -let vimclojure#WantNailgun = 0 - -" }}} -" YankRing {{{ - -function! YRRunAfterMaps() - nnoremap Y :YRYankCount 'y$' - omap L YRMapsExpression("", "$") - omap H YRMapsExpression("", "^") -endfunction - -" }}} - -" }}} -" Text objects ------------------------------------------------------------ {{{ - -" Shortcut for [] {{{ - -onoremap ir i[ -onoremap ar a[ -vnoremap ir i[ -vnoremap ar a[ - -" }}} -" Next and Last {{{ - -" Motion for "next/last object". For example, "din(" would go to the next "()" -" pair and delete its contents. - -onoremap an :call NextTextObject('a', 'f') -xnoremap an :call NextTextObject('a', 'f') -onoremap in :call NextTextObject('i', 'f') -xnoremap in :call NextTextObject('i', 'f') - -onoremap al :call NextTextObject('a', 'F') -xnoremap al :call NextTextObject('a', 'F') -onoremap il :call NextTextObject('i', 'F') -xnoremap il :call NextTextObject('i', 'F') - -function! s:NextTextObject(motion, dir) - let c = nr2char(getchar()) - - if c ==# "b" - let c = "(" - elseif c ==# "B" - let c = "{" - elseif c ==# "r" - let c = "[" - endif - - exe "normal! ".a:dir.c."v".a:motion.c -endfunction - -" }}} -" Numbers {{{ - -" Motion for numbers. Great for CSS. Lets you do things like this: -" -" margin-top: 200px; -> daN -> margin-top: px; -" ^ ^ -" TODO: Handle floats. - -onoremap N :call NumberTextObject(0) -xnoremap N :call NumberTextObject(0) -onoremap aN :call NumberTextObject(1) -xnoremap aN :call NumberTextObject(1) -onoremap iN :call NumberTextObject(1) -xnoremap iN :call NumberTextObject(1) - -function! s:NumberTextObject(whole) - normal! v - - while getline('.')[col('.')] =~# '\v[0-9]' - normal! l - endwhile - - if a:whole - normal! o - - while col('.') > 1 && getline('.')[col('.') - 2] =~# '\v[0-9]' - normal! h - endwhile - endif -endfunction - -" }}} - -" }}} -" Mini-plugins ------------------------------------------------------------ {{{ -" Stuff that should probably be broken out into plugins, but hasn't proved to be -" worth the time to do so just yet. - -" Synstack {{{ - -" Show the stack of syntax hilighting classes affecting whatever is under the -" cursor. -function! SynStack() - echo join(map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")'), " > ") -endfunc - -nnoremap :call SynStack() - -" }}} -" Diffwhite Toggle {{{ - -set diffopt-=iwhite -let g:diffwhitespaceon = 1 -function! ToggleDiffWhitespace() - if g:diffwhitespaceon - set diffopt-=iwhite - let g:diffwhitespaceon = 0 - else - set diffopt+=iwhite - let g:diffwhitespaceon = 1 - endif - diffupdate -endfunc - -nnoremap dw :call ToggleDiffWhitespace() - -" }}} -" Error Toggles {{{ - -command! ErrorsToggle call ErrorsToggle() -function! ErrorsToggle() " {{{ - if exists("w:is_error_window") - unlet w:is_error_window - exec "q" - else - exec "Errors" - lopen - let w:is_error_window = 1 - endif -endfunction " }}} - -command! -bang -nargs=? QFixToggle call QFixToggle(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 " }}} - -nmap :ErrorsToggle -nmap :QFixToggle - -" }}} -" Fake Paredit {{{ - -" TODO: Make this stuff not suck. -nnoremap > xEp -nnoremap < xgEp - -" }}} -" Nyan! {{{ - -function! NyanMe() " {{{ - hi NyanFur guifg=#BBBBBB - hi NyanPoptartEdge guifg=#ffd0ac - hi NyanPoptartFrosting guifg=#fd3699 guibg=#fe98ff - hi NyanRainbow1 guifg=#6831f8 - hi NyanRainbow2 guifg=#0099fc - hi NyanRainbow3 guifg=#3cfa04 - hi NyanRainbow4 guifg=#fdfe00 - hi NyanRainbow5 guifg=#fc9d00 - hi NyanRainbow6 guifg=#fe0000 - - - echohl NyanRainbow1 - echon "≈" - echohl NyanRainbow2 - echon "≋" - echohl NyanRainbow3 - echon "≈" - echohl NyanRainbow4 - echon "≋" - echohl NyanRainbow5 - echon "≈" - echohl NyanRainbow6 - echon "≋" - echohl NyanRainbow1 - echon "≈" - echohl NyanRainbow2 - echon "≋" - echohl NyanRainbow3 - echon "≈" - echohl NyanRainbow4 - echon "≋" - echohl NyanRainbow5 - echon "≈" - echohl NyanRainbow6 - echon "≋" - echohl None - echo "" - - echohl NyanRainbow1 - echon "≈" - echohl NyanRainbow2 - echon "≋" - echohl NyanRainbow3 - echon "≈" - echohl NyanRainbow4 - echon "≋" - echohl NyanRainbow5 - echon "≈" - echohl NyanRainbow6 - echon "≋" - echohl NyanRainbow1 - echon "≈" - echohl NyanRainbow2 - echon "≋" - echohl NyanRainbow3 - echon "≈" - echohl NyanRainbow4 - echon "≋" - echohl NyanRainbow5 - echon "≈" - echohl NyanRainbow6 - echon "≋" - echohl NyanFur - echon "╰" - echohl NyanPoptartEdge - echon "⟨" - echohl NyanPoptartFrosting - echon "⣮⣯⡿" - echohl NyanPoptartEdge - echon "⟩" - echohl NyanFur - echon "⩾^ω^⩽" - echohl None - echo "" - - echohl NyanRainbow1 - echon "≈" - echohl NyanRainbow2 - echon "≋" - echohl NyanRainbow3 - echon "≈" - echohl NyanRainbow4 - echon "≋" - echohl NyanRainbow5 - echon "≈" - echohl NyanRainbow6 - echon "≋" - echohl NyanRainbow1 - echon "≈" - echohl NyanRainbow2 - echon "≋" - echohl NyanRainbow3 - echon "≈" - echohl NyanRainbow4 - echon "≋" - echohl NyanRainbow5 - echon "≈" - echohl NyanRainbow6 - echon "≋" - echohl None - echon " " - echohl NyanFur - echon "” ‟" - echohl None - - sleep 1 - redraw - echo " " - echo " " - echo "Noms?" - redraw -endfunction " }}} -command! NyanMe call NyanMe() - -" }}} -" Hg {{{ - -function! s:HgDiff() " {{{ - diffthis - - let fn = expand('%:p') - let ft = &ft - - wincmd v - edit __hgdiff_orig__ - - setlocal buftype=nofile - - normal ggdG - execute "silent r!hg cat --rev . " . fn - normal ggdd - - execute "setlocal ft=" . ft - - diffthis - diffupdate -endfunction " }}} -command! -nargs=0 HgDiff call s:HgDiff() -nnoremap hd :HgDiff - -function! s:HgBlame() " {{{ - let fn = expand('%:p') - - wincmd v - wincmd h - edit __hgblame__ - vertical resize 28 - - setlocal scrollbind winfixwidth nolist nowrap nonumber buftype=nofile ft=none - - normal ggdG - execute "silent r!hg blame -undq " . fn - normal ggdd - execute ':%s/\v:.*$//' - - wincmd l - setlocal scrollbind - syncbind -endfunction " }}} -command! -nargs=0 HgBlame call s:HgBlame() -nnoremap hb :HgBlame - -" }}} -" Ack motions {{{ - -" Motions to Ack for things. Works with pretty much everything, including: -" -" w, W, e, E, b, B, t*, f*, i*, a*, and custom text objects -" -" Awesome. -" -" Note: If the text covered by a motion contains a newline it won't work. Ack -" searches line-by-line. - -nnoremap A :set opfunc=AckMotiong@ -xnoremap A :call AckMotion(visualmode()) - -function! s:CopyMotionForType(type) - if a:type ==# 'v' - silent execute "normal! `<" . a:type . "`>y" - elseif a:type ==# 'char' - silent execute "normal! `[v`]y" - endif -endfunction - -function! s:AckMotion(type) abort - let reg_save = @@ - - call s:CopyMotionForType(a:type) - - execute "normal! :Ack! --literal " . shellescape(@@) . "\" - - let @@ = reg_save -endfunction - -" }}} -" Indent Guides {{{ - -let g:indentguides_state = 0 -function! IndentGuides() " {{{ - if g:indentguides_state - let g:indentguides_state = 0 - 2match None - else - let g:indentguides_state = 1 - execute '2match IndentGuides /\%(\_^\s*\)\@<=\%(\%'.(0*&sw+1).'v\|\%'.(1*&sw+1).'v\|\%'.(2*&sw+1).'v\|\%'.(3*&sw+1).'v\|\%'.(4*&sw+1).'v\|\%'.(5*&sw+1).'v\|\%'.(6*&sw+1).'v\|\%'.(7*&sw+1).'v\)\s/' - endif -endfunction " }}} -hi def IndentGuides guibg=#303030 -nnoremap I :call IndentGuides() - -" }}} -" Block Colors {{{ - -let g:blockcolor_state = 0 -function! BlockColor() " {{{ - if g:blockcolor_state - let g:blockcolor_state = 0 - call matchdelete(77881) - call matchdelete(77882) - call matchdelete(77883) - call matchdelete(77884) - call matchdelete(77885) - else - let g:blockcolor_state = 1 - call matchadd("BlockColor1", '^ \{4}.*', 1, 77881) - call matchadd("BlockColor2", '^ \{8}.*', 2, 77882) - call matchadd("BlockColor3", '^ \{12}.*', 3, 77883) - call matchadd("BlockColor4", '^ \{16}.*', 4, 77884) - call matchadd("BlockColor5", '^ \{20}.*', 5, 77885) - endif -endfunction " }}} -" Default highlights {{{ -hi def BlockColor1 guibg=#222222 -hi def BlockColor2 guibg=#2a2a2a -hi def BlockColor3 guibg=#353535 -hi def BlockColor4 guibg=#3d3d3d -hi def BlockColor5 guibg=#444444 -" }}} -nnoremap B :call BlockColor() - -" }}} - -" }}} -" Environments (GUI/Console) ---------------------------------------------- {{{ - -if has('gui_running') - " GUI Vim - - set guifont=Menlo\ Regular\ for\ Powerline:h12 - - " Remove all the UI cruft - set go-=T - set go-=l - set go-=L - set go-=r - set go-=R - - highlight SpellBad term=underline gui=undercurl guisp=Orange - - " Different cursors for different modes. - set guicursor=n-c:block-Cursor-blinkon0 - set guicursor+=v:block-vCursor-blinkon0 - set guicursor+=i-ci:ver20-iCursor - - if has("gui_macvim") - " Full screen means FULL screen - set fuoptions=maxvert,maxhorz - - " Use the normal HIG movements, except for M-Up/Down - let macvim_skip_cmd_opt_movement = 1 - no - no! - no - no! - - no - no! - no - no! - - no - ino - imap { - - no - ino - imap } - - imap - inoremap my0c`y - else - " Non-MacVim GUI, like Gvim - end -else - " Console Vim - " For me, this means iTerm2, possibly through tmux - - " Mouse support - set mouse=a -endif - -" }}} diff -r 611c23c4a554 -r 7af578f732ed vim/vimrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vim/vimrc Fri Apr 13 15:23:33 2012 -0400 @@ -0,0 +1,1668 @@ +" .vimrc +" Author: Steve Losh +" Source: http://bitbucket.org/sjl/dotfiles/src/tip/vim/ +" +" This file changes a lot. I'll try to document pieces of it whenever I have +" a few minutes to kill. + +" Preamble ---------------------------------------------------------------- {{{ + +filetype off +call pathogen#runtime_append_all_bundles() +filetype plugin indent on +set nocompatible + +" }}} +" Basic options ----------------------------------------------------------- {{{ + +set encoding=utf-8 +set modelines=0 +set autoindent +set showmode +set showcmd +set hidden +set visualbell +set ttyfast +set ruler +set backspace=indent,eol,start +set nonumber +set norelativenumber +set laststatus=2 +set history=1000 +set undofile +set undoreload=10000 +set list +set listchars=tab:▸\ ,eol:¬,extends:❯,precedes:❮ +set shell=/bin/bash +set lazyredraw +set matchtime=3 +set showbreak=↪ +set splitbelow +set splitright +set fillchars=diff:⣿,vert:│ +set autowrite +set shiftround +set autoread +set title +set linebreak +set dictionary=/usr/share/dict/words +set spellfile=~/.vim/custom-dictionary.utf-8.add +set colorcolumn=+1 + +" Time out on key codes but not mappings. +" Basically this makes terminal Vim work sanely. +set notimeout +set ttimeout +set ttimeoutlen=10 + +" Make Vim able to edit crontab files again. +set backupskip=/tmp/*,/private/tmp/*" + +" Better Completion +set completeopt=longest,menuone,preview + +" Save when losing focus +au FocusLost * :silent! wall + +" Resize splits when the window is resized +au VimResized * :wincmd = + +" Cursorline {{{ +" Only show cursorline in the current window and in normal mode. + +augroup cline + au! + au WinLeave * set nocursorline + au WinEnter * set cursorline + au InsertEnter * set nocursorline + au InsertLeave * set cursorline +augroup END + +" }}} +" cpoptions+=J, dammit {{{ + +" Something occasionally removes this. If I manage to find it I'm going to +" comment out the line and replace all its characters with 'FUCK'. +augroup twospace + au! + au BufRead * :set cpoptions+=J +augroup END + +" }}} +" Trailing whitespace {{{ +" Only shown when not in insert mode so I don't go insane. + +augroup trailing + au! + au InsertEnter * :set listchars-=trail:⌴ + au InsertLeave * :set listchars+=trail:⌴ +augroup END + +" }}} +" Wildmenu completion {{{ + +set wildmenu +set wildmode=list:longest + +set wildignore+=.hg,.git,.svn " Version control +set wildignore+=*.aux,*.out,*.toc " LaTeX intermediate files +set wildignore+=*.jpg,*.bmp,*.gif,*.png,*.jpeg " binary images +set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest " compiled object files +set wildignore+=*.spl " compiled spelling word lists +set wildignore+=*.sw? " Vim swap files +set wildignore+=*.DS_Store " OSX bullshit + +set wildignore+=*.luac " Lua byte code + +set wildignore+=migrations " Django migrations +set wildignore+=*.pyc " Python byte code + +set wildignore+=*.orig " Merge resolution files + +" Clojure/Leiningen +set wildignore+=classes +set wildignore+=lib + +" }}} +" Line Return {{{ + +" Make sure Vim returns to the same line when you reopen a file. +" Thanks, Amit +augroup line_return + au! + au BufReadPost * + \ if line("'\"") > 0 && line("'\"") <= line("$") | + \ execute 'normal! g`"zvzz' | + \ endif +augroup END + +" }}} +" Tabs, spaces, wrapping {{{ + +set tabstop=8 +set shiftwidth=4 +set softtabstop=4 +set expandtab +set wrap +set textwidth=80 +set formatoptions=qrn1 +set colorcolumn=+1 + +" }}} +" Backups {{{ + +set undodir=~/.vim/tmp/undo// " undo files +set backupdir=~/.vim/tmp/backup// " backups +set directory=~/.vim/tmp/swap// " swap files +set backup " enable backups +set noswapfile " It's 2012, Vim. + +" }}} +" Leader {{{ + +let mapleader = "," +let maplocalleader = "\\" + +" }}} +" Color scheme {{{ + +syntax on +set background=dark +let g:badwolf_html_link_underline = 0 +colorscheme badwolf + +" Highlight VCS conflict markers +match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$' + +" }}} + +" }}} +" Abbreviations ----------------------------------------------------------- {{{ + +function! EatChar(pat) + let c = nr2char(getchar(0)) + return (c =~ a:pat) ? '' : c +endfunction + +function! MakeSpacelessIabbrev(from, to) + execute "iabbrev ".a:from." ".a:to."=EatChar('\\s')" +endfunction + +call MakeSpacelessIabbrev('sl/', 'http://stevelosh.com/') +call MakeSpacelessIabbrev('bb/', 'http://bitbucket.org/') +call MakeSpacelessIabbrev('bbs/', 'http://bitbucket.org/sjl/') +call MakeSpacelessIabbrev('gh/', 'http://github.com/') +call MakeSpacelessIabbrev('ghs/', 'http://github.com/sjl/') + +iabbrev ldis ಠ_ಠ +iabbrev lsad ಥ_ಥ +iabbrev lhap ಥ‿ಥ + +iabbrev sl@ steve@stevelosh.com +iabbrev vrcf `~/.vimrc` file + +inoremap a a* +inoremap b b* +inoremap g g* +inoremap d d* +inoremap e e* +inoremap l l* +inoremap y y* +inoremap h h* +inoremap m m* +inoremap r r* +inoremap p p* +inoremap f f* + +" }}} +" Convenience mappings ---------------------------------------------------- {{{ + +" Fuck you, help key. +noremap :set invfullscreen +inoremap :set invfullscreena + +" Stop it, hash key. +inoremap # X# + +" Kill window +nnoremap K :q + +" Unfuck my screen +nnoremap u :syntax sync fromstart:redraw! + +" System clipboard interaction +" From https://github.com/henrik/dotfiles/blob/master/vim/config/mappings.vim +noremap y "*y +noremap p :set paste"*p:set nopaste +noremap P :set paste"*P:set nopaste + +" I constantly hit "u" in visual mode when I mean to "y". Use "gu" for those rare occasions. +" From https://github.com/henrik/dotfiles/blob/master/vim/config/mappings.vim +vnoremap u +vnoremap gu u + +" For some reason ctags refuses to ignore Python variables, so I'll just hack +" the tags file with sed and strip them out myself. +" +" Sigh. +nnoremap :silent !/usr/local/bin/ctags -R . && sed -i .bak -E -e '/^[^ ]+ [^ ]+.py .+v$/d' tags:redraw! + +" Highlight Group(s) +nnoremap :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' + \ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" + \ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">" + +" Clean trailing whitespace +nnoremap w mz:%s/\s\+$//:let @/=''`z + +" Send visual selection to gist.github.com as a private, filetyped Gist +" Requires the gist command line too (brew install gist) +" vnoremap G :w !gist -p -t %:e \| pbcopy +" vnoremap UG :w !gist -p \| pbcopy + +" Send visual selection to paste.stevelosh.com +vnoremap :w !curl -sF 'sprunge=<-' 'http://paste.stevelosh.com' \| tr -d '\n ' \| pbcopy && open `pbpaste` + +" Make backspace work sanely in visual mode +vnoremap x + +" Select entire buffer +vnoremap vaa ggvGg_ +vnoremap Vaa ggVG + +" Change case +inoremap gUiwea + +" Emacs bindings in command line mode +cnoremap +cnoremap + +" Diffoff +nnoremap D :diffoff! + +" Formatting, TextMate-style +nnoremap Q gqip +vnoremap Q gq + +" Easier linewise reselection +nnoremap V V`] + +" Keep the cursor in place while joining limes +nnoremap J mzJ`z + +" Split line (sister to [J]oin lines) +" The normal use of S is covered by cc, so don't worry about shadowing it. +nnoremap S imwgk:silent! s/\v +$//:noh`w + +" HTML tag closing +inoremap :call InsertCloseTag()a + +" Less chording +nnoremap ; : + +" Cmdheight switching +nnoremap 1 :set cmdheight=1 +nnoremap 2 :set cmdheight=2 + +" Source +vnoremap S y:execute @@:echo 'Sourced selection.' +nnoremap S ^vg_y:execute @@:echo 'Sourced line.' + +" Marks and Quotes +noremap ' ` +noremap æ ' +noremap ` + +" Select (charwise) the contents of the current line, excluding indentation. +" Great for pasting Python lines into REPLs. +nnoremap vv ^vg_ + +" Sudo to write +cnoremap w!! w !sudo tee % >/dev/null + +" Typos +command! -bang E e +command! -bang Q q +command! -bang W w +command! -bang QA qa +command! -bang Qa qa +command! -bang Wa wa +command! -bang WA wa +command! -bang Wq wq +command! -bang WQ wq + +" I suck at typing. +nnoremap = == +vnoremap - = + +" Toggle paste +set pastetoggle= + +" Toggle [i]nvisible characters +nnoremap i :set list! + +" Drag Lines {{{ + +" and to drag lines in any mode +noremap ∆ :m+ +noremap ˚ :m-2 +inoremap ∆ :m+ +inoremap ˚ :m-2 +vnoremap ∆ :m'>+gv +vnoremap ˚ :m-2gv + +" }}} +" Easy filetype switching {{{ + +nnoremap _md :set ft=markdown +nnoremap _hd :set ft=htmldjango +nnoremap _jt :set ft=htmljinja +nnoremap _js :set ft=javascript +nnoremap _cw :set ft=confluencewiki +nnoremap _pd :set ft=python.django +nnoremap _d :set ft=diff + +" }}} +" Insert Mode Completion {{{ + +inoremap +inoremap +inoremap + +" }}} +" Quick editing {{{ + +nnoremap ev :vsplit $MYVIMRC +nnoremap es :vsplit ~/.vim/snippets/ +nnoremap ed :vsplit ~/.vim/custom-dictionary.utf-8.add +nnoremap eo :vsplit ~/Dropbox/Org4j +nnoremap eh :vsplit ~/.hgrc +nnoremap ep :vsplit ~/.pentadactylrc +nnoremap em :vsplit ~/.mutt/muttrc +nnoremap ez :vsplit ~/lib/dotfiles/zsh4j +nnoremap ek :vsplit ~/lib/dotfiles/keymando/keymandorc.rb +nnoremap et :vsplit ~/.tmux.conf + +" }}} + +" }}} +" Searching and movement -------------------------------------------------- {{{ + +" Use sane regexes. +nnoremap / /\v +vnoremap / /\v + +set ignorecase +set smartcase +set incsearch +set showmatch +set hlsearch +set gdefault + +set scrolloff=3 +set sidescroll=1 +set sidescrolloff=10 + +set virtualedit+=block + +noremap :noh:call clearmatches() + +runtime macros/matchit.vim +map % + +" Made D behave +nnoremap D d$ + +" Don't move on * +nnoremap * * + +" Keep search matches in the middle of the window. +nnoremap n nzzzv +nnoremap N Nzzzv + +" Same when jumping around +nnoremap g; g;zz +nnoremap g, g,zz + +" Easier to type, and I never use the default behavior. +noremap H ^ +noremap L $ +vnoremap L g_ + +" Heresy +inoremap I +inoremap A + +" Open a Quickfix window for the last search. +nnoremap ? :execute 'vimgrep /'.@/.'/g %':copen + +" Ack for the last search. +nnoremap / :execute "Ack! '" . substitute(substitute(substitute(@/, "\\\\<", "\\\\b", ""), "\\\\>", "\\\\b", ""), "\\\\v", "", "") . "'" + +" Fix linewise visual selection of various text objects +nnoremap VV V +nnoremap Vit vitVkoj +nnoremap Vat vatV +nnoremap Vab vabV +nnoremap VaB vaBV + +" Toggle "keep current line in the center of the screen" mode +nnoremap C :let &scrolloff=999-&scrolloff + +" Directional Keys {{{ + +" It's 2012. +noremap j gj +noremap k gk +noremap gj j +noremap gk k + +" Easy buffer navigation +noremap h +noremap j +noremap k +noremap l + +noremap v v + +" }}} +" Highlight word {{{ + +nnoremap hh :execute 'match InterestingWord1 /\<\>/' +nnoremap h1 :execute 'match InterestingWord1 /\<\>/' +nnoremap h2 :execute '2match InterestingWord2 /\<\>/' +nnoremap h3 :execute '3match InterestingWord3 /\<\>/' + +" }}} +" Visual Mode */# from Scrooloose {{{ + +function! s:VSetSearch() + let temp = @@ + norm! gvy + let @/ = '\V' . substitute(escape(@@, '\'), '\n', '\\n', 'g') + let @@ = temp +endfunction + +vnoremap * :call VSetSearch()// +vnoremap # :call VSetSearch()?? + +" }}} +" List navigation {{{ + +nnoremap :cprevzvzz +nnoremap :cnextzvzz +nnoremap :lprevzvzz +nnoremap :lnextzvzz + +" }}} + +" }}} +" Folding ----------------------------------------------------------------- {{{ + +set foldlevelstart=0 + +" Space to toggle folds. +nnoremap za +vnoremap za + +" Make zO recursively open whatever top level fold we're in, no matter where the +" cursor happens to be. +nnoremap zO zCzO + +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) + return line . '…' . repeat(" ",fillcharcount) . foldedlinecount . '…' . ' ' +endfunction " }}} +set foldtext=MyFoldText() + +" }}} +" Filetype-specific ------------------------------------------------------- {{{ + +" C {{{ + +augroup ft_c + au! + au FileType c setlocal foldmethod=syntax +augroup END + +" }}} +" Clojure {{{ + +let g:slimv_leader = '\' +let g:slimv_keybindings = 2 + +augroup ft_clojure + au! + + au FileType clojure call TurnOnClojureFolding() + au FileType clojure compiler clojure + au FileType clojure setlocal report=100000 + + au BufWinEnter SLIMV.REPL setlocal nolist + au BufNewFile,BufReadPost SLIMV.REPL setlocal nowrap foldlevel=99 + au BufNewFile,BufReadPost SLIMV.REPL nnoremap A GA + au BufNewFile,BufReadPost SLIMV.REPL nnoremap R :emenu REPL. + + " Fix the eval mappings. + au FileType clojure nnoremap ef :call SlimvEvalExp() + au FileType clojure nnoremap ee :call SlimvEvalDefun() + + " And the inspect mapping. + au FileType clojure nmap \i \di + + " Indent top-level form. + au FileType clojure nmap = v((((((((((((=% +augroup END + +" }}} +" Clojurescript {{{ + +augroup ft_clojurescript + au! + + au BufNewFile,BufRead *.cljs set filetype=clojurescript + au FileType clojurescript call TurnOnClojureFolding() + + " Indent top-level form. + au FileType clojurescript nmap = v((((((((((((=% +augroup END + +" }}} +" Confluence {{{ + +augroup ft_c + au! + + au BufRead,BufNewFile *.confluencewiki setlocal filetype=confluencewiki + + " Wiki pages should be soft-wrapped. + au FileType confluencewiki setlocal wrap linebreak nolist +augroup END + +" }}} +" Cram {{{ + +let cram_fold=1 + +augroup ft_cram + au! + + au BufNewFile,BufRead *.t set filetype=cram + au Syntax cram setlocal foldlevel=1 +augroup END + +" }}} +" CSS and LessCSS {{{ + +augroup ft_css + au! + + au BufNewFile,BufRead *.less setlocal filetype=less + + au Filetype less,css setlocal foldmethod=marker + au Filetype less,css setlocal foldmarker={,} + au Filetype less,css setlocal omnifunc=csscomplete#CompleteCSS + au Filetype less,css setlocal iskeyword+=- + + " Use S to sort properties. Turns this: + " + " p { + " width: 200px; + " height: 100px; + " background: red; + " + " ... + " } + " + " into this: + + " p { + " background: red; + " height: 100px; + " width: 200px; + " + " ... + " } + au BufNewFile,BufRead *.less,*.css nnoremap S ?{jV/\v^\s*\}?$k:sort:noh + + " Make { insert a pair of brackets in such a way that the cursor is correctly + " positioned inside of them AND the following code doesn't get unfolded. + au BufNewFile,BufRead *.less,*.css inoremap { {}.kA +augroup END + +" }}} +" Django {{{ + +augroup ft_django + au! + + au BufNewFile,BufRead urls.py setlocal nowrap + au BufNewFile,BufRead urls.py normal! zR + au BufNewFile,BufRead dashboard.py normal! zR + au BufNewFile,BufRead local_settings.py normal! zR + + au BufNewFile,BufRead admin.py setlocal filetype=python.django + au BufNewFile,BufRead urls.py setlocal filetype=python.django + au BufNewFile,BufRead models.py setlocal filetype=python.django + au BufNewFile,BufRead views.py setlocal filetype=python.django + au BufNewFile,BufRead settings.py setlocal filetype=python.django + au BufNewFile,BufRead settings.py setlocal foldmethod=marker + au BufNewFile,BufRead forms.py setlocal filetype=python.django + au BufNewFile,BufRead common_settings.py setlocal filetype=python.django + au BufNewFile,BufRead common_settings.py setlocal foldmethod=marker +augroup END + +" }}} +" Firefox {{{ + +augroup ft_firefox + au! + au BufRead,BufNewFile ~/Library/Caches/*.html setlocal buftype=nofile +augroup END + +" }}} +" Fish {{{ + +augroup ft_fish + au! + + au BufNewFile,BufRead *.fish setlocal filetype=fish +augroup END + +" }}} +" Haskell {{{ + +augroup ft_haskell + au! + au BufEnter *.hs compiler ghc +augroup END + +" }}} +" HTML and HTMLDjango {{{ + +let g:html_indent_tags = ['p', 'li'] + +augroup ft_html + au! + + au BufNewFile,BufRead *.html setlocal filetype=htmldjango + au FileType html,jinja,htmldjango setlocal foldmethod=manual + + " Use f to fold the current tag. + au FileType html,jinja,htmldjango nnoremap f Vatzf + + " Use t to fold the current templatetag. + au FileType html,jinja,htmldjango nmap t viikojozf + + " Smarter pasting + au FileType html,jinja,htmldjango nnoremap p :YRPaste 'p'v`]=`] + au FileType html,jinja,htmldjango nnoremap P :YRPaste 'P'v`]=`] + au FileType html,jinja,htmldjango nnoremap π :YRPaste 'p' + au FileType html,jinja,htmldjango nnoremap ∏ :YRPaste 'P' + + " Indent tag + au FileType html,jinja,htmldjango nnoremap = Vat= + + " Django tags + au FileType jinja,htmldjango inoremap {%%} + + " Django variables + au FileType jinja,htmldjango inoremap {{}} +augroup END + +" }}} +" Java {{{ + +augroup ft_java + au! + + au FileType java setlocal foldmethod=marker + au FileType java setlocal foldmarker={,} +augroup END + +" }}} +" Javascript {{{ + +augroup ft_javascript + au! + + au FileType javascript setlocal foldmethod=marker + au FileType javascript setlocal foldmarker={,} + + " Make { insert a pair of brackets in such a way that the cursor is correctly + " positioned inside of them AND the following code doesn't get unfolded. + au Filetype javascript inoremap { {}.kA +augroup END + +" }}} +" Lisp {{{ + +augroup ft_lisp + au! + au FileType lisp call TurnOnLispFolding() +augroup END + +" }}} +" Mail {{{ + +augroup ft_mail + au! + + au Filetype mail setlocal spell +augroup END + +" }}} +" Markdown {{{ + +augroup ft_markdown + au! + + au BufNewFile,BufRead *.m*down setlocal filetype=markdown + + " Use 1/2/3 to add headings. + au Filetype markdown nnoremap 1 yypVr= + au Filetype markdown nnoremap 2 yypVr- + au Filetype markdown nnoremap 3 I### +augroup END + +" }}} +" Nginx {{{ + +augroup ft_nginx + au! + + 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 BufRead,BufNewFile vhost.nginx set ft=nginx + + au FileType nginx setlocal foldmethod=marker foldmarker={,} +augroup END + +" }}} +" OrgMode {{{ + +augroup ft_org + au! + + au Filetype org nmap Q vahjgq + au Filetype org setlocal nolist +augroup END + +" }}} +" Pentadactyl {{{ + +augroup ft_pentadactyl + au! + au BufNewFile,BufRead .pentadactylrc set filetype=pentadactyl + au BufNewFile,BufRead ~/Library/Caches/TemporaryItems/pentadactyl-*.tmp set nolist wrap linebreak columns=100 colorcolumn=0 +augroup END + +" }}} +" Puppet {{{ + +augroup ft_puppet + au! + + au Filetype puppet setlocal foldmethod=marker + au Filetype puppet setlocal foldmarker={,} +augroup END + +" }}} +" Python {{{ + +augroup ft_python + au! + + " au FileType python setlocal omnifunc=pythoncomplete#Complete + au FileType python setlocal define=^\s*\\(def\\\\|class\\) + au FileType python compiler nose + au FileType man nnoremap :q + + " Jesus tapdancing Christ, built-in Python syntax, you couldn't let me + " override this in a normal way, could you? + au FileType python if exists("python_space_error_highlight") | unlet python_space_error_highlight | endif + + " Jesus, Python. Five characters of punctuation for a damn string? + au FileType python inoremap _(u'') + + au FileType python inoremap """""" +augroup END + +" }}} +" QuickFix {{{ + +augroup ft_quickfix + au! + au Filetype qf setlocal colorcolumn=0 nolist nocursorline nowrap tw=0 +augroup END + +" }}} +" ReStructuredText {{{ + +augroup ft_rest + au! + + au Filetype rst nnoremap 1 yypVr= + au Filetype rst nnoremap 2 yypVr- + au Filetype rst nnoremap 3 yypVr~ + au Filetype rst nnoremap 4 yypVr` +augroup END + +" }}} +" Ruby {{{ + +augroup ft_ruby + au! + au Filetype ruby setlocal foldmethod=syntax +augroup END + +" }}} +" Vagrant {{{ + +augroup ft_vagrant + au! + au BufRead,BufNewFile Vagrantfile set ft=ruby +augroup END + +" }}} +" Vim {{{ + +augroup ft_vim + au! + + au FileType vim setlocal foldmethod=marker + au FileType help setlocal textwidth=78 + au BufWinEnter *.txt if &ft == 'help' | wincmd L | endif +augroup END + +" }}} + +" }}} +" Plugin settings --------------------------------------------------------- {{{ + +" Ack {{{ + +nnoremap a :Ack! + +" }}} +" Autoclose {{{ + +nmap x ToggleAutoCloseMappings + +" }}} +" Clam {{{ + +nnoremap ! :Clam +vnoremap ! :ClamVisual +let g:clam_autoreturn = 1 +let g:clam_debug = 1 + +" }}} +" Commentary {{{ + +nmap c CommentaryLine +xmap c Commentary + +augroup plugin_commentary + au! + au FileType htmldjango setlocal commentstring={#\ %s\ #} + au FileType clojurescript setlocal commentstring=;\ %s +augroup END + +" }}} +" Ctrl-P {{{ + +let g:ctrlp_dont_split = 'NERD_tree_2' +let g:ctrlp_jump_to_buffer = 0 +let g:ctrlp_map = ',' +let g:ctrlp_working_path_mode = 0 +let g:ctrlp_match_window_reversed = 1 +let g:ctrlp_split_window = 0 +let g:ctrlp_max_height = 20 +let g:ctrlp_extensions = ['tag'] + +let g:ctrlp_prompt_mappings = { +\ 'PrtSelectMove("j")': ['', '', ''], +\ 'PrtSelectMove("k")': ['', '', ''], +\ 'PrtHistory(-1)': [''], +\ 'PrtHistory(1)': [''], +\ 'ToggleFocus()': [''], +\ } + +let ctrlp_filter_greps = "". + \ "egrep -iv '\\.(" . + \ "jar|class|swp|swo|log|so|o|pyc|jpe?g|png|gif|mo|po" . + \ ")$' | " . + \ "egrep -v '^(\\./)?(" . + \ "deploy/|lib/|classes/|libs/|deploy/vendor/|.git/|.hg/|.svn/|.*migrations/" . + \ ")'" + +let my_ctrlp_user_command = "" . + \ "find %s '(' -type f -or -type l ')' -maxdepth 15 -not -path '*/\\.*/*' | " . + \ ctrlp_filter_greps + +let my_ctrlp_git_command = "" . + \ "cd %s && git ls-files | " . + \ ctrlp_filter_greps + +let g:ctrlp_user_command = ['.git/', my_ctrlp_git_command, my_ctrlp_user_command] + +nnoremap . :CtrlPTag + +" }}} +" Easymotion {{{ + +let g:EasyMotion_do_mapping = 0 + +nnoremap f :call EasyMotion#F(0, 0) +onoremap f :call EasyMotion#F(0, 0) +vnoremap f :call EasyMotion#F(1, 0) + +nnoremap F :call EasyMotion#F(0, 1) +onoremap F :call EasyMotion#F(0, 1) +vnoremap F :call EasyMotion#F(1, 1) + +onoremap t :call EasyMotion#T(0, 0) +onoremap T :call EasyMotion#T(0, 1) + +" }}} +" Fugitive {{{ + +nnoremap gd :Gdiff +nnoremap gs :Gstatus +nnoremap gw :Gwrite +nnoremap ga :Gadd +nnoremap gb :Gblame +nnoremap gco :Gcheckout +nnoremap gci :Gcommit +nnoremap gm :Gmove +nnoremap gr :Gremove +nnoremap gl :Shell git gl -18:wincmd \| + +augroup ft_fugitive + au! + + au BufNewFile,BufRead .git/index setlocal nolist +augroup END + +" "Hub" +nnoremap H :Gbrowse +vnoremap H :Gbrowse + +" }}} +" Gundo {{{ + +nnoremap :GundoToggle + +let g:gundo_debug = 1 +let g:gundo_preview_bottom = 1 +let g:gundo_tree_statusline = "Gundo" +let g:gundo_preview_statusline = "Gundo Preview" + +" }}} +" Haskellmode {{{ + +let g:haddock_browser = "open" +let g:haddock_browser_callformat = "%s %s" +let g:ghc = "/usr/local/bin/ghc" + +" }}} +" HTML5 {{{ + +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 + +" }}} +" Linediff {{{ + +vnoremap l :Linediff +nnoremap L :LinediffReset + +" }}} +" Lisp (built-in) {{{ + +let g:lisp_rainbow = 1 + +" }}} +" Makegreen {{{ + +nnoremap \| :call MakeGreen('') + +" }}} +" NERD Tree {{{ + +noremap :NERDTreeToggle +inoremap :NERDTreeToggle + +augroup ps_nerdtree + au! + + au Filetype nerdtree setlocal nolist + au Filetype nerdtree nnoremap K :q +augroup END + +let NERDTreeHighlightCursorline = 1 +let NERDTreeIgnore = ['.vim$', '\~$', '.*\.pyc$', 'pip-log\.txt$', 'whoosh_index', + \ 'xapian_index', '.*.pid', 'monitor.py', '.*-fixtures-.*.json', + \ '.*\.o$', 'db.db', 'tags.bak'] + +let NERDTreeMinimalUI = 1 +let NERDTreeDirArrows = 1 + +" }}} +" OrgMode {{{ + +let g:org_plugins = ['ShowHide', '|', 'Navigator', 'EditStructure', '|', 'Todo', 'Date', 'Misc'] + +let g:org_todo_keywords = ['TODO', '|', 'DONE'] + +let g:org_debug = 1 + +" }}} +" Powerline {{{ + +let g:Powerline_symbols = 'fancy' +let g:Powerline_cache_enabled = 1 +" let g:Powerline_colorscheme = 'badwolf' + +" }}} +" Python-Mode {{{ + +let g:pymode_doc = 1 +let g:pymode_doc_key = 'ds' +let g:pydoc = 'pydoc' +let g:pymode_syntax = 1 +let g:pymode_syntax_all = 0 +let g:pymode_syntax_builtin_objs = 1 +let g:pymode_syntax_print_as_function = 0 +let g:pymode_syntax_space_errors = 0 +let g:pymode_run = 0 +let g:pymode_lint = 0 +let g:pymode_breakpoint = 0 +let g:pymode_utils_whitespaces = 0 +let g:pymode_virtualenv = 0 +let g:pymode_folding = 0 + +let g:pymode_options_indent = 0 +let g:pymode_options_fold = 0 +let g:pymode_options_other = 0 + +let g:pymode_rope = 1 +let g:pymode_rope_global_prefix = "R" +let g:pymode_rope_local_prefix = "r" +let g:pymode_rope_auto_project = 1 +let g:pymode_rope_enable_autoimport = 0 +let g:pymode_rope_autoimport_generate = 1 +let g:pymode_rope_autoimport_underlineds = 0 +let g:pymode_rope_codeassist_maxfixes = 10 +let g:pymode_rope_sorted_completions = 1 +let g:pymode_rope_extended_complete = 1 +let g:pymode_rope_autoimport_modules = ["os", "shutil", "datetime"] +let g:pymode_rope_confirm_saving = 1 +let g:pymode_rope_vim_completion = 1 +let g:pymode_rope_guess_project = 1 +let g:pymode_rope_goto_def_newwin = 0 +let g:pymode_rope_always_show_complete_menu = 0 + +" }}} +" Scratch {{{ + +command! ScratchToggle call ScratchToggle() + +function! ScratchToggle() + if exists("w:is_scratch_window") + unlet w:is_scratch_window + exec "q" + else + exec "normal! :Sscratch\\J:resize 13\" + let w:is_scratch_window = 1 + endif +endfunction + +nnoremap :ScratchToggle + +" }}} +" SLIMV {{{ + +let g:slimv_repl_name = 'SLIMV.REPL' +let g:slimv_repl_split = 4 +let g:slimv_repl_syntax = 0 +let g:slimv_repl_wrap = 0 + +" Use a swank command that works, and doesn't require new app windows. +let g:slimv_swank_clojure = '!dtach -n /tmp/dtach-swank.sock -r winch lein swank' + +" }}}} +" Sparkup {{{ + +let g:sparkupNextMapping = '' + +"}}} +" Supertab {{{ + +let g:SuperTabDefaultCompletionType = "" +let g:SuperTabLongestHighlight = 1 + +"}}} +" Syntastic {{{ + +let g:syntastic_enable_signs = 1 +let g:syntastic_check_on_open = 1 +let g:syntastic_disabled_filetypes = ['html', 'rst'] +let g:syntastic_stl_format = '[%E{%e Errors}%B{, }%W{%w Warnings}]' +let g:syntastic_jsl_conf = '$HOME/.vim/jsl.conf' + +" }}} +" Threesome {{{ + +let g:threesome_leader = "-" + +let g:threesome_initial_mode = "grid" + +let g:threesome_initial_layout_grid = 1 +let g:threesome_initial_layout_loupe = 0 +let g:threesome_initial_layout_compare = 0 +let g:threesome_initial_layout_path = 0 + +let g:threesome_initial_diff_grid = 1 +let g:threesome_initial_diff_loupe = 0 +let g:threesome_initial_diff_compare = 0 +let g:threesome_initial_diff_path = 0 + +let g:threesome_initial_scrollbind_grid = 0 +let g:threesome_initial_scrollbind_loupe = 0 +let g:threesome_initial_scrollbind_compare = 0 +let g:threesome_initial_scrollbind_path = 0 + +let g:threesome_wrap = "nowrap" + +" }}} +" tslime {{{ + +let g:tslime_ensure_trailing_newlines = 1 +let g:tslime_normal_mapping = 't' +let g:tslime_visual_mapping = 't' +let g:tslime_vars_mapping = 'T' + +" }}} +" VimClojure {{{ + +let vimclojure#HighlightBuiltins = 1 +let vimclojure#ParenRainbow = 1 +let vimclojure#WantNailgun = 0 + +" }}} +" YankRing {{{ + +function! YRRunAfterMaps() + nnoremap Y :YRYankCount 'y$' + omap L YRMapsExpression("", "$") + omap H YRMapsExpression("", "^") +endfunction + +" }}} + +" }}} +" Text objects ------------------------------------------------------------ {{{ + +" Shortcut for [] {{{ + +onoremap ir i[ +onoremap ar a[ +vnoremap ir i[ +vnoremap ar a[ + +" }}} +" Next and Last {{{ + +" Motion for "next/last object". For example, "din(" would go to the next "()" +" pair and delete its contents. + +onoremap an :call NextTextObject('a', 'f') +xnoremap an :call NextTextObject('a', 'f') +onoremap in :call NextTextObject('i', 'f') +xnoremap in :call NextTextObject('i', 'f') + +onoremap al :call NextTextObject('a', 'F') +xnoremap al :call NextTextObject('a', 'F') +onoremap il :call NextTextObject('i', 'F') +xnoremap il :call NextTextObject('i', 'F') + +function! s:NextTextObject(motion, dir) + let c = nr2char(getchar()) + + if c ==# "b" + let c = "(" + elseif c ==# "B" + let c = "{" + elseif c ==# "r" + let c = "[" + endif + + exe "normal! ".a:dir.c."v".a:motion.c +endfunction + +" }}} +" Numbers {{{ + +" Motion for numbers. Great for CSS. Lets you do things like this: +" +" margin-top: 200px; -> daN -> margin-top: px; +" ^ ^ +" TODO: Handle floats. + +onoremap N :call NumberTextObject(0) +xnoremap N :call NumberTextObject(0) +onoremap aN :call NumberTextObject(1) +xnoremap aN :call NumberTextObject(1) +onoremap iN :call NumberTextObject(1) +xnoremap iN :call NumberTextObject(1) + +function! s:NumberTextObject(whole) + normal! v + + while getline('.')[col('.')] =~# '\v[0-9]' + normal! l + endwhile + + if a:whole + normal! o + + while col('.') > 1 && getline('.')[col('.') - 2] =~# '\v[0-9]' + normal! h + endwhile + endif +endfunction + +" }}} + +" }}} +" Mini-plugins ------------------------------------------------------------ {{{ +" Stuff that should probably be broken out into plugins, but hasn't proved to be +" worth the time to do so just yet. + +" Synstack {{{ + +" Show the stack of syntax hilighting classes affecting whatever is under the +" cursor. +function! SynStack() + echo join(map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")'), " > ") +endfunc + +nnoremap :call SynStack() + +" }}} +" Diffwhite Toggle {{{ + +set diffopt-=iwhite +let g:diffwhitespaceon = 1 +function! ToggleDiffWhitespace() + if g:diffwhitespaceon + set diffopt-=iwhite + let g:diffwhitespaceon = 0 + else + set diffopt+=iwhite + let g:diffwhitespaceon = 1 + endif + diffupdate +endfunc + +nnoremap dw :call ToggleDiffWhitespace() + +" }}} +" Error Toggles {{{ + +command! ErrorsToggle call ErrorsToggle() +function! ErrorsToggle() " {{{ + if exists("w:is_error_window") + unlet w:is_error_window + exec "q" + else + exec "Errors" + lopen + let w:is_error_window = 1 + endif +endfunction " }}} + +command! -bang -nargs=? QFixToggle call QFixToggle(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 " }}} + +nmap :ErrorsToggle +nmap :QFixToggle + +" }}} +" Fake Paredit {{{ + +" TODO: Make this stuff not suck. +nnoremap > xEp +nnoremap < xgEp + +" }}} +" Nyan! {{{ + +function! NyanMe() " {{{ + hi NyanFur guifg=#BBBBBB + hi NyanPoptartEdge guifg=#ffd0ac + hi NyanPoptartFrosting guifg=#fd3699 guibg=#fe98ff + hi NyanRainbow1 guifg=#6831f8 + hi NyanRainbow2 guifg=#0099fc + hi NyanRainbow3 guifg=#3cfa04 + hi NyanRainbow4 guifg=#fdfe00 + hi NyanRainbow5 guifg=#fc9d00 + hi NyanRainbow6 guifg=#fe0000 + + + echohl NyanRainbow1 + echon "≈" + echohl NyanRainbow2 + echon "≋" + echohl NyanRainbow3 + echon "≈" + echohl NyanRainbow4 + echon "≋" + echohl NyanRainbow5 + echon "≈" + echohl NyanRainbow6 + echon "≋" + echohl NyanRainbow1 + echon "≈" + echohl NyanRainbow2 + echon "≋" + echohl NyanRainbow3 + echon "≈" + echohl NyanRainbow4 + echon "≋" + echohl NyanRainbow5 + echon "≈" + echohl NyanRainbow6 + echon "≋" + echohl None + echo "" + + echohl NyanRainbow1 + echon "≈" + echohl NyanRainbow2 + echon "≋" + echohl NyanRainbow3 + echon "≈" + echohl NyanRainbow4 + echon "≋" + echohl NyanRainbow5 + echon "≈" + echohl NyanRainbow6 + echon "≋" + echohl NyanRainbow1 + echon "≈" + echohl NyanRainbow2 + echon "≋" + echohl NyanRainbow3 + echon "≈" + echohl NyanRainbow4 + echon "≋" + echohl NyanRainbow5 + echon "≈" + echohl NyanRainbow6 + echon "≋" + echohl NyanFur + echon "╰" + echohl NyanPoptartEdge + echon "⟨" + echohl NyanPoptartFrosting + echon "⣮⣯⡿" + echohl NyanPoptartEdge + echon "⟩" + echohl NyanFur + echon "⩾^ω^⩽" + echohl None + echo "" + + echohl NyanRainbow1 + echon "≈" + echohl NyanRainbow2 + echon "≋" + echohl NyanRainbow3 + echon "≈" + echohl NyanRainbow4 + echon "≋" + echohl NyanRainbow5 + echon "≈" + echohl NyanRainbow6 + echon "≋" + echohl NyanRainbow1 + echon "≈" + echohl NyanRainbow2 + echon "≋" + echohl NyanRainbow3 + echon "≈" + echohl NyanRainbow4 + echon "≋" + echohl NyanRainbow5 + echon "≈" + echohl NyanRainbow6 + echon "≋" + echohl None + echon " " + echohl NyanFur + echon "” ‟" + echohl None + + sleep 1 + redraw + echo " " + echo " " + echo "Noms?" + redraw +endfunction " }}} +command! NyanMe call NyanMe() + +" }}} +" Hg {{{ + +function! s:HgDiff() " {{{ + diffthis + + let fn = expand('%:p') + let ft = &ft + + wincmd v + edit __hgdiff_orig__ + + setlocal buftype=nofile + + normal ggdG + execute "silent r!hg cat --rev . " . fn + normal ggdd + + execute "setlocal ft=" . ft + + diffthis + diffupdate +endfunction " }}} +command! -nargs=0 HgDiff call s:HgDiff() +nnoremap hd :HgDiff + +function! s:HgBlame() " {{{ + let fn = expand('%:p') + + wincmd v + wincmd h + edit __hgblame__ + vertical resize 28 + + setlocal scrollbind winfixwidth nolist nowrap nonumber buftype=nofile ft=none + + normal ggdG + execute "silent r!hg blame -undq " . fn + normal ggdd + execute ':%s/\v:.*$//' + + wincmd l + setlocal scrollbind + syncbind +endfunction " }}} +command! -nargs=0 HgBlame call s:HgBlame() +nnoremap hb :HgBlame + +" }}} +" Ack motions {{{ + +" Motions to Ack for things. Works with pretty much everything, including: +" +" w, W, e, E, b, B, t*, f*, i*, a*, and custom text objects +" +" Awesome. +" +" Note: If the text covered by a motion contains a newline it won't work. Ack +" searches line-by-line. + +nnoremap A :set opfunc=AckMotiong@ +xnoremap A :call AckMotion(visualmode()) + +function! s:CopyMotionForType(type) + if a:type ==# 'v' + silent execute "normal! `<" . a:type . "`>y" + elseif a:type ==# 'char' + silent execute "normal! `[v`]y" + endif +endfunction + +function! s:AckMotion(type) abort + let reg_save = @@ + + call s:CopyMotionForType(a:type) + + execute "normal! :Ack! --literal " . shellescape(@@) . "\" + + let @@ = reg_save +endfunction + +" }}} +" Indent Guides {{{ + +let g:indentguides_state = 0 +function! IndentGuides() " {{{ + if g:indentguides_state + let g:indentguides_state = 0 + 2match None + else + let g:indentguides_state = 1 + execute '2match IndentGuides /\%(\_^\s*\)\@<=\%(\%'.(0*&sw+1).'v\|\%'.(1*&sw+1).'v\|\%'.(2*&sw+1).'v\|\%'.(3*&sw+1).'v\|\%'.(4*&sw+1).'v\|\%'.(5*&sw+1).'v\|\%'.(6*&sw+1).'v\|\%'.(7*&sw+1).'v\)\s/' + endif +endfunction " }}} +hi def IndentGuides guibg=#303030 +nnoremap I :call IndentGuides() + +" }}} +" Block Colors {{{ + +let g:blockcolor_state = 0 +function! BlockColor() " {{{ + if g:blockcolor_state + let g:blockcolor_state = 0 + call matchdelete(77881) + call matchdelete(77882) + call matchdelete(77883) + call matchdelete(77884) + call matchdelete(77885) + else + let g:blockcolor_state = 1 + call matchadd("BlockColor1", '^ \{4}.*', 1, 77881) + call matchadd("BlockColor2", '^ \{8}.*', 2, 77882) + call matchadd("BlockColor3", '^ \{12}.*', 3, 77883) + call matchadd("BlockColor4", '^ \{16}.*', 4, 77884) + call matchadd("BlockColor5", '^ \{20}.*', 5, 77885) + endif +endfunction " }}} +" Default highlights {{{ +hi def BlockColor1 guibg=#222222 +hi def BlockColor2 guibg=#2a2a2a +hi def BlockColor3 guibg=#353535 +hi def BlockColor4 guibg=#3d3d3d +hi def BlockColor5 guibg=#444444 +" }}} +nnoremap B :call BlockColor() + +" }}} + +" }}} +" Environments (GUI/Console) ---------------------------------------------- {{{ + +if has('gui_running') + " GUI Vim + + set guifont=Menlo\ Regular\ for\ Powerline:h12 + + " Remove all the UI cruft + set go-=T + set go-=l + set go-=L + set go-=r + set go-=R + + highlight SpellBad term=underline gui=undercurl guisp=Orange + + " Different cursors for different modes. + set guicursor=n-c:block-Cursor-blinkon0 + set guicursor+=v:block-vCursor-blinkon0 + set guicursor+=i-ci:ver20-iCursor + + if has("gui_macvim") + " Full screen means FULL screen + set fuoptions=maxvert,maxhorz + + " Use the normal HIG movements, except for M-Up/Down + let macvim_skip_cmd_opt_movement = 1 + no + no! + no + no! + + no + no! + no + no! + + no + ino + imap { + + no + ino + imap } + + imap + inoremap my0c`y + else + " Non-MacVim GUI, like Gvim + end +else + " Console Vim + " For me, this means iTerm2, possibly through tmux + + " Mouse support + set mouse=a +endif + +" }}} diff -r 611c23c4a554 -r 7af578f732ed zshrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/zshrc Fri Apr 13 15:23:33 2012 -0400 @@ -0,0 +1,72 @@ +export ZSH="$HOME/lib/oh-my-zsh" +export ZSH_THEME="prose" +export DISABLE_AUTO_UPDATE="true" +export OH_MY_ZSH_DEBUG="true" +plugins=(command-coloring pip fabric lein redis-cli vagrant) + +#test -f "$HOME/src/hgd/hd" && export OH_MY_ZSH_HG="$HOME/src/hgd/hd" || export OH_MY_ZSH_HG='hg' + +source $ZSH/oh-my-zsh.sh + + +# Custom options ------------------------------------------------------------- +unsetopt promptcr + +# Useful aliases ------------------------------------------------------------- +alias j='z' +alias fab='fab -i ~/.ssh/stevelosh' +alias oldgcc='export CC=/usr/bin/gcc-4.0' +alias tm='tmux -u2' +alias c='clear' +alias bp='bpython' + +export DISABLE_AUTO_TITLE="true" + +# Environment variables ------------------------------------------------------ +export EDITOR='vim' +export PATH="$HOME/.gem/ruby/1.8/bin:${PATH}" +export PATH="$HOME/bin:${PATH}" +export PATH="$HOME/lib/dotfiles/bin:${PATH}" +export PATH="$HOME/bin:/usr/local/bin:/usr/local/sbin:/opt/local/bin:$PATH" +export PATH="/opt/subversion/bin:${PATH}" +export PATH="/usr/local/Cellar/ruby/1.9.2-p290/bin:${PATH}" +export GREP_OPTIONS='--color=auto' +export HISTSIZE=1000 +export HISTFILESIZE=1000 +export HISTCONTROL=erasedups +export COMMAND_MODE=unix2003 +export RUBYOPT=rubygems +export CLASSPATH="$CLASSPATH:/usr/local/Cellar/clojure-contrib/1.2.0/clojure-contrib.jar" + +# Python variables ----------------------------------------------------------- +export PIP_DOWNLOAD_CACHE="$HOME/.pip/cache" +export PYTHONSTARTUP="$HOME/.pythonrc.py" +export WORKON_HOME="${HOME}/lib/virtualenvs" +export PATH="${PATH}:/Developer/usr/bin/" +export PATH="${PATH}:/usr/local/share/python/" +export PATH="${PATH}:$HOME/.lein/bin" +export PYTHONPATH="$PYTHONPATH:/usr/local/Cellar/python/2.7.1/lib/python2.7/site-packages" +export PYTHONPATH="$PYTHONPATH:/usr/local/lib/python2.7.1/site-packages" +export PYTHONPATH="$PYTHONPATH:/usr/local/lib/python2.7/site-packages" +export PYTHONPATH="$PYTHONPATH:/usr/local/lib/python2.6/site-packages" +export VEW_PATH="$HOME/lib/python/virtualenvwrapper/virtualenvwrapper.sh" +export PYTHONPATH="$HOME/lib/python/see:$PYTHONPATH" +export NODE_PATH="$NODE_PATH:/usr/local/lib/node:/usr/local/lib/node_modules" + +# Mercurial variables -------------------------------------------------------- +export PATH="$HOME/lib/hg/hg-stable:$PATH" +export PYTHONPATH="$HOME/lib/hg/hg-stable:$PYTHONPATH" + +# Extra ---------------------------------------------------------------------- +source `brew --prefix`/etc/profile.d/z.sh + +# Pre-Prompt Command --------------------------------------------------------- +function precmd () { + z --add "$(pwd -P)" +} + +# Local Settings ------------------------------------------------------------- +if [[ -s $HOME/.zshrc_local ]] ; then source $HOME/.zshrc_local ; fi + +# Emacs... ------------------------------------------------------------------- +alias e='emacsclient -nc .'