From 408661c028e112ac66d02746256f98a12bfbdeab Mon Sep 17 00:00:00 2001 From: Tony Duckles Date: Sun, 8 Aug 2010 14:38:26 -0500 Subject: [PATCH 1/1] Initial commit --- .bash_completion | 16 + .bash_completion.d/git-completion.bash | 2227 ++++++++++++++++++++ .bash_completion.d/misc.bash | 10 + .bash_profile | 12 + .bashrc | 311 +++ .dircolors | 129 ++ .gitconfig | 54 + .gitshrc | 17 + .inputrc | 62 + .screenrc | 92 + .vim/colors/aqua.vim | 44 + .vim/colors/autumn.vim | 88 + .vim/colors/autumnleaf.vim | 154 ++ .vim/colors/blackdust.vim | 62 + .vim/colors/blugrine.vim | 42 + .vim/colors/camo.vim | 76 + .vim/colors/carvedwood.vim | 120 ++ .vim/colors/coffee.vim | 60 + .vim/colors/dusk.vim | 64 + .vim/colors/gardener.vim | 271 +++ .vim/colors/greyblue.vim | 75 + .vim/colors/inkpot.vim | 217 ++ .vim/colors/less.vim | 54 + .vim/colors/lingodirector.vim | 44 + .vim/colors/matrix.vim | 80 + .vim/colors/midnight.vim | 80 + .vim/colors/moria.vim | 179 ++ .vim/colors/murphy.vim | 41 + .vim/colors/navajo-night.vim | 119 ++ .vim/colors/neon.vim | 0 .vim/colors/oceanblack.vim | 115 ++ .vim/colors/pleasant.vim | 37 + .vim/colors/ps_color.vim | 469 +++++ .vim/colors/pyte.vim | 68 + .vim/colors/python.vim | 104 + .vim/colors/revolutions.vim | 75 + .vim/colors/sand.vim | 30 + .vim/colors/slate2.vim | 82 + .vim/colors/vividchalk.vim | 172 ++ .vim/colors/watermark.vim | 174 ++ .vim/colors/wood.vim | 39 + .vim/colors/zenburn.vim | 133 ++ bin/ack | 2624 ++++++++++++++++++++++++ bin/addr | 16 + bin/git-amend | 43 + bin/git-cv | 20 + bin/git-ignore | 8 + bin/git-pruneall | 35 + bin/git-rel | 40 + bin/git-reup | 1 + bin/git-sh | 2554 +++++++++++++++++++++++ bin/git-thanks | 17 + bin/git-track | 73 + bin/git-up | 33 + bin/github-grab | 22 + bin/gxpr | 47 + bin/gzball | 23 + bin/headers | 5 + bin/hide | 8 + bin/latest-ack | 3 + bin/latest-hub | 7 + bin/lgrep | 6 + bin/license | 31 + bin/orig | 10 + bin/prune-dirs | 7 + bin/sync-home | 51 + bin/trunc | 6 + 67 files changed, 11988 insertions(+) create mode 100644 .bash_completion create mode 100644 .bash_completion.d/git-completion.bash create mode 100644 .bash_completion.d/misc.bash create mode 100644 .bash_profile create mode 100644 .bashrc create mode 100644 .dircolors create mode 100644 .gitconfig create mode 100644 .gitshrc create mode 100644 .inputrc create mode 100644 .screenrc create mode 100644 .vim/colors/aqua.vim create mode 100644 .vim/colors/autumn.vim create mode 100644 .vim/colors/autumnleaf.vim create mode 100644 .vim/colors/blackdust.vim create mode 100644 .vim/colors/blugrine.vim create mode 100644 .vim/colors/camo.vim create mode 100644 .vim/colors/carvedwood.vim create mode 100644 .vim/colors/coffee.vim create mode 100644 .vim/colors/dusk.vim create mode 100644 .vim/colors/gardener.vim create mode 100644 .vim/colors/greyblue.vim create mode 100644 .vim/colors/inkpot.vim create mode 100644 .vim/colors/less.vim create mode 100644 .vim/colors/lingodirector.vim create mode 100644 .vim/colors/matrix.vim create mode 100644 .vim/colors/midnight.vim create mode 100644 .vim/colors/moria.vim create mode 100644 .vim/colors/murphy.vim create mode 100644 .vim/colors/navajo-night.vim create mode 100644 .vim/colors/neon.vim create mode 100644 .vim/colors/oceanblack.vim create mode 100644 .vim/colors/pleasant.vim create mode 100644 .vim/colors/ps_color.vim create mode 100644 .vim/colors/pyte.vim create mode 100644 .vim/colors/python.vim create mode 100644 .vim/colors/revolutions.vim create mode 100644 .vim/colors/sand.vim create mode 100644 .vim/colors/slate2.vim create mode 100644 .vim/colors/vividchalk.vim create mode 100644 .vim/colors/watermark.vim create mode 100644 .vim/colors/wood.vim create mode 100644 .vim/colors/zenburn.vim create mode 100755 bin/ack create mode 100755 bin/addr create mode 100755 bin/git-amend create mode 100755 bin/git-cv create mode 100755 bin/git-ignore create mode 100755 bin/git-pruneall create mode 100755 bin/git-rel create mode 120000 bin/git-reup create mode 100755 bin/git-sh create mode 100755 bin/git-thanks create mode 100755 bin/git-track create mode 100755 bin/git-up create mode 100755 bin/github-grab create mode 100755 bin/gxpr create mode 100755 bin/gzball create mode 100755 bin/headers create mode 100755 bin/hide create mode 100755 bin/latest-ack create mode 100755 bin/latest-hub create mode 100755 bin/lgrep create mode 100755 bin/license create mode 100755 bin/orig create mode 100755 bin/prune-dirs create mode 100755 bin/sync-home create mode 100755 bin/trunc diff --git a/.bash_completion b/.bash_completion new file mode 100644 index 0000000..6e251e7 --- /dev/null +++ b/.bash_completion @@ -0,0 +1,16 @@ +#!/bin/sh +# user bash completion definitions + +: ${USER_BASH_COMPLETION_DIR:=~/.bash_completion.d} + +test -n "$USER_BASH_COMPLETION_DIR" && { + # source completion directory definitions + if [ -d $USER_BASH_COMPLETION_DIR -a -r $USER_BASH_COMPLETION_DIR -a \ + -x $USER_BASH_COMPLETION_DIR ]; then + for i in $USER_BASH_COMPLETION_DIR/*; do + [[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|.rpm*) ]] && + [ \( -f $i -o -h $i \) -a -r $i ] && . $i + done + fi + unset i +} diff --git a/.bash_completion.d/git-completion.bash b/.bash_completion.d/git-completion.bash new file mode 100644 index 0000000..7cf8557 --- /dev/null +++ b/.bash_completion.d/git-completion.bash @@ -0,0 +1,2227 @@ +#!bash +# +# bash completion support for core Git. +# +# Copyright (C) 2006,2007 Shawn O. Pearce +# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/). +# Distributed under the GNU General Public License, version 2.0. +# +# The contained completion routines provide support for completing: +# +# *) local and remote branch names +# *) local and remote tag names +# *) .git/remotes file names +# *) git 'subcommands' +# *) tree paths within 'ref:path/to/file' expressions +# *) common --long-options +# +# To use these routines: +# +# 1) Copy this file to somewhere (e.g. ~/.git-completion.sh). +# 2) Added the following line to your .bashrc: +# source ~/.git-completion.sh +# +# 3) You may want to make sure the git executable is available +# in your PATH before this script is sourced, as some caching +# is performed while the script loads. If git isn't found +# at source time then all lookups will be done on demand, +# which may be slightly slower. +# +# 4) Consider changing your PS1 to also show the current branch: +# PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ ' +# +# The argument to __git_ps1 will be displayed only if you +# are currently in a git repository. The %s token will be +# the name of the current branch. +# +# In addition, if you set GIT_PS1_SHOWDIRTYSTATE to a nonempty +# value, unstaged (*) and staged (+) changes will be shown next +# to the branch name. You can configure this per-repository +# with the bash.showDirtyState variable, which defaults to true +# once GIT_PS1_SHOWDIRTYSTATE is enabled. +# +# You can also see if currently something is stashed, by setting +# GIT_PS1_SHOWSTASHSTATE to a nonempty value. If something is stashed, +# then a '$' will be shown next to the branch name. +# +# If you would like to see if there're untracked files, then you can +# set GIT_PS1_SHOWUNTRACKEDFILES to a nonempty value. If there're +# untracked files, then a '%' will be shown next to the branch name. +# +# To submit patches: +# +# *) Read Documentation/SubmittingPatches +# *) Send all patches to the current maintainer: +# +# "Shawn O. Pearce" +# +# *) Always CC the Git mailing list: +# +# git@vger.kernel.org +# + +case "$COMP_WORDBREAKS" in +*:*) : great ;; +*) COMP_WORDBREAKS="$COMP_WORDBREAKS:" +esac + +# __gitdir accepts 0 or 1 arguments (i.e., location) +# returns location of .git repo +__gitdir () +{ + if [ -z "${1-}" ]; then + if [ -n "${__git_dir-}" ]; then + echo "$__git_dir" + elif [ -d .git ]; then + echo .git + else + git rev-parse --git-dir 2>/dev/null + fi + elif [ -d "$1/.git" ]; then + echo "$1/.git" + else + echo "$1" + fi +} + +# __git_ps1 accepts 0 or 1 arguments (i.e., format string) +# returns text to add to bash PS1 prompt (includes branch name) +__git_ps1 () +{ + local g="$(__gitdir)" + if [ -n "$g" ]; then + local r + local b + if [ -f "$g/rebase-merge/interactive" ]; then + r="|REBASE-i" + b="$(cat "$g/rebase-merge/head-name")" + elif [ -d "$g/rebase-merge" ]; then + r="|REBASE-m" + b="$(cat "$g/rebase-merge/head-name")" + else + if [ -d "$g/rebase-apply" ]; then + if [ -f "$g/rebase-apply/rebasing" ]; then + r="|REBASE" + elif [ -f "$g/rebase-apply/applying" ]; then + r="|AM" + else + r="|AM/REBASE" + fi + elif [ -f "$g/MERGE_HEAD" ]; then + r="|MERGING" + elif [ -f "$g/BISECT_LOG" ]; then + r="|BISECTING" + fi + + b="$(git symbolic-ref HEAD 2>/dev/null)" || { + + b="$( + case "${GIT_PS1_DESCRIBE_STYLE-}" in + (contains) + git describe --contains HEAD ;; + (branch) + git describe --contains --all HEAD ;; + (describe) + git describe HEAD ;; + (* | default) + git describe --exact-match HEAD ;; + esac 2>/dev/null)" || + + b="$(cut -c1-7 "$g/HEAD" 2>/dev/null)..." || + b="unknown" + b="($b)" + } + fi + + local w + local i + local s + local u + local c + + if [ "true" = "$(git rev-parse --is-inside-git-dir 2>/dev/null)" ]; then + if [ "true" = "$(git rev-parse --is-bare-repository 2>/dev/null)" ]; then + c="BARE:" + else + b="GIT_DIR!" + fi + elif [ "true" = "$(git rev-parse --is-inside-work-tree 2>/dev/null)" ]; then + if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ]; then + if [ "$(git config --bool bash.showDirtyState)" != "false" ]; then + git diff --no-ext-diff --ignore-submodules \ + --quiet --exit-code || w="*" + if git rev-parse --quiet --verify HEAD >/dev/null; then + git diff-index --cached --quiet \ + --ignore-submodules HEAD -- || i="+" + else + i="#" + fi + fi + fi + if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ]; then + git rev-parse --verify refs/stash >/dev/null 2>&1 && s="$" + fi + + if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ]; then + if [ -n "$(git ls-files --others --exclude-standard)" ]; then + u="%" + fi + fi + fi + + if [ -n "${1-}" ]; then + printf "$1" "$c${b##refs/heads/}$w$i$s$u$r" + else + printf " (%s)" "$c${b##refs/heads/}$w$i$s$u$r" + fi + fi +} + +# __gitcomp_1 requires 2 arguments +__gitcomp_1 () +{ + local c IFS=' '$'\t'$'\n' + for c in $1; do + case "$c$2" in + --*=*) printf %s$'\n' "$c$2" ;; + *.) printf %s$'\n' "$c$2" ;; + *) printf %s$'\n' "$c$2 " ;; + esac + done +} + +# __gitcomp accepts 1, 2, 3, or 4 arguments +# generates completion reply with compgen +__gitcomp () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + if [ $# -gt 2 ]; then + cur="$3" + fi + case "$cur" in + --*=) + COMPREPLY=() + ;; + *) + local IFS=$'\n' + COMPREPLY=($(compgen -P "${2-}" \ + -W "$(__gitcomp_1 "${1-}" "${4-}")" \ + -- "$cur")) + ;; + esac +} + +# __git_heads accepts 0 or 1 arguments (to pass to __gitdir) +__git_heads () +{ + local cmd i is_hash=y dir="$(__gitdir "${1-}")" + if [ -d "$dir" ]; then + git --git-dir="$dir" for-each-ref --format='%(refname:short)' \ + refs/heads + return + fi + for i in $(git ls-remote "${1-}" 2>/dev/null); do + case "$is_hash,$i" in + y,*) is_hash=n ;; + n,*^{}) is_hash=y ;; + n,refs/heads/*) is_hash=y; echo "${i#refs/heads/}" ;; + n,*) is_hash=y; echo "$i" ;; + esac + done +} + +# __git_tags accepts 0 or 1 arguments (to pass to __gitdir) +__git_tags () +{ + local cmd i is_hash=y dir="$(__gitdir "${1-}")" + if [ -d "$dir" ]; then + git --git-dir="$dir" for-each-ref --format='%(refname:short)' \ + refs/tags + return + fi + for i in $(git ls-remote "${1-}" 2>/dev/null); do + case "$is_hash,$i" in + y,*) is_hash=n ;; + n,*^{}) is_hash=y ;; + n,refs/tags/*) is_hash=y; echo "${i#refs/tags/}" ;; + n,*) is_hash=y; echo "$i" ;; + esac + done +} + +# __git_refs accepts 0 or 1 arguments (to pass to __gitdir) +__git_refs () +{ + local i is_hash=y dir="$(__gitdir "${1-}")" + local cur="${COMP_WORDS[COMP_CWORD]}" format refs + if [ -d "$dir" ]; then + case "$cur" in + refs|refs/*) + format="refname" + refs="${cur%/*}" + ;; + *) + if [ -e "$dir/HEAD" ]; then echo HEAD; fi + format="refname:short" + refs="refs/tags refs/heads refs/remotes" + ;; + esac + git --git-dir="$dir" for-each-ref --format="%($format)" \ + $refs + return + fi + for i in $(git ls-remote "$dir" 2>/dev/null); do + case "$is_hash,$i" in + y,*) is_hash=n ;; + n,*^{}) is_hash=y ;; + n,refs/tags/*) is_hash=y; echo "${i#refs/tags/}" ;; + n,refs/heads/*) is_hash=y; echo "${i#refs/heads/}" ;; + n,refs/remotes/*) is_hash=y; echo "${i#refs/remotes/}" ;; + n,*) is_hash=y; echo "$i" ;; + esac + done +} + +# __git_refs2 requires 1 argument (to pass to __git_refs) +__git_refs2 () +{ + local i + for i in $(__git_refs "$1"); do + echo "$i:$i" + done +} + +# __git_refs_remotes requires 1 argument (to pass to ls-remote) +__git_refs_remotes () +{ + local cmd i is_hash=y + for i in $(git ls-remote "$1" 2>/dev/null); do + case "$is_hash,$i" in + n,refs/heads/*) + is_hash=y + echo "$i:refs/remotes/$1/${i#refs/heads/}" + ;; + y,*) is_hash=n ;; + n,*^{}) is_hash=y ;; + n,refs/tags/*) is_hash=y;; + n,*) is_hash=y; ;; + esac + done +} + +__git_remotes () +{ + local i ngoff IFS=$'\n' d="$(__gitdir)" + shopt -q nullglob || ngoff=1 + shopt -s nullglob + for i in "$d/remotes"/*; do + echo ${i#$d/remotes/} + done + [ "$ngoff" ] && shopt -u nullglob + for i in $(git --git-dir="$d" config --get-regexp 'remote\..*\.url' 2>/dev/null); do + i="${i#remote.}" + echo "${i/.url*/}" + done +} + +__git_merge_strategies () +{ + if [ -n "${__git_merge_strategylist-}" ]; then + echo "$__git_merge_strategylist" + return + fi + git merge -s help 2>&1 | + sed -n -e '/[Aa]vailable strategies are: /,/^$/{ + s/\.$// + s/.*:// + s/^[ ]*// + s/[ ]*$// + p + }' +} +__git_merge_strategylist= +__git_merge_strategylist=$(__git_merge_strategies 2>/dev/null) + +__git_complete_file () +{ + local pfx ls ref cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + ?*:*) + ref="${cur%%:*}" + cur="${cur#*:}" + case "$cur" in + ?*/*) + pfx="${cur%/*}" + cur="${cur##*/}" + ls="$ref:$pfx" + pfx="$pfx/" + ;; + *) + ls="$ref" + ;; + esac + + case "$COMP_WORDBREAKS" in + *:*) : great ;; + *) pfx="$ref:$pfx" ;; + esac + + local IFS=$'\n' + COMPREPLY=($(compgen -P "$pfx" \ + -W "$(git --git-dir="$(__gitdir)" ls-tree "$ls" \ + | sed '/^100... blob /{ + s,^.* ,, + s,$, , + } + /^120000 blob /{ + s,^.* ,, + s,$, , + } + /^040000 tree /{ + s,^.* ,, + s,$,/, + } + s/^.* //')" \ + -- "$cur")) + ;; + *) + __gitcomp "$(__git_refs)" + ;; + esac +} + +__git_complete_revlist () +{ + local pfx cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + *...*) + pfx="${cur%...*}..." + cur="${cur#*...}" + __gitcomp "$(__git_refs)" "$pfx" "$cur" + ;; + *..*) + pfx="${cur%..*}.." + cur="${cur#*..}" + __gitcomp "$(__git_refs)" "$pfx" "$cur" + ;; + *) + __gitcomp "$(__git_refs)" + ;; + esac +} + +__git_complete_remote_or_refspec () +{ + local cmd="${COMP_WORDS[1]}" + local cur="${COMP_WORDS[COMP_CWORD]}" + local i c=2 remote="" pfx="" lhs=1 no_complete_refspec=0 + while [ $c -lt $COMP_CWORD ]; do + i="${COMP_WORDS[c]}" + case "$i" in + --all|--mirror) [ "$cmd" = "push" ] && no_complete_refspec=1 ;; + -*) ;; + *) remote="$i"; break ;; + esac + c=$((++c)) + done + if [ -z "$remote" ]; then + __gitcomp "$(__git_remotes)" + return + fi + if [ $no_complete_refspec = 1 ]; then + COMPREPLY=() + return + fi + [ "$remote" = "." ] && remote= + case "$cur" in + *:*) + case "$COMP_WORDBREAKS" in + *:*) : great ;; + *) pfx="${cur%%:*}:" ;; + esac + cur="${cur#*:}" + lhs=0 + ;; + +*) + pfx="+" + cur="${cur#+}" + ;; + esac + case "$cmd" in + fetch) + if [ $lhs = 1 ]; then + __gitcomp "$(__git_refs2 "$remote")" "$pfx" "$cur" + else + __gitcomp "$(__git_refs)" "$pfx" "$cur" + fi + ;; + pull) + if [ $lhs = 1 ]; then + __gitcomp "$(__git_refs "$remote")" "$pfx" "$cur" + else + __gitcomp "$(__git_refs)" "$pfx" "$cur" + fi + ;; + push) + if [ $lhs = 1 ]; then + __gitcomp "$(__git_refs)" "$pfx" "$cur" + else + __gitcomp "$(__git_refs "$remote")" "$pfx" "$cur" + fi + ;; + esac +} + +__git_complete_strategy () +{ + case "${COMP_WORDS[COMP_CWORD-1]}" in + -s|--strategy) + __gitcomp "$(__git_merge_strategies)" + return 0 + esac + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --strategy=*) + __gitcomp "$(__git_merge_strategies)" "" "${cur##--strategy=}" + return 0 + ;; + esac + return 1 +} + +__git_all_commands () +{ + if [ -n "${__git_all_commandlist-}" ]; then + echo "$__git_all_commandlist" + return + fi + local i IFS=" "$'\n' + for i in $(git help -a|egrep '^ [a-zA-Z0-9]') + do + case $i in + *--*) : helper pattern;; + *) echo $i;; + esac + done +} +__git_all_commandlist= +__git_all_commandlist="$(__git_all_commands 2>/dev/null)" + +__git_porcelain_commands () +{ + if [ -n "${__git_porcelain_commandlist-}" ]; then + echo "$__git_porcelain_commandlist" + return + fi + local i IFS=" "$'\n' + for i in "help" $(__git_all_commands) + do + case $i in + *--*) : helper pattern;; + applymbox) : ask gittus;; + applypatch) : ask gittus;; + archimport) : import;; + cat-file) : plumbing;; + check-attr) : plumbing;; + check-ref-format) : plumbing;; + checkout-index) : plumbing;; + commit-tree) : plumbing;; + count-objects) : infrequent;; + cvsexportcommit) : export;; + cvsimport) : import;; + cvsserver) : daemon;; + daemon) : daemon;; + diff-files) : plumbing;; + diff-index) : plumbing;; + diff-tree) : plumbing;; + fast-import) : import;; + fast-export) : export;; + fsck-objects) : plumbing;; + fetch-pack) : plumbing;; + fmt-merge-msg) : plumbing;; + for-each-ref) : plumbing;; + hash-object) : plumbing;; + http-*) : transport;; + index-pack) : plumbing;; + init-db) : deprecated;; + local-fetch) : plumbing;; + lost-found) : infrequent;; + ls-files) : plumbing;; + ls-remote) : plumbing;; + ls-tree) : plumbing;; + mailinfo) : plumbing;; + mailsplit) : plumbing;; + merge-*) : plumbing;; + mktree) : plumbing;; + mktag) : plumbing;; + pack-objects) : plumbing;; + pack-redundant) : plumbing;; + pack-refs) : plumbing;; + parse-remote) : plumbing;; + patch-id) : plumbing;; + peek-remote) : plumbing;; + prune) : plumbing;; + prune-packed) : plumbing;; + quiltimport) : import;; + read-tree) : plumbing;; + receive-pack) : plumbing;; + reflog) : plumbing;; + repo-config) : deprecated;; + rerere) : plumbing;; + rev-list) : plumbing;; + rev-parse) : plumbing;; + runstatus) : plumbing;; + sh-setup) : internal;; + shell) : daemon;; + show-ref) : plumbing;; + send-pack) : plumbing;; + show-index) : plumbing;; + ssh-*) : transport;; + stripspace) : plumbing;; + symbolic-ref) : plumbing;; + tar-tree) : deprecated;; + unpack-file) : plumbing;; + unpack-objects) : plumbing;; + update-index) : plumbing;; + update-ref) : plumbing;; + update-server-info) : daemon;; + upload-archive) : plumbing;; + upload-pack) : plumbing;; + write-tree) : plumbing;; + var) : infrequent;; + verify-pack) : infrequent;; + verify-tag) : plumbing;; + *) echo $i;; + esac + done +} +__git_porcelain_commandlist= +__git_porcelain_commandlist="$(__git_porcelain_commands 2>/dev/null)" + +__git_aliases () +{ + local i IFS=$'\n' + for i in $(git --git-dir="$(__gitdir)" config --get-regexp "alias\..*" 2>/dev/null); do + case "$i" in + alias.*) + i="${i#alias.}" + echo "${i/ */}" + ;; + esac + done +} + +# __git_aliased_command requires 1 argument +__git_aliased_command () +{ + local word cmdline=$(git --git-dir="$(__gitdir)" \ + config --get "alias.$1") + for word in $cmdline; do + if [ "${word##-*}" ]; then + echo $word + return + fi + done +} + +# __git_find_on_cmdline requires 1 argument +__git_find_on_cmdline () +{ + local word subcommand c=1 + + while [ $c -lt $COMP_CWORD ]; do + word="${COMP_WORDS[c]}" + for subcommand in $1; do + if [ "$subcommand" = "$word" ]; then + echo "$subcommand" + return + fi + done + c=$((++c)) + done +} + +__git_has_doubledash () +{ + local c=1 + while [ $c -lt $COMP_CWORD ]; do + if [ "--" = "${COMP_WORDS[c]}" ]; then + return 0 + fi + c=$((++c)) + done + return 1 +} + +__git_whitespacelist="nowarn warn error error-all fix" + +_git_am () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" dir="$(__gitdir)" + if [ -d "$dir"/rebase-apply ]; then + __gitcomp "--skip --resolved --abort" + return + fi + case "$cur" in + --whitespace=*) + __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}" + return + ;; + --*) + __gitcomp " + --3way --committer-date-is-author-date --ignore-date + --ignore-whitespace --ignore-space-change + --interactive --keep --no-utf8 --signoff --utf8 + --whitespace= --scissors + " + return + esac + COMPREPLY=() +} + +_git_apply () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --whitespace=*) + __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}" + return + ;; + --*) + __gitcomp " + --stat --numstat --summary --check --index + --cached --index-info --reverse --reject --unidiff-zero + --apply --no-add --exclude= + --ignore-whitespace --ignore-space-change + --whitespace= --inaccurate-eof --verbose + " + return + esac + COMPREPLY=() +} + +_git_add () +{ + __git_has_doubledash && return + + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp " + --interactive --refresh --patch --update --dry-run + --ignore-errors --intent-to-add + " + return + esac + COMPREPLY=() +} + +_git_archive () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --format=*) + __gitcomp "$(git archive --list)" "" "${cur##--format=}" + return + ;; + --remote=*) + __gitcomp "$(__git_remotes)" "" "${cur##--remote=}" + return + ;; + --*) + __gitcomp " + --format= --list --verbose + --prefix= --remote= --exec= + " + return + ;; + esac + __git_complete_file +} + +_git_bisect () +{ + __git_has_doubledash && return + + local subcommands="start bad good skip reset visualize replay log run" + local subcommand="$(__git_find_on_cmdline "$subcommands")" + if [ -z "$subcommand" ]; then + __gitcomp "$subcommands" + return + fi + + case "$subcommand" in + bad|good|reset|skip) + __gitcomp "$(__git_refs)" + ;; + *) + COMPREPLY=() + ;; + esac +} + +_git_branch () +{ + local i c=1 only_local_ref="n" has_r="n" + + while [ $c -lt $COMP_CWORD ]; do + i="${COMP_WORDS[c]}" + case "$i" in + -d|-m) only_local_ref="y" ;; + -r) has_r="y" ;; + esac + c=$((++c)) + done + + case "${COMP_WORDS[COMP_CWORD]}" in + --*) + __gitcomp " + --color --no-color --verbose --abbrev= --no-abbrev + --track --no-track --contains --merged --no-merged + " + ;; + *) + if [ $only_local_ref = "y" -a $has_r = "n" ]; then + __gitcomp "$(__git_heads)" + else + __gitcomp "$(__git_refs)" + fi + ;; + esac +} + +_git_bundle () +{ + local cmd="${COMP_WORDS[2]}" + case "$COMP_CWORD" in + 2) + __gitcomp "create list-heads verify unbundle" + ;; + 3) + # looking for a file + ;; + *) + case "$cmd" in + create) + __git_complete_revlist + ;; + esac + ;; + esac +} + +_git_checkout () +{ + __git_has_doubledash && return + + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --conflict=*) + __gitcomp "diff3 merge" "" "${cur##--conflict=}" + ;; + --*) + __gitcomp " + --quiet --ours --theirs --track --no-track --merge + --conflict= --patch + " + ;; + *) + __gitcomp "$(__git_refs)" + ;; + esac +} + +_git_cherry () +{ + __gitcomp "$(__git_refs)" +} + +_git_cherry_pick () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp "--edit --no-commit" + ;; + *) + __gitcomp "$(__git_refs)" + ;; + esac +} + +_git_clean () +{ + __git_has_doubledash && return + + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp "--dry-run --quiet" + return + ;; + esac + COMPREPLY=() +} + +_git_clone () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp " + --local + --no-hardlinks + --shared + --reference + --quiet + --no-checkout + --bare + --mirror + --origin + --upload-pack + --template= + --depth + " + return + ;; + esac + COMPREPLY=() +} + +_git_commit () +{ + __git_has_doubledash && return + + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp " + --all --author= --signoff --verify --no-verify + --edit --amend --include --only --interactive + --dry-run + " + return + esac + COMPREPLY=() +} + +_git_describe () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp " + --all --tags --contains --abbrev= --candidates= + --exact-match --debug --long --match --always + " + return + esac + __gitcomp "$(__git_refs)" +} + +__git_diff_common_options="--stat --numstat --shortstat --summary + --patch-with-stat --name-only --name-status --color + --no-color --color-words --no-renames --check + --full-index --binary --abbrev --diff-filter= + --find-copies-harder + --text --ignore-space-at-eol --ignore-space-change + --ignore-all-space --exit-code --quiet --ext-diff + --no-ext-diff + --no-prefix --src-prefix= --dst-prefix= + --inter-hunk-context= + --patience + --raw + --dirstat --dirstat= --dirstat-by-file + --dirstat-by-file= --cumulative +" + +_git_diff () +{ + __git_has_doubledash && return + + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp "--cached --staged --pickaxe-all --pickaxe-regex + --base --ours --theirs + $__git_diff_common_options + " + return + ;; + esac + __git_complete_file +} + +__git_mergetools_common="diffuse ecmerge emerge kdiff3 meld opendiff + tkdiff vimdiff gvimdiff xxdiff araxis +" + +_git_difftool () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --tool=*) + __gitcomp "$__git_mergetools_common kompare" "" "${cur##--tool=}" + return + ;; + --*) + __gitcomp "--tool=" + return + ;; + esac + COMPREPLY=() +} + +__git_fetch_options=" + --quiet --verbose --append --upload-pack --force --keep --depth= + --tags --no-tags +" + +_git_fetch () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp "$__git_fetch_options" + return + ;; + esac + __git_complete_remote_or_refspec +} + +_git_format_patch () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --thread=*) + __gitcomp " + deep shallow + " "" "${cur##--thread=}" + return + ;; + --*) + __gitcomp " + --stdout --attach --no-attach --thread --thread= + --output-directory + --numbered --start-number + --numbered-files + --keep-subject + --signoff + --in-reply-to= --cc= + --full-index --binary + --not --all + --cover-letter + --no-prefix --src-prefix= --dst-prefix= + --inline --suffix= --ignore-if-in-upstream + --subject-prefix= + " + return + ;; + esac + __git_complete_revlist +} + +_git_fsck () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp " + --tags --root --unreachable --cache --no-reflogs --full + --strict --verbose --lost-found + " + return + ;; + esac + COMPREPLY=() +} + +_git_gc () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp "--prune --aggressive" + return + ;; + esac + COMPREPLY=() +} + +_git_grep () +{ + __git_has_doubledash && return + + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp " + --cached + --text --ignore-case --word-regexp --invert-match + --full-name + --extended-regexp --basic-regexp --fixed-strings + --files-with-matches --name-only + --files-without-match + --max-depth + --count + --and --or --not --all-match + " + return + ;; + esac + COMPREPLY=() +} + +_git_help () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp "--all --info --man --web" + return + ;; + esac + __gitcomp "$(__git_all_commands) + attributes cli core-tutorial cvs-migration + diffcore gitk glossary hooks ignore modules + repository-layout tutorial tutorial-2 + workflows + " +} + +_git_init () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --shared=*) + __gitcomp " + false true umask group all world everybody + " "" "${cur##--shared=}" + return + ;; + --*) + __gitcomp "--quiet --bare --template= --shared --shared=" + return + ;; + esac + COMPREPLY=() +} + +_git_ls_files () +{ + __git_has_doubledash && return + + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp "--cached --deleted --modified --others --ignored + --stage --directory --no-empty-directory --unmerged + --killed --exclude= --exclude-from= + --exclude-per-directory= --exclude-standard + --error-unmatch --with-tree= --full-name + --abbrev --ignored --exclude-per-directory + " + return + ;; + esac + COMPREPLY=() +} + +_git_ls_remote () +{ + __gitcomp "$(__git_remotes)" +} + +_git_ls_tree () +{ + __git_complete_file +} + +# Options that go well for log, shortlog and gitk +__git_log_common_options=" + --not --all + --branches --tags --remotes + --first-parent --merges --no-merges + --max-count= + --max-age= --since= --after= + --min-age= --until= --before= +" +# Options that go well for log and gitk (not shortlog) +__git_log_gitk_options=" + --dense --sparse --full-history + --simplify-merges --simplify-by-decoration + --left-right +" +# Options that go well for log and shortlog (not gitk) +__git_log_shortlog_options=" + --author= --committer= --grep= + --all-match +" + +__git_log_pretty_formats="oneline short medium full fuller email raw format:" +__git_log_date_formats="relative iso8601 rfc2822 short local default raw" + +_git_log () +{ + __git_has_doubledash && return + + local cur="${COMP_WORDS[COMP_CWORD]}" + local g="$(git rev-parse --git-dir 2>/dev/null)" + local merge="" + if [ -f "$g/MERGE_HEAD" ]; then + merge="--merge" + fi + case "$cur" in + --pretty=*) + __gitcomp "$__git_log_pretty_formats + " "" "${cur##--pretty=}" + return + ;; + --format=*) + __gitcomp "$__git_log_pretty_formats + " "" "${cur##--format=}" + return + ;; + --date=*) + __gitcomp "$__git_log_date_formats" "" "${cur##--date=}" + return + ;; + --decorate=*) + __gitcomp "long short" "" "${cur##--decorate=}" + return + ;; + --*) + __gitcomp " + $__git_log_common_options + $__git_log_shortlog_options + $__git_log_gitk_options + --root --topo-order --date-order --reverse + --follow --full-diff + --abbrev-commit --abbrev= + --relative-date --date= + --pretty= --format= --oneline + --cherry-pick + --graph + --decorate --decorate= + --walk-reflogs + --parents --children + $merge + $__git_diff_common_options + --pickaxe-all --pickaxe-regex + " + return + ;; + esac + __git_complete_revlist +} + +__git_merge_options=" + --no-commit --no-stat --log --no-log --squash --strategy + --commit --stat --no-squash --ff --no-ff +" + +_git_merge () +{ + __git_complete_strategy && return + + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp "$__git_merge_options" + return + esac + __gitcomp "$(__git_refs)" +} + +_git_mergetool () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --tool=*) + __gitcomp "$__git_mergetools_common tortoisemerge" "" "${cur##--tool=}" + return + ;; + --*) + __gitcomp "--tool=" + return + ;; + esac + COMPREPLY=() +} + +_git_merge_base () +{ + __gitcomp "$(__git_refs)" +} + +_git_mv () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp "--dry-run" + return + ;; + esac + COMPREPLY=() +} + +_git_name_rev () +{ + __gitcomp "--tags --all --stdin" +} + +_git_pull () +{ + __git_complete_strategy && return + + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp " + --rebase --no-rebase + $__git_merge_options + $__git_fetch_options + " + return + ;; + esac + __git_complete_remote_or_refspec +} + +_git_push () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "${COMP_WORDS[COMP_CWORD-1]}" in + --repo) + __gitcomp "$(__git_remotes)" + return + esac + case "$cur" in + --repo=*) + __gitcomp "$(__git_remotes)" "" "${cur##--repo=}" + return + ;; + --*) + __gitcomp " + --all --mirror --tags --dry-run --force --verbose + --receive-pack= --repo= + " + return + ;; + esac + __git_complete_remote_or_refspec +} + +_git_rebase () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" dir="$(__gitdir)" + if [ -d "$dir"/rebase-apply ] || [ -d "$dir"/rebase-merge ]; then + __gitcomp "--continue --skip --abort" + return + fi + __git_complete_strategy && return + case "$cur" in + --*) + __gitcomp "--onto --merge --strategy --interactive" + return + esac + __gitcomp "$(__git_refs)" +} + +__git_send_email_confirm_options="always never auto cc compose" +__git_send_email_suppresscc_options="author self cc bodycc sob cccmd body all" + +_git_send_email () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --confirm=*) + __gitcomp " + $__git_send_email_confirm_options + " "" "${cur##--confirm=}" + return + ;; + --suppress-cc=*) + __gitcomp " + $__git_send_email_suppresscc_options + " "" "${cur##--suppress-cc=}" + + return + ;; + --smtp-encryption=*) + __gitcomp "ssl tls" "" "${cur##--smtp-encryption=}" + return + ;; + --*) + __gitcomp "--annotate --bcc --cc --cc-cmd --chain-reply-to + --compose --confirm= --dry-run --envelope-sender + --from --identity + --in-reply-to --no-chain-reply-to --no-signed-off-by-cc + --no-suppress-from --no-thread --quiet + --signed-off-by-cc --smtp-pass --smtp-server + --smtp-server-port --smtp-encryption= --smtp-user + --subject --suppress-cc= --suppress-from --thread --to + --validate --no-validate" + return + ;; + esac + COMPREPLY=() +} + +__git_config_get_set_variables () +{ + local prevword word config_file= c=$COMP_CWORD + while [ $c -gt 1 ]; do + word="${COMP_WORDS[c]}" + case "$word" in + --global|--system|--file=*) + config_file="$word" + break + ;; + -f|--file) + config_file="$word $prevword" + break + ;; + esac + prevword=$word + c=$((--c)) + done + + git --git-dir="$(__gitdir)" config $config_file --list 2>/dev/null | + while read line + do + case "$line" in + *.*=*) + echo "${line/=*/}" + ;; + esac + done +} + +_git_config () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + local prv="${COMP_WORDS[COMP_CWORD-1]}" + case "$prv" in + branch.*.remote) + __gitcomp "$(__git_remotes)" + return + ;; + branch.*.merge) + __gitcomp "$(__git_refs)" + return + ;; + remote.*.fetch) + local remote="${prv#remote.}" + remote="${remote%.fetch}" + __gitcomp "$(__git_refs_remotes "$remote")" + return + ;; + remote.*.push) + local remote="${prv#remote.}" + remote="${remote%.push}" + __gitcomp "$(git --git-dir="$(__gitdir)" \ + for-each-ref --format='%(refname):%(refname)' \ + refs/heads)" + return + ;; + pull.twohead|pull.octopus) + __gitcomp "$(__git_merge_strategies)" + return + ;; + color.branch|color.diff|color.interactive|\ + color.showbranch|color.status|color.ui) + __gitcomp "always never auto" + return + ;; + color.pager) + __gitcomp "false true" + return + ;; + color.*.*) + __gitcomp " + normal black red green yellow blue magenta cyan white + bold dim ul blink reverse + " + return + ;; + help.format) + __gitcomp "man info web html" + return + ;; + log.date) + __gitcomp "$__git_log_date_formats" + return + ;; + sendemail.aliasesfiletype) + __gitcomp "mutt mailrc pine elm gnus" + return + ;; + sendemail.confirm) + __gitcomp "$__git_send_email_confirm_options" + return + ;; + sendemail.suppresscc) + __gitcomp "$__git_send_email_suppresscc_options" + return + ;; + --get|--get-all|--unset|--unset-all) + __gitcomp "$(__git_config_get_set_variables)" + return + ;; + *.*) + COMPREPLY=() + return + ;; + esac + case "$cur" in + --*) + __gitcomp " + --global --system --file= + --list --replace-all + --get --get-all --get-regexp + --add --unset --unset-all + --remove-section --rename-section + " + return + ;; + branch.*.*) + local pfx="${cur%.*}." + cur="${cur##*.}" + __gitcomp "remote merge mergeoptions rebase" "$pfx" "$cur" + return + ;; + branch.*) + local pfx="${cur%.*}." + cur="${cur#*.}" + __gitcomp "$(__git_heads)" "$pfx" "$cur" "." + return + ;; + guitool.*.*) + local pfx="${cur%.*}." + cur="${cur##*.}" + __gitcomp " + argprompt cmd confirm needsfile noconsole norescan + prompt revprompt revunmerged title + " "$pfx" "$cur" + return + ;; + difftool.*.*) + local pfx="${cur%.*}." + cur="${cur##*.}" + __gitcomp "cmd path" "$pfx" "$cur" + return + ;; + man.*.*) + local pfx="${cur%.*}." + cur="${cur##*.}" + __gitcomp "cmd path" "$pfx" "$cur" + return + ;; + mergetool.*.*) + local pfx="${cur%.*}." + cur="${cur##*.}" + __gitcomp "cmd path trustExitCode" "$pfx" "$cur" + return + ;; + pager.*) + local pfx="${cur%.*}." + cur="${cur#*.}" + __gitcomp "$(__git_all_commands)" "$pfx" "$cur" + return + ;; + remote.*.*) + local pfx="${cur%.*}." + cur="${cur##*.}" + __gitcomp " + url proxy fetch push mirror skipDefaultUpdate + receivepack uploadpack tagopt pushurl + " "$pfx" "$cur" + return + ;; + remote.*) + local pfx="${cur%.*}." + cur="${cur#*.}" + __gitcomp "$(__git_remotes)" "$pfx" "$cur" "." + return + ;; + url.*.*) + local pfx="${cur%.*}." + cur="${cur##*.}" + __gitcomp "insteadOf pushInsteadOf" "$pfx" "$cur" + return + ;; + esac + __gitcomp " + add.ignore-errors + alias. + apply.ignorewhitespace + apply.whitespace + branch.autosetupmerge + branch.autosetuprebase + clean.requireForce + color.branch + color.branch.current + color.branch.local + color.branch.plain + color.branch.remote + color.diff + color.diff.commit + color.diff.frag + color.diff.meta + color.diff.new + color.diff.old + color.diff.plain + color.diff.whitespace + color.grep + color.grep.external + color.grep.match + color.interactive + color.interactive.header + color.interactive.help + color.interactive.prompt + color.pager + color.showbranch + color.status + color.status.added + color.status.changed + color.status.header + color.status.nobranch + color.status.untracked + color.status.updated + color.ui + commit.template + core.autocrlf + core.bare + core.compression + core.createObject + core.deltaBaseCacheLimit + core.editor + core.excludesfile + core.fileMode + core.fsyncobjectfiles + core.gitProxy + core.ignoreCygwinFSTricks + core.ignoreStat + core.logAllRefUpdates + core.loosecompression + core.packedGitLimit + core.packedGitWindowSize + core.pager + core.preferSymlinkRefs + core.preloadindex + core.quotepath + core.repositoryFormatVersion + core.safecrlf + core.sharedRepository + core.symlinks + core.trustctime + core.warnAmbiguousRefs + core.whitespace + core.worktree + diff.autorefreshindex + diff.external + diff.mnemonicprefix + diff.renameLimit + diff.renameLimit. + diff.renames + diff.suppressBlankEmpty + diff.tool + diff.wordRegex + difftool. + difftool.prompt + fetch.unpackLimit + format.attach + format.cc + format.headers + format.numbered + format.pretty + format.signoff + format.subjectprefix + format.suffix + format.thread + gc.aggressiveWindow + gc.auto + gc.autopacklimit + gc.packrefs + gc.pruneexpire + gc.reflogexpire + gc.reflogexpireunreachable + gc.rerereresolved + gc.rerereunresolved + gitcvs.allbinary + gitcvs.commitmsgannotation + gitcvs.dbTableNamePrefix + gitcvs.dbdriver + gitcvs.dbname + gitcvs.dbpass + gitcvs.dbuser + gitcvs.enabled + gitcvs.logfile + gitcvs.usecrlfattr + guitool. + gui.blamehistoryctx + gui.commitmsgwidth + gui.copyblamethreshold + gui.diffcontext + gui.encoding + gui.fastcopyblame + gui.matchtrackingbranch + gui.newbranchtemplate + gui.pruneduringfetch + gui.spellingdictionary + gui.trustmtime + help.autocorrect + help.browser + help.format + http.lowSpeedLimit + http.lowSpeedTime + http.maxRequests + http.noEPSV + http.proxy + http.sslCAInfo + http.sslCAPath + http.sslCert + http.sslKey + http.sslVerify + i18n.commitEncoding + i18n.logOutputEncoding + imap.folder + imap.host + imap.pass + imap.port + imap.preformattedHTML + imap.sslverify + imap.tunnel + imap.user + instaweb.browser + instaweb.httpd + instaweb.local + instaweb.modulepath + instaweb.port + interactive.singlekey + log.date + log.showroot + mailmap.file + man. + man.viewer + merge.conflictstyle + merge.log + merge.renameLimit + merge.stat + merge.tool + merge.verbosity + mergetool. + mergetool.keepBackup + mergetool.prompt + pack.compression + pack.deltaCacheLimit + pack.deltaCacheSize + pack.depth + pack.indexVersion + pack.packSizeLimit + pack.threads + pack.window + pack.windowMemory + pager. + pull.octopus + pull.twohead + push.default + rebase.stat + receive.denyCurrentBranch + receive.denyDeletes + receive.denyNonFastForwards + receive.fsckObjects + receive.unpackLimit + repack.usedeltabaseoffset + rerere.autoupdate + rerere.enabled + sendemail.aliasesfile + sendemail.aliasesfiletype + sendemail.bcc + sendemail.cc + sendemail.cccmd + sendemail.chainreplyto + sendemail.confirm + sendemail.envelopesender + sendemail.multiedit + sendemail.signedoffbycc + sendemail.smtpencryption + sendemail.smtppass + sendemail.smtpserver + sendemail.smtpserverport + sendemail.smtpuser + sendemail.suppresscc + sendemail.suppressfrom + sendemail.thread + sendemail.to + sendemail.validate + showbranch.default + status.relativePaths + status.showUntrackedFiles + tar.umask + transfer.unpackLimit + url. + user.email + user.name + user.signingkey + web.browser + branch. remote. + " +} + +_git_remote () +{ + local subcommands="add rename rm show prune update set-head" + local subcommand="$(__git_find_on_cmdline "$subcommands")" + if [ -z "$subcommand" ]; then + __gitcomp "$subcommands" + return + fi + + case "$subcommand" in + rename|rm|show|prune) + __gitcomp "$(__git_remotes)" + ;; + update) + local i c='' IFS=$'\n' + for i in $(git --git-dir="$(__gitdir)" config --get-regexp "remotes\..*" 2>/dev/null); do + i="${i#remotes.}" + c="$c ${i/ */}" + done + __gitcomp "$c" + ;; + *) + COMPREPLY=() + ;; + esac +} + +_git_replace () +{ + __gitcomp "$(__git_refs)" +} + +_git_reset () +{ + __git_has_doubledash && return + + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp "--merge --mixed --hard --soft --patch" + return + ;; + esac + __gitcomp "$(__git_refs)" +} + +_git_revert () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp "--edit --mainline --no-edit --no-commit --signoff" + return + ;; + esac + __gitcomp "$(__git_refs)" +} + +_git_rm () +{ + __git_has_doubledash && return + + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp "--cached --dry-run --ignore-unmatch --quiet" + return + ;; + esac + COMPREPLY=() +} + +_git_shortlog () +{ + __git_has_doubledash && return + + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp " + $__git_log_common_options + $__git_log_shortlog_options + --numbered --summary + " + return + ;; + esac + __git_complete_revlist +} + +_git_show () +{ + __git_has_doubledash && return + + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --pretty=*) + __gitcomp "$__git_log_pretty_formats + " "" "${cur##--pretty=}" + return + ;; + --format=*) + __gitcomp "$__git_log_pretty_formats + " "" "${cur##--format=}" + return + ;; + --*) + __gitcomp "--pretty= --format= --abbrev-commit --oneline + $__git_diff_common_options + " + return + ;; + esac + __git_complete_file +} + +_git_show_branch () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp " + --all --remotes --topo-order --current --more= + --list --independent --merge-base --no-name + --color --no-color + --sha1-name --sparse --topics --reflog + " + return + ;; + esac + __git_complete_revlist +} + +_git_stash () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + local save_opts='--keep-index --no-keep-index --quiet --patch' + local subcommands='save list show apply clear drop pop create branch' + local subcommand="$(__git_find_on_cmdline "$subcommands")" + if [ -z "$subcommand" ]; then + case "$cur" in + --*) + __gitcomp "$save_opts" + ;; + *) + if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then + __gitcomp "$subcommands" + else + COMPREPLY=() + fi + ;; + esac + else + case "$subcommand,$cur" in + save,--*) + __gitcomp "$save_opts" + ;; + apply,--*|pop,--*) + __gitcomp "--index --quiet" + ;; + show,--*|drop,--*|branch,--*) + COMPREPLY=() + ;; + show,*|apply,*|drop,*|pop,*|branch,*) + __gitcomp "$(git --git-dir="$(__gitdir)" stash list \ + | sed -n -e 's/:.*//p')" + ;; + *) + COMPREPLY=() + ;; + esac + fi +} + +_git_submodule () +{ + __git_has_doubledash && return + + local subcommands="add status init update summary foreach sync" + if [ -z "$(__git_find_on_cmdline "$subcommands")" ]; then + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp "--quiet --cached" + ;; + *) + __gitcomp "$subcommands" + ;; + esac + return + fi +} + +_git_svn () +{ + local subcommands=" + init fetch clone rebase dcommit log find-rev + set-tree commit-diff info create-ignore propget + proplist show-ignore show-externals branch tag blame + migrate + " + local subcommand="$(__git_find_on_cmdline "$subcommands")" + if [ -z "$subcommand" ]; then + __gitcomp "$subcommands" + else + local remote_opts="--username= --config-dir= --no-auth-cache" + local fc_opts=" + --follow-parent --authors-file= --repack= + --no-metadata --use-svm-props --use-svnsync-props + --log-window-size= --no-checkout --quiet + --repack-flags --use-log-author --localtime + --ignore-paths= $remote_opts + " + local init_opts=" + --template= --shared= --trunk= --tags= + --branches= --stdlayout --minimize-url + --no-metadata --use-svm-props --use-svnsync-props + --rewrite-root= --prefix= --use-log-author + --add-author-from $remote_opts + " + local cmt_opts=" + --edit --rmdir --find-copies-harder --copy-similarity= + " + + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$subcommand,$cur" in + fetch,--*) + __gitcomp "--revision= --fetch-all $fc_opts" + ;; + clone,--*) + __gitcomp "--revision= $fc_opts $init_opts" + ;; + init,--*) + __gitcomp "$init_opts" + ;; + dcommit,--*) + __gitcomp " + --merge --strategy= --verbose --dry-run + --fetch-all --no-rebase --commit-url + --revision $cmt_opts $fc_opts + " + ;; + set-tree,--*) + __gitcomp "--stdin $cmt_opts $fc_opts" + ;; + create-ignore,--*|propget,--*|proplist,--*|show-ignore,--*|\ + show-externals,--*) + __gitcomp "--revision=" + ;; + log,--*) + __gitcomp " + --limit= --revision= --verbose --incremental + --oneline --show-commit --non-recursive + --authors-file= --color + " + ;; + rebase,--*) + __gitcomp " + --merge --verbose --strategy= --local + --fetch-all --dry-run $fc_opts + " + ;; + commit-diff,--*) + __gitcomp "--message= --file= --revision= $cmt_opts" + ;; + info,--*) + __gitcomp "--url" + ;; + branch,--*) + __gitcomp "--dry-run --message --tag" + ;; + tag,--*) + __gitcomp "--dry-run --message" + ;; + blame,--*) + __gitcomp "--git-format" + ;; + migrate,--*) + __gitcomp " + --config-dir= --ignore-paths= --minimize + --no-auth-cache --username= + " + ;; + *) + COMPREPLY=() + ;; + esac + fi +} + +_git_tag () +{ + local i c=1 f=0 + while [ $c -lt $COMP_CWORD ]; do + i="${COMP_WORDS[c]}" + case "$i" in + -d|-v) + __gitcomp "$(__git_tags)" + return + ;; + -f) + f=1 + ;; + esac + c=$((++c)) + done + + case "${COMP_WORDS[COMP_CWORD-1]}" in + -m|-F) + COMPREPLY=() + ;; + -*|tag) + if [ $f = 1 ]; then + __gitcomp "$(__git_tags)" + else + COMPREPLY=() + fi + ;; + *) + __gitcomp "$(__git_refs)" + ;; + esac +} + +_git () +{ + local i c=1 command __git_dir + + while [ $c -lt $COMP_CWORD ]; do + i="${COMP_WORDS[c]}" + case "$i" in + --git-dir=*) __git_dir="${i#--git-dir=}" ;; + --bare) __git_dir="." ;; + --version|-p|--paginate) ;; + --help) command="help"; break ;; + *) command="$i"; break ;; + esac + c=$((++c)) + done + + if [ -z "$command" ]; then + case "${COMP_WORDS[COMP_CWORD]}" in + --*) __gitcomp " + --paginate + --no-pager + --git-dir= + --bare + --version + --exec-path + --html-path + --work-tree= + --help + " + ;; + *) __gitcomp "$(__git_porcelain_commands) $(__git_aliases)" ;; + esac + return + fi + + local expansion=$(__git_aliased_command "$command") + [ "$expansion" ] && command="$expansion" + + case "$command" in + am) _git_am ;; + add) _git_add ;; + apply) _git_apply ;; + archive) _git_archive ;; + bisect) _git_bisect ;; + bundle) _git_bundle ;; + branch) _git_branch ;; + checkout) _git_checkout ;; + cherry) _git_cherry ;; + cherry-pick) _git_cherry_pick ;; + clean) _git_clean ;; + clone) _git_clone ;; + commit) _git_commit ;; + config) _git_config ;; + describe) _git_describe ;; + diff) _git_diff ;; + difftool) _git_difftool ;; + fetch) _git_fetch ;; + format-patch) _git_format_patch ;; + fsck) _git_fsck ;; + gc) _git_gc ;; + grep) _git_grep ;; + help) _git_help ;; + init) _git_init ;; + log) _git_log ;; + ls-files) _git_ls_files ;; + ls-remote) _git_ls_remote ;; + ls-tree) _git_ls_tree ;; + merge) _git_merge;; + mergetool) _git_mergetool;; + merge-base) _git_merge_base ;; + mv) _git_mv ;; + name-rev) _git_name_rev ;; + pull) _git_pull ;; + push) _git_push ;; + rebase) _git_rebase ;; + remote) _git_remote ;; + replace) _git_replace ;; + reset) _git_reset ;; + revert) _git_revert ;; + rm) _git_rm ;; + send-email) _git_send_email ;; + shortlog) _git_shortlog ;; + show) _git_show ;; + show-branch) _git_show_branch ;; + stash) _git_stash ;; + stage) _git_add ;; + submodule) _git_submodule ;; + svn) _git_svn ;; + tag) _git_tag ;; + whatchanged) _git_log ;; + *) COMPREPLY=() ;; + esac +} + +_gitk () +{ + __git_has_doubledash && return + + local cur="${COMP_WORDS[COMP_CWORD]}" + local g="$(__gitdir)" + local merge="" + if [ -f "$g/MERGE_HEAD" ]; then + merge="--merge" + fi + case "$cur" in + --*) + __gitcomp " + $__git_log_common_options + $__git_log_gitk_options + $merge + " + return + ;; + esac + __git_complete_revlist +} + +complete -o bashdefault -o default -o nospace -F _git git 2>/dev/null \ + || complete -o default -o nospace -F _git git +complete -o bashdefault -o default -o nospace -F _gitk gitk 2>/dev/null \ + || complete -o default -o nospace -F _gitk gitk + +# The following are necessary only for Cygwin, and only are needed +# when the user has tab-completed the executable name and consequently +# included the '.exe' suffix. +# +if [ Cygwin = "$(uname -o 2>/dev/null)" ]; then +complete -o bashdefault -o default -o nospace -F _git git.exe 2>/dev/null \ + || complete -o default -o nospace -F _git git.exe +fi diff --git a/.bash_completion.d/misc.bash b/.bash_completion.d/misc.bash new file mode 100644 index 0000000..92a0fe6 --- /dev/null +++ b/.bash_completion.d/misc.bash @@ -0,0 +1,10 @@ +# various additional completions +# http://www.gnu.org/software/bash/manual/bashref.html#Programmable-Completion-Builtins + +complete -F _known_hosts whois nslookup nmap +complete -F _known_hosts push_ssh_cert + +complete -o nospace -A command killall + +# git-track completes remote names +complete -o default -o nospace -F _git_checkout git-track diff --git a/.bash_profile b/.bash_profile new file mode 100644 index 0000000..9974040 --- /dev/null +++ b/.bash_profile @@ -0,0 +1,12 @@ +# ~/.bash_profile: executed by bash(1) for login shells. + +umask 022 +if [ -f ~/.bashrc ]; then + source ~/.bashrc +fi + +# keychain +if [ -f ~/.ssh/id_dsa ]; then + /usr/bin/keychain -q ~/.ssh/id_dsa + source ~/.keychain/`hostname`-sh > /dev/null +fi diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..cde4034 --- /dev/null +++ b/.bashrc @@ -0,0 +1,311 @@ +#!/bin/bash +# ~/.bashrc: executed by bash(1) for non-login shells. +# A basically sane bash environment. +# Tony Duckles (based on http://github.com/rtomayko/dotfiles) + +# the basics +: ${HOME=~} +: ${LOGNAME=$(id -un)} +: ${UNAME=$(uname)} + +# complete hostnames from this file +: ${HOSTFILE=~/.ssh/known_hosts} + +# readline config +: ${INPUTRC=~/.inputrc} + +# ---------------------------------------------------------------------- +# SHELL OPTIONS +# ---------------------------------------------------------------------- + +# bring in system bashrc +test -r /etc/bashrc && + . /etc/bashrc + +# notify of bg job completion immediately +set -o notify + +# shell opts. see bash(1) for details +shopt -s cdspell >/dev/null 2>&1 +shopt -s extglob >/dev/null 2>&1 +shopt -s histappend >/dev/null 2>&1 +shopt -s hostcomplete >/dev/null 2>&1 +shopt -s interactive_comments >/dev/null 2>&1 +shopt -u mailwarn >/dev/null 2>&1 +shopt -s no_empty_cmd_completion >/dev/null 2>&1 + +# don't check for new mail +unset MAILCHECK + +# disable core dumps +ulimit -S -c 0 + +# default umask +umask 0022 + +# ---------------------------------------------------------------------- +# PATH +# ---------------------------------------------------------------------- + +# we want the various sbins on the path along with /usr/local/bin +PATH="$PATH:/usr/local/sbin:/usr/sbin:/sbin" +PATH="/usr/local/bin:$PATH" + +# put ~/bin on PATH if you have it +test -d "$HOME/bin" && + PATH="$HOME/bin:$PATH" + +# ---------------------------------------------------------------------- +# ENVIRONMENT CONFIGURATION +# ---------------------------------------------------------------------- + +# detect interactive shell +case "$-" in + *i*) INTERACTIVE=yes ;; + *) unset INTERACTIVE ;; +esac + +# detect login shell +case "$0" in + -*) LOGIN=yes ;; + *) unset LOGIN ;; +esac + +# enable en_US locale w/ utf-8 encodings if not already +# configured +: ${LANG:="en_US.UTF-8"} +: ${LANGUAGE:="en"} +: ${LC_CTYPE:="en_US.UTF-8"} +: ${LC_ALL:="en_US.UTF-8"} +export LANG LANGUAGE LC_CTYPE LC_ALL + +# ignore backups, CVS directories, python bytecode, vim swap files +FIGNORE="~:CVS:#:.pyc:.swp:.swa:apache-solr-*" +HISTCONTROL=ignoreboth + +# ---------------------------------------------------------------------- +# PAGER / EDITOR +# ---------------------------------------------------------------------- + +# See what we have to work with ... +HAVE_VIM=$(command -v vim) + +# EDITOR +test -n "$HAVE_VIM" && + EDITOR=vim || + EDITOR=vi +export EDITOR + +# PAGER +if test -n "$(command -v less)" ; then + PAGER="less -FirSwX" + MANPAGER="less -FiRswX" +else + PAGER=more + MANPAGER="$PAGER" +fi +export PAGER MANPAGER + +# ---------------------------------------------------------------------- +# PROMPT +# ---------------------------------------------------------------------- + +RED="\[\033[0;91m\]" +GREEN="\[\033[0;92m\]" +BROWN="\[\033[0;33m\]" +GREY="\[\033[0;37m\]" +WHITE="\[\033[0;97m\]" +BLUE="\[\033[0;94m\]" +PS_CLEAR="\[\033[0m\]" +SCREEN_ESC="\[\033k\033\134\]" + +if [ "$LOGNAME" = "root" ]; then + COLOR1="${RED}" + COLOR2="${RED}" + COLOR3="${GREY}" + P="#" +else + COLOR1="" + COLOR2="" + COLOR3="" + P="\$" +fi + +prompt_simple() { + unset PROMPT_COMMAND + PS1="[\u@\h:\w]\$ " + PS2="> " +} + +prompt_compact() { + unset PROMPT_COMMAND + PS1="${COLOR1}${P}${PS_CLEAR} " + PS2="> " +} + +prompt_color() { + PS1="[${COLOR1}\u${PS_CLEAR}@${COLOR2}\h${PS_CLEAR}:${COLOR3}\w${PS_CLEAR}]${COLOR1}$P${PS_CLEAR} " + PS2="\[^[[33;1m\]continue \[^[[0m^[[1m\]> " +} + +# ---------------------------------------------------------------------- +# MACOS X / DARWIN SPECIFIC +# ---------------------------------------------------------------------- + +if [ "$UNAME" = Darwin ]; then + # put ports on the paths if /opt/local exists + test -x /opt/local -a ! -L /opt/local && { + PORTS=/opt/local + + # setup the PATH and MANPATH + PATH="$PORTS/bin:$PORTS/sbin:$PATH" + MANPATH="$PORTS/share/man:$MANPATH" + + # nice little port alias + alias port="sudo nice -n +18 $PORTS/bin/port" + } +fi + +# ---------------------------------------------------------------------- +# ALIASES / FUNCTIONS +# ---------------------------------------------------------------------- + +# disk usage with human sizes and minimal depth +alias du1='du -h --max-depth=1' +alias fn='find . -name' +alias hi='history | tail -20' + +# ---------------------------------------------------------------------- +# BASH COMPLETION +# ---------------------------------------------------------------------- + +test -z "$BASH_COMPLETION" && { + bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.} + test -n "$PS1" && test $bmajor -gt 1 && { + # search for a bash_completion file to source + for f in /usr/local/etc/bash_completion \ + /usr/pkg/etc/bash_completion \ + /opt/local/etc/bash_completion \ + /etc/bash_completion + do + test -f $f && { + . $f + break + } + done + } + unset bash bmajor bminor +} + +# override and disable tilde expansion +_expand() +{ + return 0 +} + +# ---------------------------------------------------------------------- +# LS AND DIRCOLORS +# ---------------------------------------------------------------------- + +# we always pass these to ls(1) +LS_COMMON="--color=auto" + +# if the dircolors utility is available, set that up to +dircolors="$(type -P gdircolors dircolors | head -1)" +test -n "$dircolors" && { + COLORS=/etc/DIR_COLORS + test -e "/etc/DIR_COLORS.$TERM" && COLORS="/etc/DIR_COLORS.$TERM" + test -e "$HOME/.dircolors" && COLORS="$HOME/.dircolors" + test ! -e "$COLORS" && COLORS= + eval `$dircolors --sh $COLORS` +} +unset dircolors + +# setup the main ls alias if we've established common args +test -n "$LS_COMMON" && + alias ls="command ls $LS_COMMON" + +# these use the ls aliases above +alias ll="ls -l" +alias l.="ls -d .*" + +# -------------------------------------------------------------------- +# MISC COMMANDS +# -------------------------------------------------------------------- + +# push SSH public key to another box +push_ssh_cert() { + local _host + test -f ~/.ssh/id_dsa.pub || ssh-keygen -t dsa + for _host in "$@"; + do + echo $_host + ssh $_host 'cat >> ~/.ssh/authorized_keys' < ~/.ssh/id_dsa.pub + done +} + +# -------------------------------------------------------------------- +# PATH MANIPULATION FUNCTIONS +# -------------------------------------------------------------------- + +# Usage: pls [] +# List path entries of PATH or environment variable . +pls () { eval echo \$${1:-PATH} |tr : '\n'; } + +# Usage: pshift [-n ] [] +# Shift entries off the front of PATH or environment var . +# with the option. Useful: pshift $(pwd) +pshift () { + local n=1 + [ "$1" = "-n" ] && { n=$(( $2 + 1 )); shift 2; } + eval "${1:-PATH}='$(pls |tail -n +$n |tr '\n' :)'" +} + +# Usage: ppop [-n ] [] +# Pop entries off the end of PATH or environment variable . +ppop () { + local n=1 i=0 + [ "$1" = "-n" ] && { n=$2; shift 2; } + while [ $i -lt $n ] + do eval "${1:-PATH}='\${${1:-PATH}%:*}'" + i=$(( i + 1 )) + done +} + +# Usage: prm [] +# Remove from PATH or environment variable . +prm () { eval "${2:-PATH}='$(pls $2 |grep -v "^$1\$" |tr '\n' :)'"; } + +# Usage: punshift [] +# Shift onto the beginning of PATH or environment variable . +punshift () { eval "${2:-PATH}='$1:$(eval echo \$${2:-PATH})'"; } + +# Usage: puniq [] +# Remove duplicate entries from a PATH style value while retaining +# the original order. Use PATH if no is given. +# +# Example: +# $ puniq /usr/bin:/usr/local/bin:/usr/bin +# /usr/bin:/usr/local/bin +puniq () { + echo "$1" |tr : '\n' |nl |sort -u -k 2,2 |sort -n | + cut -f 2- |tr '\n' : |sed -e 's/:$//' -e 's/^://' +} + +# ------------------------------------------------------------------- +# USER SHELL ENVIRONMENT +# ------------------------------------------------------------------- + +# source ~/.shenv now if it exists +test -r ~/.shenv && + . ~/.shenv + +# condense PATH entries +PATH=$(puniq $PATH) +MANPATH=$(puniq $MANPATH) + +# Use the color prompt by default when interactive +test -n "$PS1" && + prompt_color + +# vim: ts=4 sts=4 shiftwidth=4 expandtab diff --git a/.dircolors b/.dircolors new file mode 100644 index 0000000..56ba4be --- /dev/null +++ b/.dircolors @@ -0,0 +1,129 @@ +# Configuration file for dircolors, a utility to help you set the +# LS_COLORS environment variable used by GNU ls with the --color option. + +# COLOR needs one of these arguments: +# 'tty' colorizes output to ttys, but not pipes (--color=auto), +# 'all' adds color characters to all output (--color=always), +# 'none' shuts colorization off (--color=never). +COLOR tty + +# Extra command line options for ls go here. +# Basically these ones are: +# -F = show '/' for dirs, '*' for executables, etc. +# -T 0 = don't trust tab spacing when formatting ls output. +# -b = better support for special characters +OPTIONS -F -b -T 0 + +# Below, there should be one TERM entry for each termtype that is colorizable +TERM linux +TERM console +TERM con132x25 +TERM con132x30 +TERM con132x43 +TERM con132x60 +TERM con80x25 +TERM con80x28 +TERM con80x30 +TERM con80x43 +TERM con80x50 +TERM con80x60 +TERM xterm +TERM vt100 +TERM screen + +# Below are the color init strings for the basic file types. A color init +# string consists of one or more of the following numeric codes: +# Attribute codes: +# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed +# Text color codes: +# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white +# Background color codes: +# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white +NORMAL 00 # global default, although everything should be something. +FILE 00 # normal file +DIR 01;34 # directory +LINK 01;36 # symbolic link +FIFO 40;33 # pipe +SOCK 01;35 # socket +BLK 40;33;01 # block device driver +CHR 40;33;01 # character device driver +ORPHAN 40;31;01 # symlink to nonexistent file + +# This is for files with execute permission: +EXEC 01;32 + +# List any file extensions like '.gz' or '.tar' that you would like ls +# to colorize below. Put the extension, a space, and the color init string. +# (and any comments you want to add after a '#') + +.tar 01;31 # archives or compressed (bright red) +.tgz 01;31 +.arj 01;31 +.taz 01;31 +.lzh 01;31 +.zip 01;31 +.bz2 01;31 +.rpm 01;31 +.deb 01;31 +.z 01;31 +.Z 01;31 +.gz 01;31 +.deb 01;31 +.rpm 01;31 +.jar 01;31 +.rar 01;31 +.7z 01;31 + +.jpg 01;35 # image formats +.jpeg 01;35 +.gif 01;35 +.bmp 01;35 +.ppm 01;35 +.tga 01;35 +.xbm 01;35 +.xpm 01;35 +.tif 01;35 +.png 01;35 +.psd 01;35 + +.mpg 01;37 # movie formats +.mpeg 01;37 +.avi 01;37 +.mov 01;37 +.rm 01;37 +.asf 01;37 +.wmv 01;37 +.asf 01;37 +.flc 01;37 + +.wav 36 # sound formats +.aiff 36 +.mp3 36 +.mp2 36 +.au 36 +.m3u 36 +.mod 36 +.s3m 36 +.xm 36 +.mid 36 +.it 36 +.ult 36 +.mtm 36 +.ram 36 +.ogg 36 +.flac 36 + +.txt 33 # text formats +.doc 33 +.nfo 33 +.html 33 + +.cpp 01;33 # Programming stuff +.cc 01;33 +.h 33;01 +.c 33;01 +.java 01;33 +.class 01;33 +.php 01;33 +.vim 01;33 + diff --git a/.gitconfig b/.gitconfig new file mode 100644 index 0000000..374e33a --- /dev/null +++ b/.gitconfig @@ -0,0 +1,54 @@ +[user] + name = Tony Duckles + email = tony@nynim.org + +[alias] + sh = !git-sh + grab = !githug-grab + thanks = !git-thanks + cv = !git-cv + track = !git-track + ll = log --pretty=oneline --abbrev-commit --max-count=15 + review = log -p --max-count=1 + fp = format-patch --stdout + ci = commit + st = status + br = branch + co = checkout + df = diff + lg = log -p + who = shortlog -s -- + +[core] + filemode = true + whitespace = space-before-tab, trailing-space + +[diff] + renames = copies + +[sendemail] + smtpserver = smtp.gmail.com + smtpserverport = 587 + smtpencryption = tls + smtpuser = tony@nynim.org + +[color] + ui = auto + +[color "diff"] + meta = blue bold + frag = magenta bold + old = red bold + new = green bold + +[color "branch"] + current = yellow reverse + local = yellow bold + remote = green bold + plain = red bold + +[color "status"] + added = yellow + changed = green bold + untracked = blue bold + diff --git a/.gitshrc b/.gitshrc new file mode 100644 index 0000000..14aaf44 --- /dev/null +++ b/.gitshrc @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# Settings for git-sh + +# list remotes with repo URLs +rv () { + local line + git remote -v | grep push | sed 's/(.*$//' | + while read line; + do + printf "%-15s %s\n" $line + done +} + +gitcomplete cv checkout +gitcomplete track checkout +gitcomplete gitx checkout +gitcomplete tig checkout diff --git a/.inputrc b/.inputrc new file mode 100644 index 0000000..ba61c88 --- /dev/null +++ b/.inputrc @@ -0,0 +1,62 @@ +# do not bell on tab-completion +set bell-style bell + +set expand-tilde off +set input-meta off +set convert-meta on +set output-meta off +set horizontal-scroll-mode off +set history-preserve-point on +set mark-directories on +set mark-symlinked-directories on +set match-hidden-files off + +# completion settings +set page-completions off +set completion-query-items 2000 +set completion-ignore-case off +set show-all-if-ambiguous on +set show-all-if-unmodified on +set completion-prefix-display-length 10 +set print-completions-horizontally off + +#set editing-mode emacs + +## reload file +#"\C-x\C-r": re-read-init-file + +#C-n: history-search-forward +#C-p: history-search-backward + +#$if mode=emacs +# +## make control-tab complete from history +## C-TAB: dynamic-complete-history +# +#"\e[A": history-search-backward +#"\e[B": history-search-forward +# +## for linux console and RH/Debian xterm +#"\e[1~": beginning-of-line +#"\e[4~": end-of-line +#"\e[5~": beginning-of-history +#"\e[6~": end-of-history +#"\e[3~": delete-char +#"\e[2~": quoted-insert +#"\e[5C": forward-word +#"\e[5D": backward-word +#"\e\e[C": forward-word +#"\e\e[D": backward-word +# +## for rxvt +#"\e[8~": end-of-line +# +## for non RH/Debian xterm, can't hurt for RH/DEbian xterm +#"\eOH": beginning-of-line +#"\eOF": end-of-line +# +## for freebsd console +#"\e[H": beginning-of-line +#"\e[F": end-of-line +# +#$endif diff --git a/.screenrc b/.screenrc new file mode 100644 index 0000000..7fef06f --- /dev/null +++ b/.screenrc @@ -0,0 +1,92 @@ +# ------------------------------------------------------------------- +# Settings +# ------------------------------------------------------------------- +crlf off # No Microsoft linebreaks +startup_message off # bypass GPL notice (we're aware) +vbell off # Use audio bell +defscrollback 15000 # big scrollback +shell bash # don't start login shells +shelltitle "sh" # no title by default - set in PS1 +#defmonitor on # turn on monitoring +#activity "%c activity <%n>" # let you know when stuff happens! +nethack off # makes error messages cryptic +pow_detach_msg "Screen session of \$LOGNAME \$:cr:\$:nl:ended." +autodetach on +term xterm + +# Use UTF-8 +defutf8 on +defencoding UTF-8 +setenv LANG 'en_US.UTF-8' + +# status line to display a bar at the bottom listing the window +# names and highlighting the current windowname in blue. +# (http://www.ibm.com/developerworks/aix/library/au-gnu_screen/index.html) +hardstatus alwayslastline "%{.bw}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} " + +# enable bold +attrcolor b ".I" + +# allow 256 colors +termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm' + +# disable altscreen, so PuTTy + screen play nicely together +termcapinfo xterm* 'ti@:te@' +altscreen off + +# xterm understands both im/ic and doesn't have a status line. +# Note: Do not specify im and ic in the real termcap/info file as +# some programs (e.g. vi) will not work anymore. +termcap xterm 'hs@:cs=\E[%i%d;%dr:im=\E[4h:ei=\E[4l' +terminfo xterm 'hs@:cs=\E[%i%p1%d;%p2%dr:im=\E[4h:ei=\E[4l' +termcap xterm-color 'hs@:cs=\E[%i%d;%dr:im=\E[4h:ei=\E[4l' +terminfo xterm-color 'hs@:cs=\E[%i%p1%d;%p2%dr:im=\E[4h:ei=\E[4l' + +# our xterm has colors! (rxvt, too) +termcap xterm* 'AF=\E[3%dm:AB=\E[4%dm' +terminfo xterm* 'AF=\E[3%p1%dm:AB=\E[4%p1%dm' + +# this makes backspace sane on debian systems +termcapinfo xterm 'bc@:bs@' +termcapinfo xterm-color 'bc@:bs@' + +# 80/132 column switching must be enabled for ^AW to work +# change init sequence to not switch width +termcapinfo xterm 'Z0=\E[?3h:Z1=\E[?3l:is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l' +termcapinfo xterm-color 'Z0=\E[?3h:Z1=\E[?3l:is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l' + +# tell screen that xterm can switch to dark background and has function +# keys. +termcapinfo xterm 'VR=\E[?5h:VN=\E[?5l' +termcapinfo xterm 'k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~' +termcapinfo xterm 'kh=\EOH:kI=\E[2~:kD=\E[3~:kH=\EOF:kP=\E[5~:kN=\E[6~' +termcapinfo xterm-color 'VR=\E[?5h:VN=\E[?5l' +termcapinfo xterm-color 'k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~' +termcapinfo xterm-color 'kh=\EOH:kI=\E[2~:kD=\E[3~:kH=\EOF:kP=\E[5~:kN=\E[6~' + +# make the output buffer large for (fast) xterms. +termcapinfo xterm* 'OL=10000' +termcapinfo xterm* 'vi=\E[?25l:ve=\E[34h\E[?25h:vs=\E[34l' + +# emulate part of the 'K' charset +termcapinfo xterm* 'XC=K%,%\E(B,[\304,\\\\\326,]\334,{\344,|\366,}\374,~\337' + +# remove some stupid / dangerous key bindings +bind k +bind ^K +bind \\ +bind ^\ + +# add some useful key bindings +bind ' ' windowlist -b +bind ')' select 10 +bind '!' select 11 +bind '@' select 12 +bind '#' select 13 +bind '$' select 14 +bind '%' select 15 +bind '^' select 16 +bind '&' select 17 +bind '*' select 18 +bind '(' select 19 + diff --git a/.vim/colors/aqua.vim b/.vim/colors/aqua.vim new file mode 100644 index 0000000..483b6ac --- /dev/null +++ b/.vim/colors/aqua.vim @@ -0,0 +1,44 @@ +" Vim color file +" Maintainer: tranquility@portugalmail.pt +" Last Change: 6 Apr 2002 + + +" cool help screens +" :he group-name +" :he highlight-groups +" :he cterm-colors + +set background=dark +hi clear +if exists("syntax_on") + syntax reset +endif +let g:colors_name="aqua" + +hi Normal guibg=steelblue guifg=linen +hi Cursor guibg=lightblue3 guifg=black gui=bold +hi VertSplit guifg=white guibg=navyblue gui=none +hi Folded guibg=darkblue guifg=white +hi FoldColumn guibg=lightgray guifg=navyblue +hi ModeMsg guifg=black guibg=steelblue1 +hi MoreMsg guifg=black guibg=steelblue1 +hi NonText guifg=white guibg=steelblue4 gui=none +hi Question guifg=snow +hi Search guibg=#FFFFFF guifg=midnightblue gui=bold +hi SpecialKey guifg=navyblue +hi StatusLine guibg=skyblue3 guifg=black gui=none +hi StatusLineNC guibg=skyblue1 guifg=black gui=none +hi Title guifg=bisque3 +hi Subtitle guifg=black +hi Visual guifg=white guibg=royalblue4 gui=none +hi WarningMsg guifg=salmon4 guibg=gray60 gui=bold +hi Comment guifg=lightskyblue +hi Constant guifg=turquoise gui=bold +hi Identifier guifg=lightcyan +hi Statement guifg=royalblue4 +hi PreProc guifg=black gui=bold +hi Type guifg=lightgreen +hi Special guifg=navajowhite +hi Ignore guifg=grey29 +hi Todo guibg=black guifg=white +hi WildMenu guibg=aquamarine diff --git a/.vim/colors/autumn.vim b/.vim/colors/autumn.vim new file mode 100644 index 0000000..22a5ef0 --- /dev/null +++ b/.vim/colors/autumn.vim @@ -0,0 +1,88 @@ +" Vim colour file +" Maintainer: Antony Scriven +" Last Change: 2003-06-12 +" +set background=light +hi clear +if exists("syntax_on") + syntax reset +endif + +let colors_name = "autumn" + +hi Normal term=none cterm=none ctermfg=black ctermbg=White gui=none guifg=Black guibg=#f0f2f0 +hi Cursor term=none cterm=none ctermfg=white ctermbg=darkgrey gui=none guifg=black guibg=red +hi DiffAdd term=bold cterm=none ctermfg=white ctermbg=DarkBlue gui=none guifg=#aaeeaa guibg=#447744 +hi DiffChange term=bold cterm=none ctermfg=white ctermbg=DarkMagenta gui=none guifg=lightyellow guibg=#ddbb55 +hi DiffDelete term=bold cterm=none ctermfg=blue ctermbg=darkcyan gui=none guifg=#336633 guibg=#aaccaa +hi difftext term=reverse cterm=bold ctermfg=white ctermbg=red gui=none guifg=lightyellow guibg=#cc7733 +hi Directory term=none cterm=none ctermfg=Red ctermbg=white gui=none guifg=Red guibg=bg +hi ErrorMsg term=standout cterm=none ctermfg=white ctermbg=DarkRed gui=none guifg=white guibg=DarkRed +hi Folded term=reverse cterm=none ctermfg=darkblue ctermbg=lightgrey gui=none guifg=darkblue guibg=lightgrey +"8 col term +hi FoldColumn term=reverse cterm=none ctermfg=darkblue ctermbg=grey gui=none guifg=darkblue guibg=grey +hi IncSearch term=reverse cterm=none ctermfg=yellow ctermbg=darkgreen gui=none guifg=yellow guibg=#449944 +hi lCursor term=reverse cterm=none ctermfg=black ctermbg=cyan gui=none guifg=black guibg=Cyan +hi LineNr term=reverse cterm=none ctermfg=darkred ctermbg=grey gui=none guifg=brown guibg=lightgrey +hi ModeMsg term=bold cterm=none ctermfg=green ctermbg=darkgreen gui=none guifg=#007700 guibg=#aaccaa +hi MoreMsg term=bold cterm=none ctermfg=darkGreen ctermbg=white gui=none guifg=darkgreen guibg=bg +hi Question term=bold cterm=none ctermfg=darkGreen ctermbg=white gui=none guifg=darkgreen guibg=bg +hi Search term=reverse cterm=none ctermfg=black ctermbg=yellow gui=none guifg=black guibg=yellow +hi SpecialKey term=italic cterm=none ctermfg=lightgrey ctermbg=white gui=none guifg=lightblue guibg=bg +hi NonText term=bold cterm=none ctermfg=lightgrey ctermbg=white gui=none guifg=#c6c6c6 guibg=bg +hi StatusLine term=reverse cterm=none ctermfg=white ctermbg=black gui=none guifg=#80624d guibg=#ddd9b8 +hi Title term=bold cterm=none ctermfg=DarkMagenta ctermbg=white gui=none guifg=DarkMagenta guibg=bg +if has("gui_running") || &t_Co > 8 + hi Visual term=reverse cterm=none ctermfg=black ctermbg=lightgrey gui=none guifg=black guibg=lightgreen + hi VertSplit term=reverse cterm=none ctermfg=darkgrey ctermbg=darkgrey gui=none guifg=#c7c7c2 guibg=#d7d7d2 + hi StatusLineNC term=reverse cterm=none ctermfg=white ctermbg=darkgrey gui=none guifg=darkgrey guibg=#d7d7d2 + hi Comment term=italic cterm=none ctermfg=grey ctermbg=white gui=none guifg=#ccaaaa guibg=bg +else + hi Visual term=reverse cterm=none ctermfg=green ctermbg=darkgreen gui=none guifg=black guibg=lightgreen + hi VertSplit term=reverse cterm=none ctermfg=darkcyan ctermbg=darkblue gui=none guifg=darkgrey guibg=darkgrey + hi StatusLineNC term=reverse cterm=none ctermfg=white ctermbg=darkblue gui=none guifg=white guibg=darkgrey + hi Comment term=italic cterm=none ctermfg=darkcyan ctermbg=white gui=none guifg=#ccaaaa guibg=bg +endif +hi VisualNOS term=bold cterm=none ctermfg=grey ctermbg=black gui=none guifg=grey guibg=black +hi WarningMsg term=standout cterm=none ctermfg=Red ctermbg=white gui=none guifg=Red guibg=bg +hi WildMenu term=bold cterm=none ctermfg=darkblue ctermbg=yellow gui=none guifg=black guibg=lightyellow + +hi Constant term=underline cterm=none ctermfg=darkred ctermbg=bg gui=none guifg=#bb6666 guibg=bg +hi Special term=bold cterm=none ctermfg=darkcyan ctermbg=white gui=none guifg=darkcyan guibg=bg +hi identifier term=underline cterm=none ctermfg=darkmagenta ctermbg=white gui=none guifg=darkcyan guibg=bg +hi statement term=bold cterm=none ctermfg=darkgreen ctermbg=white gui=none guifg=#44aa44 guibg=bg +hi preproc term=underline cterm=none ctermfg=darkgrey ctermbg=white gui=none guifg=darkgrey guibg=bg +hi type term=none cterm=none ctermfg=brown ctermbg=white gui=none guifg=#bb9900 guibg=bg +hi underlined term=underline cterm=underline ctermfg=darkmagenta ctermbg=white gui=underline guifg=darkmagenta guibg=bg +hi Ignore term=italic cterm=none ctermfg=lightgrey ctermbg=white gui=none guifg=grey guibg=bg +"hi todo term=underline cterm=bold ctermfg=yellow ctermbg=brown gui=none guifg=#333333 guibg=#ddee33 +hi todo term=bold cterm=none ctermfg=yellow ctermbg=brown gui=bold guifg=#229900 guibg=#ddd9b8 +hi function term=bold cterm=none ctermfg=blue ctermbg=white gui=none guifg=#0055cc guibg=bg + +hi link String Constant +hi link Character Constant +hi link Number Constant +hi link Boolean Constant +hi link Float Number +hi link Conditional Statement +hi link Repeat Statement +hi link Label Statement +hi link Operator Statement +hi link Keyword Statement +hi link Exception Statement +hi link Include PreProc +hi link Define PreProc +hi link Macro PreProc +hi link PreCondit PreProc +hi link StorageClass Type +hi link Structure Type +hi link Typedef Type +hi link Tag Special +hi link SpecialChar Special +hi link Delimiter Special +hi link SpecialComment Special +hi link Debug Special +hi link vimfunction function + + +" vim: set ts=8 sw=8 et sts=8 tw=72 fo-=t ff=unix : diff --git a/.vim/colors/autumnleaf.vim b/.vim/colors/autumnleaf.vim new file mode 100644 index 0000000..f7af59f --- /dev/null +++ b/.vim/colors/autumnleaf.vim @@ -0,0 +1,154 @@ +" Vim color file +" Maintainer: Anders Korte +" Last Change: 17 Oct 2004 + +" AutumnLeaf color scheme 1.0 + +set background=light + +hi clear + +if exists("syntax_on") + syntax reset +endif + +let colors_name="AutumnLeaf" + + +" Colors for the User Interface. + +hi Cursor guibg=#aa7733 guifg=#ffeebb gui=bold +hi Normal guibg=#fffdfa guifg=black gui=none +hi NonText guibg=#eafaea guifg=#000099 gui=bold +hi Visual guibg=#fff8cc guifg=black gui=none +" hi VisualNOS + +hi Linenr guibg=bg guifg=#999999 gui=none + +" Uncomment these if you use Diff...?? +" hi DiffText guibg=#cc0000 guifg=white gui=none +" hi DiffAdd guibg=#0000cc guifg=white gui=none +" hi DiffChange guibg=#990099 guifg=white gui=none +" hi DiffDelete guibg=#888888 guifg=#333333 gui=none + +hi Directory guibg=bg guifg=#337700 gui=none + +hi IncSearch guibg=#c8e8ff guifg=black gui=none +hi Search guibg=#c8e8ff guifg=black gui=none +hi SpecialKey guibg=bg guifg=fg gui=none +hi Titled guibg=bg guifg=fg gui=none + +hi ErrorMsg guibg=bg guifg=#cc0000 gui=bold +hi ModeMsg guibg=bg guifg=#003399 gui=none +hi link MoreMsg ModeMsg +hi link Question ModeMsg +hi WarningMsg guibg=bg guifg=#cc0000 gui=bold + +hi StatusLine guibg=#ffeebb guifg=black gui=bold +hi StatusLineNC guibg=#aa8866 guifg=#f8e8cc gui=none +hi VertSplit guibg=#aa8866 guifg=#ffe0bb gui=none + +" hi Folded +" hi FoldColumn +" hi SignColumn + + +" Colors for Syntax Highlighting. + +hi Comment guibg=#ddeedd guifg=#002200 gui=none + +hi Constant guibg=bg guifg=#003399 gui=bold +hi String guibg=bg guifg=#003399 gui=italic +hi Character guibg=bg guifg=#003399 gui=italic +hi Number guibg=bg guifg=#003399 gui=bold +hi Boolean guibg=bg guifg=#003399 gui=bold +hi Float guibg=bg guifg=#003399 gui=bold + +hi Identifier guibg=bg guifg=#003399 gui=none +hi Function guibg=bg guifg=#0055aa gui=bold +hi Statement guibg=bg guifg=#003399 gui=none + +hi Conditional guibg=bg guifg=#aa7733 gui=bold +hi Repeat guibg=bg guifg=#aa5544 gui=bold +hi link Label Conditional +hi Operator guibg=bg guifg=#aa7733 gui=bold +hi link Keyword Statement +hi Exception guibg=bg guifg=#228877 gui=bold + +hi PreProc guibg=bg guifg=#aa7733 gui=bold +hi Include guibg=bg guifg=#558811 gui=bold +hi link Define Include +hi link Macro Include +hi link PreCondit Include + +hi Type guibg=bg guifg=#007700 gui=bold +hi link StorageClass Type +hi link Structure Type +hi Typedef guibg=bg guifg=#009900 gui=italic + +hi Special guibg=bg guifg=fg gui=none +hi SpecialChar guibg=bg guifg=fg gui=bold +hi Tag guibg=bg guifg=#003399 gui=bold +hi link Delimiter Special +hi SpecialComment guibg=#dddddd guifg=#aa0000 gui=none +hi link Debug Special + +hi Underlined guibg=bg guifg=blue gui=underline + +hi Title guibg=bg guifg=fg gui=bold +hi Ignore guibg=bg guifg=#999999 gui=none +hi Error guibg=red guifg=white gui=none +hi Todo guibg=bg guifg=#aa0000 gui=none + + + +" The same in cterm colors. +hi Cursor ctermbg=6 ctermfg=14 +hi Normal ctermbg=15 ctermfg=0 +hi NonText ctermbg=10 ctermfg=1 +hi Visual ctermbg=14 ctermfg=0 +" hi VisualNOS +hi Linenr ctermbg=bg ctermfg=7 +" hi DiffText ctermbg=4 ctermfg=15 +" hi DiffAdd ctermbg=1 ctermfg=15 +" hi DiffChange ctermbg=5 ctermfg=15 +" hi DiffDelete ctermbg=7 ctermfg=8 +hi Directory ctermbg=bg ctermfg=2 +hi IncSearch ctermbg=9 ctermfg=0 +hi Search ctermbg=9 ctermfg=0 +hi SpecialKey ctermbg=bg ctermfg=fg +hi Titled ctermbg=bg ctermfg=fg +hi ErrorMsg ctermbg=bg ctermfg=12 +hi ModeMsg ctermbg=bg ctermfg=9 +hi WarningMsg ctermbg=bg ctermfg=12 +hi StatusLine ctermbg=14 ctermfg=0 +hi StatusLineNC ctermbg=6 ctermfg=14 +hi VertSplit ctermbg=6 ctermfg=14 +" hi Folded +" hi FoldColumn +" hi SignColumn +hi Comment ctermbg=10 ctermfg=2 +hi Constant ctermbg=bg ctermfg=9 +hi String ctermbg=bg ctermfg=9 cterm=italic +hi Character ctermbg=bg ctermfg=9 cterm=italic +hi Number ctermbg=bg ctermfg=9 cterm=bold +hi Boolean ctermbg=bg ctermfg=9 cterm=bold +hi Float ctermbg=bg ctermfg=9 cterm=bold +hi Function ctermbg=bg ctermfg=9 cterm=bold +hi Statement ctermbg=bg ctermfg=9 cterm=bold +hi Conditional ctermbg=bg ctermfg=6 cterm=bold +hi Repeat ctermbg=bg ctermfg=6 cterm=bold +hi Operator ctermbg=bg ctermfg=6 cterm=bold +hi Exception ctermbg=bg ctermfg=2 cterm=bold +hi PreProc ctermbg=bg ctermfg=6 +hi Include ctermbg=bg ctermfg=2 cterm=bold +hi Type ctermbg=bg ctermfg=2 cterm=bold +hi Typedef ctermbg=bg ctermfg=2 cterm=italic +hi Special ctermbg=bg ctermfg=fg cterm=bold +hi Tag ctermbg=bg ctermfg=9 cterm=bold +hi SpecialComment ctermbg=7 ctermfg=4 +hi Underlined ctermbg=bg ctermfg=9 cterm=underline +hi Title ctermbg=bg ctermfg=fg cterm=bold +hi Ignore ctermbg=bg ctermfg=7 +hi Error ctermbg=12 ctermfg=15 +hi Todo ctermbg=bg ctermfg=15 diff --git a/.vim/colors/blackdust.vim b/.vim/colors/blackdust.vim new file mode 100644 index 0000000..0eb20a7 --- /dev/null +++ b/.vim/colors/blackdust.vim @@ -0,0 +1,62 @@ +set background=dark +hi clear + +hi Boolean guifg=#dca3a3 gui=bold +hi Character guifg=#dca3a3 gui=bold +hi Comment guifg=#7f7f7f +hi Condtional guifg=#8fffff +hi Constant guifg=#dca3a3 gui=bold +hi Cursor guifg=#000000 guibg=#aeaeae +hi Debug guifg=#dca3a3 gui=bold +hi Define guifg=#ffcfaf gui=bold +hi Delimiter guifg=#8f8f8f +hi DiffAdd guibg=#613c46 +hi DiffChange guibg=#333333 +hi DiffDelete guifg=#333333 guibg=#464646 gui=none +hi DiffText guifg=#ffffff guibg=#1f1f1f gui=bold +hi Directory guifg=#ffffff gui=bold +hi Error guifg=#000000 guibg=#00ffff +hi ErrorMsg guifg=#000000 guibg=#00c0cf +hi Exception guifg=#8fffff gui=underline +hi Float guifg=#9c93b3 +hi FoldColumn guifg=#dca3a3 guibg=#464646 +hi Folded guifg=#dca3a3 guibg=#333333 +hi Function guifg=#ffff8f +hi Identifier guifg=#ffffff +hi Include guifg=#ffcfaf gui=bold +hi IncSearch guifg=#000000 guibg=#c15c66 +hi Keyword guifg=#ffffff gui=bold +hi Label guifg=#8fffff gui=underline +hi LineNr guifg=#7f7f7f guibg=#464646 +hi Macro guifg=#ffcfaf gui=bold +hi ModeMsg guifg=#dca3a3 gui=bold +hi MoreMsg guifg=#ffffff gui=bold +hi NonText guifg=#1f1f1f +hi Normal guifg=#cccccc guibg=#3f3f3f +hi Number guifg=#aca0a3 +hi Operator guifg=#ffffff +hi PreCondit guifg=#dfaf8f gui=bold +hi PreProc guifg=#ffcfaf gui=bold +hi Question guifg=#ffffff gui=bold +hi Repeat guifg=#8fffff gui=underline +hi Search guifg=#000000 guibg=#c15c66 +hi SpecialChar guifg=#dca3a3 gui=bold +hi SpecialComment guifg=#dca3a3 gui=bold +hi Special guifg=#7f7f7f +hi SpecialKey guifg=#7e7e7e +hi Statement guifg=#8fffff +hi StatusLine guifg=#333333 guibg=#f18c96 +hi StatusLineNC guifg=#333333 guibg=#cccccc +hi StorageClass guifg=#ffffff gui=bold +hi String guifg=#cc9393 +hi Structure guifg=#ffffff gui=bold,underline +hi Tag guifg=#dca3a3 gui=bold +hi Title guifg=#ffffff guibg=#333333 gui=bold +hi Todo guifg=#ffffff guibg=#000000 gui=bold +hi Typedef guifg=#ffffff gui=bold,underline +hi Type guifg=#ffffff gui=bold +hi VertSplit guifg=#333333 guibg=#cccccc +hi Visual guifg=#333333 guibg=#f18c96 gui=reverse +hi VisualNOS guifg=#333333 guibg=#f18c96 gui=bold,underline +hi WarningMsg guifg=#ffffff guibg=#333333 gui=bold +hi WildMenu guifg=#000000 guibg=#dca3a3 diff --git a/.vim/colors/blugrine.vim b/.vim/colors/blugrine.vim new file mode 100644 index 0000000..6ba6330 --- /dev/null +++ b/.vim/colors/blugrine.vim @@ -0,0 +1,42 @@ +" author Helder Correia < helder (dot) correia (at) netcabo (dot) pt> +" version 2004.0 +" based on bluegreen colorscheme by Joao Estevao +" feel free to modify / redistribute this file + +set background=dark +hi clear +if exists("syntax_on") + syntax reset +endif +let g:colors_name="blugrine" + +hi Normal guifg=White guibg=#000000 + +" highlight groups +hi Cursor guibg=#D74141 guifg=#e3e3e3 +hi VertSplit guibg=#C0FFFF guifg=#075554 gui=none +hi Folded guibg=#FFC0C0 guifg=black +hi FoldColumn guibg=#800080 guifg=tan +hi ModeMsg guifg=#404040 guibg=#C0C0C0 +hi MoreMsg guifg=darkturquoise guibg=#188F90 +hi NonText guibg=#334C75 guifg=#9FADC5 +hi Question guifg=#F4BB7E +hi Search guibg=fg guifg=bg +hi SpecialKey guifg=#BF9261 +hi StatusLine guibg=#004443 guifg=#c0ffff gui=none +hi StatusLineNC guibg=#067C7B guifg=#004443 gui=bold +hi Title guifg=#8DB8C3 +hi Visual gui=bold guifg=black guibg=#C0FFC0 +hi WarningMsg guifg=#F60000 gui=underline + +" syntax highlighting groups +hi Comment guifg=#DABEA2 +hi Constant guifg=#72A5E4 gui=bold +hi Identifier guifg=#ADCBF1 +hi Statement guifg=#7E75B5 +hi PreProc guifg=#14F07C +hi Type guifg=#A9EE8A +hi Special guifg=#EEBABA +hi Ignore guifg=grey60 +hi Todo guibg=#9C8C84 guifg=#244C0A + diff --git a/.vim/colors/camo.vim b/.vim/colors/camo.vim new file mode 100644 index 0000000..059af42 --- /dev/null +++ b/.vim/colors/camo.vim @@ -0,0 +1,76 @@ +" Vim color file +" Maintainer: Tim Aldrich +" Last Change: 19 January 2002 + +set background=dark +hi clear +if exists("syntax_on") + syntax reset +endif +let g:colors_name="camo" +hi Normal guifg=bisque guibg=grey15 +hi Cursor guifg=snow guibg=bisque3 +hi CursorIM guifg=OliveDrab4 guibg=bisque +hi Directory guifg=OliveDrab4 guibg=grey15 +hi DiffAdd guifg=DarkOliveGreen1 guibg=grey15 +hi DiffChange guifg=PaleGreen guibg=grey15 +hi DiffDelete guifg=red guibg=grey15 +hi DiffText guifg=grey15 guibg=red +hi ErrorMsg guifg=snow guibg=red +hi VertSplit guifg=bisque4 guibg=DarkOliveGreen1 +hi Folded guifg=DarkOliveGreen2 guibg=grey30 +hi FoldColumn guifg=DarkOliveGreen2 guibg=grey30 +hi IncSearch guifg=bisque guibg=red +hi LineNr guifg=OliveDrab4 guibg=grey15 +hi ModeMsg guifg=khaki3 guibg=grey15 +hi MoreMsg guifg=khaki3 guibg=grey15 +hi NonText guifg=DarkSalmon guibg=grey10 +hi Question guifg=IndianRed guibg=grey10 +hi Search guifg=DarkSalmon guibg=grey15 +hi SpecialKey guifg=yellow guibg=grey15 +hi StatusLine guifg=bisque4 guibg=DarkOliveGreen1 +hi StatusLineNC guifg=bisque4 guibg=DarkOliveGreen3 +hi Title guifg=IndianRed guibg=grey15 +hi Visual guifg=OliveDrab4 guibg=bisque1 +hi WarningMsg guifg=bisque guibg=red +hi WildMenu guifg=LightBlue guibg=DarkViolet + + +"Syntax hilight groups + +hi Comment guifg=tan +hi Constant guifg=khaki +hi String guifg=moccasin +hi Character guifg=chocolate +hi Number guifg=chocolate +hi Boolean guifg=OliveDrab3 +hi Float guifg=chocolate +hi Identifier guifg=khaki4 +hi Function guifg=OliveDrab4 +hi Statement guifg=khaki +hi Conditional guifg=khaki +hi Repeat guifg=khaki +hi Label guifg=khaki +hi Operator guifg=DarkKhaki +hi Keyword guifg=DarkKhaki +hi Exception guifg=khaki +hi PreProc guifg=khaki4 +hi Include guifg=khaki4 +hi Define guifg=khaki1 +hi Macro guifg=khaki2 +hi PreCondit guifg=khaki3 +hi Type guifg=khaki3 +hi StorageClass guifg=tan +hi Structure guifg=DarkGoldenrod +hi Typedef guifg=khaki3 +hi Special guifg=IndianRed +hi SpecialChar guifg=DarkGoldenrod +hi Tag guifg=DarkKhaki +hi Delimiter guifg=DarkGoldenrod +hi SpecialComment guifg=cornsilk +hi Debug guifg=brown +hi Underlined guifg=IndianRed +hi Ignore guifg=grey30 +hi Error guifg=bisque guibg=red +hi Todo guifg=red guibg=bisque + diff --git a/.vim/colors/carvedwood.vim b/.vim/colors/carvedwood.vim new file mode 100644 index 0000000..aef1413 --- /dev/null +++ b/.vim/colors/carvedwood.vim @@ -0,0 +1,120 @@ +" Vim color file +" carvedwood v0.7a +" Maintainer: Shawn Axsom +" [axs221.1l.com] + +" carvedwood - +" a color scheme modified from my desertocean scheme into a brown +" and green scheme, easier on the eyes and optimized for more important syntax +" to stand out the most (eg comments and values are dark and dull while +" statements are bright). + +" cool help screens +" :he group-name +" :he highlight-groups +" :he cterm-colors + +set background=dark +if version > 580 + " no guarantees for version 5.8 and below, but this makes it stop + " complaining + hi clear + if exists("syntax_on") + syntax reset + endif +endif + +let g:colors_name="carvedwood" + +hi Normal guifg=#b09aa0 guibg=#111410 +hi NonText guifg=#382920 guibg=#1a1d1a + +" syntax highlighting +hi Comment guifg=#403b43 +hi Title guifg=#60b0ea +hi Underlined guifg=#80aae0 +hi Statement guifg=#fac5b3 +hi Type guifg=#c5908a +hi Constant guifg=#7b5b5d +hi PreProc guifg=#c07a6a gui=none +hi Identifier guifg=#b36d70 +hi Special guifg=#606A70 +hi Ignore guifg=grey40 +hi Todo guifg=orangered guibg=yellow2 +hi Error guibg=#e04462 +"end syntax highlighting + +" highlight groups +"hi CursorIM +hi Directory guifg=#bbd0df +"hi DiffAdd +"hi DiffChange +"hi DiffDelete +"hi DiffText +"hi ErrorMsg + +hi Cursor guibg=#205a50 guifg=#7ab0aa + +hi FoldColumn guibg=#403533 guifg=#00CCFF +hi LineNr guibg=#594540 guifg=#D0C0BA +hi StatusLine guibg=#c99f93 guifg=#102015 gui=none +hi StatusLineNC guibg=#937b7a guifg=#373334 gui=none + +hi Search guibg=#5a6d7d guifg=#bac5d0 +hi IncSearch guifg=#50606d guibg=#cddaf0 + +hi VertSplit guibg=#c2bfa5 guifg=grey50 gui=none +hi Folded guibg=#0a4f4d guifg=#BBDDCC +hi ModeMsg guifg=#00AACC +hi MoreMsg guifg=SeaGreen +hi Question guifg=#AABBCC +hi SpecialKey guifg=#90703B +hi Visual guifg=#008FBF guibg=#33DFEF +"hi VisualNOS +hi WarningMsg guifg=salmon +"hi WildMenu +"hi Menu +"hi Scrollbar guibg=grey30 guifg=tan +"hi Tooltip + + +" color terminal definitions +hi SpecialKey ctermfg=darkgreen +hi NonText cterm=bold ctermfg=darkblue +hi Directory ctermfg=darkcyan +hi ErrorMsg cterm=bold ctermfg=7 ctermbg=1 +hi IncSearch cterm=NONE ctermfg=yellow ctermbg=green +hi Search cterm=NONE ctermfg=grey ctermbg=blue +hi MoreMsg ctermfg=darkgreen +hi ModeMsg cterm=NONE ctermfg=brown +hi LineNr ctermfg=3 +hi Question ctermfg=green +hi StatusLine cterm=bold,reverse +hi StatusLineNC cterm=reverse +hi VertSplit cterm=reverse +hi Title ctermfg=5 +hi Visual cterm=reverse +hi VisualNOS cterm=bold,underline +hi WarningMsg ctermfg=1 +hi WildMenu ctermfg=0 ctermbg=3 +hi Folded ctermfg=darkgrey ctermbg=NONE +hi FoldColumn ctermfg=darkgrey ctermbg=NONE +hi DiffAdd ctermbg=4 +hi DiffChange ctermbg=5 +hi DiffDelete cterm=bold ctermfg=4 ctermbg=6 +hi DiffText cterm=bold ctermbg=1 +hi Comment ctermfg=darkcyan +hi Constant ctermfg=brown +hi Special ctermfg=5 +hi Identifier ctermfg=6 +hi Statement ctermfg=3 +hi PreProc ctermfg=5 +hi Type ctermfg=2 +hi Underlined cterm=underline ctermfg=5 +hi Ignore cterm=bold ctermfg=7 +hi Ignore ctermfg=darkgrey +hi Error cterm=bold ctermfg=7 ctermbg=1 + + +"vim: sw=4 + diff --git a/.vim/colors/coffee.vim b/.vim/colors/coffee.vim new file mode 100644 index 0000000..284fb01 --- /dev/null +++ b/.vim/colors/coffee.vim @@ -0,0 +1,60 @@ +" Vim color file +" Maintainer: David Lazar +" Last Change: Fri Jan 31 01:08:13 UTC 2003 +" Version: 1.0 +" URL: http://c7.campus.utcluj.ro/~david/coffee.vim +" +" This colorscheme script was created using Hans Fugal's colorscheme template + +set background=dark +hi clear +if exists("syntax_on") + syntax reset +endif +let g:colors_name="coffee" + +hi Normal gui=none guibg= #514c44 guifg=#b0a594 + +hi Cursor gui=none guibg=#ffffff guifg=bg +hi link CursorIM Cursor +hi Directory guifg=#ffffff +hi DiffAdd guibg=#9e9485 guifg=bg +hi DiffDelete guibg=#2e2b26 guifg=fg +hi DiffChange guibg=#70695e guifg=fg +hi DiffText guibg=#70695e guifg=#880000 +hi ErrorMsg guibg=#880000 guifg=#ffffff +hi Folded guifg=#88c0c7 +hi FoldColumn guifg=#88c0c7 +hi IncSearch guifg=#fff0d6 guibg=#000000 +hi LineNr guibg=#000000 guifg=#ffff21 +hi ModeMsg guifg=#ffffff +hi MoreMsg guifg=#00ff00 +hi NonText guifg=#61616d +hi Question guifg=#ffff00 +hi link Search IncSearch +hi SpecialKey guifg=#ffffff +hi StatusLine guibg=#000000 guifg=#deefff +hi StatusLineNC guibg=#395956 guifg=#a4b1bd +hi VertSplit guibg=#395956 guifg=#a4b1bd +hi Title guifg=#ffffff +hi Visual guifg=#fff0d6 guibg=#000000 +hi VisualNOS guifg=#dddddd guibg=bg +hi WarningMsg guifg=#ffff00 +"hi WildMenu +"hi Menu +"hi Scrollbar +"hi Tooltip + +" syntax highlighting groups +hi Comment guifg=#1a1813 +hi Constant guifg=#cefece +hi Identifier guifg=#cc7c3d +hi Statement guifg=#effec5 +hi PreProc guifg=#85ff85 +hi Type guifg=#c6feeb +hi Special guifg=#eeffee +hi Underlined gui=underline guifg=#ffffff +hi Ignore guifg=fg +hi Error guibg=bg guifg=#ff4c4a +hi Todo guibg=#aa0006 guifg=#fff300 + diff --git a/.vim/colors/dusk.vim b/.vim/colors/dusk.vim new file mode 100644 index 0000000..fc7c8a5 --- /dev/null +++ b/.vim/colors/dusk.vim @@ -0,0 +1,64 @@ +" Vim color file +" Maintainer: Ajit J. Thakkar (ajit AT unb DOT ca) +" Last Change: 2003 Sep. 02 +" Version: 1.0 +" URL: http://www.unb.ca/chem/ajit/vim.htm + +" This GUI-only color scheme has a blue-black background + +set background=dark +hi clear +if exists("syntax_on") + syntax reset +endif + +let colors_name = "dusk" + +hi Normal guifg=ivory guibg=#1f3048 + +" Groups used in the 'highlight' and 'guicursor' options default value. +hi ErrorMsg gui=NONE guifg=Red guibg=Linen +hi IncSearch gui=NONE guibg=LightGreen guifg=Black +hi ModeMsg gui=NONE guifg=fg guibg=bg +hi StatusLine gui=NONE guifg=DarkBlue guibg=Grey +hi StatusLineNC gui=NONE guifg=Grey50 guibg=Grey +hi VertSplit gui=NONE guifg=Grey guibg=Grey +hi Visual gui=reverse guifg=fg guibg=LightSkyBlue4 +hi VisualNOS gui=underline guifg=fg guibg=bg +hi DiffText gui=NONE guifg=Yellow guibg=LightSkyBlue4 +hi Cursor guibg=Green guifg=Black +hi lCursor guibg=Cyan guifg=Black +hi Directory guifg=LightGreen guibg=bg +hi LineNr guifg=MistyRose3 guibg=bg +hi MoreMsg gui=NONE guifg=SeaGreen guibg=bg +hi NonText gui=NONE guifg=Cyan4 guibg=#102848 +hi Question gui=NONE guifg=LimeGreen guibg=bg +hi Search gui=NONE guifg=SkyBlue4 guibg=Bisque +hi SpecialKey guifg=Cyan guibg=bg +hi Title gui=NONE guifg=Yellow2 guibg=bg +hi WarningMsg guifg=Tomato3 guibg=Linen +hi WildMenu gui=NONE guifg=SkyBlue4 guibg=Bisque +hi Folded guifg=MistyRose2 guibg=bg +hi FoldColumn guifg=DarkBlue guibg=Grey +hi DiffAdd gui=NONE guifg=Blue guibg=LightCyan +hi DiffChange gui=NONE guifg=white guibg=LightCyan4 +hi DiffDelete gui=NONE guifg=LightBlue guibg=LightCyan + +" Colors for syntax highlighting +hi Constant gui=NONE guifg=MistyRose3 guibg=bg +hi String gui=NONE guifg=LightBlue3 guibg=bg +hi Special gui=NONE guifg=GoldenRod guibg=bg +hi Statement gui=NONE guifg=khaki guibg=bg +"hi Statement gui=NONE guifg=#d7cd7b guibg=bg +hi Operator gui=NONE guifg=Chartreuse guibg=bg +hi Ignore gui=NONE guifg=bg guibg=bg +hi ToDo gui=NONE guifg=DodgerBlue guibg=bg +hi Error gui=NONE guifg=Red guibg=Linen +hi Comment gui=NONE guifg=SlateGrey guibg=bg +hi Comment gui=NONE guifg=Lavender guibg=bg +hi Identifier gui=NONE guifg=BlanchedAlmond guibg=bg +hi PreProc gui=NONE guifg=#ffa0a0 guibg=bg +hi Type gui=NONE guifg=NavajoWhite guibg=bg +hi Underlined gui=underline guifg=fg guibg=bg + +" vim: sw=2 diff --git a/.vim/colors/gardener.vim b/.vim/colors/gardener.vim new file mode 100644 index 0000000..4c70e4f --- /dev/null +++ b/.vim/colors/gardener.vim @@ -0,0 +1,271 @@ +" Vim color file +" Original Maintainer: Anders Korte + +" Modified: by entheon +" Last Change: 13 Sept 2005 + +" Gardener v1.1 +" A modification of the Guardian colorscheme v1.2 + +" 'For code surgeons and web gardeners everywhere' + +" A nice earthy color scheme which is easy on the eyes. It +" has as it's base a dark background monocrhomatic khaki +" scheme with dabs of color thrown in here and there on the +" keywords. Plus lots of extra config options so you can +" tweak it to your liking and or make it more like the +" original Guardian scheme. All the defaults are what I like +" but if you want to change stuff just set the right var and +" it will change pretty much immediately, you might have to +" move out of and back into your buffer for it to refresh. + + +" Features: +" 256 Color XTerm Compatibility +" Richer Syntax +" Black Background +" Functions +" No Italics +" Purple Booleans +" Swapped Status Line Colors +" Other minor tweaks + +" Change Log: +" changed the ghastly puke salmon red to green like it +" should have been in the first place esp considering the +" name Gardener, now all vimsters can truly frolic in +" their Vim Gardens + +" Options: +" g:gardener_light_comments +" if this var exists then comments are white on a +" gray-blue background if it is not set then the +" comments default to medium grey with no background +" color, I can't stand bg colors but some people might +" like it, so I left it as an option. +" +" g:gardener_soil +" This is a GUI only option because there are no +" colors that work even in the 256 color XTerm. This +" option gives you a brownish background instead of a +" black background. I think the black background gives +" better contrast and thus is easier to read from. if +" you disagree then you've got this option +" +" g:gardener_setnum +" turns the background of the line numbers black + +" Using The Options: +" To enable a feature add the line +" let g:gardenter_some_feature=1 +" to your ~/.vimrc +" To disable the feature temporarily run the command +" :unlet g:gardener_some_feature +" To disable the feature permanently, simply remove +" the line from your .vimrc file. + +set background=dark +hi clear +syntax reset + +if has("gui_running") + +" Colors for the User Interface. + if exists("g:gardener_setnum") + hi linenr guibg=black guifg=#808080 gui=bold + else + hi linenr guibg=#262626 guifg=#808080 gui=bold + endif + + hi Cursor guibg=#cc4455 guifg=white gui=bold + hi link CursorIM Cursor + if exists("g:gardener_soil") + hi Normal guibg=#332211 guifg=white gui=none + else + hi Normal guibg=black guifg=white gui=none + endif + hi NonText guibg=#445566 guifg=#ffeecc gui=bold + hi Visual guibg=#557799 guifg=white gui=none + + hi Directory guibg=bg guifg=#337700 gui=none + + hi IncSearch guibg=#0066cc guifg=white gui=none + hi link Seach IncSearch + + hi SpecialKey guibg=bg guifg=fg gui=none + hi Titled guibg=bg guifg=fg gui=none + + hi ErrorMsg guibg=bg guifg=#ff0000 gui=bold + hi ModeMsg guibg=bg guifg=#ffeecc gui=none + hi link MoreMsg ModeMsg + hi Question guibg=bg guifg=#ccffcc gui=bold + hi link WarningMsg ErrorMsg + + hi StatusLineNC guibg=#ffeecc guifg=black gui=none + hi StatusLine guibg=#cc4455 guifg=white gui=bold + hi VertSplit guibg=#ffeecc guifg=black gui=none + + hi DiffAdd guibg=#446688 guifg=fg gui=none + hi DiffChange guibg=#558855 guifg=fg gui=none + hi DiffDelete guibg=#884444 guifg=fg gui=none + hi DiffText guibg=#884444 guifg=fg gui=bold + + " Colors for Syntax Highlighting. + if exists("g:gardener_light_comments") + hi Comment guibg=#334455 guifg=#dddddd gui=none + else + hi Comment guibg=bg guifg=#888888 gui=none + endif + + + hi Define guibg=bg guifg=#66ccdd gui=bold + hi Conditional guibg=bg guifg=#aadd55 gui=bold + + hi Constant guibg=bg guifg=white gui=bold + hi Identifier guibg=bg guifg=#ffddaa gui=none + hi String guibg=bg guifg=#ffffcc gui=none + hi Character guibg=bg guifg=#ffffcc gui=bold + hi Number guibg=bg guifg=#bbddff gui=bold + hi Boolean guibg=bg guifg=#ff55ff gui=bold + hi Float guibg=bg guifg=#bbddff gui=bold + + hi Function guibg=bg guifg=#ffffaa gui=bold + hi Statement guibg=bg guifg=#ffffcc gui=bold + + hi Repeat guibg=bg guifg=#ff9900 gui=bold + hi Label guibg=bg guifg=#ffccff gui=bold + hi Operator guibg=bg guifg=#cc9966 gui=bold + hi Keyword guibg=bg guifg=#66ffcc gui=bold + hi Exception guibg=bg guifg=#66ffcc gui=bold + + hi PreProc guibg=bg guifg=#ffcc99 gui=bold + hi Include guibg=bg guifg=#99cc99 gui=bold + hi link Macro Include + hi link PreCondit Include + + hi Type guibg=bg guifg=#ccffaa gui=bold + hi Structure guibg=bg guifg=#99ff99 gui=bold + hi Typedef guibg=bg guifg=#99cc99 gui=italic + + hi StorageClass guibg=bg guifg=#99cc99 gui=bold + hi Special guibg=bg guifg=#bbddff gui=bold + hi SpecialChar guibg=bg guifg=#bbddff gui=bold + hi Tag guibg=bg guifg=#bbddff gui=bold + hi Delimiter guibg=bg guifg=fg gui=bold + hi SpecialComment guibg=#334455 guifg=#dddddd gui=italic + hi Debug guibg=bg guifg=#ff9999 gui=none + + hi Underlined guibg=bg guifg=#99ccff gui=underline + + hi Title guibg=#445566 guifg=white gui=bold + hi Ignore guibg=bg guifg=#cccccc gui=italic + hi Error guibg=#ff0000 guifg=white gui=bold + hi Todo guibg=#556677 guifg=#ff0000 gui=bold + + hi htmlH1 guibg=bg guifg=#ffffff gui=bold + hi htmlH2 guibg=bg guifg=#dadada gui=bold + hi htmlH3 guibg=bg guifg=#c6c6c6 gui=bold + hi htmlH4 guibg=bg guifg=#b2b2b2 gui=bold + hi htmlH5 guibg=bg guifg=#9e9e9e gui=bold + hi htmlH6 guibg=bg guifg=#8a8a8a gui=bold + +else +" Colors for the User Interface. + + if exists("g:gardener_setnum") + exec "hi linenr cterm=BOLD ctermfg=235 ctermbg=244" + else + exec "hi linenr cterm=BOLD ctermfg=244 ctermbg=235" + endif + + + exec "hi Cursor cterm=BOLD ctermfg=255 ctermbg=167" + exec "hi CursorIM cterm=BOLD ctermfg=255 ctermbg=167" + + exec "hi Normal cterm=NONE ctermfg=255 ctermbg=233" + exec "hi NonText cterm=NONE ctermfg=230 ctermbg=60" + exec "hi Visual cterm=NONE ctermfg=255 ctermbg=68" + + exec "hi Linear cterm=NONE ctermfg=248 ctermbg=NONE" + + exec "hi Directory cterm=NONE ctermfg=64 ctermbg=NONE" + + exec "hi IncSearch cterm=NONE ctermfg=255 ctermbg=25" + + exec "hi ErrorMsg cterm=BOLD ctermfg=196 ctermbg=NONE" + exec "hi WarningMsg cterm=BOLD ctermfg=196 ctermbg=NONE" + exec "hi ModeMsg cterm=NONE ctermfg=230 ctermbg=NONE" + exec "hi MoreMsg cterm=NONE ctermfg=230 ctermbg=NONE" + exec "hi Question cterm=NONE ctermfg=194 ctermbg=NONE" + + exec "hi StatusLineNC cterm=NONE ctermfg=16 ctermbg=229" + exec "hi StatusLine cterm=BOLD ctermfg=255 ctermbg=167" + exec "hi VertSplit cterm=NONE ctermfg=16 ctermbg=229" + + exec "hi DiffAdd cterm=NONE ctermfg=255 ctermbg=60" + exec "hi DiffAdd cterm=NONE ctermfg=255 ctermbg=65" + exec "hi DiffAdd cterm=NONE ctermfg=255 ctermbg=95" + exec "hi DiffAdd cterm=BOLD ctermfg=255 ctermbg=95" + + " Colors for Syntax Highlighting. + if exists("g:gardener_light_comments") + exec "hi Comment cterm=NONE ctermfg=253 ctermbg=60" + else + exec "hi Comment cterm=NONE ctermfg=244 ctermbg=NONE" + endif + + exec "hi Constant cterm=BOLD ctermfg=255 ctermbg=NONE" + exec "hi String cterm=NONE ctermfg=230 ctermbg=NONE" + exec "hi Character cterm=BOLD ctermfg=230 ctermbg=NONE" + exec "hi Number cterm=BOLD ctermfg=153 ctermbg=NONE" + exec "hi Boolean cterm=NONE ctermfg=207 ctermbg=NONE" + exec "hi Float cterm=BOLD ctermfg=153 ctermbg=NONE" + + exec "hi Identifier cterm=NONE ctermfg=223 ctermbg=NONE" + exec "hi Function cterm=BOLD ctermfg=229 ctermbg=NONE" + exec "hi Statement cterm=BOLD ctermfg=230 ctermbg=NONE" + + exec "hi Define cterm=BOLD ctermfg=68 ctermbg=NONE" + exec "hi Conditional cterm=BOLD ctermfg=149 ctermbg=NONE" + + exec "hi Repeat cterm=BOLD ctermfg=208 ctermbg=NONE" + exec "hi Label cterm=BOLD ctermfg=225 ctermbg=NONE" + exec "hi Operator cterm=BOLD ctermfg=173 ctermbg=NONE" + exec "hi Keyword cterm=BOLD ctermfg=86 ctermbg=NONE" + exec "hi Exception cterm=BOLD ctermfg=86 ctermbg=NONE" + + exec "hi PreProc cterm=BOLD ctermfg=222 ctermbg=NONE" + exec "hi Include cterm=BOLD ctermfg=114 ctermbg=NONE" + exec "hi Macro cterm=BOLD ctermfg=114 ctermbg=NONE" + exec "hi PreCondit cterm=BOLD ctermfg=114 ctermbg=NONE" + + exec "hi Type cterm=BOLD ctermfg=193 ctermbg=NONE" + exec "hi StorageClass cterm=BOLD ctermfg=78 ctermbg=NONE" + exec "hi Structure cterm=BOLD ctermfg=114 ctermbg=NONE" + exec "hi Typedef cterm=BOLD ctermfg=114 ctermbg=NONE" + + exec "hi Special cterm=BOLD ctermfg=153 ctermbg=NONE" + exec "hi SpecialChar cterm=BOLD ctermfg=153 ctermbg=NONE" + exec "hi Tag cterm=BOLD ctermfg=153 ctermbg=NONE" + exec "hi Delimiter cterm=BOLD ctermfg=255 ctermbg=NONE" + exec "hi SpecialComment cterm=BOLD ctermfg=253 ctermbg=24" + exec "hi Debug cterm=NONE ctermfg=210 ctermbg=NONE" + + exec "hi Title cterm=BOLD ctermfg=255 ctermbg=60" + exec "hi Ignore cterm=NONE ctermfg=251 ctermbg=NONE" + exec "hi Error cterm=NONE ctermfg=255 ctermbg=196" + exec "hi Ignore cterm=NONE ctermfg=196 ctermbg=60" + + exec "hi htmlH1 cterm=BOLD ctermfg=255 ctermbg=NONE" + exec "hi htmlH2 cterm=BOLD ctermfg=253 ctermbg=NONE" + exec "hi htmlH3 cterm=BOLD ctermfg=251 ctermbg=NONE" + exec "hi htmlH4 cterm=BOLD ctermfg=249 ctermbg=NONE" + exec "hi htmlH5 cterm=BOLD ctermfg=247 ctermbg=NONE" + exec "hi htmlH6 cterm=BOLD ctermfg=245 ctermbg=NONE" + +endif +" And finally. + +let g:colors_name = "gardener" +let colors_name = "gardener" + diff --git a/.vim/colors/greyblue.vim b/.vim/colors/greyblue.vim new file mode 100644 index 0000000..1b3c233 --- /dev/null +++ b/.vim/colors/greyblue.vim @@ -0,0 +1,75 @@ +" Vim color file +" + +set background=dark +hi clear +if exists("syntax_on") + syntax reset +endif + +let colors_name = "greyblue" + +hi Normal ctermfg=NONE ctermbg=NONE gui=NONE guifg=#b7af9f guibg=#090909 + +" Search +hi IncSearch ctermfg=NONE ctermbg=NONE gui=NONE guifg=#7800ff guibg=#e0d8ff +hi Search ctermfg=NONE ctermbg=NONE gui=NONE guifg=#7800ff guibg=#e0d8ff + +" Messages +hi ErrorMsg ctermfg=NONE ctermbg=NONE gui=NONE guifg=#ffffff guibg=NONE +hi WarningMsg ctermfg=NONE ctermbg=NONE gui=NONE guifg=#ffffff guibg=NONE +hi ModeMsg ctermfg=NONE ctermbg=NONE gui=NONE guifg=#ffffff guibg=NONE +hi MoreMsg ctermfg=NONE ctermbg=NONE gui=NONE guifg=#ffffff guibg=NONE +hi Question ctermfg=NONE ctermbg=NONE gui=NONE guifg=#ffffff guibg=NONE + +" Split area +hi StatusLine ctermfg=NONE ctermbg=NONE gui=BOLD guifg=#070707 guibg=#cfcfbf +hi StatusLineNC ctermfg=NONE ctermbg=NONE gui=BOLD guifg=#5f5f4f guibg=#cfcfbf +hi VertSplit ctermfg=NONE ctermbg=NONE gui=NONE guifg=#070707 guibg=#cfcfbf +hi WildMenu ctermfg=NONE ctermbg=NONE gui=BOLD guifg=#070707 guibg=#ff5533 + +" Diff +hi DiffText ctermfg=NONE ctermbg=NONE gui=NONE guifg=#07cfef guibg=#00151f +hi DiffChange ctermfg=NONE ctermbg=NONE gui=NONE guifg=#ff97ff guibg=#2f002f +hi DiffDelete ctermfg=NONE ctermbg=NONE gui=NONE guifg=#dfdf00 guibg=#370d15 +hi DiffAdd ctermfg=NONE ctermbg=NONE gui=NONE guifg=#dfdf00 guibg=#370d15 + +" Cursor +hi Cursor ctermfg=NONE ctermbg=NONE gui=NONE guifg=#ffff00 guibg=#7fff00 +hi lCursor ctermfg=NONE ctermbg=NONE gui=NONE guifg=#070707 guibg=#7fff00 +hi CursorIM ctermfg=NONE ctermbg=NONE gui=NONE guifg=#070707 guibg=#7fff00 + +" Fold +hi Folded ctermfg=NONE ctermbg=NONE gui=NONE guifg=#87ff00 guibg=#1f2700 +hi FoldColumn ctermfg=NONE ctermbg=NONE gui=NONE guifg=#559f00 guibg=#0f0f0b + +" Other +hi Directory ctermfg=NONE ctermbg=NONE gui=NONE guifg=#aaaaba guibg=NONE +hi LineNr ctermfg=NONE ctermbg=NONE gui=NONE guifg=#7f7f5f guibg=NONE +hi NonText ctermfg=NONE ctermbg=NONE gui=BOLD guifg=#211d1a guibg=#211d1a +hi SpecialKey ctermfg=NONE ctermbg=NONE gui=NONE guifg=#378fff guibg=NONE +hi Title ctermfg=NONE ctermbg=NONE gui=NONE guifg=#ffbf9f guibg=#370f07 +hi Visual ctermfg=NONE ctermbg=NONE gui=reverse guifg=#a5a5a5 guibg=#353535 + +" Syntax group +hi Comment ctermfg=NONE ctermbg=NONE gui=BOLD guifg=#555565 guibg=NONE +hi Constant ctermfg=NONE ctermbg=NONE gui=NONE guifg=#d1bfb1 guibg=#151515 +hi Error ctermfg=NONE ctermbg=NONE gui=NONE guifg=#00ffff guibg=NONE +hi Identifier ctermfg=NONE ctermbg=NONE gui=NONE guifg=#aaaaba guibg=NONE +hi Ignore ctermfg=NONE ctermbg=NONE gui=NONE guifg=NONE guibg=NONE +hi PreProc ctermfg=NONE ctermbg=NONE gui=NONE guifg=NONE guibg=NONE +hi Special ctermfg=NONE ctermbg=NONE gui=NONE guifg=#aa1565 guibg=NONE +hi Statement ctermfg=NONE ctermbg=NONE gui=bold guifg=#d1bfb1 guibg=NONE +hi Todo ctermfg=NONE ctermbg=NONE gui=NONE guifg=NONE guibg=NONE +hi Type ctermfg=NONE ctermbg=NONE gui=BOLD guifg=#d1bfb1 guibg=NONE +hi Underlined ctermfg=NONE ctermbg=NONE gui=UNDERLINE guifg=NONE guibg=NONE + +" HTML +hi htmlLink gui=UNDERLINE guifg=#ffff00 guibg=NONE +hi htmlBold gui=BOLD +hi htmlBoldItalic gui=BOLD,ITALIC +hi htmlBoldUnderline gui=BOLD,UNDERLINE +hi htmlBoldUnderlineItalic gui=BOLD,UNDERLINE,ITALIC +hi htmlItalic gui=ITALIC +hi htmlUnderline gui=UNDERLINE +hi htmlUnderlineItalic gui=UNDERLINE,ITALIC diff --git a/.vim/colors/inkpot.vim b/.vim/colors/inkpot.vim new file mode 100644 index 0000000..a5acc6c --- /dev/null +++ b/.vim/colors/inkpot.vim @@ -0,0 +1,217 @@ +" Vim color file +" Name: inkpot.vim +" Maintainer: Ciaran McCreesh +" Homepage: http://github.com/ciaranm/inkpot/ +" +" This should work in the GUI, rxvt-unicode (88 colour mode) and xterm (256 +" colour mode). It won't work in 8/16 colour terminals. +" +" To use a black background, :let g:inkpot_black_background = 1 + +set background=dark +hi clear +if exists("syntax_on") + syntax reset +endif + +let colors_name = "inkpot" + +" map a urxvt cube number to an xterm-256 cube number +fun! M(a) + return strpart("0135", a:a, 1) + 0 +endfun + +" map a urxvt colour to an xterm-256 colour +fun! X(a) + if &t_Co == 88 + return a:a + else + if a:a == 8 + return 237 + elseif a:a < 16 + return a:a + elseif a:a > 79 + return 232 + (3 * (a:a - 80)) + else + let l:b = a:a - 16 + let l:x = l:b % 4 + let l:y = (l:b / 4) % 4 + let l:z = (l:b / 16) + return 16 + M(l:x) + (6 * M(l:y)) + (36 * M(l:z)) + endif + endif +endfun + +if ! exists("g:inkpot_black_background") + let g:inkpot_black_background = 0 +endif + +if has("gui_running") + if ! g:inkpot_black_background + hi Normal gui=NONE guifg=#cfbfad guibg=#1e1e27 + else + hi Normal gui=NONE guifg=#cfbfad guibg=#000000 + endif + + hi CursorLine guibg=#2e2e37 + + hi IncSearch gui=BOLD guifg=#303030 guibg=#cd8b60 + hi Search gui=NONE guifg=#303030 guibg=#ad7b57 + hi ErrorMsg gui=BOLD guifg=#ffffff guibg=#ce4e4e + hi WarningMsg gui=BOLD guifg=#ffffff guibg=#ce8e4e + hi ModeMsg gui=BOLD guifg=#7e7eae guibg=NONE + hi MoreMsg gui=BOLD guifg=#7e7eae guibg=NONE + hi Question gui=BOLD guifg=#ffcd00 guibg=NONE + + hi StatusLine gui=BOLD guifg=#b9b9b9 guibg=#3e3e5e + hi User1 gui=BOLD guifg=#00ff8b guibg=#3e3e5e + hi User2 gui=BOLD guifg=#7070a0 guibg=#3e3e5e + hi StatusLineNC gui=NONE guifg=#b9b9b9 guibg=#3e3e5e + hi VertSplit gui=NONE guifg=#b9b9b9 guibg=#3e3e5e + + hi WildMenu gui=BOLD guifg=#eeeeee guibg=#6e6eaf + + hi MBENormal guifg=#cfbfad guibg=#2e2e3f + hi MBEChanged guifg=#eeeeee guibg=#2e2e3f + hi MBEVisibleNormal guifg=#cfcfcd guibg=#4e4e8f + hi MBEVisibleChanged guifg=#eeeeee guibg=#4e4e8f + + hi DiffText gui=NONE guifg=#ffffcd guibg=#4a2a4a + hi DiffChange gui=NONE guifg=#ffffcd guibg=#306b8f + hi DiffDelete gui=NONE guifg=#ffffcd guibg=#6d3030 + hi DiffAdd gui=NONE guifg=#ffffcd guibg=#306d30 + + hi Cursor gui=NONE guifg=#404040 guibg=#8b8bff + hi lCursor gui=NONE guifg=#404040 guibg=#8fff8b + hi CursorIM gui=NONE guifg=#404040 guibg=#8b8bff + + hi Folded gui=NONE guifg=#cfcfcd guibg=#4b208f + hi FoldColumn gui=NONE guifg=#8b8bcd guibg=#2e2e2e + + hi Directory gui=NONE guifg=#00ff8b guibg=NONE + hi LineNr gui=NONE guifg=#8b8bcd guibg=#2e2e2e + hi NonText gui=BOLD guifg=#8b8bcd guibg=NONE + hi SpecialKey gui=BOLD guifg=#ab60ed guibg=NONE + hi Title gui=BOLD guifg=#af4f4b guibg=NONE + hi Visual gui=NONE guifg=#eeeeee guibg=#4e4e8f + + hi Comment gui=NONE guifg=#cd8b00 guibg=NONE + hi Constant gui=NONE guifg=#ffcd8b guibg=NONE + hi String gui=NONE guifg=#ffcd8b guibg=#404040 + hi Error gui=NONE guifg=#ffffff guibg=#6e2e2e + hi Identifier gui=NONE guifg=#ff8bff guibg=NONE + hi Ignore gui=NONE + hi Number gui=NONE guifg=#f0ad6d guibg=NONE + hi PreProc gui=NONE guifg=#409090 guibg=NONE + hi Special gui=NONE guifg=#c080d0 guibg=NONE + hi SpecialChar gui=NONE guifg=#c080d0 guibg=#404040 + hi Statement gui=NONE guifg=#808bed guibg=NONE + hi Todo gui=BOLD guifg=#303030 guibg=#d0a060 + hi Type gui=NONE guifg=#ff8bff guibg=NONE + hi Underlined gui=BOLD guifg=#df9f2d guibg=NONE + hi TaglistTagName gui=BOLD guifg=#808bed guibg=NONE + + hi perlSpecialMatch gui=NONE guifg=#c080d0 guibg=#404040 + hi perlSpecialString gui=NONE guifg=#c080d0 guibg=#404040 + + hi cSpecialCharacter gui=NONE guifg=#c080d0 guibg=#404040 + hi cFormat gui=NONE guifg=#c080d0 guibg=#404040 + + hi doxygenBrief gui=NONE guifg=#fdab60 guibg=NONE + hi doxygenParam gui=NONE guifg=#fdd090 guibg=NONE + hi doxygenPrev gui=NONE guifg=#fdd090 guibg=NONE + hi doxygenSmallSpecial gui=NONE guifg=#fdd090 guibg=NONE + hi doxygenSpecial gui=NONE guifg=#fdd090 guibg=NONE + hi doxygenComment gui=NONE guifg=#ad7b20 guibg=NONE + hi doxygenSpecial gui=NONE guifg=#fdab60 guibg=NONE + hi doxygenSpecialMultilineDesc gui=NONE guifg=#ad600b guibg=NONE + hi doxygenSpecialOnelineDesc gui=NONE guifg=#ad600b guibg=NONE + + if v:version >= 700 + hi Pmenu gui=NONE guifg=#eeeeee guibg=#4e4e8f + hi PmenuSel gui=BOLD guifg=#eeeeee guibg=#2e2e3f + hi PmenuSbar gui=BOLD guifg=#eeeeee guibg=#6e6eaf + hi PmenuThumb gui=BOLD guifg=#eeeeee guibg=#6e6eaf + + hi SpellBad gui=undercurl guisp=#cc6666 + hi SpellRare gui=undercurl guisp=#cc66cc + hi SpellLocal gui=undercurl guisp=#cccc66 + hi SpellCap gui=undercurl guisp=#66cccc + + hi MatchParen gui=NONE guifg=#cfbfad guibg=#4e4e8f + endif +else + if ! g:inkpot_black_background + exec "hi Normal cterm=NONE ctermfg=" . X(79) . " ctermbg=" . X(80) + else + exec "hi Normal cterm=NONE ctermfg=" . X(79) . " ctermbg=" . X(16) + endif + + exec "hi IncSearch cterm=BOLD ctermfg=" . X(80) . " ctermbg=" . X(73) + exec "hi Search cterm=NONE ctermfg=" . X(80) . " ctermbg=" . X(52) + exec "hi ErrorMsg cterm=BOLD ctermfg=" . X(16) . " ctermbg=" . X(48) + exec "hi WarningMsg cterm=BOLD ctermfg=" . X(16) . " ctermbg=" . X(68) + exec "hi ModeMsg cterm=BOLD ctermfg=" . X(38) . " ctermbg=" . "NONE" + exec "hi MoreMsg cterm=BOLD ctermfg=" . X(38) . " ctermbg=" . "NONE" + exec "hi Question cterm=BOLD ctermfg=" . X(52) . " ctermbg=" . "NONE" + + exec "hi StatusLine cterm=BOLD ctermfg=" . X(85) . " ctermbg=" . X(81) + exec "hi User1 cterm=BOLD ctermfg=" . X(28) . " ctermbg=" . X(81) + exec "hi User2 cterm=BOLD ctermfg=" . X(39) . " ctermbg=" . X(81) + exec "hi StatusLineNC cterm=NONE ctermfg=" . X(84) . " ctermbg=" . X(81) + exec "hi VertSplit cterm=NONE ctermfg=" . X(84) . " ctermbg=" . X(81) + + exec "hi WildMenu cterm=BOLD ctermfg=" . X(87) . " ctermbg=" . X(38) + + exec "hi MBENormal ctermfg=" . X(85) . " ctermbg=" . X(81) + exec "hi MBEChanged ctermfg=" . X(87) . " ctermbg=" . X(81) + exec "hi MBEVisibleNormal ctermfg=" . X(85) . " ctermbg=" . X(82) + exec "hi MBEVisibleChanged ctermfg=" . X(87) . " ctermbg=" . X(82) + + exec "hi DiffText cterm=NONE ctermfg=" . X(79) . " ctermbg=" . X(34) + exec "hi DiffChange cterm=NONE ctermfg=" . X(79) . " ctermbg=" . X(17) + exec "hi DiffDelete cterm=NONE ctermfg=" . X(79) . " ctermbg=" . X(32) + exec "hi DiffAdd cterm=NONE ctermfg=" . X(79) . " ctermbg=" . X(20) + + exec "hi Folded cterm=NONE ctermfg=" . X(79) . " ctermbg=" . X(35) + exec "hi FoldColumn cterm=NONE ctermfg=" . X(39) . " ctermbg=" . X(80) + + exec "hi Directory cterm=NONE ctermfg=" . X(28) . " ctermbg=" . "NONE" + exec "hi LineNr cterm=NONE ctermfg=" . X(39) . " ctermbg=" . X(80) + exec "hi NonText cterm=BOLD ctermfg=" . X(39) . " ctermbg=" . "NONE" + exec "hi SpecialKey cterm=BOLD ctermfg=" . X(55) . " ctermbg=" . "NONE" + exec "hi Title cterm=BOLD ctermfg=" . X(48) . " ctermbg=" . "NONE" + exec "hi Visual cterm=NONE ctermfg=" . X(79) . " ctermbg=" . X(38) + + exec "hi Comment cterm=NONE ctermfg=" . X(52) . " ctermbg=" . "NONE" + exec "hi Constant cterm=NONE ctermfg=" . X(73) . " ctermbg=" . "NONE" + exec "hi String cterm=NONE ctermfg=" . X(73) . " ctermbg=" . X(81) + exec "hi Error cterm=NONE ctermfg=" . X(79) . " ctermbg=" . X(32) + exec "hi Identifier cterm=NONE ctermfg=" . X(53) . " ctermbg=" . "NONE" + exec "hi Ignore cterm=NONE" + exec "hi Number cterm=NONE ctermfg=" . X(69) . " ctermbg=" . "NONE" + exec "hi PreProc cterm=NONE ctermfg=" . X(25) . " ctermbg=" . "NONE" + exec "hi Special cterm=NONE ctermfg=" . X(55) . " ctermbg=" . "NONE" + exec "hi SpecialChar cterm=NONE ctermfg=" . X(55) . " ctermbg=" . X(81) + exec "hi Statement cterm=NONE ctermfg=" . X(27) . " ctermbg=" . "NONE" + exec "hi Todo cterm=BOLD ctermfg=" . X(16) . " ctermbg=" . X(57) + exec "hi Type cterm=NONE ctermfg=" . X(71) . " ctermbg=" . "NONE" + exec "hi Underlined cterm=BOLD ctermfg=" . X(77) . " ctermbg=" . "NONE" + exec "hi TaglistTagName cterm=BOLD ctermfg=" . X(39) . " ctermbg=" . "NONE" + + if v:version >= 700 + exec "hi Pmenu cterm=NONE ctermfg=" . X(87) . " ctermbg=" . X(82) + exec "hi PmenuSel cterm=BOLD ctermfg=" . X(87) . " ctermbg=" . X(38) + exec "hi PmenuSbar cterm=BOLD ctermfg=" . X(87) . " ctermbg=" . X(39) + exec "hi PmenuThumb cterm=BOLD ctermfg=" . X(87) . " ctermbg=" . X(39) + + exec "hi SpellBad cterm=NONE ctermbg=" . X(32) + exec "hi SpellRare cterm=NONE ctermbg=" . X(33) + exec "hi SpellLocal cterm=NONE ctermbg=" . X(36) + exec "hi SpellCap cterm=NONE ctermbg=" . X(21) + exec "hi MatchParen cterm=NONE ctermbg=" . X(14) . "ctermfg=" . X(25) + endif +endif + +" vim: set et : + diff --git a/.vim/colors/less.vim b/.vim/colors/less.vim new file mode 100644 index 0000000..28cac02 --- /dev/null +++ b/.vim/colors/less.vim @@ -0,0 +1,54 @@ +" vim color file +" Maintainer: Brian Nelson +" Last Change: $Revision: 1.1 $ $Date: 2003/12/15 17:25:08 $ +" +" Less is More - A minimal color scheme. +" Disigned to work equally well on 8 or 16 colors, terminal or gui. + +hi clear +set background=dark +if exists("syntax_on") + syntax reset +endif +let g:colors_name = "less" + +hi Normal term=none ctermfg=7 ctermbg=0 gui=none guifg=LightGray guibg=black +hi Directory term=bold cterm=bold ctermfg=blue guifg=Blue +hi Search term=reverse ctermfg=white ctermbg=blue guifg=white guibg=Blue +hi MoreMsg term=bold cterm=bold ctermfg=darkgreen gui=bold guifg=DarkGreen +hi ModeMsg term=bold cterm=bold gui=bold guifg=White guibg=Blue +hi LineNr term=underline cterm=bold ctermfg=darkcyan guifg=DarkCyan +hi Question term=standout cterm=bold ctermfg=darkgreen gui=bold guifg=DarkGreen +hi Comment term=bold cterm=bold ctermfg=0 gui=none guifg=DarkGray +hi Constant term=bold cterm=none ctermfg=7 gui=none guifg=LightGray +hi Special term=bold cterm=none ctermfg=3 gui=none guifg=Orange +hi Identifier term=none cterm=none ctermfg=7 gui=none guifg=LightGray +hi PreProc term=underline cterm=bold ctermfg=7 gui=bold guifg=White +hi Error term=reverse cterm=bold ctermfg=7 ctermbg=1 gui=bold guifg=Black guibg=Red +hi Todo term=standout cterm=none ctermfg=0 ctermbg=7 guifg=Black guibg=White +hi String term=none cterm=none ctermfg=3 gui=none guifg=LightYellow +hi Function term=bold cterm=bold ctermfg=3 gui=none guifg=Yellow +hi Statement term=bold cterm=bold ctermfg=7 gui=bold guifg=White +hi Include term=bold cterm=bold ctermfg=4 gui=none guifg=LightBlue +hi StorageClass term=bold cterm=bold ctermfg=5 gui=none guifg=LightMagenta +hi Type term=none cterm=none ctermfg=7 gui=none guifg=LightGray +hi Defined term=bold cterm=bold ctermfg=6 gui=none guifg=LightCyan +hi link Character String +hi link Number Constant +hi link Boolean Constant +hi link Float Number +hi link Conditional Statement +hi link Repeat Statement +hi link Label Statement +hi link Operator Statement +hi link Keyword Statement +hi link Exception Statement +hi link Macro Include +hi link PreCondit PreProc +hi link Structure Type +hi link Typedef Type +hi link Tag Special +hi link SpecialChar Special +hi link Delimiter Special +hi link SpecialComment Special +hi link Debug Special diff --git a/.vim/colors/lingodirector.vim b/.vim/colors/lingodirector.vim new file mode 100644 index 0000000..57f2b3c --- /dev/null +++ b/.vim/colors/lingodirector.vim @@ -0,0 +1,44 @@ +" Vim color file +" Maintainer: Thomas Schmall +" Last Change: 2004 June 16 +" Version:1.0 +" URL: http://www.oxpal.com/index.php?o=dev_vim&lan=en +" +" Note: you can type :set number! to activate or deactivate the line numbering, wich also +" looks similar to Director + +set background=light +hi clear +if exists("syntax_on") + syntax reset +endif +let g:colors_name="lingodirector" + +hi Normal guifg=black guibg=white ctermfg=Black ctermbg=white +hi Title guifg=black guibg=white ctermfg=Black ctermbg=white gui=BOLD +hi lCursor guibg=Cyan guifg=NONE + +hi LineNr guifg=white guibg=#8c9bfa + + + +" syntax highlighting groups +hi Comment ctermfg=Red guifg=#c80000 gui=NONE +hi Operator term=None cterm=None gui=None + +hi Identifier ctermfg=Green guifg=#008000 gui=NONE + +hi Statement ctermfg=Blue guifg=#0000c8 gui=NONE +hi TypeDef ctermfg=Blue guifg=#0000c8 gui=NONE +hi Type ctermfg=Blue guifg=#0000c8 gui=NONE +hi Boolean ctermfg=Blue guifg=#0000c8 gui=NONE + +hi String ctermfg=Gray guifg=#808080 gui=NONE +hi Number ctermfg=Gray guifg=#808080 gui=NONE +hi Constant ctermfg=Gray guifg=#808080 gui=NONE + +hi Function ctermfg=Green guifg=#008040 gui=NONE +hi PreProc ctermfg=Green guifg=#008040 gui=NONE +hi Keyword ctermfg=Green guifg=#008040 gui=NONE + +"set number diff --git a/.vim/colors/matrix.vim b/.vim/colors/matrix.vim new file mode 100644 index 0000000..da5c687 --- /dev/null +++ b/.vim/colors/matrix.vim @@ -0,0 +1,80 @@ +" vim:set ts=8 sts=2 sw=2 tw=0: +" +" matrix.vim - MATRIX like colorscheme. +" +" Maintainer: MURAOKA Taro +" Last Change: 10-Jun-2003. + +set background=dark +hi clear +if exists("syntax_on") + syntax reset +endif +let g:colors_name = 'matrix' + +" the character under the cursor +hi Cursor guifg=#226622 guibg=#55ff55 +hi lCursor guifg=#226622 guibg=#55ff55 +" like Cursor, but used when in IME mode |CursorIM| +hi CursorIM guifg=#226622 guibg=#55ff55 +" directory names (and other special names in listings) +hi Directory guifg=#55ff55 guibg=#000000 +" diff mode: Added line |diff.txt| +hi DiffAdd guifg=#55ff55 guibg=#226622 gui=none +" diff mode: Changed line |diff.txt| +hi DiffChange guifg=#55ff55 guibg=#226622 gui=none +" diff mode: Deleted line |diff.txt| +hi DiffDelete guifg=#113311 guibg=#113311 gui=none +" diff mode: Changed text within a changed line |diff.txt| +hi DiffText guifg=#55ff55 guibg=#339933 gui=bold +" error messages on the command line +hi ErrorMsg guifg=#55ff55 guibg=#339933 +" the column separating vertically split windows +hi VertSplit guifg=#339933 guibg=#339933 +" line used for closed folds +hi Folded guifg=#44cc44 guibg=#113311 +" 'foldcolumn' +hi FoldColumn guifg=#44cc44 guibg=#226622 +" 'incsearch' highlighting; also used for the text replaced with +hi IncSearch guifg=#226622 guibg=#55ff55 gui=none +" line number for ":number" and ":#" commands, and when 'number' +hi LineNr guifg=#44cc44 guibg=#000000 +" 'showmode' message (e.g., "-- INSERT --") +hi ModeMsg guifg=#44cc44 guibg=#000000 +" |more-prompt| +hi MoreMsg guifg=#44cc44 guibg=#000000 +" '~' and '@' at the end of the window, characters from +hi NonText guifg=#44cc44 guibg=#113311 +" normal text +hi Normal guifg=#44cc44 guibg=#000000 +" |hit-enter| prompt and yes/no questions +hi Question guifg=#44cc44 guibg=#000000 +" Last search pattern highlighting (see 'hlsearch'). +hi Search guifg=#113311 guibg=#44cc44 gui=none +" Meta and special keys listed with ":map", also for text used +hi SpecialKey guifg=#44cc44 guibg=#000000 +" status line of current window +hi StatusLine guifg=#55ff55 guibg=#339933 gui=none +" status lines of not-current windows +hi StatusLineNC guifg=#113311 guibg=#339933 gui=none +" titles for output from ":set all", ":autocmd" etc. +hi Title guifg=#55ff55 guibg=#113311 gui=bold +" Visual mode selection +hi Visual guifg=#55ff55 guibg=#339933 gui=none +" Visual mode selection when vim is "Not Owning the Selection". +hi VisualNOS guifg=#44cc44 guibg=#000000 +" warning messages +hi WarningMsg guifg=#55ff55 guibg=#000000 +" current match in 'wildmenu' completion +hi WildMenu guifg=#226622 guibg=#55ff55 + +hi Comment guifg=#226622 guibg=#000000 +hi Constant guifg=#55ff55 guibg=#226622 +hi Special guifg=#44cc44 guibg=#226622 +hi Identifier guifg=#55ff55 guibg=#000000 +hi Statement guifg=#55ff55 guibg=#000000 gui=bold +hi PreProc guifg=#339933 guibg=#000000 +hi Type guifg=#55ff55 guibg=#000000 gui=bold +hi Underlined guifg=#55ff55 guibg=#000000 gui=underline +hi Error guifg=#55ff55 guibg=#339933 +hi Todo guifg=#113311 guibg=#44cc44 gui=none diff --git a/.vim/colors/midnight.vim b/.vim/colors/midnight.vim new file mode 100644 index 0000000..5fab610 --- /dev/null +++ b/.vim/colors/midnight.vim @@ -0,0 +1,80 @@ +" Vim color file +" Maintainer: Michael Brailsford +" Date: $Date: 2002/04/11 03:29:51 $ +" Version: $Revision: 1.4 $ + +" cool help screens +" :he group-name +" :he highlight-groups +" :he cterm-colors + +" your pick: +set background=dark +hi clear +if exists("syntax_on") + syntax reset +endif +let g:colors_name="midnight" + +hi Normal guifg=lightsteelblue guibg=#00006f ctermfg=14 + +"Toggle semicolon matching at the end of lines +nmap ; :call ToggleSemicolonHighlighting() +"{{{ +function! ToggleSemicolonHighlighting() + if exists("b:semicolon") + unlet b:semicolon + hi semicolon guifg=NONE gui=NONE ctermfg=NONE + else + syn match semicolon #;$# + hi semicolon guifg=red gui=bold ctermfg=1 + let b:semicolon = 1 + endif +endfunction +"}}} + +hi Cursor guifg=bg guibg=fg ctermfg=0 ctermbg=11 +"hi CursorIM +hi Directory gui=bold +hi DiffAdd guifg=yellow guibg=darkgreen ctermbg=0 +"hi DiffChange +"hi DiffDelete +"hi DiffText +hi ErrorMsg guibg=red ctermfg=1 +"hi VertSplit +hi Folded guibg=#000047 ctermbg=4 guifg=yellow ctermfg=11 gui=bold +hi FoldColumn guibg=steelblue3 ctermbg=14 guifg=darkblue ctermfg=11 gui=bold +"hi IncSearch +hi LineNr guifg=yellow ctermfg=11 +hi ModeMsg guifg=yellow gui=bold +"hi MoreMsg +"hi NonText +"hi Question +hi Search guibg=yellow guifg=bg +"hi SpecialKey +hi StatusLine guifg=steelblue1 +hi StatusLineNC guifg=steelblue3 +"hi Title +hi Visual guifg=fg guibg=bg +"hi VisualNOS +"hi WarningMsg +"hi WildMenu +"hi Menu +"hi Scrollbar +"hi Tooltip + +" syntax highlighting groups +hi Comment guifg=green ctermfg=10 +hi Constant guifg=lightmagenta gui=bold ctermfg=13 +hi String guifg=indianred1 ctermfg=5 +hi Character guifg=violet ctermfg=5 +hi Number guifg=turquoise1 ctermfg=5 +"hi Identifier +hi Statement guifg=khaki1 gui=bold ctermfg=15 cterm=underline +hi PreProc guifg=firebrick1 gui=italic ctermfg=9 +hi Type guifg=gold gui=bold ctermfg=3 +"hi Special +"hi Underlined +"hi Ignore +"hi Error +hi Todo guifg=yellow guibg=blue gui=bold diff --git a/.vim/colors/moria.vim b/.vim/colors/moria.vim new file mode 100644 index 0000000..2da7b4c --- /dev/null +++ b/.vim/colors/moria.vim @@ -0,0 +1,179 @@ +if exists("g:moria_style") + let s:moria_style = g:moria_style +else + let s:moria_style = &background +endif + +execute "command! -nargs=1 Colo let g:moria_style = \"\" | colo moria" + +if s:moria_style == "dark" || s:moria_style == "black" + set background=dark +elseif s:moria_style == "light" || s:moria_style == "white" + set background=light +else + let s:moria_style = &background +endif + +hi clear + +if exists("syntax_on") + syntax reset +endif + +let colors_name = "moria" + +if &background == "dark" + if s:moria_style == "dark" + hi Normal ctermbg=0 ctermfg=7 guibg=#202020 guifg=#d0d0d0 gui=none + + hi CursorColumn guibg=#444444 gui=none + hi CursorLine guibg=#444444 gui=none + elseif s:moria_style == "black" + hi Normal ctermbg=0 ctermfg=7 guibg=#000000 guifg=#d0d0d0 gui=none + + hi CursorColumn guibg=#3a3a3a gui=none + hi CursorLine guibg=#3a3a3a gui=none + endif + hi Cursor guibg=#ffa500 guifg=bg gui=none + hi DiffAdd guibg=#008b00 guifg=fg gui=none + hi DiffChange guibg=#00008b guifg=fg gui=none + hi DiffDelete guibg=#8b0000 guifg=fg gui=none + hi DiffText guibg=#0000cd guifg=fg gui=bold + hi Directory guibg=bg guifg=#1e90ff gui=none + hi ErrorMsg guibg=#ee2c2c guifg=#ffffff gui=bold + hi FoldColumn ctermbg=bg guibg=bg guifg=#a0b0c0 gui=none + hi Folded guibg=#585858 guifg=#c0d0e0 gui=none + hi IncSearch guibg=#e0cd78 guifg=#000000 gui=none + hi LineNr guifg=#a0b0c0 gui=none + hi ModeMsg guibg=bg guifg=fg gui=bold + hi MoreMsg guibg=bg guifg=#7ec0ee gui=bold + hi NonText ctermfg=8 guibg=bg guifg=#a0b0c0 gui=bold + hi Pmenu guibg=#8090a0 guifg=#000000 gui=none + hi PmenuSbar guibg=#607080 guifg=fg gui=none + hi PmenuSel guibg=#e0e000 guifg=#000000 gui=none + hi PmenuThumb guibg=#c0d0e0 guifg=bg gui=none + hi Question guibg=bg guifg=#e8b87e gui=bold + hi Search guibg=#90e090 guifg=#000000 gui=none + hi SignColumn ctermbg=bg guibg=bg guifg=#a0b0c0 gui=none + hi SpecialKey guibg=bg guifg=#e8b87e gui=none + if has("spell") + hi SpellBad guisp=#ee2c2c gui=undercurl + hi SpellCap guisp=#2c2cee gui=undercurl + hi SpellLocal guisp=#2ceeee gui=undercurl + hi SpellRare guisp=#ee2cee gui=undercurl + endif + hi StatusLine ctermbg=7 ctermfg=0 guibg=#485868 guifg=fg gui=bold + hi StatusLineNC ctermbg=8 ctermfg=0 guibg=#304050 guifg=fg gui=none + hi TabLine guibg=#566676 guifg=fg gui=underline + hi TabLineFill guibg=#c0d0e0 guifg=bg gui=none + hi TabLineSel guibg=bg guifg=fg gui=bold + hi Title ctermbg=0 ctermfg=15 guifg=fg gui=bold + hi VertSplit ctermbg=7 ctermfg=0 guibg=#304050 guifg=fg gui=none + if version >= 700 + hi Visual ctermbg=7 ctermfg=0 guibg=#607080 gui=none + else + hi Visual ctermbg=7 ctermfg=0 guibg=#607080 guifg=fg gui=none + endif + hi VisualNOS guibg=bg guifg=#90a0b0 gui=bold,underline + hi WarningMsg guibg=bg guifg=#ee2c2c gui=bold + hi WildMenu guibg=#e0e000 guifg=#000000 gui=bold + + hi Comment guibg=bg guifg=#d0d0a0 gui=none + hi Constant guibg=bg guifg=#87df71 gui=none + hi Error guibg=bg guifg=#ee2c2c gui=none + hi Identifier guibg=bg guifg=#7ee0ce gui=none + hi Ignore guibg=bg guifg=bg gui=none + hi lCursor guibg=#00e700 guifg=#000000 gui=none + hi MatchParen guibg=#008b8b gui=none + hi PreProc guibg=bg guifg=#d7a0d7 gui=none + hi Special guibg=bg guifg=#e8b87e gui=none + hi Statement guibg=bg guifg=#7ec0ee gui=none + hi Todo guibg=#e0e000 guifg=#000000 gui=none + hi Type guibg=bg guifg=#f09479 gui=none + hi Underlined guibg=bg guifg=#00a0ff gui=underline + + hi htmlBold ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=bold + hi htmlItalic ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=italic + hi htmlUnderline ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=underline + hi htmlBoldItalic ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=bold,italic + hi htmlBoldUnderline ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=bold,underline + hi htmlBoldUnderlineItalic ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=bold,underline,italic + hi htmlUnderlineItalic ctermbg=0 ctermfg=15 guibg=bg guifg=fg gui=underline,italic +elseif &background == "light" + if s:moria_style == "light" + hi Normal ctermbg=15 ctermfg=0 guibg=#f0f0f0 guifg=#000000 gui=none + + hi CursorColumn guibg=#d4d4d4 gui=none + hi CursorLine guibg=#d4d4d4 gui=none + elseif s:moria_style == "white" + hi Normal ctermbg=15 ctermfg=0 guibg=#ffffff guifg=#000000 gui=none + + hi CursorColumn guibg=#dbdbdb gui=none + hi CursorLine guibg=#dbdbdb gui=none + endif + hi Cursor guibg=#883400 guifg=bg gui=none + hi DiffAdd guibg=#008b00 guifg=#ffffff gui=none + hi DiffChange guibg=#00008b guifg=#ffffff gui=none + hi DiffDelete guibg=#8b0000 guifg=#ffffff gui=none + hi DiffText guibg=#0000cd guifg=#ffffff gui=bold + hi Directory guibg=bg guifg=#0000f0 gui=none + hi ErrorMsg guibg=#ee2c2c guifg=#ffffff gui=bold + hi FoldColumn ctermbg=bg guibg=bg guifg=#506070 gui=none + hi Folded guibg=#c5c5c5 guifg=#203040 gui=none + hi IncSearch guibg=#ffcd78 gui=none + hi LineNr guifg=#506070 gui=none + hi ModeMsg ctermbg=15 ctermfg=0 guibg=bg guifg=fg gui=bold + hi MoreMsg guibg=bg guifg=#1f3f81 gui=bold + hi NonText ctermfg=8 guibg=bg guifg=#506070 gui=bold + hi Pmenu guibg=#8a9aaa guifg=#000000 gui=none + hi PmenuSbar guibg=#708090 guifg=fg gui=none + hi PmenuSel guibg=#ffff00 guifg=#000000 gui=none + hi PmenuThumb guibg=#b0c0d0 guifg=fg gui=none + hi Question guibg=bg guifg=#813f11 gui=bold + hi Search guibg=#a0f0a0 gui=none + hi SignColumn ctermbg=bg guibg=bg guifg=#506070 gui=none + hi SpecialKey guibg=bg guifg=#912f11 gui=none + if has("spell") + hi SpellBad guisp=#ee2c2c gui=undercurl + hi SpellCap guisp=#2c2cee gui=undercurl + hi SpellLocal guisp=#008b8b gui=undercurl + hi SpellRare guisp=#ee2cee gui=undercurl + endif + hi StatusLine ctermbg=0 ctermfg=15 guibg=#a0b0c0 guifg=fg gui=bold + hi StatusLineNC ctermbg=7 ctermfg=0 guibg=#b0c0d0 guifg=fg gui=none + hi TabLine guibg=#b4c4d4 guifg=fg gui=underline + hi TabLineFill guibg=fg guifg=bg gui=none + hi TabLineSel guibg=bg guifg=fg gui=bold + hi Title guifg=fg gui=bold + hi VertSplit ctermbg=7 ctermfg=0 guibg=#b0c0d0 guifg=fg gui=none + if version >= 700 + hi Visual ctermbg=7 ctermfg=0 guibg=#c0d0e0 gui=none + else + hi Visual ctermbg=7 ctermfg=0 guibg=#c0d0e0 guifg=fg gui=none + endif + hi VisualNOS guibg=bg guifg=#90a0b0 gui=bold,underline + hi WarningMsg guibg=bg guifg=#ee2c2c gui=bold + hi WildMenu guibg=#ffff00 guifg=fg gui=bold + + hi Comment guibg=bg guifg=#786000 gui=none + hi Constant guibg=bg guifg=#077807 gui=none + hi Error guibg=bg guifg=#ee2c2c gui=none + hi Identifier guibg=bg guifg=#007080 gui=none + hi Ignore guibg=bg guifg=bg gui=none + hi lCursor guibg=#008000 guifg=#ffffff gui=none + hi MatchParen guibg=#00ffff gui=none + hi PreProc guibg=bg guifg=#800090 gui=none + hi Special guibg=bg guifg=#912f11 gui=none + hi Statement guibg=bg guifg=#1f3f81 gui=bold + hi Todo guibg=#ffff00 guifg=fg gui=none + hi Type guibg=bg guifg=#912f11 gui=bold + hi Underlined guibg=bg guifg=#0000cd gui=underline + + hi htmlBold guibg=bg guifg=fg gui=bold + hi htmlItalic guibg=bg guifg=fg gui=italic + hi htmlUnderline guibg=bg guifg=fg gui=underline + hi htmlBoldItalic guibg=bg guifg=fg gui=bold,italic + hi htmlBoldUnderline guibg=bg guifg=fg gui=bold,underline + hi htmlBoldUnderlineItalic guibg=bg guifg=fg gui=bold,underline,italic + hi htmlUnderlineItalic guibg=bg guifg=fg gui=underline,italic +endif diff --git a/.vim/colors/murphy.vim b/.vim/colors/murphy.vim new file mode 100644 index 0000000..5810d0d --- /dev/null +++ b/.vim/colors/murphy.vim @@ -0,0 +1,41 @@ +" local syntax file - set colors on a per-machine basis: +" vim: tw=0 ts=4 sw=4 +" Vim color file +" Maintainer: Ron Aaron +" Last Change: 2001 Sep 02 + +hi clear +set background=dark +if exists("syntax_on") + syntax reset +endif +let g:colors_name = "murphy" + +hi Normal ctermbg=Black ctermfg=lightgreen guibg=Black guifg=lightgreen +hi Comment term=bold ctermfg=LightRed guifg=Orange +hi Constant term=underline ctermfg=LightGreen guifg=White gui=NONE +hi Identifier term=underline ctermfg=LightCyan guifg=#00ffff +hi Ignore ctermfg=black guifg=bg +hi PreProc term=underline ctermfg=LightBlue guifg=Wheat +hi Search term=reverse guifg=white guibg=Blue +hi Special term=bold ctermfg=LightRed guifg=magenta +hi Statement term=bold ctermfg=Yellow guifg=#ffff00 gui=NONE +hi Type ctermfg=LightGreen guifg=grey gui=none +hi Error term=reverse ctermbg=Red ctermfg=White guibg=Red guifg=White +hi Todo term=standout ctermbg=Yellow ctermfg=Black guifg=Blue guibg=Yellow +" From the source: +hi Cursor guifg=Orchid guibg=fg +hi Directory term=bold ctermfg=LightCyan guifg=Cyan +hi ErrorMsg term=standout ctermbg=DarkRed ctermfg=White guibg=Red guifg=White +hi IncSearch term=reverse cterm=reverse gui=reverse +hi LineNr term=underline ctermfg=Yellow guifg=Yellow +hi ModeMsg term=bold cterm=bold gui=bold +hi MoreMsg term=bold ctermfg=LightGreen gui=bold guifg=SeaGreen +hi NonText term=bold ctermfg=Blue gui=bold guifg=Blue +hi Question term=standout ctermfg=LightGreen gui=bold guifg=Cyan +hi SpecialKey term=bold ctermfg=LightBlue guifg=Cyan +hi StatusLine term=reverse,bold cterm=reverse gui=NONE guifg=White guibg=darkblue +hi StatusLineNC term=reverse cterm=reverse gui=NONE guifg=white guibg=#333333 +hi Title term=bold ctermfg=LightMagenta gui=bold guifg=Pink +hi WarningMsg term=standout ctermfg=LightRed guifg=Red +hi Visual term=reverse cterm=reverse gui=NONE guifg=white guibg=darkgreen diff --git a/.vim/colors/navajo-night.vim b/.vim/colors/navajo-night.vim new file mode 100644 index 0000000..f0c27f0 --- /dev/null +++ b/.vim/colors/navajo-night.vim @@ -0,0 +1,119 @@ +" Vim colour file +" Maintainer: Matthew Hawkins +" Last Change: Mon, 22 Apr 2002 15:28:04 +1000 +" URI: http://mh.dropbear.id.au/vim/navajo-night.png +" +" This colour scheme uses a "navajo-black" background +" I have added colours for the statusbar and for spell checking +" as taken from Cream (http://cream.sf.net/) + + +set background=dark +hi clear +if exists("syntax_on") + syntax reset +endif + +let g:colors_name = "navajo-night" + +" This is the list of colour changes from Navajo that +" weren't a simple mathematical subtraction from 0xffffff +" DarkBlue -> #ffff74 +" DarkRed -> #74ffff +" DarkGreen -> #ff9bff +" DarkCyan -> #ff7474 +" DarkMagenta -> #74ff74 +" DarkYellow -> #7474ff +" DarkGray -> #565656 +" Blue -> Yellow +" Red -> Cyan +" Yellow -> Blue +" Gray -> #414141 +" Brown -> #5ad5d5 +" #ff8060 -> #007f9f +" #f6e8d0 -> #09172f +" #edb5cd -> #124a32 +" #c0c0c0 -> #3f3f3f +" #907050 -> #6f8faf +" #808080 -> #7f7f7f +" #707070 -> #8f8f8f +" SeaGreen -> #d174a8 +" LightRed (assuming #ee9090) -> #116f6f +" LightBlue -> #522719 + +hi Normal ctermfg=White guifg=White guibg=#35536f + +hi SpecialKey term=bold ctermfg=darkblue guifg=Yellow +hi NonText term=bold ctermfg=darkblue cterm=bold gui=bold guifg=#7f7f7f +hi Directory term=bold ctermfg=darkblue guifg=Yellow +hi ErrorMsg term=standout ctermfg=grey ctermbg=darkred cterm=bold gui=bold guifg=Black guibg=Cyan +hi IncSearch term=reverse cterm=reverse gui=reverse +hi Search term=reverse ctermbg=White ctermfg=Black cterm=reverse guibg=Black guifg=Yellow +hi MoreMsg term=bold ctermfg=green gui=bold guifg=#d174a8 +hi ModeMsg term=bold cterm=bold gui=bold +hi LineNr term=underline ctermfg=darkcyan ctermbg=grey guibg=#7f7f7f gui=bold guifg=White +hi Question term=standout ctermfg=darkgreen gui=bold guifg=#d174a8 +hi StatusLine term=bold,reverse cterm=bold,reverse gui=bold guifg=Black guibg=White +hi StatusLineNC term=reverse cterm=reverse gui=bold guifg=#116f6f guibg=#8f8f8f +hi VertSplit term=reverse cterm=reverse gui=bold guifg=Black guibg=#8f8f8f +hi Title term=bold ctermfg=green gui=bold guifg=#74ff74 +"+++ Cream: +"hi Visual term=reverse cterm=reverse gui=reverse guifg=#3f3f3f guibg=White +"+++ +hi VisualNOS term=bold,underline cterm=bold,underline gui=reverse guifg=#414141 guibg=Black +hi WarningMsg term=standout ctermfg=darkred gui=bold guifg=Cyan +hi WildMenu term=standout ctermfg=White ctermbg=darkyellow guifg=White guibg=Blue +hi Folded term=standout ctermfg=darkblue ctermbg=grey guifg=White guibg=NONE guifg=#afcfef +hi FoldColumn term=standout ctermfg=darkblue ctermbg=grey guifg=#ffff74 guibg=#3f3f3f +hi DiffAdd term=bold ctermbg=darkblue guibg=Black +hi DiffChange term=bold ctermbg=darkmagenta guibg=#124a32 +hi DiffDelete term=bold ctermfg=darkblue ctermbg=blue cterm=bold gui=bold guifg=#522719 guibg=#09172f +hi DiffText term=reverse ctermbg=darkblue cterm=bold gui=bold guibg=#007f9f +hi Cursor gui=reverse guifg=#bfbfef guibg=Black +hi lCursor guifg=fg guibg=bg +hi Match term=bold,reverse ctermbg=Blue ctermfg=Yellow cterm=bold,reverse gui=bold,reverse guifg=Blue guibg=Yellow + + +" Colours for syntax highlighting +hi Comment term=bold ctermfg=darkblue guifg=#e7e77f +hi Constant term=underline ctermfg=darkred guifg=#3fffa7 +hi Special term=bold ctermfg=darkgreen guifg=#bfbfef +hi Identifier term=underline ctermfg=darkcyan cterm=NONE guifg=#ef9f9f +hi Statement term=bold ctermfg=darkred cterm=bold gui=bold guifg=#5ad5d5 +hi PreProc term=underline ctermfg=darkmagenta guifg=#74ff74 +hi Type term=underline ctermfg=green gui=bold guifg=#d174a8 +hi Ignore ctermfg=grey cterm=bold guifg=bg + +hi Error term=reverse ctermfg=grey ctermbg=darkred cterm=bold gui=bold guifg=Black guibg=Cyan +hi Todo term=standout ctermfg=darkblue ctermbg=Blue guifg=Yellow guibg=Blue + +"+++ Cream: statusbar +" Colours for statusbar +"hi User1 gui=bold guifg=#565656 guibg=#0c0c0c +"hi User2 gui=bold guifg=White guibg=#0c0c0c +"hi User3 gui=bold guifg=Yellow guibg=#0c0c0c +"hi User4 gui=bold guifg=Cyan guibg=#0c0c0c +highlight User1 gui=bold guifg=#999933 guibg=#45637f +highlight User2 gui=bold guifg=#e7e77f guibg=#45637f +highlight User3 gui=bold guifg=Black guibg=#45637f +highlight User4 gui=bold guifg=#33cc99 guibg=#45637f +"+++ + +"+++ Cream: selection +highlight Visual gui=bold guifg=Black guibg=#aacc77 +"+++ + +"+++ Cream: bookmarks +highlight Cream_ShowMarksHL ctermfg=blue ctermbg=lightblue cterm=bold guifg=Black guibg=#aacc77 gui=bold +"+++ + +"+++ Cream: spell check +" Colour misspelt words +"hi BadWord ctermfg=White ctermbg=darkred cterm=bold guifg=Yellow guibg=#522719 gui=bold +" mathematically correct: +"highlight BadWord ctermfg=black ctermbg=lightblue gui=NONE guifg=White guibg=#003333 +" adjusted: +highlight BadWord ctermfg=black ctermbg=lightblue gui=NONE guifg=#ff9999 guibg=#003333 +"+++ + + diff --git a/.vim/colors/neon.vim b/.vim/colors/neon.vim new file mode 100644 index 0000000..e69de29 diff --git a/.vim/colors/oceanblack.vim b/.vim/colors/oceanblack.vim new file mode 100644 index 0000000..e6e6be3 --- /dev/null +++ b/.vim/colors/oceanblack.vim @@ -0,0 +1,115 @@ +" Vim color file +" Maintainer: Chris Vertonghen +" Last Change: 2003-03-25 +" Version: 0.1 +" based on Tom Regner's oceanblue.vim + +""" Init +set background=dark +highlight clear +if exists("syntax_on") + syntax reset +endif +let g:colors_name = "oceanblack" + + +""""""""\ Colors \"""""""" + + +"""" GUI Colors + +highlight Cursor gui=None guibg=PaleTurquoise3 guifg=White +highlight CursorIM gui=bold guifg=white guibg=PaleTurquoise3 +highlight Directory guifg=LightSeaGreen guibg=bg +highlight DiffAdd gui=None guifg=fg guibg=DarkCyan +highlight DiffChange gui=None guifg=fg guibg=Green4 +highlight DiffDelete gui=None guifg=fg guibg=black +highlight DiffText gui=bold guifg=fg guibg=bg +highlight ErrorMsg guifg=LightYellow guibg=FireBrick +" previously 'FillColumn': +"highlight FillColumn gui=NONE guifg=black guibg=grey60 +highlight VertSplit gui=NONE guifg=black guibg=grey60 +highlight Folded gui=bold guibg=#305060 guifg=#b0d0e0 +highlight FoldColumn gui=None guibg=#305060 guifg=#b0d0e0 +highlight IncSearch gui=reverse guifg=fg guibg=bg +"highlight LineNr guibg=grey6 guifg=LightSkyBlue3 +highlight LineNr guibg=grey6 guifg=#777777 +highlight ModeMsg guibg=DarkGreen guifg=LightGreen +highlight MoreMsg gui=bold guifg=SeaGreen4 guibg=bg +if version < 600 + " same as SpecialKey + highlight NonText guibg=#123A4A guifg=#3D5D6D +else + " Bottom fill (use e.g. same as LineNr) + highlight NonText gui=None guibg=#000000 guifg=LightSkyBlue +endif +highlight Normal gui=None guibg=#000000 guifg=honeydew2 +highlight Question gui=bold guifg=SeaGreen2 guibg=bg +highlight Search gui=NONE guibg=LightSkyBlue4 guifg=NONE +highlight SpecialKey guibg=#103040 guifg=#324262 +highlight StatusLine gui=bold guibg=grey88 guifg=black +highlight StatusLineNC gui=NONE guibg=grey60 guifg=grey10 +highlight Title gui=bold guifg=MediumOrchid1 guibg=bg +highlight Visual gui=reverse guibg=WHITE guifg=SeaGreen +highlight VisualNOS gui=bold,underline guifg=fg guibg=bg +highlight WarningMsg gui=bold guifg=FireBrick1 guibg=bg +highlight WildMenu gui=bold guibg=Chartreuse guifg=Black + + +"""" Syntax Colors + +"highlight Comment gui=reverse guifg=#507080 +"highlight Comment gui=None guifg=#507080 +highlight Comment gui=None guifg=#7C7268 + +highlight Constant guifg=cyan3 guibg=bg +"hi String gui=None guifg=turquoise2 guibg=bg +hi String gui=None guifg=#80a0ff guibg=bg + "hi Character gui=None guifg=Cyan guibg=bg + "highlight Number gui=None guifg=Cyan guibg=bg + highlight Number gui=None guifg=Cyan guibg=black + highlight Boolean gui=bold guifg=Cyan guibg=bg + "hi Float gui=None guifg=Cyan guibg=bg + +highlight Identifier guifg=LightSkyBlue3 +hi Function gui=None guifg=DarkSeaGreen3 guibg=bg + +highlight Statement gui=NONE guifg=LightGreen + highlight Conditional gui=None guifg=LightGreen guibg=bg + highlight Repeat gui=None guifg=SeaGreen2 guibg=bg + "hi Label gui=None guifg=LightGreen guibg=bg + highlight Operator gui=None guifg=Chartreuse guibg=bg + highlight Keyword gui=None guifg=LightGreen guibg=bg + highlight Exception gui=None guifg=LightGreen guibg=bg + +highlight PreProc guifg=SkyBlue1 +hi Include gui=None guifg=LightSteelBlue3 guibg=bg +hi Define gui=None guifg=LightSteelBlue2 guibg=bg +hi Macro gui=None guifg=LightSkyBlue3 guibg=bg +hi PreCondit gui=None guifg=LightSkyBlue2 guibg=bg + +highlight Type gui=NONE guifg=LightBlue +hi StorageClass gui=None guifg=LightBlue guibg=bg +hi Structure gui=None guifg=LightBlue guibg=bg +hi Typedef gui=None guifg=LightBlue guibg=bg + +"highlight Special gui=bold guifg=aquamarine3 +highlight Special guifg=#999999 + "hi SpecialChar gui=bold guifg=White guibg=bg + "hi Tag gui=bold guifg=White guibg=bg + "hi Delimiter gui=bold guifg=White guibg=bg + "hi SpecialComment gui=bold guifg=White guibg=bg + "hi Debug gui=bold guifg=White guibg=bg + +highlight Underlined gui=underline guifg=honeydew4 guibg=bg + +highlight Ignore guifg=#204050 + +highlight Error guifg=LightYellow guibg=FireBrick + +highlight Todo guifg=Cyan guibg=#507080 + +""" OLD COLORS + + + diff --git a/.vim/colors/pleasant.vim b/.vim/colors/pleasant.vim new file mode 100644 index 0000000..e327bc9 --- /dev/null +++ b/.vim/colors/pleasant.vim @@ -0,0 +1,37 @@ +" Vim color file +" Maintainer: iyerns +" Last Change: 25 August 2005 +" Version:1.0 +" Comment: A bright and colorful scheme for gui + +set background=light +hi clear +if exists("syntax_on") + syntax reset +endif +let g:colors_name="pleasant" + +hi Normal guifg=black guibg=white +hi Title guifg=black guibg=white gui=BOLD +hi lCursor guibg=Cyan guifg=NONE + +hi LineNr guifg=white guibg=#8c9bfa + +" syntax highlighting groups +hi Comment ctermfg=Red guifg=#c80000 gui=NONE +hi Operator term=None cterm=None gui=None + +hi Identifier guifg=#008000 gui=NONE + +hi Statement guifg=#0000c8 gui=NONE +hi TypeDef guifg=#c000c8 gui=NONE +hi Type guifg=#0000c8 gui=NONE +hi Boolean guifg=#0000aa gui=NONE + +hi String guifg=#808055 gui=NONE +hi Number guifg=#808880 gui=NONE +hi Constant guifg=#888080 gui=NONE + +hi Function guifg=#008040 gui=NONE guibg=#cccccc +hi PreProc guifg=#808040 gui=NONE +hi Keyword guifg=#008088 gui=NONE diff --git a/.vim/colors/ps_color.vim b/.vim/colors/ps_color.vim new file mode 100644 index 0000000..fb3e02b --- /dev/null +++ b/.vim/colors/ps_color.vim @@ -0,0 +1,469 @@ +" Vim colour file --- PSC +" Maintainer: Pan, Shi Zhu +" URL: http://vim.sourceforge.net/scripts/script.php?script_id=760 +" Last Change: 18 July 2006 +" Version: 2.9 +" +" Please prepend [VIM] in the title when writing e-mail to me, or it will +" be automatically treated as spam and removed. +" +" See the help document for all details, the help document will be +" installed after the script has been sourced once, do not open the +" script when you source it for the first time. +" + +" Initializations: {{{1 +" + +" without user_commands, all these are not possible +if !has("user_commands") + finish +end + +function! s:init_option(var, value) + if !exists("g:psc_".a:var) + execute "let s:".a:var." = ".a:value + else + let s:{a:var} = g:psc_{a:var} + endif +endfunction +command! -nargs=+ InitOpt call s:init_option() + +function! s:multi_hi(setting, ...) + let l:idx = a:0 + while l:idx > 0 + let l:hlgroup = a:{l:idx} + execute "highlight ".l:hlgroup." ".a:setting + let l:idx = l:idx - 1 + endwhile +endfunction +command! -nargs=+ MultiHi call s:multi_hi() + +InitOpt style 'cool' +InitOpt inversed_todo 0 +InitOpt use_default_for_cterm 0 +InitOpt statement_different_from_type 0 +if s:style == 'warm' + InitOpt fontface 'mixed' +else + InitOpt fontface 'plain' +endif + +if !has("gui_running") + call s:init_option("cterm_style", "'".s:style."'") + + " Forces 'cool' style when gui is not present Since the 'warm' style for + " terminal isn't available now, and probably never will be. + if s:cterm_style=='warm' | let s:cterm_style = 'cool' + endif + if s:use_default_for_cterm==1 | let s:cterm_style = 'default' + elseif s:use_default_for_cterm==2 | let s:cterm_style = 'defdark' + endif +endif + + +InitOpt other_style 0 + +if has("gui_running") + if s:style=='warm' || s:style=='default' + set background=light + elseif s:style=='cool' || s:style=='defdark' + set background=dark + else | let s:other_style = 1 + endif +else + if s:cterm_style=='cool' || s:cterm_style=='defdark' + set background=dark + elseif s:cterm_style=='default' + set background=light + else | let s:other_style = 1 + endif +endif + + +highlight clear + +if exists("syntax_on") + syntax reset +endif + +let s:color_name = expand(":t:r") + +if s:other_style==0 | let g:colors_name = s:color_name + " Go from console version to gui, the color scheme should be sourced again + execute "autocmd TermChanged * if g:colors_name == '".s:color_name."' | " + \."colo ".s:color_name." | endif" +else + execute "runtime colors/".s:style.".vim" +endif + +" Command to go different schemes easier. +execute "command! -nargs=1 Colo if '".s:color_name."'!=\"\" | " + \'let g:psc_style = ""| endif | colo '.s:color_name + +" Give control to 'reloaded' scheme if possible +if s:style == 'reloaded' + finish +endif + +" }}}1 + +" Relevant Help: +" :h highlight-groups +" :h psc-cterm-color-table +" :ru syntax/hitest.vim +" +" Hardcoded Colors Comment: +" #aabbcc = Red aa, Green bb, Blue cc +" we must use hard-coded colours to get more 'tender' colours +" + + +" GUI: +" +" I don't want to abuse folding, but here folding is used to avoid confusion. +if s:style=='warm' + " Warm style for gui here {{{2 + " LIGHT COLOR DEFINE START + + highlight Normal guifg=#000000 guibg=#e0e0e0 + highlight Search guifg=#902000 guibg=#f8f8f8 + highlight Visual guifg=fg guibg=#a6caf0 + highlight Cursor guifg=#f0f0f0 guibg=#008000 + " The idea of CursorIM is pretty good, however, the feature is still buggy + " in the current version (Vim 7.0). + " The following line will be kept commented until the bug fixed. + " + " highlight CursorIM guifg=#f0f0f0 guibg=#800080 + highlight Special guifg=#907000 guibg=bg + highlight Comment guifg=#606000 guibg=bg + highlight Number guifg=#907000 guibg=bg + highlight Constant guifg=#007068 guibg=bg + highlight StatusLine guifg=fg guibg=#a6caf0 + highlight LineNr guifg=#686868 guibg=bg + highlight Question guifg=fg guibg=#d0d090 + highlight PreProc guifg=#009030 guibg=bg + if s:statement_different_from_type==1 + highlight Statement guifg=#4020a0 guibg=bg + else + highlight Statement guifg=#2060a8 guibg=bg + endif + highlight Type guifg=#0850a0 guibg=bg + if s:inversed_todo==1 + highlight Todo guifg=#e0e090 guibg=#000080 + else + highlight Todo guifg=#800000 guibg=#e0e090 + endif + " NOTE THIS IS IN THE WARM SECTION + highlight Error guifg=#c03000 guibg=bg + highlight Identifier guifg=#a030a0 guibg=bg + highlight ModeMsg guifg=fg guibg=#b0b0e0 + highlight VisualNOS guifg=fg guibg=#b0b0e0 + highlight SpecialKey guifg=#1050a0 guibg=bg + highlight NonText guifg=#002090 guibg=#d0d0d0 + highlight Directory guifg=#a030a0 guibg=bg + highlight ErrorMsg guifg=fg guibg=#f0b090 + highlight MoreMsg guifg=#489000 guibg=bg + highlight Title guifg=#a030a0 guibg=bg + highlight WarningMsg guifg=#b02000 guibg=bg + highlight WildMenu guifg=fg guibg=#d0d090 + highlight Folded guifg=fg guibg=#b0e0b0 + highlight FoldColumn guifg=fg guibg=#90e090 + highlight DiffAdd guifg=fg guibg=#b0b0e0 + highlight DiffChange guifg=fg guibg=#e0b0e0 + highlight DiffDelete guifg=#002090 guibg=#d0d0d0 + highlight DiffText guifg=fg guibg=#c0e080 + highlight SignColumn guifg=fg guibg=#90e090 + highlight IncSearch guifg=#f0f0f0 guibg=#806060 + highlight StatusLineNC guifg=fg guibg=#c0c0c0 + highlight VertSplit guifg=fg guibg=#c0c0c0 + highlight Underlined guifg=#6a5acd guibg=bg gui=underline + highlight Ignore guifg=bg guibg=bg + " NOTE THIS IS IN THE WARM SECTION + if v:version >= 700 + highlight SpellBad guifg=NONE guibg=NONE guisp=#c03000 + highlight SpellCap guifg=NONE guibg=NONE guisp=#2060a8 + highlight SpellRare guifg=NONE guibg=NONE guisp=#a030a0 + highlight SpellLocal guifg=NONE guibg=NONE guisp=#007068 + highlight Pmenu guifg=fg guibg=#e0b0e0 + highlight PmenuSel guifg=#f0f0f0 guibg=#806060 + highlight PmenuSbar guifg=fg guibg=#c0c0c0 + highlight PmenuThumb guifg=fg guibg=#c0e080 + highlight TabLine guifg=fg guibg=#c0c0c0 gui=underline + highlight TabLineFill guifg=fg guibg=#c0c0c0 gui=underline + highlight TabLineSel guifg=fg guibg=bg + highlight CursorColumn guifg=NONE guibg=#f0b090 + highlight CursorLine guifg=NONE guibg=NONE gui=underline + highlight MatchParen guifg=NONE guibg=#c0e080 + endif + + " LIGHT COLOR DEFINE END + " }}}2 +elseif s:style=='cool' + " Cool style for gui here {{{2 + " DARK COLOR DEFINE START + + highlight Normal guifg=#d0d0d0 guibg=#202020 + highlight Comment guifg=#d0d090 guibg=bg + highlight Constant guifg=#80c0e0 guibg=bg + highlight Number guifg=#e0c060 guibg=bg + highlight Identifier guifg=#f0c0f0 guibg=bg + if s:statement_different_from_type==1 + highlight Statement guifg=#98a8f0 guibg=bg + else + highlight Statement guifg=#c0d8f8 guibg=bg + endif + highlight PreProc guifg=#60f080 guibg=bg + highlight Type guifg=#b0d0f0 guibg=bg + highlight Special guifg=#e0c060 guibg=bg + highlight Error guifg=#f08060 guibg=bg + if s:inversed_todo==1 + highlight Todo guifg=#d0d090 guibg=#000080 + else + highlight Todo guifg=#800000 guibg=#d0d090 + endif + highlight Search guifg=#e0e0e0 guibg=#800000 + highlight Visual guifg=#000000 guibg=#a6caf0 + highlight Cursor guifg=#000000 guibg=#00f000 + " NOTE THIS IS IN THE COOL SECTION + " highlight CursorIM guifg=#000000 guibg=#f000f0 + highlight StatusLine guifg=#000000 guibg=#a6caf0 + highlight LineNr guifg=#b0b0b0 guibg=bg + highlight Question guifg=#000000 guibg=#d0d090 + highlight ModeMsg guifg=fg guibg=#000080 + highlight VisualNOS guifg=fg guibg=#000080 + highlight SpecialKey guifg=#b0d0f0 guibg=bg + highlight NonText guifg=#6080f0 guibg=#101010 + highlight Directory guifg=#80c0e0 guibg=bg + highlight ErrorMsg guifg=#d0d090 guibg=#800000 + highlight MoreMsg guifg=#c0e080 guibg=bg + highlight Title guifg=#f0c0f0 guibg=bg + highlight WarningMsg guifg=#f08060 guibg=bg + highlight WildMenu guifg=#000000 guibg=#d0d090 + highlight Folded guifg=#d0d0d0 guibg=#004000 + highlight FoldColumn guifg=#e0e0e0 guibg=#008000 + highlight DiffAdd guifg=fg guibg=#000080 + highlight DiffChange guifg=fg guibg=#800080 + highlight DiffDelete guifg=#6080f0 guibg=#202020 + highlight DiffText guifg=#000000 guibg=#c0e080 + highlight SignColumn guifg=#e0e0e0 guibg=#008000 + highlight IncSearch guifg=#000000 guibg=#d0d0d0 + highlight StatusLineNC guifg=#000000 guibg=#c0c0c0 + highlight VertSplit guifg=#000000 guibg=#c0c0c0 + highlight Underlined guifg=#80a0ff guibg=bg gui=underline + highlight Ignore guifg=#000000 guibg=bg + " NOTE THIS IS IN THE COOL SECTION + if v:version >= 700 + highlight SpellBad guifg=NONE guibg=NONE guisp=#f08060 + highlight SpellCap guifg=NONE guibg=NONE guisp=#6080f0 + highlight SpellRare guifg=NONE guibg=NONE guisp=#f0c0f0 + highlight SpellLocal guifg=NONE guibg=NONE guisp=#c0d8f8 + highlight Pmenu guifg=fg guibg=#800080 + highlight PmenuSel guifg=#000000 guibg=#d0d0d0 + highlight PmenuSbar guifg=fg guibg=#000080 + highlight PmenuThumb guifg=fg guibg=#008000 + highlight TabLine guifg=fg guibg=#008000 gui=underline + highlight TabLineFill guifg=fg guibg=#008000 gui=underline + highlight TabLineSel guifg=fg guibg=bg + highlight CursorColumn guifg=NONE guibg=#800000 + highlight CursorLine guifg=NONE guibg=NONE gui=underline + highlight MatchParen guifg=NONE guibg=#800080 + endif + + " DARK COLOR DEFINE END + " }}}2 +elseif s:style=='defdark' + highlight Normal guifg=#f0f0f0 guibg=#000000 +endif + +" Take NT gui for example, If you want to use a console font such as +" Lucida_Console with font size larger than 14, the font looks already thick, +" and the bold font for that will be too thick, you may not want it be bolded. +" The following code does this. +" +" All of the bold font may be disabled, since continuously switching between +" bold and plain font hurts consistency and will inevitably fatigue your eye! + +" Maximum 20 parameters for vim script function +" +MultiHi gui=NONE ModeMsg Search Cursor Special Comment Constant Number LineNr Question PreProc Statement Type Todo Error Identifier Normal + +MultiHi gui=NONE VisualNOS SpecialKey NonText Directory ErrorMsg MoreMsg Title WarningMsg WildMenu Folded FoldColumn DiffAdd DiffChange DiffDelete DiffText SignColumn + +" Vim 7 added stuffs +if v:version >= 700 + MultiHi gui=NONE Ignore PmenuSel PmenuSel PmenuSbar PmenuThumb TabLine TabLineFill TabLineSel + + " the gui=undercurl guisp could only support in Vim 7 + MultiHi gui=undercurl SpellBad SpellCap SpellRare SpellLocal + if s:style=="cool" || s:style=="warm" + MultiHi gui=underline TabLine TabLineFill Underlined CursorLine + else + MultiHi gui=underline TabLine Underlined + endif +endif + +" For reversed stuffs +MultiHi gui=NONE IncSearch StatusLine StatusLineNC VertSplit Visual + +if s:style=="cool" || s:style=="warm" + if s:fontface=="mixed" + MultiHi gui=bold IncSearch StatusLine StatusLineNC VertSplit Visual + endif +else + if s:fontface=="mixed" + hi StatusLine gui=bold,reverse + else + hi StatusLine gui=reverse + endif + MultiHi gui=reverse IncSearch StatusLineNC VertSplit Visual +endif + +" Enable the bold style +if s:fontface=="mixed" + MultiHi gui=bold Question DiffText Statement Type MoreMsg ModeMsg NonText Title VisualNOS DiffDelete TabLineSel +endif + + + + +" Color Term: + +" It's not quite possible to support 'cool' and 'warm' simultaneously, since +" we cannot expect a terminal to have more than 16 color names. +" + +" I assume Vim will never go to cterm mode when has("gui_running") returns 1, +" Please enlighten me if I am wrong. +" +if !has('gui_running') + " cterm settings {{{1 + if s:cterm_style=='cool' + + highlight Normal ctermfg=LightGrey ctermbg=Black + highlight Search ctermfg=White ctermbg=DarkRed + highlight Visual ctermfg=Black ctermbg=DarkCyan + highlight Cursor ctermfg=Black ctermbg=Green + highlight Special ctermfg=Yellow ctermbg=Black + highlight Comment ctermfg=DarkYellow ctermbg=Black + highlight Constant ctermfg=Blue ctermbg=Black + highlight Number ctermfg=Yellow ctermbg=Black + highlight StatusLine ctermfg=Black ctermbg=DarkCyan + highlight LineNr ctermfg=DarkGrey ctermbg=Black + highlight Question ctermfg=Black ctermbg=DarkYellow + highlight PreProc ctermfg=Green ctermbg=Black + highlight Statement ctermfg=Cyan ctermbg=Black + highlight Type ctermfg=Cyan ctermbg=Black + if s:inversed_todo==0 + highlight Todo ctermfg=DarkRed ctermbg=DarkYellow + else + highlight Todo ctermfg=DarkYellow ctermbg=DarkBlue + endif + highlight Error ctermfg=Red ctermbg=Black + highlight Identifier ctermfg=Magenta ctermbg=Black + highlight Folded ctermfg=White ctermbg=DarkGreen + highlight ModeMsg ctermfg=Grey ctermbg=DarkBlue + highlight VisualNOS ctermfg=Grey ctermbg=DarkBlue + highlight SpecialKey ctermfg=Cyan ctermbg=Black + highlight NonText ctermfg=Blue ctermbg=Black + highlight Directory ctermfg=Blue ctermbg=Black + highlight ErrorMsg ctermfg=DarkYellow ctermbg=DarkRed + highlight MoreMsg ctermfg=Green ctermbg=Black + highlight Title ctermfg=Magenta ctermbg=Black + highlight WarningMsg ctermfg=Red ctermbg=Black + highlight WildMenu ctermfg=Black ctermbg=DarkYellow + highlight FoldColumn ctermfg=White ctermbg=DarkGreen + highlight SignColumn ctermfg=White ctermbg=DarkGreen + highlight DiffText ctermfg=Black ctermbg=DarkYellow + highlight DiffDelete ctermfg=Blue ctermbg=Black + + if v:version >= 700 + highlight SpellBad ctermfg=NONE ctermbg=DarkRed + highlight SpellCap ctermfg=NONE ctermbg=DarkBlue + highlight SpellRare ctermfg=NONE ctermbg=DarkMagenta + highlight SpellLocal ctermfg=NONE ctermbg=DarkGreen + highlight Pmenu ctermfg=fg ctermbg=DarkMagenta + highlight PmenuSel ctermfg=bg ctermbg=fg + highlight PmenuSbar ctermfg=fg ctermbg=DarkBlue + highlight PmenuThumb ctermfg=fg ctermbg=DarkGreen + highlight TabLine ctermfg=fg ctermbg=DarkGreen cterm=underline + highlight TabLineFill ctermfg=fg ctermbg=DarkGreen cterm=underline + highlight TabLineSel ctermfg=fg ctermbg=bg + highlight CursorColumn ctermfg=NONE ctermbg=DarkRed + highlight CursorLine ctermfg=NONE ctermbg=NONE cterm=underline + highlight MatchParen ctermfg=NONE ctermbg=DarkMagenta + endif + if &t_Co==8 + " 8 colour terminal support, this assumes 16 colour is available through + " setting the 'bold' attribute, will get bright foreground colour. + " However, the bright background color is not available for 8-color terms. + " + " You can manually set t_Co=16 in your .vimrc to see if your terminal + " supports 16 colours, + MultiHi cterm=none DiffText Visual Cursor Comment Todo StatusLine Question DiffChange ModeMsg VisualNOS ErrorMsg WildMenu DiffAdd Folded DiffDelete Normal PmenuThumb + MultiHi cterm=bold Search Special Constant Number LineNr PreProc Statement Type Error Identifier SpecialKey NonText MoreMsg Title WarningMsg FoldColumn SignColumn Directory DiffDelete + + else + " Background > 7 is only available with 16 or more colors + + " Only use the s:fontface option when there is 16-colour(or more) + " terminal support + + MultiHi cterm=none WarningMsg Search Visual Cursor Special Comment Constant Number LineNr PreProc Todo Error Identifier Folded SpecialKey Directory ErrorMsg Normal PmenuThumb + MultiHi cterm=none WildMenu FoldColumn SignColumn DiffAdd DiffChange Question StatusLine DiffText + MultiHi cterm=reverse IncSearch StatusLineNC VertSplit + + " Well, well, bold font with color 0-7 is not possible. + " So, the Question, StatusLine, DiffText cannot act as expected. + + call s:multi_hi("cterm=".((s:fontface=="plain") ? "none" : "bold"), "Statement", "Type", "MoreMsg", "ModeMsg", "NonText", "Title", "VisualNOS", "DiffDelete", "TabLineSel") + + endif + + elseif s:cterm_style=='defdark' + highlight Normal ctermfg=LightGrey ctermbg=Black + endif + " }}}1 +endif + + +" Term: +" For console with only 4 colours (term, not cterm), we'll use the default. +" ... +" The default colorscheme is good enough for terms with no more than 4 colours +" + + +" Links: +" +if (s:style=='cool') || (s:style == 'warm') + " COLOR LINKS DEFINE START + + highlight link String Constant + " Character must be different from strings because in many languages + " (especially C, C++) a 'char' variable is scalar while 'string' is pointer, + " mistaken a 'char' for a 'string' will cause disaster! + highlight link Character Number + highlight link SpecialChar LineNr + highlight link Tag Identifier + " The following are not standard hi links, + " these are used by DrChip + highlight link Warning MoreMsg + highlight link Notice Constant + " these are used by Calendar + highlight link CalToday PreProc + " these are used by TagList + highlight link MyTagListTagName IncSearch + highlight link MyTagListTagScope Constant + + " COLOR LINKS DEFINE END +endif + + +" Clean: +" +delcommand InitOpt +delcommand MultiHi + +" vim:et:nosta:sw=2:ts=8: +" vim600:fdm=marker:fdl=1: diff --git a/.vim/colors/pyte.vim b/.vim/colors/pyte.vim new file mode 100644 index 0000000..aadd3cf --- /dev/null +++ b/.vim/colors/pyte.vim @@ -0,0 +1,68 @@ + +set background=light + +hi clear +if exists("syntax_on") + syntax reset +endif + +let colors_name = "pyte" +" +" Html-Titles +hi Title guifg=#202020 gui=bold +hi Underlined guifg=#202020 gui=underline + + +hi Cursor guifg=black guibg=#b0b4b8 +hi lCursor guifg=black guibg=white +hi LineNr guifg=#ffffff guibg=#c0d0e0 + +hi Normal guifg=#202020 guibg=#f0f0f0 + +hi StatusLine guifg=white guibg=#8090a0 gui=bold,italic +hi StatusLineNC guifg=#506070 guibg=#a0b0c0 gui=italic +hi VertSplit guifg=#a0b0c0 guibg=#a0b0c0 gui=NONE + +hi Folded guifg=#708090 guibg=#c0d0e0 + +hi NonText guibg=#e0e0e0 +" Kommentare +hi Comment guifg=#a0b0c0 gui=italic + +" Konstanten +hi Constant guifg=#a07040 +hi String guifg=#4070a0 +hi Number guifg=#40a070 +hi Float guifg=#70a040 +"hi Statement guifg=#0070e0 gui=NONE +" Python: def and so on, html: tag-names +hi Statement guifg=#007020 gui=bold + + +" HTML: arguments +hi Type guifg=#e5a00d gui=italic +" Python: Standard exceptions, True&False +hi Structure guifg=#007020 gui=italic +hi Function guifg=#06287e gui=italic + +hi Identifier guifg=#5b3674 gui=italic + +hi Repeat guifg=#7fbf58 gui=bold +hi Conditional guifg=#4c8f2f gui=bold + +" Cheetah: #-Symbol, function-names +hi PreProc guifg=#1060a0 gui=NONE +" Cheetah: def, for and so on, Python: Decorators +hi Define guifg=#1060a0 gui=bold + +hi Error guifg=white guibg=red +hi Todo guifg=#a0b0c0 guibg=NONE gui=italic,bold,underline + +" Python: %(...)s - constructs, encoding +hi Special guifg=#70a0d0 gui=italic + +hi Operator guifg=#408010 + +" color of s etc... +hi SpecialKey guifg=#d8a080 guibg=#e8e8e8 gui=italic + diff --git a/.vim/colors/python.vim b/.vim/colors/python.vim new file mode 100644 index 0000000..6f4a765 --- /dev/null +++ b/.vim/colors/python.vim @@ -0,0 +1,104 @@ +""" Init +set background=light +highlight clear +if exists("syntax_on") + syntax reset +endif +let g:colors_name = "python" + + +""""""""\ Colors \"""""""" + + +"""" GUI Colors + +highlight Cursor gui=None guibg=Palegreen3 guifg=White +highlight CursorIM gui=bold guifg=white guibg=PaleTurquoise3 +highlight Directory guifg=LightSeaGreen guibg=bg +highlight DiffAdd gui=None guifg=fg guibg=DarkCyan +highlight DiffChange gui=None guifg=fg guibg=Green4 +highlight DiffDelete gui=None guifg=fg guibg=black +highlight DiffText gui=bold guifg=fg guibg=bg +highlight ErrorMsg guifg=LightYellow guibg=FireBrick +" previously 'FillColumn': +"highlight FillColumn gui=NONE guifg=black guibg=grey60 +highlight VertSplit gui=NONE guifg=black guibg=#c8d6b3 +highlight Folded gui=bold guibg=#305060 guifg=#b0d0e0 +highlight FoldColumn gui=bold guibg=#395602 guifg=#6f9b1f +highlight IncSearch gui=reverse guifg=fg guibg=bg +highlight LineNr gui=bold guibg=#395602 guifg=#6f9b1f +highlight ModeMsg guibg=DarkGreen guifg=Green +highlight MoreMsg gui=bold guifg=SeaGreen4 guibg=bg +if version < 600 + " same as SpecialKey + highlight NonText guibg=#123A4A guifg=#3D5D6D +else + " Bottom fill (use e.g. same as LineNr) + highlight NonText gui=None guibg=bg guifg=fg +endif +highlight Normal gui=None guibg=#f6ffe5 guifg=black +highlight Question gui=bold guifg=SeaGreen2 guibg=bg +highlight Search gui=NONE guibg=LightSkyBlue4 guifg=NONE +highlight SpecialKey guibg=#103040 guifg=#324262 +highlight StatusLine gui=bold guibg=#c8d6b3 guifg=black +highlight StatusLineNC gui=NONE guibg=#c8d6b3 guifg=black +highlight Title gui=bold guifg=MediumOrchid1 guibg=bg +highlight Visual gui=reverse guibg=WHITE guifg=SeaGreen +highlight VisualNOS gui=bold,underline guifg=fg guibg=bg +highlight WarningMsg gui=bold guifg=FireBrick1 guibg=bg +highlight WildMenu gui=bold guibg=Chartreuse guifg=Black + + +"""" Syntax Colors + +"highlight Comment gui=reverse guifg=#507080 +highlight Comment gui=italic guifg=#507080 + +highlight Constant guifg=black guibg=bg +hi String gui=None guifg=#ccab3f guibg=bg + "hi Character gui=None guifg=#969248 guibg=bg + highlight Number gui=None guifg=#969248 guibg=bg + highlight Boolean gui=bold guifg=#969248 guibg=bg + "hi Float gui=None guifg=#969248 guibg=bg + +highlight Identifier guifg=#6f9b1f +hi Function gui=None guifg=#775d05 guibg=bg + +highlight Statement gui=NONE guifg=#669907 + highlight Conditional gui=None guifg=Green guibg=bg + highlight Repeat gui=None guifg=SeaGreen2 guibg=bg + "hi Label gui=None guifg=Green guibg=bg + highlight Operator gui=None guifg=Chartreuse guibg=bg + highlight Keyword gui=bold guifg=#6f9b1f guibg=bg + highlight Exception gui=bold guifg=Green guibg=bg + +highlight PreProc guifg=SkyBlue1 +hi Include gui=None guifg=#725c05 guibg=bg +hi Define gui=None guifg=#725c05 guibg=bg +hi Macro gui=None guifg=#486610 guibg=bg +hi PreCondit gui=None guifg=LightSkyBlue2 guibg=bg + +highlight Type gui=NONE guifg=#ccab3f +hi StorageClass gui=None guifg=#ccab3f guibg=bg +hi Structure gui=None guifg=#ccab3f guibg=bg +hi Typedef gui=None guifg=#ccab3f guibg=bg + +highlight Special gui=bold guifg=#ddb100 + "hi SpecialChar gui=bold guifg=White guibg=bg + "hi Tag gui=bold guifg=White guibg=bg + "hi Delimiter gui=bold guifg=White guibg=bg + "hi SpecialComment gui=bold guifg=White guibg=bg + "hi Debug gui=bold guifg=White guibg=bg + +highlight Underlined gui=underline guifg=honeydew4 guibg=bg + +highlight Ignore guifg=#204050 + +highlight Error guifg=LightYellow guibg=FireBrick + +highlight Todo guifg=#969248 guibg=#507080 + +""" OLD COLORS + + + diff --git a/.vim/colors/revolutions.vim b/.vim/colors/revolutions.vim new file mode 100644 index 0000000..15450c9 --- /dev/null +++ b/.vim/colors/revolutions.vim @@ -0,0 +1,75 @@ +" MATRIX-REVOLUTIONS colorscheme +" Author: Christian MICHON +" Version: 1.0 +" Last Change: 23 Jun 2004 + +set background=dark +hi clear +if exists("syntax_on") + syntax reset +endif + +let g:colors_name = 'revolutions' + +hi Boolean guifg=#e6fff3 guibg=#43705a gui=none +hi Character guifg=#e6fff3 guibg=#43705a gui=none +hi Comment guifg=#43705a guibg=#000000 gui=underline +hi Conditional guifg=#e6fff3 guibg=#000000 gui=bold +hi Constant guifg=#e6fff3 guibg=#43705a gui=none +hi Cursor guifg=#43705a guibg=#e6fff3 gui=none +hi Debug guifg=#61a181 guibg=#000000 gui=none +hi Define guifg=#e6fff3 guibg=#000000 gui=none +hi Delimiter guifg=#61a181 guibg=#000000 gui=none +hi DiffAdd guifg=#e6fff3 guibg=#43705a gui=bold +hi DiffChange guifg=#e6fff3 guibg=#43705a gui=none +hi DiffDelete guifg=#e6fff3 guibg=#43705a gui=none +hi DiffText guifg=#000000 guibg=#e6fff3 gui=bold +hi Directory guifg=#e6fff3 guibg=#000000 gui=none +hi Error guifg=#e6fff3 guibg=#61a181 gui=bold +hi ErrorMsg guifg=#e6fff3 guibg=#61a181 gui=bold +hi Exception guifg=#e6fff3 guibg=#000000 gui=bold +hi Float guifg=#e6fff3 guibg=#43705a gui=none +hi FoldColumn guifg=#9bcfb5 guibg=#43705a gui=bold +hi Folded guifg=#9bcfb5 guibg=#43705a gui=bold +hi Function guifg=#e6fff3 guibg=#000000 gui=none +hi Identifier guifg=#e6fff3 guibg=#000000 gui=none +hi Ignore guifg=#000000 guibg=#000000 gui=none +hi Include guifg=#e6fff3 guibg=#000000 gui=none +hi IncSearch guifg=#1d3026 guibg=#61a181 gui=bold +hi Keyword guifg=#e6fff3 guibg=#000000 gui=bold +hi Label guifg=#e6fff3 guibg=#000000 gui=bold +hi lCursor guifg=#43705a guibg=#e6fff3 gui=none +hi LineNr guifg=#9bcfb5 guibg=#000000 gui=bold +hi Macro guifg=#e6fff3 guibg=#000000 gui=none +hi ModeMsg guifg=#9bcfb5 guibg=#000000 gui=bold +hi MoreMsg guifg=#9bcfb5 guibg=#000000 gui=bold +hi NonText guifg=#9bcfb5 guibg=#1d3026 gui=bold +hi Normal guifg=#9bcfb5 guibg=#000000 gui=none +hi Number guifg=#e6fff3 guibg=#000000 gui=none +hi Operator guifg=#e6fff3 guibg=#000000 gui=bold +hi PreCondit guifg=#e6fff3 guibg=#000000 gui=none +hi PreProc guifg=#61a181 guibg=#000000 gui=none +hi Question guifg=#9bcfb5 guibg=#000000 gui=bold +hi Repeat guifg=#e6fff3 guibg=#000000 gui=bold +hi Search guifg=#1d3026 guibg=#61a181 gui=bold +hi Special guifg=#61a181 guibg=#000000 gui=none +hi SpecialChar guifg=#61a181 guibg=#000000 gui=none +hi SpecialComment guifg=#61a181 guibg=#000000 gui=none +hi SpecialKey guifg=#9bcfb5 guibg=#000000 gui=none +hi Statement guifg=#e6fff3 guibg=#000000 gui=bold +hi StatusLine guifg=#e6fff3 guibg=#61a181 gui=bold +hi StatusLineNC guifg=#1d3026 guibg=#61a181 gui=bold +hi StorageClass guifg=#f070a0 guibg=#000000 gui=bold +hi String guifg=#e6fff3 guibg=#000000 gui=none +hi Structure guifg=#f070a0 guibg=#000000 gui=bold +hi Tag guifg=#61a181 guibg=#000000 gui=none +hi Title guifg=#e6fff3 guibg=#1d3026 gui=bold +hi Todo guifg=#1d3026 guibg=#9bcfb5 gui=none +hi Type guifg=#e6fff3 guibg=#000000 gui=bold +hi Typedef guifg=#f070a0 guibg=#000000 gui=bold +hi Underlined guifg=#e6fff3 guibg=#000000 gui=underline +hi VertSplit guifg=#61a181 guibg=#61a181 gui=none +hi Visual guifg=#e6fff3 guibg=#61a181 gui=none +hi VisualNOS guifg=#9bcfb5 guibg=#000000 gui=underline +hi WarningMsg guifg=#1d3026 guibg=#61a181 gui=bold +hi WildMenu guifg=#43705a guibg=#e6fff3 gui=none diff --git a/.vim/colors/sand.vim b/.vim/colors/sand.vim new file mode 100644 index 0000000..cc673df --- /dev/null +++ b/.vim/colors/sand.vim @@ -0,0 +1,30 @@ +" Vim color file +" Maintainer: Tim Alexeevsky +" Last Change: 2002-03-14 +" Version: 0.5 +" URL: http://sunsite.cs.msu.su/~tim/vim/sand.vim +" +" Thanx to Hans Fugal for his colorscheme_template.vim + +set background=light +hi clear +if exists("syntax_on") + syntax reset +endif +let g:colors_name="sand" + +highlight Normal guibg=cornsilk guifg=NONE +highlight PreProc guibg=NONE guifg=Maroon4 +highlight Comment guibg=NONE guifg=SteelBlue4 +highlight Constant guibg=NONE guifg=NavajoWhite4 +highlight Special guibg=NONE guifg=SlateBlue4 +highlight Identifier guibg=NONE guifg=SeaGreen +highlight Statement guibg=NONE guifg=bisque4 +highlight Type guibg=NONE guifg=DarkOliveGreen +highlight Todo guibg=LightYellow3 guifg=Blue4 +highlight NonText guibg=NONE guifg=DarkGreen +highlight LineNr guibg=NONE guifg=Brown +highlight StatusLineNC guifg=#8090a0 +highlight StatusLine guifg=#005070 + +"vim: tw=0 sw=3 ts=3 sts=3 et diff --git a/.vim/colors/slate2.vim b/.vim/colors/slate2.vim new file mode 100644 index 0000000..af690bd --- /dev/null +++ b/.vim/colors/slate2.vim @@ -0,0 +1,82 @@ +set background=dark +hi clear + +if exists("syntax_on") + syntax reset +endif + +let colors_name="slate" + +if exists("g:slate_style") + let s:slate_style = g:slate_style +else + let s:slate_style = 'slate' +endif + +if s:slate_style == "bw" + hi Normal ctermbg=0 ctermfg=15 guibg=#1b1b1b guifg=#d0d0d0 gui=none + + hi Cursor guibg=#e7e7e7 guifg=#000000 gui=bold + hi FoldColumn guibg=#3d3d3d guifg=fg gui=none + hi Folded guibg=#525252 guifg=fg gui=none + hi LineNr guibg=#292929 guifg=#a7a7a7 gui=none + hi NonText ctermfg=8 guibg=bg guifg=#878787 gui=bold + hi SignColumn guibg=#3d3d3d guifg=fg gui=none + hi StatusLine guibg=fg guifg=#000000 gui=bold + hi StatusLineNC ctermbg=7 ctermfg=0 guibg=#878787 guifg=#000000 gui=bold + hi VertSplit ctermbg=7 ctermfg=0 guibg=#878787 guifg=#000000 gui=bold + hi Visual ctermbg=7 ctermfg=0 guibg=#ababab guifg=#000000 gui=bold + hi VisualNOS guibg=bg guifg=#ababab gui=bold,underline + hi WildMenu guibg=#a0a0a0 guifg=#000000 gui=bold +else + hi Normal ctermbg=0 ctermfg=15 guibg=#181b1f guifg=#d0d0d0 gui=none + + hi Cursor guibg=#c6e2ff guifg=#000000 gui=bold + hi FoldColumn guibg=#363d45 guifg=fg gui=none + hi Folded guibg=#48525d guifg=fg gui=none + hi LineNr guibg=#24292e guifg=#a7a7a7 gui=none + hi NonText ctermfg=8 guibg=bg guifg=#878787 gui=bold + hi SignColumn guibg=#363d45 guifg=fg gui=none + hi StatusLine guibg=#9fb6cd guifg=#000000 gui=bold + hi StatusLineNC ctermbg=7 ctermfg=0 guibg=#6c7b8b guifg=#000000 gui=bold + hi VertSplit ctermbg=7 ctermfg=0 guibg=#6c7b8b guifg=#000000 gui=bold + hi Visual ctermbg=7 ctermfg=0 guibg=#8598ac guifg=#000000 gui=bold + hi VisualNOS guibg=bg guifg=#8598ac gui=bold,underline + hi WildMenu guibg=#e7e7e7 guifg=#000000 gui=bold +endif + +hi Directory guibg=bg guifg=#1e90ff gui=none +hi ErrorMsg guibg=#ee2c2c guifg=#ffffff gui=bold +hi DiffAdd guibg=#008b00 guifg=fg gui=none +hi DiffChange guibg=#00008b guifg=fg gui=none +hi DiffDelete guibg=#8b0000 guifg=fg gui=none +hi DiffText guibg=#00008b guifg=fg gui=bold +hi IncSearch guibg=#e7e7e7 guifg=#000000 gui=bold +hi ModeMsg guibg=bg guifg=fg gui=bold +hi MoreMsg guibg=bg guifg=#d0d097 gui=bold +hi Question guibg=bg guifg=#e0c07e gui=bold +hi Search guibg=#bbbb87 guifg=#000000 gui=bold +hi SpecialKey guibg=bg guifg=#a28b5b gui=none +hi Title guibg=bg guifg=#e7e7e7 gui=bold +hi WarningMsg guibg=bg guifg=#ee2c2c gui=bold + +hi Comment guibg=bg guifg=#bbbb87 gui=none +hi Constant guibg=bg guifg=#8fe779 gui=none +hi Error guibg=bg guifg=#ee2c2c gui=none +hi Identifier guibg=bg guifg=#7ee0ce gui=none +hi Ignore guibg=bg guifg=#373737 gui=none +hi lCursor guibg=fg guifg=bg gui=bold +hi PreProc guibg=bg guifg=#d7a0d7 gui=none +hi Special guibg=bg guifg=#e0c07e gui=none +hi Statement guibg=bg guifg=#7ec0ee gui=none +hi Todo guibg=bg guifg=#bbbb87 gui=bold,underline +hi Type guibg=bg guifg=#f09479 gui=none +hi Underlined guibg=bg guifg=#1e90ff gui=underline + +hi htmlBold guibg=bg guifg=fg gui=bold +hi htmlItalic guibg=bg guifg=fg gui=italic +hi htmlUnderline guibg=bg guifg=fg gui=underline +hi htmlBoldItalic guibg=bg guifg=fg gui=bold,italic +hi htmlBoldUnderline guibg=bg guifg=fg gui=bold,underline +hi htmlBoldUnderlineItalic guibg=bg guifg=fg gui=bold,underline,italic +hi htmlUnderlineItalic guibg=bg guifg=fg gui=underline,italic diff --git a/.vim/colors/vividchalk.vim b/.vim/colors/vividchalk.vim new file mode 100644 index 0000000..9bcec92 --- /dev/null +++ b/.vim/colors/vividchalk.vim @@ -0,0 +1,172 @@ +" Vim color scheme +" Name: vividchalk.vim +" Author: Tim Pope +" GetLatestVimScripts: 1891 1 :AutoInstall: vividchalk.vim +" $Id: vividchalk.vim,v 1.8 2007-07-11 18:50:16 tpope Exp $ + +" Based on the Vibrank Ink theme for TextMate +" Distributable under the same terms as Vim itself (see :help license) + +if has("gui_running") + set background=dark +endif +hi clear +if exists("syntax_on") + syntax reset +endif + +let colors_name = "vividchalk" + +" First two functions adapted from inkpot.vim + +" map a urxvt cube number to an xterm-256 cube number +fun! s:M(a) + return strpart("0245", a:a, 1) + 0 +endfun + +" map a urxvt colour to an xterm-256 colour +fun! s:X(a) + if &t_Co == 88 + return a:a + else + if a:a == 8 + return 237 + elseif a:a < 16 + return a:a + elseif a:a > 79 + return 232 + (3 * (a:a - 80)) + else + let l:b = a:a - 16 + let l:x = l:b % 4 + let l:y = (l:b / 4) % 4 + let l:z = (l:b / 16) + return 16 + s:M(l:x) + (6 * s:M(l:y)) + (36 * s:M(l:z)) + endif + endif +endfun + +function! E2T(a) + return s:X(a:a) +endfunction + +function! s:choose(mediocre,good) + if &t_Co != 88 && &t_Co != 256 + return a:mediocre + else + return s:X(a:good) + endif +endfunction + +function! s:hifg(group,guifg,first,second,...) + if a:0 && &t_Co == 256 + let ctermfg = a:1 + else + let ctermfg = s:choose(a:first,a:second) + endif + exe "highlight ".a:group." guifg=".a:guifg." ctermfg=".ctermfg +endfunction + +function! s:hibg(group,guibg,first,second) + let ctermbg = s:choose(a:first,a:second) + exe "highlight ".a:group." guibg=".a:guibg." ctermbg=".ctermbg +endfunction + +hi link railsMethod PreProc +hi link rubyDefine Keyword +hi link rubySymbol Constant +hi link rubyAccess rubyMethod +hi link rubyAttribute rubyMethod +hi link rubyEval rubyMethod +hi link rubyException rubyMethod +hi link rubyInclude rubyMethod +hi link rubyStringDelimiter rubyString +hi link rubyRegexp Regexp +hi link rubyRegexpDelimiter rubyRegexp +"hi link rubyConstant Variable +"hi link rubyGlobalVariable Variable +"hi link rubyClassVariable Variable +"hi link rubyInstanceVariable Variable +hi link javascriptRegexpString Regexp +hi link javascriptNumber Number +hi link javascriptNull Constant + +call s:hifg("Normal","#EEEEEE","White",87) +if &background == "light" || has("gui_running") + hi Normal guibg=Black ctermbg=Black +else + hi Normal guibg=Black ctermbg=NONE +endif +highlight StatusLine guifg=Black guibg=#aabbee gui=bold ctermfg=Black ctermbg=White cterm=bold +highlight StatusLineNC guifg=#444444 guibg=#aaaaaa gui=none ctermfg=Black ctermbg=Grey cterm=none +"if &t_Co == 256 + "highlight StatusLine ctermbg=117 +"else + "highlight StatusLine ctermbg=43 +"endif +highlight WildMenu guifg=Black guibg=#ffff00 gui=bold ctermfg=Black ctermbg=Yellow cterm=bold +highlight Cursor guifg=Black guibg=White ctermfg=Black ctermbg=White +highlight CursorLine guibg=#222222 guifg=NONE +highlight CursorColumn guibg=#222222 guifg=NONE +highlight NonText guifg=#404040 ctermfg=8 +highlight SpecialKey guifg=#404040 ctermfg=8 +highlight Directory none +high link Directory Identifier +highlight ErrorMsg guibg=Red ctermbg=DarkRed guifg=NONE ctermfg=NONE +highlight Search guifg=NONE ctermfg=NONE gui=none cterm=none +call s:hibg("Search" ,"#555555","Black",81) +highlight IncSearch guifg=White guibg=Black ctermfg=White ctermbg=Black +highlight MoreMsg guifg=#00AA00 ctermfg=Green +highlight LineNr guifg=#99AABB ctermfg=DarkGrey +call s:hibg("LineNr" ,"#222222","Black",80) +highlight Question none +high link Question MoreMsg +highlight Title guifg=Magenta ctermfg=Magenta +highlight VisualNOS gui=none cterm=none +call s:hibg("Visual" ,"#555577","LightBlue",83) +call s:hibg("VisualNOS" ,"#444444","DarkBlue",81) +highlight WarningMsg guifg=Red ctermfg=Red +highlight Folded guibg=#1100aa ctermbg=DarkBlue +call s:hibg("Folded" ,"#110077","DarkBlue",17) +call s:hifg("Folded" ,"#aaddee","LightCyan",63) +highlight FoldColumn none +high link FoldColumn Folded +highlight Pmenu guifg=White ctermfg=White gui=bold cterm=bold +highlight PmenuSel guifg=White ctermfg=White gui=bold cterm=bold +call s:hibg("Pmenu" ,"#000099","Blue",18) +call s:hibg("PmenuSel" ,"#5555ff","DarkCyan",39) +highlight PmenuSbar guibg=Grey ctermbg=Grey +highlight PmenuThumb guibg=White ctermbg=White +highlight TabLine gui=underline cterm=underline +call s:hifg("TabLine" ,"#bbbbbb","LightGrey",85) +call s:hibg("TabLine" ,"#333333","DarkGrey",80) +highlight TabLineSel guifg=White guibg=Black ctermfg=White ctermbg=Black +highlight TabLineFill gui=underline cterm=underline +call s:hifg("TabLineFill","#bbbbbb","LightGrey",85) +call s:hibg("TabLineFill","#808080","Grey",83) + +hi Type gui=none +hi Statement gui=none +if !has("gui_mac") + " Mac GUI degrades italics to ugly underlining. + hi Comment gui=italic + hi railsUserClass gui=italic + hi railsUserMethod gui=italic +endif +hi Identifier cterm=none +" Commented numbers at the end are *old* 256 color values +"highlight PreProc guifg=#EDF8F9 +call s:hifg("Comment" ,"#AA88DD","DarkMagenta",34) " 92 +" 26 instead? +call s:hifg("Constant" ,"#BBBBFF","DarkCyan",21) " 30 +call s:hifg("rubyNumber" ,"#FFCC66","Yellow",60) " 190 +call s:hifg("String" ,"#AAFF88","LightGreen",44,82) " 82 +call s:hifg("Identifier" ,"#FFCC99","Yellow",72) " 220 +call s:hifg("Statement" ,"#FF8866","LightRed",68) " 202 +call s:hifg("PreProc" ,"#AAFFFF","LightCyan",47) " 213 +call s:hifg("railsUserMethod","#AACCFF","LightCyan",27) +call s:hifg("Type" ,"#AAAA77","Grey",57) " 101 +call s:hifg("railsUserClass" ,"#AAAAAA","Grey",7) " 101 +call s:hifg("Special" ,"#99AA00","DarkGreen",24) " 7 +call s:hifg("Regexp" ,"#44B4CC","DarkCyan",21) " 74 +call s:hifg("rubyMethod" ,"#FFDDAA","Yellow",77) " 191 +"highlight railsMethod guifg=#EE1122 ctermfg=1 diff --git a/.vim/colors/watermark.vim b/.vim/colors/watermark.vim new file mode 100644 index 0000000..09818e4 --- /dev/null +++ b/.vim/colors/watermark.vim @@ -0,0 +1,174 @@ +" Vim color file +" watermark v1.0b +" http://www.vim.org/scripts/script.php?script_id=1454 +" +" Maintainer: Shawn Axsom +" +" * Place :colo watermark in your VimRC/GVimRC file +" * GvimRC if using GUI any +" +" - Thanks to Desert and OceanDeep for their color scheme +" file layouts +" - Thanks to Raimon Grau for his feedback + +set background=dark +if version > 580 + " no guarantees for version 5.8 and below, but this makes it stop + " complaining + hi clear + if exists("syntax_on") + syntax reset + endif +endif + +let g:colors_name="watermark" + +hi Normal guifg=#8b9aaa guibg=#1a202a "1a1823 +hi NonText guifg=#382920 guibg=bg + +hi Folded guibg=#222038 guifg=#BBDDCC +hi FoldColumn guibg=black guifg=#dbcaa5 +hi LineNr guibg=black guifg=#8095d5 +hi StatusLine guibg=grey guifg=#203ad5 gui=none +hi StatusLineNC guibg=grey guifg=#1b2058 gui=none +hi VertSplit guibg=#22253d guifg=#223355 gui=none + +hi tablinesel guibg=#515a71 guifg=#50aae5 gui=none +hi tabline guibg=#4d4d5f guifg=#5b7098 gui=none +hi tablinefill guibg=#2d2d3f guifg=#aaaaaa gui=none + +" syntax highlighting """""""""""""""""""""""""""""""""""""""" + +"set comments to grey on non-Windows OS's to make sure +"it is readable +if &term == "builtin_gui" || &term == "win32" + hi Comment guifg=#369960 guibg=bg +else + hi Comment guifg=#559988 guibg=bg +endif +"""""""""""""""""""""""""""""""""""""""""""""""""""""" + +hi Title guifg=#6d806a gui=none +hi Underlined guifg=#5b759a gui=none + +hi Statement guifg=#cac0c0 gui=none +hi Type guifg=#6ac0ba gui=none +hi Constant guifg=#70a0de +hi Number guifg=#1da5da +hi PreProc guifg=#c0a0b0 +hi Special guifg=#50a0b0 +hi Ignore guifg=grey40 +hi Todo guifg=orangered guibg=yellow2 +hi Error guibg=#f06070 +hi Function guifg=#a090a0 guibg=bg gui=None +hi Identifier guifg=#a090b0 +highlight Exception gui=none guifg=#aaa4a0 guibg=bg +"""""this section borrowed from OceanDeep/Midnight""""" +highlight Conditional gui=None guifg=#c08ac0 guibg=bg +highlight Repeat gui=None guifg=#c07ac0 guibg=bg +"hi Label gui=None guifg=LightGreen guibg=bg +highlight Operator gui=None guifg=#aa9a45 guibg=bg +highlight Keyword gui=bold guifg=grey guibg=bg +""""""""""""""""""""""""""""""""""""""""""""""""""""""" +"end syntax highlighting """"""""""""""""""""""""""""""""""""" + +" highlight groups +"hi CursorIM +hi Directory guifg=#bbd0df +"hi DiffAdd +"hi DiffChange +"hi DiffDelete +"hi DiffText +hi ErrorMsg guibg=#ff4545 + +hi Cursor guibg=#cad5c0 guifg=#05293d + + +hi Search guibg=#808373 guifg=#3a4520 +hi IncSearch guifg=#babeaa guibg=#3a4520 + +hi ModeMsg guifg=#00AACC +hi MoreMsg guifg=SeaGreen +hi Question guifg=#AABBCC +hi SpecialKey guifg=#90dcb0 +hi Visual guifg=black guibg=#43D5FF +hi VisualNOS guifg=#201a30 guibg=#a3a5FF +hi WarningMsg guifg=salmon +"hi WildMenu +"hi Menu +"hi Scrollbar guibg=grey30 guifg=tan +"hi Tooltip + + +" new Vim 7.0 items +hi Pmenu guibg=#3a6595 guifg=#9aadd5 +hi PmenuSel guibg=#4a85ba guifg=#b0d0f0 + + + + + +" color terminal definitions +hi Normal ctermfg=grey +hi Number ctermfg=blue +highlight Operator ctermfg=yellow +highlight Conditional ctermfg=darkred +highlight Repeat ctermfg=darkred +hi Exception ctermfg=red +hi function ctermfg=darkyellow +hi SpecialKey ctermfg=darkgreen +hi NonText cterm=bold ctermfg=darkgrey +hi Directory ctermfg=darkcyan +hi ErrorMsg cterm=bold ctermfg=7 ctermbg=1 +hi IncSearch ctermfg=yellow ctermbg=darkyellow cterm=NONE +hi Search ctermfg=black ctermbg=darkyellow cterm=NONE +hi MoreMsg ctermfg=darkgreen +hi ModeMsg cterm=NONE ctermfg=brown +hi LineNr ctermfg=darkcyan ctermbg=NONE +hi Question ctermfg=green +hi StatusLine ctermfg=blue ctermbg=grey cterm=NONE +hi StatusLineNC ctermfg=black ctermbg=grey cterm=NONE +hi VertSplit ctermfg=black ctermbg=grey cterm=NONE +hi Title ctermfg=Yellow cterm=NONE +hi Visual ctermbg=darkcyan ctermfg=black cterm=NONE +hi VisualNOS ctermbg=darkcyan ctermfg=black cterm=NONE +hi WarningMsg ctermfg=1 +hi WildMenu ctermfg=0 ctermbg=3 +hi Folded ctermfg=darkgreen ctermbg=NONE cterm=NONE +hi FoldColumn ctermfg=green ctermbg=black +hi DiffAdd ctermbg=4 +hi DiffChange ctermbg=5 +hi DiffDelete cterm=bold ctermfg=4 ctermbg=6 +hi DiffText cterm=bold ctermbg=1 +hi identifier ctermfg=darkmagenta + +"set comments to grey on non-Windows OS's to make sure +"it is readable +if &term == "builtin_gui" || &term == "win32" + hi Comment ctermfg=darkgrey ctermbg=darkblue + hi IncSearch ctermfg=black ctermbg=grey cterm=NONE + hi Search ctermfg=black ctermbg=darkgrey cterm=NONE +else + hi Comment ctermfg=grey ctermbg=darkblue + hi IncSearch ctermfg=yellow ctermbg=darkyellow cterm=NONE + hi Search ctermfg=black ctermbg=darkyellow cterm=NONE +endif +"""""""""""""""""""""""""""""""""""""""""""""""""""""" + +hi Constant ctermfg=blue +hi Special ctermfg=darkmagenta +hi Statement ctermfg=red +hi PreProc ctermfg=magenta +hi Type ctermfg=darkblue " ctermbg=darkblue +hi Underlined ctermfg=yellow cterm=NONE +hi Ignore cterm=bold ctermfg=7 +hi Ignore ctermfg=darkgrey +hi Error cterm=bold ctermfg=7 ctermbg=1 + +" new Vim 7.0 items +hi Pmenu ctermbg=darkblue ctermfg=lightgrey +hi PmenuSel ctermbg=lightblue ctermfg=white + +"vim: sw=4 + + diff --git a/.vim/colors/wood.vim b/.vim/colors/wood.vim new file mode 100644 index 0000000..2f6059e --- /dev/null +++ b/.vim/colors/wood.vim @@ -0,0 +1,39 @@ +" Vim color file +" Maintainer: freddydaoud@netscape.net +" Last Change: 09 Apr 2005 + +set background=dark +hi clear +if exists("syntax_on") + syntax reset +endif +let g:colors_name="wood" + +hi Normal guibg=#81816A guifg=linen +hi Cursor guibg=#CFCFC6 guifg=black gui=bold +hi VertSplit guifg=#81816A guibg=#CCCCAA gui=none +hi Folded guibg=black guifg=white +hi FoldColumn guibg=lightgray guifg=#292926 +hi ModeMsg guifg=black guibg=#CFCFC6 +hi MoreMsg guifg=black guibg=#CFCFC6 +hi NonText guifg=white guibg=#61614A gui=none +hi Question guifg=snow +hi Search guibg=#CFCFC6 guifg=black gui=bold +hi SpecialKey guifg=yellow +hi StatusLine guibg=#DFDFD6 guifg=black gui=none +hi StatusLineNC guibg=#BFBFB6 guifg=black gui=none +hi Title guifg=bisque3 +hi Subtitle guifg=black +hi Visual guifg=#292926 guibg=#CFCFC6 gui=none +hi WarningMsg guifg=salmon4 guibg=gray60 gui=bold +hi Comment guifg=#D1D1BA +hi Constant guifg=#FFFFCC gui=bold +hi Identifier guifg=#FFFFCC +hi Statement guifg=#000000 +hi PreProc guifg=black gui=bold +hi Type guifg=#FFE0C0 +hi Special guifg=navajowhite +hi Ignore guifg=grey29 +hi Todo guibg=black guifg=white +hi WildMenu guibg=brown +hi LineNr guifg=#CCCCAA guibg=#61614A diff --git a/.vim/colors/zenburn.vim b/.vim/colors/zenburn.vim new file mode 100644 index 0000000..af9c07f --- /dev/null +++ b/.vim/colors/zenburn.vim @@ -0,0 +1,133 @@ +" Vim color file +" Maintainer: Jani Nurminen +" Last Change: $Id: zenburn.vim,v 1.13 2002/09/16 18:03:49 jnurmine Exp $ +" URL: Not yet... +" License: GPL +" +" Nothing too fancy, just some alien fruit salad to keep you in the zone. +" This syntax file was designed to be used with dark environments and +" low light situations. Of course, if it works during a daybright office, go +" ahead :) +" +" Owes heavily to other Vim color files! With special mentions +" to "BlackDust", "Camo" and "Desert". +" +" To install, copy to ~/.vim/colors directory. Then :colorscheme zenburn. +" See also :help syntax +" +" CONFIGURABLE PARAMETERS: +" +" You can use the default (don't set any parameters), or you can +" set some parameters to tweak the Zenlook colours. +" +" * To get more contrast to the Visual selection, use +" +" let g:zenburn_alternate_Visual = 1 +" +" * To use alternate colouring for Error message, use +" +" let g:zenburn_alternate_Error = 1 +" +" * The new default for Include is a duller orang.e To use the original +" colouring for Include, use +" +" let g:zenburn_alternate_Include = 1 +" +" * To turn the parameter(s) back to defaults, use unlet. +" +" That's it, enjoy! +" +" TODO +" - IME colouring (CursorIM) +" - obscure syntax groups: check and colourize +" - add more groups if necessary + +set background=dark +hi clear +if exists("syntax_on") + syntax reset +endif +let g:colors_name="zenburn" + +hi Boolean guifg=#dca3a3 +hi Character guifg=#dca3a3 gui=bold +hi Comment guifg=#7f9f7f +hi Conditional guifg=#f0dfaf gui=bold +hi Constant guifg=#dca3a3 gui=bold +hi Cursor guifg=#000d18 guibg=#8faf9f gui=bold +hi Debug guifg=#dca3a3 gui=bold +hi Define guifg=#ffcfaf gui=bold +hi Delimiter guifg=#8f8f8f +hi DiffAdd guifg=#709080 guibg=#313c36 gui=bold +hi DiffChange guibg=#333333 +hi DiffDelete guifg=#333333 guibg=#464646 +hi DiffText guifg=#ecbcbc guibg=#41363c gui=bold +hi Directory guifg=#dcdccc gui=bold +hi ErrorMsg guifg=#60b48a guibg=#3f3f3f gui=bold +hi Exception guifg=#c3bf9f gui=bold +hi Float guifg=#c0bed1 +hi FoldColumn guifg=#93b3a3 guibg=#3f4040 +hi Folded guifg=#93b3a3 guibg=#3f4040 +hi Function guifg=#efef8f +hi Identifier guifg=#efdcbc +hi IncSearch guibg=#f8f893 guifg=#385f38 +hi Keyword guifg=#f0dfaf gui=bold +hi Label guifg=#dfcfaf gui=underline +hi LineNr guifg=#7f8f8f guibg=#464646 +hi Macro guifg=#ffcfaf gui=bold +hi ModeMsg guifg=#ffcfaf gui=none +hi MoreMsg guifg=#ffffff gui=bold +hi NonText guifg=#404040 +hi Normal guifg=#dcdccc guibg=#3f3f3f +hi Number guifg=#8cd0d3 +hi Operator guifg=#f0efd0 +hi PreCondit guifg=#dfaf8f gui=bold +hi PreProc guifg=#ffcfaf gui=bold +hi Question guifg=#ffffff gui=bold +hi Repeat guifg=#ffd7a7 gui=bold +hi Search guifg=#ffffe0 guibg=#385f38 +hi SpecialChar guifg=#dca3a3 gui=bold +hi SpecialComment guifg=#82a282 gui=bold +hi Special guifg=#cfbfaf +hi SpecialKey guifg=#9ece9e +hi Statement guifg=#e3ceab guibg=#3f3f3f gui=none +hi StatusLine guifg=#1e2320 guibg=#acbc90 +hi StatusLineNC guifg=#2e3330 guibg=#88b090 +hi StorageClass guifg=#c3bf9f gui=bold +hi String guifg=#cc9393 +hi Structure guifg=#efefaf gui=bold +hi Tag guifg=#dca3a3 gui=bold +hi Title guifg=#efefef guibg=#3f3f3f gui=bold +hi Todo guifg=#7faf8f guibg=#3f3f3f gui=bold +hi Typedef guifg=#dfe4cf gui=bold +hi Type guifg=#dfdfbf gui=bold +hi Underlined guifg=#dcdccc guibg=#3f3f3f gui=underline +hi VertSplit guifg=#303030 guibg=#688060 +hi VisualNOS guifg=#333333 guibg=#f18c96 gui=bold,underline +hi WarningMsg guifg=#ffffff guibg=#333333 gui=bold +hi WildMenu guibg=#2c302d guifg=#cbecd0 gui=underline + +if exists("g:zenburn_alternate_Visual") + " Visual with more contrast, thanks to Steve Hall & Cream posse + hi Visual guifg=#000000 guibg=#71d3b4 +else + " use default visual + hi Visual guifg=#233323 guibg=#71d3b4 +endif + +if exists("g:zenburn_alternate_Error") + " use a bit different Error + hi Error guifg=#ef9f9f guibg=#201010 gui=bold +else + " default + hi Error guifg=#e37170 guibg=#332323 gui=none +endif + +if exists("g:zenburn_alternate_Include") + " original setting + hi Include guifg=#ffcfaf gui=bold +else + " new, less contrasted one + hi Include guifg=#dfaf8f gui=bold +endif + " TODO check every syntax group that they're ok diff --git a/bin/ack b/bin/ack new file mode 100755 index 0000000..7cc459c --- /dev/null +++ b/bin/ack @@ -0,0 +1,2624 @@ +#!/usr/bin/env perl +# +# This file, ack, is generated code. +# Please DO NOT EDIT or send patches for it. +# +# Please take a look at the source from +# http://github.com/petdance/ack +# and submit patches against the individual files +# that build ack. +# + +use warnings; +use strict; + +our $VERSION = '1.92'; +# Check http://betterthangrep.com/ for updates + +# These are all our globals. + + +MAIN: { + if ( $App::Ack::VERSION ne $main::VERSION ) { + App::Ack::die( "Program/library version mismatch\n\t$0 is $main::VERSION\n\t$INC{'App/Ack.pm'} is $App::Ack::VERSION" ); + } + + # Do preliminary arg checking; + my $env_is_usable = 1; + for ( @ARGV ) { + last if ( $_ eq '--' ); + + # Priorities! Get the --thpppt checking out of the way. + /^--th[pt]+t+$/ && App::Ack::_thpppt($_); + + # See if we want to ignore the environment. (Don't tell Al Gore.) + if ( $_ eq '--noenv' ) { + my @keys = ( 'ACKRC', grep { /^ACK_/ } keys %ENV ); + delete @ENV{@keys}; + $env_is_usable = 0; + } + } + unshift( @ARGV, App::Ack::read_ackrc() ) if $env_is_usable; + App::Ack::load_colors(); + + if ( exists $ENV{ACK_SWITCHES} ) { + App::Ack::warn( 'ACK_SWITCHES is no longer supported. Use ACK_OPTIONS.' ); + } + + if ( !@ARGV ) { + App::Ack::show_help(); + exit 1; + } + + main(); +} + +sub main { + my $opt = App::Ack::get_command_line_options(); + + $| = 1 if $opt->{flush}; # Unbuffer the output if flush mode + + if ( App::Ack::input_from_pipe() ) { + # We're going into filter mode + for ( qw( f g l ) ) { + $opt->{$_} and App::Ack::die( "Can't use -$_ when acting as a filter." ); + } + $opt->{show_filename} = 0; + $opt->{regex} = App::Ack::build_regex( defined $opt->{regex} ? $opt->{regex} : shift @ARGV, $opt ); + if ( my $nargs = @ARGV ) { + my $s = $nargs == 1 ? '' : 's'; + App::Ack::warn( "Ignoring $nargs argument$s on the command-line while acting as a filter." ); + } + my $res = App::Ack::Resource::Basic->new( '-' ); + App::Ack::search_resource( $res, $opt ); + $res->close(); + exit 0; + } + + my $file_matching = $opt->{f} || $opt->{lines}; + if ( !$file_matching ) { + @ARGV or App::Ack::die( 'No regular expression found.' ); + $opt->{regex} = App::Ack::build_regex( defined $opt->{regex} ? $opt->{regex} : shift @ARGV, $opt ); + } + + # check that all regexes do compile fine + App::Ack::check_regex( $_ ) for ( $opt->{regex}, $opt->{G} ); + + my $what = App::Ack::get_starting_points( \@ARGV, $opt ); + my $iter = App::Ack::get_iterator( $what, $opt ); + App::Ack::filetype_setup(); + + my $nmatches = 0; + + App::Ack::set_up_pager( $opt->{pager} ) if defined $opt->{pager}; + if ( $opt->{f} ) { + $nmatches = App::Ack::print_files( $iter, $opt ); + } + elsif ( $opt->{l} || $opt->{count} ) { + $nmatches = App::Ack::print_files_with_matches( $iter, $opt ); + } + else { + $nmatches = App::Ack::print_matches( $iter, $opt ); + } + close $App::Ack::fh; + exit ($nmatches ? 0 : 1); +} + +=head1 NAME + +ack - grep-like text finder + +=head1 SYNOPSIS + + ack [options] PATTERN [FILE...] + ack -f [options] [DIRECTORY...] + +=head1 DESCRIPTION + +Ack is designed as a replacement for 99% of the uses of F. + +Ack searches the named input FILEs (or standard input if no files are +named, or the file name - is given) for lines containing a match to the +given PATTERN. By default, ack prints the matching lines. + +Ack can also list files that would be searched, without actually searching +them, to let you take advantage of ack's file-type filtering capabilities. + +=head1 FILE SELECTION + +I is intelligent about the files it searches. It knows about +certain file types, based on both the extension on the file and, +in some cases, the contents of the file. These selections can be +made with the B<--type> option. + +With no file selections, I only searches files of types that +it recognizes. If you have a file called F, and I +doesn't know what a .wango file is, I won't search it. + +The B<-a> option tells I to select all files, regardless of +type. + +Some files will never be selected by I, even with B<-a>, +including: + +=over 4 + +=item * Backup files: Files matching F<#*#> or ending with F<~>. + +=item * Coredumps: Files matching F + +=back + +However, I always searches the files given on the command line, +no matter what type. Furthermore, by specifying the B<-u> option all +files will be searched. + +=head1 DIRECTORY SELECTION + +I descends through the directory tree of the starting directories +specified. However, it will ignore the shadow directories used by +many version control systems, and the build directories used by the +Perl MakeMaker system. You may add or remove a directory from this +list with the B<--[no]ignore-dir> option. The option may be repeated +to add/remove multiple directories from the ignore list. + +For a complete list of directories that do not get searched, run +F. + +=head1 WHEN TO USE GREP + +I trumps I as an everyday tool 99% of the time, but don't +throw I away, because there are times you'll still need it. + +E.g., searching through huge files looking for regexes that can be +expressed with I syntax should be quicker with I. + +If your script or parent program uses I C<--quiet> or +C<--silent> or needs exit 2 on IO error, use I. + +=head1 OPTIONS + +=over 4 + +=item B<-a>, B<--all> + +Operate on all files, regardless of type (but still skip directories +like F, F, etc.) + +=item B<-A I>, B<--after-context=I> + +Print I lines of trailing context after matching lines. + +=item B<-B I>, B<--before-context=I> + +Print I lines of leading context before matching lines. + +=item B<-C [I]>, B<--context[=I]> + +Print I lines (default 2) of context around matching lines. + +=item B<-c>, B<--count> + +Suppress normal output; instead print a count of matching lines for +each input file. If B<-l> is in effect, it will only show the +number of lines for each file that has lines matching. Without +B<-l>, some line counts may be zeroes. + +=item B<--color>, B<--nocolor> + +B<--color> highlights the matching text. B<--nocolor> supresses +the color. This is on by default unless the output is redirected. + +On Windows, this option is off by default unless the +L module is installed or the C +environment variable is used. + +=item B<--color-filename=I> + +Sets the color to be used for filenames. + +=item B<--color-match=I> + +Sets the color to be used for matches. + +=item B<--column> + +Show the column number of the first match. This is helpful for editors +that can place your cursor at a given position. + +=item B<--env>, B<--noenv> + +B<--noenv> disables all environment processing. No F<.ackrc> is read +and all environment variables are ignored. By default, F considers +F<.ackrc> and settings in the environment. + +=item B<--flush> + +B<--flush> flushes output immediately. This is off by default +unless ack is running interactively (when output goes to a pipe +or file). + +=item B<-f> + +Only print the files that would be searched, without actually doing +any searching. PATTERN must not be specified, or it will be taken as +a path to search. + +=item B<--follow>, B<--nofollow> + +Follow or don't follow symlinks, other than whatever starting files +or directories were specified on the command line. + +This is off by default. + +=item B<-G I> + +Only paths matching I are included in the search. The entire +path and filename are matched against I, and I is a +Perl regular expression, not a shell glob. + +The options B<-i>, B<-w>, B<-v>, and B<-Q> do not apply to this I. + +=item B<-g I> + +Print files where the relative path + filename matches I. This option is +a convenience shortcut for B<-f> B<-G I>. + +The options B<-i>, B<-w>, B<-v>, and B<-Q> do not apply to this I. + +=item B<--group>, B<--nogroup> + +B<--group> groups matches by file name with. This is the default when +used interactively. + +B<--nogroup> prints one result per line, like grep. This is the default +when output is redirected. + +=item B<-H>, B<--with-filename> + +Print the filename for each match. + +=item B<-h>, B<--no-filename> + +Suppress the prefixing of filenames on output when multiple files are +searched. + +=item B<--help> + +Print a short help statement. + +=item B<-i>, B<--ignore-case> + +Ignore case in the search strings. + +This applies only to the PATTERN, not to the regexes given for the B<-g> +and B<-G> options. + +=item B<--[no]ignore-dir=DIRNAME> + +Ignore directory (as CVS, .svn, etc are ignored). May be used multiple times +to ignore multiple directories. For example, mason users may wish to include +B<--ignore-dir=data>. The B<--noignore-dir> option allows users to search +directories which would normally be ignored (perhaps to research the contents +of F<.svn/props> directories). + +=item B<--line=I> + +Only print line I of each file. Multiple lines can be given with multiple +B<--line> options or as a comma separated list (B<--line=3,5,7>). B<--line=4-7> +also works. The lines are always output in ascending order, no matter the +order given on the command line. + +=item B<-l>, B<--files-with-matches> + +Only print the filenames of matching files, instead of the matching text. + +=item B<-L>, B<--files-without-matches> + +Only print the filenames of files that do I match. This is equivalent +to specifying B<-l> and B<-v>. + +=item B<--match I> + +Specify the I explicitly. This is helpful if you don't want to put the +regex as your first argument, e.g. when executing multiple searches over the +same set of files. + + # search for foo and bar in given files + ack file1 t/file* --match foo + ack file1 t/file* --match bar + +=item B<-m=I>, B<--max-count=I> + +Stop reading a file after I matches. + +=item B<--man> + +Print this manual page. + +=item B<-n> + +No descending into subdirectories. + +=item B<-o> + +Show only the part of each line matching PATTERN (turns off text +highlighting) + +=item B<--output=I> + +Output the evaluation of I for each line (turns off text +highlighting) + +=item B<--pager=I> + +Direct ack's output through I. This can also be specified +via the C and C environment variables. + +Using --pager does not suppress grouping and coloring like piping +output on the command-line does. + +=item B<--passthru> + +Prints all lines, whether or not they match the expression. Highlighting +will still work, though, so it can be used to highlight matches while +still seeing the entire file, as in: + + # Watch a log file, and highlight a certain IP address + $ tail -f ~/access.log | ack --passthru 123.45.67.89 + +=item B<--print0> + +Only works in conjunction with -f, -g, -l or -c (filename output). The filenames +are output separated with a null byte instead of the usual newline. This is +helpful when dealing with filenames that contain whitespace, e.g. + + # remove all files of type html + ack -f --html --print0 | xargs -0 rm -f + +=item B<-Q>, B<--literal> + +Quote all metacharacters in PATTERN, it is treated as a literal. + +This applies only to the PATTERN, not to the regexes given for the B<-g> +and B<-G> options. + +=item B<--smart-case>, B<--no-smart-case> + +Ignore case in the search strings if PATTERN contains no uppercase +characters. This is similar to C in vim. This option is +off by default. + +B<-i> always overrides this option. + +This applies only to the PATTERN, not to the regexes given for the +B<-g> and B<-G> options. + +=item B<--sort-files> + +Sorts the found files lexically. Use this if you want your file +listings to be deterministic between runs of I. + +=item B<--thpppt> + +Display the all-important Bill The Cat logo. Note that the exact +spelling of B<--thpppppt> is not important. It's checked against +a regular expression. + +=item B<--type=TYPE>, B<--type=noTYPE> + +Specify the types of files to include or exclude from a search. +TYPE is a filetype, like I or I. B<--type=perl> can +also be specified as B<--perl>, and B<--type=noperl> can be done +as B<--noperl>. + +If a file is of both type "foo" and "bar", specifying --foo and +--nobar will exclude the file, because an exclusion takes precedence +over an inclusion. + +Type specifications can be repeated and are ORed together. + +See I for a list of valid types. + +=item B<--type-add I=I<.EXTENSION>[,I<.EXT2>[,...]]> + +Files with the given EXTENSION(s) are recognized as being of (the +existing) type TYPE. See also L. + + +=item B<--type-set I=I<.EXTENSION>[,I<.EXT2>[,...]]> + +Files with the given EXTENSION(s) are recognized as being of type +TYPE. This replaces an existing definition for type TYPE. See also +L. + +=item B<-u>, B<--unrestricted> + +All files and directories (including blib/, core.*, ...) are searched, +nothing is skipped. When both B<-u> and B<--ignore-dir> are used, the +B<--ignore-dir> option has no effect. + +=item B<-v>, B<--invert-match> + +Invert match: select non-matching lines + +This applies only to the PATTERN, not to the regexes given for the B<-g> +and B<-G> options. + +=item B<--version> + +Display version and copyright information. + +=item B<-w>, B<--word-regexp> + +Force PATTERN to match only whole words. The PATTERN is wrapped with +C<\b> metacharacters. + +This applies only to the PATTERN, not to the regexes given for the B<-g> +and B<-G> options. + +=item B<-1> + +Stops after reporting first match of any kind. This is different +from B<--max-count=1> or B<-m1>, where only one match per file is +shown. Also, B<-1> works with B<-f> and B<-g>, where B<-m> does +not. + +=back + +=head1 THE .ackrc FILE + +The F<.ackrc> file contains command-line options that are prepended +to the command line before processing. Multiple options may live +on multiple lines. Lines beginning with a # are ignored. A F<.ackrc> +might look like this: + + # Always sort the files + --sort-files + + # Always color, even if piping to a another program + --color + + # Use "less -r" as my pager + --pager=less -r + +Note that arguments with spaces in them do not need to be quoted, +as they are not interpreted by the shell. Basically, each I +in the F<.ackrc> file is interpreted as one element of C<@ARGV>. + +F looks in your home directory for the F<.ackrc>. You can +specify another location with the F variable, below. + +If B<--noenv> is specified on the command line, the F<.ackrc> file +is ignored. + +=head1 Defining your own types + +ack allows you to define your own types in addition to the predefined +types. This is done with command line options that are best put into +an F<.ackrc> file - then you do not have to define your types over and +over again. In the following examples the options will always be shown +on one command line so that they can be easily copy & pasted. + +I searches for foo in all perl files. I +tells you, that perl files are files ending +in .pl, .pm, .pod or .t. So what if you would like to include .xs +files as well when searching for --perl files? I +does this for you. B<--type-add> appends +additional extensions to an existing type. + +If you want to define a new type, or completely redefine an existing +type, then use B<--type-set>. I defines the type I to include files with +the extensions .e or .eiffel. So to search for all eiffel files +containing the word Bertrand use I. +As usual, you can also write B<--type=eiffel> +instead of B<--eiffel>. Negation also works, so B<--noeiffel> excludes +all eiffel files from a search. Redefining also works: I +and I<.xs> files no longer belong to the type I. + +When defining your own types in the F<.ackrc> file you have to use +the following: + + --type-set=eiffel=.e,.eiffel + +or writing on separate lines + + --type-set + eiffel=.e,.eiffel + +The following does B work in the F<.ackrc> file: + + --type-set eiffel=.e,.eiffel + + +In order to see all currently defined types, use I<--help types>, e.g. +I + +Restrictions: + +=over 4 + +=item + +The types 'skipped', 'make', 'binary' and 'text' are considered "builtin" and +cannot be altered. + +=item + +The shebang line recognition of the types 'perl', 'ruby', 'php', 'python', +'shell' and 'xml' cannot be redefined by I<--type-set>, it is always +active. However, the shebang line is only examined for files where the +extension is not recognised. Therefore it is possible to say +I and +only find your shiny new I<.perl> files (and all files with unrecognized extension +and perl on the shebang line). + +=back + +=head1 ENVIRONMENT VARIABLES + +For commonly-used ack options, environment variables can make life much easier. +These variables are ignored if B<--noenv> is specified on the command line. + +=over 4 + +=item ACKRC + +Specifies the location of the F<.ackrc> file. If this file doesn't +exist, F looks in the default location. + +=item ACK_OPTIONS + +This variable specifies default options to be placed in front of +any explicit options on the command line. + +=item ACK_COLOR_FILENAME + +Specifies the color of the filename when it's printed in B<--group> +mode. By default, it's "bold green". + +The recognized attributes are clear, reset, dark, bold, underline, +underscore, blink, reverse, concealed black, red, green, yellow, +blue, magenta, on_black, on_red, on_green, on_yellow, on_blue, +on_magenta, on_cyan, and on_white. Case is not significant. +Underline and underscore are equivalent, as are clear and reset. +The color alone sets the foreground color, and on_color sets the +background color. + +This option can also be set with B<--color-filename>. + +=item ACK_COLOR_MATCH + +Specifies the color of the matching text when printed in B<--color> +mode. By default, it's "black on_yellow". + +This option can also be set with B<--color-match>. + +See B for the color specifications. + +=item ACK_PAGER + +Specifies a pager program, such as C, C or C, to which +ack will send its output. + +Using C does not suppress grouping and coloring like +piping output on the command-line does, except that on Windows +ack will assume that C does not support color. + +C overrides C if both are specified. + +=item ACK_PAGER_COLOR + +Specifies a pager program that understands ANSI color sequences. +Using C does not suppress grouping and coloring +like piping output on the command-line does. + +If you are not on Windows, you never need to use C. + +=back + +=head1 ACK & OTHER TOOLS + +=head2 Vim integration + +F integrates easily with the Vim text editor. Set this in your +F<.vimrc> to use F instead of F: + + set grepprg=ack\ -a + +That examples uses C<-a> to search through all files, but you may +use other default flags. Now you can search with F and easily +step through the results in Vim: + + :grep Dumper perllib + +=head2 Emacs integration + +Phil Jackson put together an F extension that "provides a +simple compilation mode ... has the ability to guess what files you +want to search for based on the major-mode." + +L + +=head2 TextMate integration + +Pedro Melo is a TextMate user who writes "I spend my day mostly +inside TextMate, and the built-in find-in-project sucks with large +projects. So I hacked a TextMate command that was using find + +grep to use ack. The result is the Search in Project with ack, and +you can find it here: +L" + +=head2 Shell and Return Code + +For greater compatibility with I, I in normal use returns +shell return or exit code of 0 only if something is found and 1 if +no match is found. + +(Shell exit code 1 is C<$?=256> in perl with C or backticks.) + +The I code 2 for errors is not used. + +If C<-f> or C<-g> are specified, then 0 is returned if at least one +file is found. If no files are found, then 1 is returned. + +=cut + +=head1 DEBUGGING ACK PROBLEMS + +If ack gives you output you're not expecting, start with a few simple steps. + +=head2 Use B<--noenv> + +Your environment variables and F<.ackrc> may be doing things you're +not expecting, or forgotten you specified. Use B<--noenv> to ignore +your environment and F<.ackrc>. + +=head2 Use B<-f> to see what files you're scanning + +The reason I created B<-f> in the first place was as a debugging +tool. If ack is not finding matches you think it should find, run +F to see what files are being checked. + +=head1 TIPS + +=head2 Use the F<.ackrc> file. + +The F<.ackrc> is the place to put all your options you use most of +the time but don't want to remember. Put all your --type-add and +--type-set definitions in it. If you like --smart-case, set it +there, too. I also set --sort-files there. + +=head2 Use F<-f> for working with big codesets + +Ack does more than search files. C will create a +list of all the Perl files in a tree, ideal for sending into F. +For example: + + # Change all "this" to "that" in all Perl files in a tree. + ack -f --perl | xargs perl -p -i -e's/this/that/g' + +or if you prefer: + + perl -p -i -e's/this/thatg/' $(ack -f --perl) + +=head2 Use F<-Q> when in doubt about metacharacters + +If you're searching for something with a regular expression +metacharacter, most often a period in a filename or IP address, add +the -Q to avoid false positives without all the backslashing. See +the following example for more... + +=head2 Use ack to watch log files + +Here's one I used the other day to find trouble spots for a website +visitor. The user had a problem loading F, so I +took the access log and scanned it with ack twice. + + ack -Q aa.bb.cc.dd /path/to/access.log | ack -Q -B5 troublesome.gif + +The first ack finds only the lines in the Apache log for the given +IP. The second finds the match on my troublesome GIF, and shows +the previous five lines from the log in each case. + +=head2 Share your knowledge + +Join the ack-users mailing list. Send me your tips and I may add +them here. + +=head1 FAQ + +=head2 Why isn't ack finding a match in (some file)? + +Probably because it's of a type that ack doesn't recognize. + +ack's searching behavior is driven by filetype. If ack doesn't +know what kind of file it is, ack ignores it. + +If you want ack to search files that it doesn't recognize, use the +C<-a> switch. + +If you want ack to search every file, even ones that it always +ignores like coredumps and backup files, use the C<-u> switch. + +=head2 Why does ack ignore unknown files by default? + +ack is designed by a programmer, for programmers, for searching +large trees of code. Most codebases have a lot files in them which +aren't source files (like compiled object files, source control +metadata, etc), and grep wastes a lot of time searching through all +of those as well and returning matches from those files. + +That's why ack's behavior of not searching things it doesn't recognize +is one of its greatest strengths: the speed you get from only +searching the things that you want to be looking at. + +=head2 Wouldn't it be great if F did search & replace? + +No, ack will always be read-only. Perl has a perfectly good way +to do search & replace in files, using the C<-i>, C<-p> and C<-n> +switches. + +You can certainly use ack to select your files to update. For +example, to change all "foo" to "bar" in all PHP files, you can do +this form the Unix shell: + + $ perl -i -p -e's/foo/bar/g' $(ack -f --php) + +=head2 Can you make ack recognize F<.xyz> files? + +That's an enhancement. Please see the section in the manual about +enhancements. + +=head2 There's already a program/package called ack. + +Yes, I know. + +=head2 Why is it called ack if it's called ack-grep? + +The name of the program is "ack". Some packagers have called it +"ack-grep" when creating packages because there's already a package +out there called "ack" that has nothing to do with this ack. + +I suggest you rename your ack-grep install to "ack" because one of +the crucial benefits of ack is having a name that's so short and +simple to type. + +=head1 AUTHOR + +Andy Lester, C<< >> + +=head1 BUGS + +Please report any bugs or feature requests to the issues list at +Github: L + +=head1 ENHANCEMENTS + +All enhancement requests MUST first be posted to the ack-users +mailing list at L. I +will not consider a request without it first getting seen by other +ack users. This includes requests for new filetypes. + +There is a list of enhancements I want to make to F in the ack +issues list at Github: L + +Patches are always welcome, but patches with tests get the most +attention. + +=head1 SUPPORT + +Support for and information about F can be found at: + +=over 4 + +=item * The ack homepage + +L + +=item * The ack issues list at Github + +L + +=item * AnnoCPAN: Annotated CPAN documentation + +L + +=item * CPAN Ratings + +L + +=item * Search CPAN + +L + +=item * Git source repository + +L + +=back + +=head1 ACKNOWLEDGEMENTS + +How appropriate to have Inowledgements! + +Thanks to everyone who has contributed to ack in any way, including +Packy Anderson, +JR Boyens, +Dan Sully, +Ryan Niebur, +Kent Fredric, +Mike Morearty, +Ingmar Vanhassel, +Eric Van Dewoestine, +Sitaram Chamarty, +Adam James, +Richard Carlsson, +Pedro Melo, +AJ Schuster, +Phil Jackson, +Michael Schwern, +Jan Dubois, +Christopher J. Madsen, +Matthew Wickline, +David Dyck, +Jason Porritt, +Jjgod Jiang, +Thomas Klausner, +Uri Guttman, +Peter Lewis, +Kevin Riggle, +Ori Avtalion, +Torsten Blix, +Nigel Metheringham, +GEbor SzabE, +Tod Hagan, +Michael Hendricks, +Evar ArnfjErE Bjarmason, +Piers Cawley, +Stephen Steneker, +Elias Lutfallah, +Mark Leighton Fisher, +Matt Diephouse, +Christian Jaeger, +Bill Sully, +Bill Ricker, +David Golden, +Nilson Santos F. Jr, +Elliot Shank, +Merijn Broeren, +Uwe Voelker, +Rick Scott, +Ask BjErn Hansen, +Jerry Gay, +Will Coleda, +Mike O'Regan, +Slaven ReziE<0x107>, +Mark Stosberg, +David Alan Pisoni, +Adriano Ferreira, +James Keenan, +Leland Johnson, +Ricardo Signes +and Pete Krawczyk. + +=head1 COPYRIGHT & LICENSE + +Copyright 2005-2009 Andy Lester. + +This program is free software; you can redistribute it and/or modify +it under the terms of either: + +=over 4 + +=item * the GNU General Public License as published by the Free +Software Foundation; either version 1, or (at your option) any later +version, or + +=item * the Artistic License version 2.0. + +=back + +=cut +package File::Next; + +use strict; +use warnings; + + +our $VERSION = '1.06'; + + + +use File::Spec (); + + +our $name; # name of the current file +our $dir; # dir of the current file + +our %files_defaults; +our %skip_dirs; + +BEGIN { + %files_defaults = ( + file_filter => undef, + descend_filter => undef, + error_handler => sub { CORE::die @_ }, + sort_files => undef, + follow_symlinks => 1, + ); + %skip_dirs = map {($_,1)} (File::Spec->curdir, File::Spec->updir); +} + + +sub files { + ($_[0] eq __PACKAGE__) && die 'File::Next::files must not be invoked as File::Next->files'; + + my ($parms,@queue) = _setup( \%files_defaults, @_ ); + my $filter = $parms->{file_filter}; + + return sub { + while (@queue) { + my ($dir,$file,$fullpath) = splice( @queue, 0, 3 ); + if ( -f $fullpath ) { + if ( $filter ) { + local $_ = $file; + local $File::Next::dir = $dir; + local $File::Next::name = $fullpath; + next if not $filter->(); + } + return wantarray ? ($dir,$file,$fullpath) : $fullpath; + } + elsif ( -d _ ) { + unshift( @queue, _candidate_files( $parms, $fullpath ) ); + } + } # while + + return; + }; # iterator +} + + + + + + + +sub sort_standard($$) { return $_[0]->[1] cmp $_[1]->[1] } +sub sort_reverse($$) { return $_[1]->[1] cmp $_[0]->[1] } + +sub reslash { + my $path = shift; + + my @parts = split( /\//, $path ); + + return $path if @parts < 2; + + return File::Spec->catfile( @parts ); +} + + + +sub _setup { + my $defaults = shift; + my $passed_parms = ref $_[0] eq 'HASH' ? {%{+shift}} : {}; # copy parm hash + + my %passed_parms = %{$passed_parms}; + + my $parms = {}; + for my $key ( keys %{$defaults} ) { + $parms->{$key} = + exists $passed_parms{$key} + ? delete $passed_parms{$key} + : $defaults->{$key}; + } + + # Any leftover keys are bogus + for my $badkey ( keys %passed_parms ) { + my $sub = (caller(1))[3]; + $parms->{error_handler}->( "Invalid option passed to $sub(): $badkey" ); + } + + # If it's not a code ref, assume standard sort + if ( $parms->{sort_files} && ( ref($parms->{sort_files}) ne 'CODE' ) ) { + $parms->{sort_files} = \&sort_standard; + } + my @queue; + + for ( @_ ) { + my $start = reslash( $_ ); + if (-d $start) { + push @queue, ($start,undef,$start); + } + else { + push @queue, (undef,$start,$start); + } + } + + return ($parms,@queue); +} + + +sub _candidate_files { + my $parms = shift; + my $dir = shift; + + my $dh; + if ( !opendir $dh, $dir ) { + $parms->{error_handler}->( "$dir: $!" ); + return; + } + + my @newfiles; + my $descend_filter = $parms->{descend_filter}; + my $follow_symlinks = $parms->{follow_symlinks}; + my $sort_sub = $parms->{sort_files}; + + for my $file ( grep { !exists $skip_dirs{$_} } readdir $dh ) { + my $has_stat; + + # Only do directory checking if we have a descend_filter + my $fullpath = File::Spec->catdir( $dir, $file ); + if ( !$follow_symlinks ) { + next if -l $fullpath; + $has_stat = 1; + } + + if ( $descend_filter ) { + if ( $has_stat ? (-d _) : (-d $fullpath) ) { + local $File::Next::dir = $fullpath; + local $_ = $file; + next if not $descend_filter->(); + } + } + if ( $sort_sub ) { + push( @newfiles, [ $dir, $file, $fullpath ] ); + } + else { + push( @newfiles, $dir, $file, $fullpath ); + } + } + closedir $dh; + + if ( $sort_sub ) { + return map { @{$_} } sort $sort_sub @newfiles; + } + + return @newfiles; +} + + +1; # End of File::Next +package App::Ack; + +use warnings; +use strict; + + + + +our $VERSION; +our $COPYRIGHT; +BEGIN { + $VERSION = '1.92'; + $COPYRIGHT = 'Copyright 2005-2009 Andy Lester.'; +} + +our $fh; + +BEGIN { + $fh = *STDOUT; +} + + +our %types; +our %type_wanted; +our %mappings; +our %ignore_dirs; + +our $input_from_pipe; +our $output_to_pipe; + +our $dir_sep_chars; +our $is_cygwin; +our $is_windows; + +use File::Spec (); +use File::Glob ':glob'; +use Getopt::Long (); + +BEGIN { + %ignore_dirs = ( + '.bzr' => 'Bazaar', + '.cdv' => 'Codeville', + '~.dep' => 'Interface Builder', + '~.dot' => 'Interface Builder', + '~.nib' => 'Interface Builder', + '~.plst' => 'Interface Builder', + '.git' => 'Git', + '.hg' => 'Mercurial', + '.pc' => 'quilt', + '.svn' => 'Subversion', + blib => 'Perl module building', + CVS => 'CVS', + RCS => 'RCS', + SCCS => 'SCCS', + _darcs => 'darcs', + _sgbak => 'Vault/Fortress', + 'autom4te.cache' => 'autoconf', + 'cover_db' => 'Devel::Cover', + _build => 'Module::Build', + ); + + %mappings = ( + actionscript => [qw( as mxml )], + ada => [qw( ada adb ads )], + asm => [qw( asm s )], + batch => [qw( bat cmd )], + binary => q{Binary files, as defined by Perl's -B op (default: off)}, + cc => [qw( c h xs )], + cfmx => [qw( cfc cfm cfml )], + cpp => [qw( cpp cc cxx m hpp hh h hxx )], + csharp => [qw( cs )], + css => [qw( css )], + elisp => [qw( el )], + erlang => [qw( erl hrl )], + fortran => [qw( f f77 f90 f95 f03 for ftn fpp )], + haskell => [qw( hs lhs )], + hh => [qw( h )], + html => [qw( htm html shtml xhtml )], + java => [qw( java properties )], + js => [qw( js )], + jsp => [qw( jsp jspx jhtm jhtml )], + lisp => [qw( lisp lsp )], + lua => [qw( lua )], + make => q{Makefiles}, + mason => [qw( mas mhtml mpl mtxt )], + objc => [qw( m h )], + objcpp => [qw( mm h )], + ocaml => [qw( ml mli )], + parrot => [qw( pir pasm pmc ops pod pg tg )], + perl => [qw( pl pm pod t )], + php => [qw( php phpt php3 php4 php5 phtml)], + plone => [qw( pt cpt metadata cpy py )], + python => [qw( py )], + rake => q{Rakefiles}, + ruby => [qw( rb rhtml rjs rxml erb rake )], + scala => [qw( scala )], + scheme => [qw( scm ss )], + shell => [qw( sh bash csh tcsh ksh zsh )], + skipped => q{Files, but not directories, normally skipped by ack (default: off)}, + smalltalk => [qw( st )], + sql => [qw( sql ctl )], + tcl => [qw( tcl itcl itk )], + tex => [qw( tex cls sty )], + text => q{Text files, as defined by Perl's -T op (default: off)}, + tt => [qw( tt tt2 ttml )], + vb => [qw( bas cls frm ctl vb resx )], + vim => [qw( vim )], + yaml => [qw( yaml yml )], + xml => [qw( xml dtd xslt ent )], + ); + + while ( my ($type,$exts) = each %mappings ) { + if ( ref $exts ) { + for my $ext ( @{$exts} ) { + push( @{$types{$ext}}, $type ); + } + } + } + + # These have to be checked before any filehandle diddling. + $output_to_pipe = not -t *STDOUT; + $input_from_pipe = -p STDIN; + + $is_cygwin = ($^O eq 'cygwin'); + $is_windows = ($^O =~ /MSWin32/); + $dir_sep_chars = $is_windows ? quotemeta( '\\/' ) : quotemeta( File::Spec->catfile( '', '' ) ); +} + + +sub read_ackrc { + my @files = ( $ENV{ACKRC} ); + my @dirs = + $is_windows + ? ( $ENV{HOME}, $ENV{USERPROFILE} ) + : ( '~', $ENV{HOME} ); + for my $dir ( grep { defined } @dirs ) { + for my $file ( '.ackrc', '_ackrc' ) { + push( @files, bsd_glob( "$dir/$file", GLOB_TILDE ) ); + } + } + for my $filename ( @files ) { + if ( defined $filename && -e $filename ) { + open( my $fh, '<', $filename ) or App::Ack::die( "$filename: $!\n" ); + my @lines = grep { /./ && !/^\s*#/ } <$fh>; + chomp @lines; + close $fh or App::Ack::die( "$filename: $!\n" ); + + return @lines; + } + } + + return; +} + + +sub get_command_line_options { + my %opt = ( + pager => $ENV{ACK_PAGER_COLOR} || $ENV{ACK_PAGER}, + ); + + my $getopt_specs = { + 1 => sub { $opt{1} = $opt{m} = 1 }, + 'A|after-context=i' => \$opt{after_context}, + 'B|before-context=i' => \$opt{before_context}, + 'C|context:i' => sub { shift; my $val = shift; $opt{before_context} = $opt{after_context} = ($val || 2) }, + 'a|all-types' => \$opt{all}, + 'break!' => \$opt{break}, + c => \$opt{count}, + 'color|colour!' => \$opt{color}, + 'color-match=s' => \$ENV{ACK_COLOR_MATCH}, + 'color-filename=s' => \$ENV{ACK_COLOR_FILENAME}, + 'column!' => \$opt{column}, + count => \$opt{count}, + 'env!' => sub { }, # ignore this option, it is handled beforehand + f => \$opt{f}, + flush => \$opt{flush}, + 'follow!' => \$opt{follow}, + 'g=s' => sub { shift; $opt{G} = shift; $opt{f} = 1 }, + 'G=s' => \$opt{G}, + 'group!' => sub { shift; $opt{heading} = $opt{break} = shift }, + 'heading!' => \$opt{heading}, + 'h|no-filename' => \$opt{h}, + 'H|with-filename' => \$opt{H}, + 'i|ignore-case' => \$opt{i}, + 'lines=s' => sub { shift; my $val = shift; push @{$opt{lines}}, $val }, + 'l|files-with-matches' => \$opt{l}, + 'L|files-without-matches' => sub { $opt{l} = $opt{v} = 1 }, + 'm|max-count=i' => \$opt{m}, + 'match=s' => \$opt{regex}, + 'n|no-recurse' => \$opt{n}, + o => sub { $opt{output} = '$&' }, + 'output=s' => \$opt{output}, + 'pager=s' => \$opt{pager}, + 'nopager' => sub { $opt{pager} = undef }, + 'passthru' => \$opt{passthru}, + 'print0' => \$opt{print0}, + 'Q|literal' => \$opt{Q}, + 'r|R|recurse' => sub {}, + 'smart-case!' => \$opt{smart_case}, + 'sort-files' => \$opt{sort_files}, + 'u|unrestricted' => \$opt{u}, + 'v|invert-match' => \$opt{v}, + 'w|word-regexp' => \$opt{w}, + + 'ignore-dirs=s' => sub { shift; my $dir = remove_dir_sep( shift ); $ignore_dirs{$dir} = '--ignore-dirs' }, + 'noignore-dirs=s' => sub { shift; my $dir = remove_dir_sep( shift ); delete $ignore_dirs{$dir} }, + + 'version' => sub { print_version_statement(); exit 1; }, + 'help|?:s' => sub { shift; show_help(@_); exit; }, + 'help-types'=> sub { show_help_types(); exit; }, + 'man' => sub { require Pod::Usage; Pod::Usage::pod2usage({-verbose => 2}); exit; }, + + 'type=s' => sub { + # Whatever --type=xxx they specify, set it manually in the hash + my $dummy = shift; + my $type = shift; + my $wanted = ($type =~ s/^no//) ? 0 : 1; # must not be undef later + + if ( exists $type_wanted{ $type } ) { + $type_wanted{ $type } = $wanted; + } + else { + App::Ack::die( qq{Unknown --type "$type"} ); + } + }, # type sub + }; + + # Stick any default switches at the beginning, so they can be overridden + # by the command line switches. + unshift @ARGV, split( ' ', $ENV{ACK_OPTIONS} ) if defined $ENV{ACK_OPTIONS}; + + # first pass through options, looking for type definitions + def_types_from_ARGV(); + + for my $i ( filetypes_supported() ) { + $getopt_specs->{ "$i!" } = \$type_wanted{ $i }; + } + + + my $parser = Getopt::Long::Parser->new(); + $parser->configure( 'bundling', 'no_ignore_case', ); + $parser->getoptions( %{$getopt_specs} ) or + App::Ack::die( 'See ack --help, ack --help-types or ack --man for options.' ); + + my $to_screen = not output_to_pipe(); + my %defaults = ( + all => 0, + color => $to_screen, + follow => 0, + break => $to_screen, + heading => $to_screen, + before_context => 0, + after_context => 0, + ); + if ( $is_windows && $defaults{color} && not $ENV{ACK_PAGER_COLOR} ) { + if ( $ENV{ACK_PAGER} || not eval { require Win32::Console::ANSI } ) { + $defaults{color} = 0; + } + } + if ( $to_screen && $ENV{ACK_PAGER_COLOR} ) { + $defaults{color} = 1; + } + + while ( my ($key,$value) = each %defaults ) { + if ( not defined $opt{$key} ) { + $opt{$key} = $value; + } + } + + if ( defined $opt{m} && $opt{m} <= 0 ) { + App::Ack::die( '-m must be greater than zero' ); + } + + for ( qw( before_context after_context ) ) { + if ( defined $opt{$_} && $opt{$_} < 0 ) { + App::Ack::die( "--$_ may not be negative" ); + } + } + + if ( defined( my $val = $opt{output} ) ) { + $opt{output} = eval qq[ sub { "$val" } ]; + } + if ( defined( my $l = $opt{lines} ) ) { + # --line=1 --line=5 is equivalent to --line=1,5 + my @lines = split( /,/, join( ',', @{$l} ) ); + + # --line=1-3 is equivalent to --line=1,2,3 + @lines = map { + my @ret; + if ( /-/ ) { + my ($from, $to) = split /-/, $_; + if ( $from > $to ) { + App::Ack::warn( "ignoring --line=$from-$to" ); + @ret = (); + } + else { + @ret = ( $from .. $to ); + } + } + else { + @ret = ( $_ ); + }; + @ret + } @lines; + + if ( @lines ) { + my %uniq; + @uniq{ @lines } = (); + $opt{lines} = [ sort { $a <=> $b } keys %uniq ]; # numerical sort and each line occurs only once! + } + else { + # happens if there are only ignored --line directives + App::Ack::die( 'All --line options are invalid.' ); + } + } + + return \%opt; +} + + +sub def_types_from_ARGV { + my @typedef; + + my $parser = Getopt::Long::Parser->new(); + # pass_through => leave unrecognized command line arguments alone + # no_auto_abbrev => otherwise -c is expanded and not left alone + $parser->configure( 'no_ignore_case', 'pass_through', 'no_auto_abbrev' ); + $parser->getoptions( + 'type-set=s' => sub { shift; push @typedef, ['c', shift] }, + 'type-add=s' => sub { shift; push @typedef, ['a', shift] }, + ) or App::Ack::die( 'See ack --help or ack --man for options.' ); + + for my $td (@typedef) { + my ($type, $ext) = split /=/, $td->[1]; + + if ( $td->[0] eq 'c' ) { + # type-set + if ( exists $mappings{$type} ) { + # can't redefine types 'make', 'skipped', 'text' and 'binary' + App::Ack::die( qq{--type-set: Builtin type "$type" cannot be changed.} ) + if ref $mappings{$type} ne 'ARRAY'; + + delete_type($type); + } + } + else { + # type-add + + # can't append to types 'make', 'skipped', 'text' and 'binary' + App::Ack::die( qq{--type-add: Builtin type "$type" cannot be changed.} ) + if exists $mappings{$type} && ref $mappings{$type} ne 'ARRAY'; + + App::Ack::warn( qq{--type-add: Type "$type" does not exist, creating with "$ext" ...} ) + unless exists $mappings{$type}; + } + + my @exts = split /,/, $ext; + s/^\.// for @exts; + + if ( !exists $mappings{$type} || ref($mappings{$type}) eq 'ARRAY' ) { + push @{$mappings{$type}}, @exts; + for my $e ( @exts ) { + push @{$types{$e}}, $type; + } + } + else { + App::Ack::die( qq{Cannot append to type "$type".} ); + } + } + + return; +} + + +sub delete_type { + my $type = shift; + + App::Ack::die( qq{Internal error: Cannot delete builtin type "$type".} ) + unless ref $mappings{$type} eq 'ARRAY'; + + delete $mappings{$type}; + delete $type_wanted{$type}; + for my $ext ( keys %types ) { + $types{$ext} = [ grep { $_ ne $type } @{$types{$ext}} ]; + } +} + + +sub ignoredir_filter { + return !exists $ignore_dirs{$_}; +} + + +sub remove_dir_sep { + my $path = shift; + $path =~ s/[$dir_sep_chars]$//; + + return $path; +} + + +use constant TEXT => 'text'; + +sub filetypes { + my $filename = shift; + + my $basename = $filename; + $basename =~ s{.*[$dir_sep_chars]}{}; + + return 'skipped' unless is_searchable( $basename ); + + my $lc_basename = lc $basename; + return ('make',TEXT) if $lc_basename eq 'makefile'; + return ('rake','ruby',TEXT) if $lc_basename eq 'rakefile'; + + # If there's an extension, look it up + if ( $filename =~ m{\.([^\.$dir_sep_chars]+)$}o ) { + my $ref = $types{lc $1}; + return (@{$ref},TEXT) if $ref; + } + + # At this point, we can't tell from just the name. Now we have to + # open it and look inside. + + return unless -e $filename; + # From Elliot Shank: + # I can't see any reason that -r would fail on these-- the ACLs look + # fine, and no program has any of them open, so the busted Windows + # file locking model isn't getting in there. If I comment the if + # statement out, everything works fine + # So, for cygwin, don't bother trying to check for readability. + if ( !$is_cygwin ) { + if ( !-r $filename ) { + App::Ack::warn( "$filename: Permission denied" ); + return; + } + } + + return 'binary' if -B $filename; + + # If there's no extension, or we don't recognize it, check the shebang line + my $fh; + if ( !open( $fh, '<', $filename ) ) { + App::Ack::warn( "$filename: $!" ); + return; + } + my $header = <$fh>; + close $fh; + + if ( $header =~ /^#!/ ) { + return ($1,TEXT) if $header =~ /\b(ruby|p(?:erl|hp|ython))\b/; + return ('shell',TEXT) if $header =~ /\b(?:ba|t?c|k|z)?sh\b/; + } + else { + return ('xml',TEXT) if $header =~ /\Q{Q}; + if ( $opt->{w} ) { + $str = "\\b$str" if $str =~ /^\w/; + $str = "$str\\b" if $str =~ /\w$/; + } + + my $regex_is_lc = $str eq lc $str; + if ( $opt->{i} || ($opt->{smart_case} && $regex_is_lc) ) { + $str = "(?i)$str"; + } + + return $str; +} + + +sub check_regex { + my $regex = shift; + + return unless defined $regex; + + eval { qr/$regex/ }; + if ($@) { + (my $error = $@) =~ s/ at \S+ line \d+.*//; + chomp($error); + App::Ack::die( "Invalid regex '$regex':\n $error" ); + } + + return; +} + + + + +sub warn { + return CORE::warn( _my_program(), ': ', @_, "\n" ); +} + + +sub die { + return CORE::die( _my_program(), ': ', @_, "\n" ); +} + +sub _my_program { + require File::Basename; + return File::Basename::basename( $0 ); +} + + + +sub filetypes_supported { + return keys %mappings; +} + +sub _get_thpppt { + my $y = q{_ /|,\\'!.x',=(www)=, U }; + $y =~ tr/,x!w/\nOo_/; + return $y; +} + +sub _thpppt { + my $y = _get_thpppt(); + App::Ack::print( "$y ack $_[0]!\n" ); + exit 0; +} + +sub _key { + my $str = lc shift; + $str =~ s/[^a-z]//g; + + return $str; +} + + +sub show_help { + my $help_arg = shift || 0; + + return show_help_types() if $help_arg =~ /^types?/; + + my $ignore_dirs = _listify( sort { _key($a) cmp _key($b) } keys %ignore_dirs ); + + App::Ack::print( <<"END_OF_HELP" ); +Usage: ack [OPTION]... PATTERN [FILE] + +Search for PATTERN in each source file in the tree from cwd on down. +If [FILES] is specified, then only those files/directories are checked. +ack may also search STDIN, but only if no FILE are specified, or if +one of FILES is "-". + +Default switches may be specified in ACK_OPTIONS environment variable or +an .ackrc file. If you want no dependency on the environment, turn it +off with --noenv. + +Example: ack -i select + +Searching: + -i, --ignore-case Ignore case distinctions in PATTERN + --[no]smart-case Ignore case distinctions in PATTERN, + only if PATTERN contains no upper case + Ignored if -i is specified + -v, --invert-match Invert match: select non-matching lines + -w, --word-regexp Force PATTERN to match only whole words + -Q, --literal Quote all metacharacters; PATTERN is literal + +Search output: + --line=NUM Only print line(s) NUM of each file + -l, --files-with-matches + Only print filenames containing matches + -L, --files-without-matches + Only print filenames with no matches + -o Show only the part of a line matching PATTERN + (turns off text highlighting) + --passthru Print all lines, whether matching or not + --output=expr Output the evaluation of expr for each line + (turns off text highlighting) + --match PATTERN Specify PATTERN explicitly. + -m, --max-count=NUM Stop searching in each file after NUM matches + -1 Stop searching after one match of any kind + -H, --with-filename Print the filename for each match + -h, --no-filename Suppress the prefixing filename on output + -c, --count Show number of lines matching per file + --column Show the column number of the first match + + -A NUM, --after-context=NUM + Print NUM lines of trailing context after matching + lines. + -B NUM, --before-context=NUM + Print NUM lines of leading context before matching + lines. + -C [NUM], --context[=NUM] + Print NUM lines (default 2) of output context. + + --print0 Print null byte as separator between filenames, + only works with -f, -g, -l, -L or -c. + +File presentation: + --pager=COMMAND Pipes all ack output through COMMAND. For example, + --pager="less -R". Ignored if output is redirected. + --nopager Do not send output through a pager. Cancels any + setting in ~/.ackrc, ACK_PAGER or ACK_PAGER_COLOR. + --[no]heading Print a filename heading above each file's results. + (default: on when used interactively) + --[no]break Print a break between results from different files. + (default: on when used interactively) + --group Same as --heading --break + --nogroup Same as --noheading --nobreak + --[no]color Highlight the matching text (default: on unless + output is redirected, or on Windows) + --[no]colour Same as --[no]color + --color-filename=COLOR + --color-match=COLOR Set the color for matches and filenames. + --flush Flush output immediately, even when ack is used + non-interactively (when output goes to a pipe or + file). + +File finding: + -f Only print the files found, without searching. + The PATTERN must not be specified. + -g REGEX Same as -f, but only print files matching REGEX. + --sort-files Sort the found files lexically. + +File inclusion/exclusion: + -a, --all-types All file types searched; + Ignores CVS, .svn and other ignored directories + -u, --unrestricted All files and directories searched + --[no]ignore-dir=name Add/Remove directory from the list of ignored dirs + -r, -R, --recurse Recurse into subdirectories (ack's default behavior) + -n, --no-recurse No descending into subdirectories + -G REGEX Only search files that match REGEX + + --perl Include only Perl files. + --type=perl Include only Perl files. + --noperl Exclude Perl files. + --type=noperl Exclude Perl files. + See "ack --help type" for supported filetypes. + + --type-set TYPE=.EXTENSION[,.EXT2[,...]] + Files with the given EXTENSION(s) are recognized as + being of type TYPE. This replaces an existing + definition for type TYPE. + --type-add TYPE=.EXTENSION[,.EXT2[,...]] + Files with the given EXTENSION(s) are recognized as + being of (the existing) type TYPE + + --[no]follow Follow symlinks. Default is off. + + Directories ignored by default: + $ignore_dirs + + Files not checked for type: + /~\$/ - Unix backup files + /#.+#\$/ - Emacs swap files + /[._].*\\.swp\$/ - Vi(m) swap files + /core\\.\\d+\$/ - core dumps + +Miscellaneous: + --noenv Ignore environment variables and ~/.ackrc + --help This help + --man Man page + --version Display version & copyright + --thpppt Bill the Cat + +Exit status is 0 if match, 1 if no match. + +This is version $VERSION of ack. +END_OF_HELP + + return; + } + + + +sub show_help_types { + App::Ack::print( <<'END_OF_HELP' ); +Usage: ack [OPTION]... PATTERN [FILES] + +The following is the list of filetypes supported by ack. You can +specify a file type with the --type=TYPE format, or the --TYPE +format. For example, both --type=perl and --perl work. + +Note that some extensions may appear in multiple types. For example, +.pod files are both Perl and Parrot. + +END_OF_HELP + + my @types = filetypes_supported(); + my $maxlen = 0; + for ( @types ) { + $maxlen = length if $maxlen < length; + } + for my $type ( sort @types ) { + next if $type =~ /^-/; # Stuff to not show + my $ext_list = $mappings{$type}; + + if ( ref $ext_list ) { + $ext_list = join( ' ', map { ".$_" } @{$ext_list} ); + } + App::Ack::print( sprintf( " --[no]%-*.*s %s\n", $maxlen, $maxlen, $type, $ext_list ) ); + } + + return; +} + +sub _listify { + my @whats = @_; + + return '' if !@whats; + + my $end = pop @whats; + my $str = @whats ? join( ', ', @whats ) . " and $end" : $end; + + no warnings 'once'; + require Text::Wrap; + $Text::Wrap::columns = 75; + return Text::Wrap::wrap( '', ' ', $str ); +} + + +sub get_version_statement { + require Config; + + my $copyright = get_copyright(); + my $this_perl = $Config::Config{perlpath}; + if ($^O ne 'VMS') { + my $ext = $Config::Config{_exe}; + $this_perl .= $ext unless $this_perl =~ m/$ext$/i; + } + my $ver = sprintf( '%vd', $^V ); + + return <<"END_OF_VERSION"; +ack $VERSION +Running under Perl $ver at $this_perl + +$copyright + +This program is free software; you can redistribute it and/or modify +it under the terms of either: the GNU General Public License as +published by the Free Software Foundation; or the Artistic License. +END_OF_VERSION +} + + +sub print_version_statement { + App::Ack::print( get_version_statement() ); + + return; +} + + +sub get_copyright { + return $COPYRIGHT; +} + + +sub load_colors { + eval 'use Term::ANSIColor ()'; + + $ENV{ACK_COLOR_MATCH} ||= 'black on_yellow'; + $ENV{ACK_COLOR_FILENAME} ||= 'bold green'; + + return; +} + + +sub is_interesting { + return if /^\./; + + my $include; + + for my $type ( filetypes( $File::Next::name ) ) { + if ( defined $type_wanted{$type} ) { + if ( $type_wanted{$type} ) { + $include = 1; + } + else { + return; + } + } + } + + return $include; +} + + + +# print subs added in order to make it easy for a third party +# module (such as App::Wack) to redefine the display methods +# and show the results in a different way. +sub print { print {$fh} @_ } +sub print_first_filename { App::Ack::print( $_[0], "\n" ) } +sub print_blank_line { App::Ack::print( "\n" ) } +sub print_separator { App::Ack::print( "--\n" ) } +sub print_filename { App::Ack::print( $_[0], $_[1] ) } +sub print_line_no { App::Ack::print( $_[0], $_[1] ) } +sub print_column_no { App::Ack::print( $_[0], $_[1] ) } +sub print_count { + my $filename = shift; + my $nmatches = shift; + my $ors = shift; + my $count = shift; + + App::Ack::print( $filename ); + App::Ack::print( ':', $nmatches ) if $count; + App::Ack::print( $ors ); +} + +sub print_count0 { + my $filename = shift; + my $ors = shift; + + App::Ack::print( $filename, ':0', $ors ); +} + + + +{ + my $filename; + my $regex; + my $display_filename; + + my $keep_context; + + my $last_output_line; # number of the last line that has been output + my $any_output; # has there been any output for the current file yet + my $context_overall_output_count; # has there been any output at all + +sub search_resource { + my $res = shift; + my $opt = shift; + + $filename = $res->name(); + + my $v = $opt->{v}; + my $passthru = $opt->{passthru}; + my $max = $opt->{m}; + my $nmatches = 0; + + $display_filename = undef; + + # for --line processing + my $has_lines = 0; + my @lines; + if ( defined $opt->{lines} ) { + $has_lines = 1; + @lines = ( @{$opt->{lines}}, -1 ); + undef $regex; # Don't match when printing matching line + } + else { + $regex = qr/$opt->{regex}/; + } + + # for context processing + $last_output_line = -1; + $any_output = 0; + my $before_context = $opt->{before_context}; + my $after_context = $opt->{after_context}; + + $keep_context = ($before_context || $after_context) && !$passthru; + + my @before; + my $before_starts_at_line; + my $after = 0; # number of lines still to print after a match + + while ( $res->next_text ) { + # XXX Optimize away the case when there are no more @lines to find. + # XXX $has_lines, $passthru and $v never change. Optimize. + if ( $has_lines + ? $. != $lines[0] # $lines[0] should be a scalar + : $v ? m/$regex/ : !m/$regex/ ) { + if ( $passthru ) { + App::Ack::print( $_ ); + next; + } + + if ( $keep_context ) { + if ( $after ) { + print_match_or_context( $opt, 0, $., $-[0], $+[0], $_ ); + $after--; + } + elsif ( $before_context ) { + if ( @before ) { + if ( @before >= $before_context ) { + shift @before; + ++$before_starts_at_line; + } + } + else { + $before_starts_at_line = $.; + } + push @before, $_; + } + last if $max && ( $nmatches >= $max ) && !$after; + } + next; + } # not a match + + ++$nmatches; + + # print an empty line as a divider before first line in each file (not before the first file) + if ( !$any_output && $opt->{show_filename} && $opt->{break} && defined( $context_overall_output_count ) ) { + App::Ack::print_blank_line(); + } + + shift @lines if $has_lines; + + if ( $res->is_binary ) { + App::Ack::print( "Binary file $filename matches\n" ); + last; + } + if ( $keep_context ) { + if ( @before ) { + print_match_or_context( $opt, 0, $before_starts_at_line, $-[0], $+[0], @before ); + @before = (); + $before_starts_at_line = 0; + } + if ( $max && $nmatches > $max ) { + --$after; + } + else { + $after = $after_context; + } + } + print_match_or_context( $opt, 1, $., $-[0], $+[0], $_ ); + + last if $max && ( $nmatches >= $max ) && !$after; + } # while + + return $nmatches; +} # search_resource() + + + +sub print_match_or_context { + my $opt = shift; # opts array + my $is_match = shift; # is there a match on the line? + my $line_no = shift; + my $match_start = shift; + my $match_end = shift; + + my $color = $opt->{color}; + my $heading = $opt->{heading}; + my $show_filename = $opt->{show_filename}; + my $show_column = $opt->{column}; + + if ( $show_filename ) { + if ( not defined $display_filename ) { + $display_filename = + $color + ? Term::ANSIColor::colored( $filename, $ENV{ACK_COLOR_FILENAME} ) + : $filename; + if ( $heading && !$any_output ) { + App::Ack::print_first_filename($display_filename); + } + } + } + + my $sep = $is_match ? ':' : '-'; + my $output_func = $opt->{output}; + for ( @_ ) { + if ( $keep_context && !$output_func ) { + if ( ( $last_output_line != $line_no - 1 ) && + ( $any_output || ( !$heading && defined( $context_overall_output_count ) ) ) ) { + App::Ack::print_separator(); + } + # to ensure separators between different files when --noheading + + $last_output_line = $line_no; + } + + if ( $show_filename ) { + App::Ack::print_filename($display_filename, $sep) if not $heading; + App::Ack::print_line_no($line_no, $sep); + } + + if ( $output_func ) { + while ( /$regex/go ) { + App::Ack::print( $output_func->() . "\n" ); + } + } + else { + if ( $color && $is_match && $regex && + s/$regex/Term::ANSIColor::colored( substr($_, $-[0], $+[0] - $-[0]), $ENV{ACK_COLOR_MATCH} )/eg ) { + # At the end of the line reset the color and remove newline + s/[\r\n]*\z/\e[0m\e[K/; + } + else { + # remove any kind of newline at the end of the line + s/[\r\n]*\z//; + } + if ( $show_column ) { + App::Ack::print_column_no( $match_start+1, $sep ); + } + App::Ack::print($_ . "\n"); + } + $any_output = 1; + ++$context_overall_output_count; + ++$line_no; + } + + return; +} # print_match_or_context() + +} # scope around search_resource() and print_match_or_context() + + + +sub search_and_list { + my $res = shift; + my $opt = shift; + + my $nmatches = 0; + my $count = $opt->{count}; + my $ors = $opt->{print0} ? "\0" : "\n"; # output record separator + + my $regex = qr/$opt->{regex}/; + + if ( $opt->{v} ) { + while ( $res->next_text ) { + if ( /$regex/ ) { + return 0 unless $count; + } + else { + ++$nmatches; + } + } + } + else { + while ( $res->next_text ) { + if ( /$regex/ ) { + ++$nmatches; + last unless $count; + } + } + } + + if ( $nmatches ) { + App::Ack::print_count( $res->name, $nmatches, $ors, $count ); + } + elsif ( $count && !$opt->{l} ) { + App::Ack::print_count0( $res->name, $ors ); + } + + return $nmatches ? 1 : 0; +} # search_and_list() + + + +sub filetypes_supported_set { + return grep { defined $type_wanted{$_} && ($type_wanted{$_} == 1) } filetypes_supported(); +} + + + +sub print_files { + my $iter = shift; + my $opt = shift; + + my $ors = $opt->{print0} ? "\0" : "\n"; + + my $nmatches = 0; + while ( defined ( my $file = $iter->() ) ) { + App::Ack::print $file, $ors; + $nmatches++; + last if $opt->{1}; + } + + return $nmatches; +} + + +sub print_files_with_matches { + my $iter = shift; + my $opt = shift; + + my $nmatches = 0; + while ( defined ( my $filename = $iter->() ) ) { + my $repo = App::Ack::Repository::Basic->new( $filename ); + my $res; + while ( $res = $repo->next_resource() ) { + $nmatches += search_and_list( $res, $opt ); + $res->close(); + last if $nmatches && $opt->{1}; + } + $repo->close(); + } + + return $nmatches; +} + + +sub print_matches { + my $iter = shift; + my $opt = shift; + + $opt->{show_filename} = 0 if $opt->{h}; + $opt->{show_filename} = 1 if $opt->{H}; + + my $nmatches = 0; + while ( defined ( my $filename = $iter->() ) ) { + my $repo; + my $tarballs_work = 0; + if ( $tarballs_work && $filename =~ /\.tar\.gz$/ ) { + App::Ack::die( 'Not working here yet' ); + require App::Ack::Repository::Tar; # XXX Error checking + $repo = App::Ack::Repository::Tar->new( $filename ); + } + else { + $repo = App::Ack::Repository::Basic->new( $filename ); + } + $repo or next; + + while ( my $res = $repo->next_resource() ) { + my $needs_line_scan; + if ( $opt->{regex} && !$opt->{passthru} ) { + $needs_line_scan = $res->needs_line_scan( $opt ); + if ( $needs_line_scan ) { + $res->reset(); + } + } + else { + $needs_line_scan = 1; + } + if ( $needs_line_scan ) { + $nmatches += search_resource( $res, $opt ); + } + $res->close(); + } + last if $nmatches && $opt->{1}; + $repo->close(); + } + return $nmatches; +} + + +sub filetype_setup { + my $filetypes_supported_set = filetypes_supported_set(); + # If anyone says --no-whatever, we assume all other types must be on. + if ( !$filetypes_supported_set ) { + for my $i ( keys %type_wanted ) { + $type_wanted{$i} = 1 unless ( defined( $type_wanted{$i} ) || $i eq 'binary' || $i eq 'text' || $i eq 'skipped' ); + } + } + return; +} + + +EXPAND_FILENAMES_SCOPE: { + my $filter; + + sub expand_filenames { + my $argv = shift; + + my $attr; + my @files; + + foreach my $pattern ( @{$argv} ) { + my @results = bsd_glob( $pattern ); + + if (@results == 0) { + @results = $pattern; # Glob didn't match, pass it thru unchanged + } + elsif ( (@results > 1) or ($results[0] ne $pattern) ) { + if (not defined $filter) { + eval 'require Win32::File;'; + if ($@) { + $filter = 0; + } + else { + $filter = Win32::File::HIDDEN()|Win32::File::SYSTEM(); + } + } # end unless we've tried to load Win32::File + if ( $filter ) { + # Filter out hidden and system files: + @results = grep { not(Win32::File::GetAttributes($_, $attr) and $attr & $filter) } @results; + App::Ack::warn( "$pattern: Matched only hidden files" ) unless @results; + } # end if we can filter by file attributes + } # end elsif this pattern got expanded + + push @files, @results; + } # end foreach pattern + + return \@files; + } # end expand_filenames +} # EXPAND_FILENAMES_SCOPE + + + +sub get_starting_points { + my $argv = shift; + my $opt = shift; + + my @what; + + if ( @{$argv} ) { + @what = @{ $is_windows ? expand_filenames($argv) : $argv }; + $_ = File::Next::reslash( $_ ) for @what; + + # Show filenames unless we've specified one single file + $opt->{show_filename} = (@what > 1) || (!-f $what[0]); + } + else { + @what = '.'; # Assume current directory + $opt->{show_filename} = 1; + } + + for my $start_point (@what) { + App::Ack::warn( "$start_point: No such file or directory" ) unless -e $start_point; + } + return \@what; +} + + + +sub get_iterator { + my $what = shift; + my $opt = shift; + + # Starting points are always searched, no matter what + my %starting_point = map { ($_ => 1) } @{$what}; + + my $g_regex = defined $opt->{G} ? qr/$opt->{G}/ : undef; + my $file_filter; + + if ( $g_regex ) { + $file_filter + = $opt->{u} ? sub { $File::Next::name =~ /$g_regex/ } # XXX Maybe this should be a 1, no? + : $opt->{all} ? sub { $starting_point{ $File::Next::name } || ( $File::Next::name =~ /$g_regex/ && is_searchable( $_ ) ) } + : sub { $starting_point{ $File::Next::name } || ( $File::Next::name =~ /$g_regex/ && is_interesting( @_ ) ) } + ; + } + else { + $file_filter + = $opt->{u} ? sub {1} + : $opt->{all} ? sub { $starting_point{ $File::Next::name } || is_searchable( $_ ) } + : sub { $starting_point{ $File::Next::name } || is_interesting( @_ ) } + ; + } + + my $descend_filter + = $opt->{n} ? sub {0} + : $opt->{u} ? sub {1} + : \&ignoredir_filter; + + my $iter = + File::Next::files( { + file_filter => $file_filter, + descend_filter => $descend_filter, + error_handler => sub { my $msg = shift; App::Ack::warn( $msg ) }, + sort_files => $opt->{sort_files}, + follow_symlinks => $opt->{follow}, + }, @{$what} ); + return $iter; +} + + +sub set_up_pager { + my $command = shift; + + return if App::Ack::output_to_pipe(); + + my $pager; + if ( not open( $pager, '|-', $command ) ) { + App::Ack::die( qq{Unable to pipe to pager "$command": $!} ); + } + $fh = $pager; + + return; +} + + +sub input_from_pipe { + return $input_from_pipe; +} + + + +sub output_to_pipe { + return $output_to_pipe; +} + + + +1; # End of App::Ack +package App::Ack::Repository; + + +use warnings; +use strict; + +sub FAIL { + require Carp; + Carp::confess( 'Must be overloaded' ); +} + + +sub new { + FAIL(); +} + + +sub next_resource { + FAIL(); +} + + +sub close { + FAIL(); +} + +1; +package App::Ack::Resource; + + +use warnings; +use strict; + +sub FAIL { + require Carp; + Carp::confess( 'Must be overloaded' ); +} + + +sub new { + FAIL(); +} + + +sub name { + FAIL(); +} + + +sub is_binary { + FAIL(); +} + + + +sub needs_line_scan { + FAIL(); +} + + +sub reset { + FAIL(); +} + + +sub next_text { + FAIL(); +} + + +sub close { + FAIL(); +} + +1; +package App::Ack::Plugin::Basic; + + + +package App::Ack::Resource::Basic; + + +use warnings; +use strict; + + +our @ISA = qw( App::Ack::Resource ); + + +sub new { + my $class = shift; + my $filename = shift; + + my $self = bless { + filename => $filename, + fh => undef, + could_be_binary => undef, + opened => undef, + id => undef, + }, $class; + + if ( $self->{filename} eq '-' ) { + $self->{fh} = *STDIN; + $self->{could_be_binary} = 0; + } + else { + if ( !open( $self->{fh}, '<', $self->{filename} ) ) { + App::Ack::warn( "$self->{filename}: $!" ); + return; + } + $self->{could_be_binary} = 1; + } + + return $self; +} + + +sub name { + my $self = shift; + + return $self->{filename}; +} + + +sub is_binary { + my $self = shift; + + if ( $self->{could_be_binary} ) { + return -B $self->{filename}; + } + + return 0; +} + + + +sub needs_line_scan { + my $self = shift; + my $opt = shift; + + return 1 if $opt->{v}; + + my $size = -s $self->{fh}; + if ( $size == 0 ) { + return 0; + } + elsif ( $size > 100_000 ) { + return 1; + } + + my $buffer; + my $rc = sysread( $self->{fh}, $buffer, $size ); + if ( not defined $rc ) { + App::Ack::warn( "$self->{filename}: $!" ); + return 1; + } + return 0 unless $rc && ( $rc == $size ); + + my $regex = $opt->{regex}; + return $buffer =~ /$regex/m; +} + + +sub reset { + my $self = shift; + + seek( $self->{fh}, 0, 0 ) + or App::Ack::warn( "$self->{filename}: $!" ); + + return; +} + + +sub next_text { + if ( defined ($_ = readline $_[0]->{fh}) ) { + $. = ++$_[0]->{line}; + return 1; + } + + return; +} + + +sub close { + my $self = shift; + + if ( not close $self->{fh} ) { + App::Ack::warn( $self->name() . ": $!" ); + } + + return; +} + +package App::Ack::Repository::Basic; + + +our @ISA = qw( App::Ack::Repository ); + + +use warnings; +use strict; + +sub new { + my $class = shift; + my $filename = shift; + + my $self = bless { + filename => $filename, + nexted => 0, + }, $class; + + return $self; +} + + +sub next_resource { + my $self = shift; + + return if $self->{nexted}; + $self->{nexted} = 1; + + return App::Ack::Resource::Basic->new( $self->{filename} ); +} + + +sub close { +} + + + +1; diff --git a/bin/addr b/bin/addr new file mode 100755 index 0000000..24e461a --- /dev/null +++ b/bin/addr @@ -0,0 +1,16 @@ +#!/bin/sh +# Usage: addr [] +# Show IPv4 address for interface or all interfaces with +# no given. + +# Darwin/OSX +ifconfig -a | +grep 'inet ' | +grep broadcast | +awk '{ print $2 }' + +# Linux +ifconfig -a | +grep 'inet ' | +grep Bcast | +awk '{ print $2 }' diff --git a/bin/git-amend b/bin/git-amend new file mode 100755 index 0000000..9101a67 --- /dev/null +++ b/bin/git-amend @@ -0,0 +1,43 @@ +#!/bin/sh -e +# Usage: git-amend +# Amend changes staged in the index to , or edit commit message if +# no changes are currently staged. Modifications not staged are stashed and +# then reapplied once the amend and rebase operations are complete. +# +# This command rewrites history. Do not run it after or its +# decendants have been published to the world. +# +# This version in POSIX sh by Ryan Tomayko +# +# Based on Mislav's bash version here: +# http://gist.github.com/278825 + +# NOTE removed check for staged files, since sometimes I just +# want to change the commit message. + +TARGET="$1" +BRANCH=$(git name-rev HEAD | cut -d' ' -f2) + +test -z "$TARGET" && { + echo "$(basename $0): you must specify the target commit" 1>&2 + exit 1 +} + +# stash off work tree modifications leaving the +# index for amending to the target commit +git stash save -q --keep-index git-amend + +# always restore from stash before exiting +trap 'git stash pop -q stash@{git-amend} 2>/dev/null' EXIT + +# go back in history +git checkout -q "$TARGET" || { + echo "$(basename $0): changes didn't apply cleanly" 1>&2 + exit 1 +} + +# amend the commit. this opens your editor +git commit -v --amend + +# apply the remaining commits on this branch +git rebase --onto HEAD "$TARGET" "$BRANCH" diff --git a/bin/git-cv b/bin/git-cv new file mode 100755 index 0000000..71560aa --- /dev/null +++ b/bin/git-cv @@ -0,0 +1,20 @@ +#!/bin/sh +# Usage: git-cv [ []] +# Humane git-cherry view. Show commits not merged upstream +# like git-cherry with verbose output, short SHAs, and ANSI +# color. + +for a in "$@" ; do + test "$a" = "--help" && + exec git cherry --help +done + +SHA=$(git config --get-color 'color.branch.local') +ADD=$(git config --get-color 'color.diff.new') +REM=$(git config --get-color 'color.diff.old') +RESET=$(git config --get-color '' 'reset') + +git cherry -v "$@" | +cut -c1-9 -c43- | +sed -e "s/^\(.\) \(.......\)/\1 $SHA\2$RESET/" | +sed -e "s/^-/$REM-$RESET/" -e "s/^+/$ADD+$RESET/" diff --git a/bin/git-ignore b/bin/git-ignore new file mode 100755 index 0000000..0c2dfc5 --- /dev/null +++ b/bin/git-ignore @@ -0,0 +1,8 @@ +#!/bin/sh +# Usage: git-ignore ,,... +# Add files to the current Git repo's exclude list + +for pattern in "$@" +do + echo "$pattern" | tee -a .git/info/exclude +done diff --git a/bin/git-pruneall b/bin/git-pruneall new file mode 100755 index 0000000..b00f26a --- /dev/null +++ b/bin/git-pruneall @@ -0,0 +1,35 @@ +#!/bin/sh -e +# Usage: git-pruneall [...] +# Prune branches from specified remotes, or all remotes when +# not specified. + +REMOTES="$@" + +test -z "$REMOTES" && +REMOTES=$(git remote) + +for remote in $REMOTES +do + echo "pruning: $remote" + git remote prune "$remote" || true +done + +# Copyright (c) 2009 Ryan Tomayko +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. diff --git a/bin/git-rel b/bin/git-rel new file mode 100755 index 0000000..7d1bf42 --- /dev/null +++ b/bin/git-rel @@ -0,0 +1,40 @@ +#!/bin/sh +# Usage: git-rel [] +# Shows the relationship between the current branch and . With no , +# the current branch's remote tracking branch is used. +# +# Examples: +# +# $ git-rel +# 15 ahead +# 11 behind +# +# $ git-rel v1.1 +# 230 ahead + +strip_prefix () { + echo "$@" | + sed 's@refs/heads/@@' +} + +current_branch () { + git symbolic-ref -q HEAD | + sed 's@refs/heads/@@' +} + +tracking_branch () { + remote=$(git config --get branch.$(current_branch).remote) + merge=$(git config --get branch.$(current_branch).merge) + echo "$remote/$(strip_prefix $merge)" +} + +ref="${1:-$(tracking_branch)}" + +git rev-list --left-right --abbrev-commit --abbrev $ref...HEAD | +cut -c1 | +sed ' + s/>/ahead/ + s/ +# Copyright (C) 2008 Aristotle Pagaltzis +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# Distributed under the GNU General Public License, version 2.0. + +# use to install the sh alias +[[ $1 = '--configure' && $# = 1 ]] && { + set -e + git config --global alias.sh '!git-sh' + echo "alias 'sh' added to ~/.gitconfig" + exit 0 +} + +# we expect to be sourced into an interactive shell. when executed as a +# command, kick off a new shell and source us. +[ "$0" = 'bash' ] || +exec /usr/bin/env bash --rcfile "$0" "$@" + +# source the user's .bashrc file +[ -r ~/.bashrc ] && { + pushd ~ > /dev/null + . .bashrc + popd > /dev/null +} + + +# ALIASES + COMPLETION ========================================================= + +# gitcomp +# +# Complete command named like standard git command named +# . must be a valid git command with completion. +# +# Examples: +# gitcomplete ci commit +# gitcomplete c checkout +gitcomplete() { + local alias="$1" command="$2" + complete -o default -o nospace -F _git_${command//-/_} $alias +} + +# gitalias =' [...]' +# +# Define a new shell alias (as with the alias builtin) named +# and enable command completion based on . must be +# a standard non-abbreviated git command name that has completion support. +# +# Examples: +# gitalias c=checkout +# gitalias ci='commit -v' +# gitalias r='rebase --interactive HEAD~10' +gitalias() { + local alias="${1%%=*}" command="${1#*=}" + local prog="${command##git }" + prog="${prog%% *}" + alias $alias="$command" + gitcomplete "$alias" "$prog" +} + +# create aliases and configure bash completion for most porcelain commands + +_git_cmd_cfg=( + 'add alias' + 'am alias stdcmpl' + 'annotate alias' + 'apply alias stdcmpl' + 'archive alias' + 'bisect alias stdcmpl' + 'blame alias' + 'branch alias stdcmpl' + 'bundle alias stdcmpl' + 'cat-file alias' + 'checkout alias stdcmpl' + 'cherry alias stdcmpl' + 'cherry-pick alias stdcmpl' + 'clean alias' + 'clone alias' + 'commit alias stdcmpl' + 'config alias stdcmpl' + 'describe alias stdcmpl' + 'diff alias stdcmpl' + 'fetch alias stdcmpl' + 'format-patch alias stdcmpl' + 'fsck alias' + 'gc alias stdcmpl' + 'gui alias' + 'init alias' + 'instaweb alias' + 'log alias logcmpl' + 'lost-found alias' + 'ls-files alias' + 'ls-remote alias stdcmpl' + 'ls-tree alias stdcmpl' + 'merge alias stdcmpl' + 'merge-base stdcmpl' + 'mergetool alias' + 'mv alias' + 'name-rev stdcmpl' + 'patch-id alias' + 'peek-remote alias' + 'prune alias' + 'pull alias stdcmpl' + 'push alias stdcmpl' + 'quiltimport alias' + 'rebase alias stdcmpl' + 'reflog alias' + 'remote alias stdcmpl' + 'repack alias' + 'repo-config alias' + 'request-pull alias' + 'reset alias stdcmpl' + 'rev-list alias' + 'rev-parse alias' + 'revert alias' + 'rm alias' + 'send-email alias' + 'send-pack alias' + 'shortlog stdcmpl' + 'show alias stdcmpl' + 'show-branch logcmpl' + 'stash alias stdcmpl' + 'status alias' + 'stripspace alias' + 'submodule alias stdcmpl' + 'svn alias stdcmpl' + 'symbolic-ref alias' + 'tag alias stdcmpl' + 'tar-tree alias' + 'var alias' + 'whatchanged alias logcmpl' +) + +for cfg in "${_git_cmd_cfg[@]}" ; do + read cmd opts <<< $cfg + for opt in $opts ; do + case $opt in + alias) alias $cmd="git $cmd" ;; + stdcmpl) complete -o default -o nospace -F _git_${cmd//-/_} $cmd ;; + logcmpl) complete -o default -o nospace -F _git_log $cmd ;; + esac + done +done + +# Create aliases for everything defined in the gitconfig [alias] section. +_git_import_aliases () { + eval "$( + git config --get-regexp 'alias\..*' | + sed 's/^alias\.//' | + while read key command + do + if expr -- "$command" : '!' >/dev/null + then echo "alias $key='${command#!}'" + else echo "gitalias $key='git $command'" + fi + done + )" +} + +# PROMPT ======================================================================= + +PS1='`_git_headname`!`_git_workdir``_git_dirty`> ' + +ANSI_RESET="\001$(git config --get-color "" "reset")\002" + +# detect whether the tree is in a dirty state. returns +_git_dirty() { + if git status 2>/dev/null | fgrep -q '(working directory clean)'; then + return 0 + fi + local dirty_marker="`git config gitsh.dirty || echo ' *'`" + _git_apply_color "$dirty_marker" "color.sh.dirty" "red" +} + +# detect the current branch; use 7-sha when not on branch +_git_headname() { + local br=`git symbolic-ref -q HEAD 2>/dev/null` + [ -n "$br" ] && + br=${br#refs/heads/} || + br=`git rev-parse --short HEAD 2>/dev/null` + _git_apply_color "$br" "color.sh.branch" "yellow reverse" +} + +# detect working directory relative to working tree root +_git_workdir() { + subdir=`git rev-parse --show-prefix 2>/dev/null` + subdir="${subdir%/}" + workdir="${PWD%/$subdir}" + _git_apply_color "${workdir/*\/}${subdir:+/$subdir}" "color.sh.workdir" "blue bold" +} + +# determine whether color should be enabled. this checks git's color.ui +# option and then color.sh. +_git_color_enabled() { + [ `git config --get-colorbool color.sh true` = "true" ] +} + +# apply a color to the first argument +_git_apply_color() { + local output="$1" color="$2" default="$3" + if _git_color_enabled ; then + color=`_git_color "$color" "$default"` + echo -ne "${color}${output}${ANSI_RESET}" + else + echo -ne "$output" + fi +} + +# retrieve an ANSI color escape sequence from git config +_git_color() { + local color + color=`git config --get-color "$1" "$2" 2>/dev/null` + [ -n "$color" ] && echo -ne "\001$color\002" +} + +# HELP ======================================================================== + +_help_display() { + local name value + # show git's inbuilt help, after some tweaking... + git --help | grep -v "See 'git help" + + # show aliases defined in ~/.gitconfig + echo "Command aliases:" + git config --get-regexp 'alias\..*' | + sed 's/^alias\.//' | + sort | + while read name value + do printf " %-10s %-65s\n" "$name" "$value" + done + + printf "\nSee 'help COMMAND' for more information on a specific command.\n" +} + +help() { + local _git_pager=$(git config core.pager) + if [ $# = 1 ]; + then git help $1 + else (_help_display | ${_git_pager:-${PAGER:-less}}) + fi +} +complete -o default -o nospace -F _git help + +# vim: tw=80 noexpandtab +#!bash +# +# bash completion support for core Git. +# +# Copyright (C) 2006,2007 Shawn O. Pearce +# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/). +# Distributed under the GNU General Public License, version 2.0. +# +# The contained completion routines provide support for completing: +# +# *) local and remote branch names +# *) local and remote tag names +# *) .git/remotes file names +# *) git 'subcommands' +# *) tree paths within 'ref:path/to/file' expressions +# *) common --long-options +# +# To use these routines: +# +# 1) Copy this file to somewhere (e.g. ~/.git-completion.sh). +# 2) Added the following line to your .bashrc: +# source ~/.git-completion.sh +# +# 3) You may want to make sure the git executable is available +# in your PATH before this script is sourced, as some caching +# is performed while the script loads. If git isn't found +# at source time then all lookups will be done on demand, +# which may be slightly slower. +# +# 4) Consider changing your PS1 to also show the current branch: +# PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ ' +# +# The argument to __git_ps1 will be displayed only if you +# are currently in a git repository. The %s token will be +# the name of the current branch. +# +# In addition, if you set GIT_PS1_SHOWDIRTYSTATE to a nonempty +# value, unstaged (*) and staged (+) changes will be shown next +# to the branch name. You can configure this per-repository +# with the bash.showDirtyState variable, which defaults to true +# once GIT_PS1_SHOWDIRTYSTATE is enabled. +# +# You can also see if currently something is stashed, by setting +# GIT_PS1_SHOWSTASHSTATE to a nonempty value. If something is stashed, +# then a '$' will be shown next to the branch name. +# +# If you would like to see if there're untracked files, then you can +# set GIT_PS1_SHOWUNTRACKEDFILES to a nonempty value. If there're +# untracked files, then a '%' will be shown next to the branch name. +# +# To submit patches: +# +# *) Read Documentation/SubmittingPatches +# *) Send all patches to the current maintainer: +# +# "Shawn O. Pearce" +# +# *) Always CC the Git mailing list: +# +# git@vger.kernel.org +# + +case "$COMP_WORDBREAKS" in +*:*) : great ;; +*) COMP_WORDBREAKS="$COMP_WORDBREAKS:" +esac + +# __gitdir accepts 0 or 1 arguments (i.e., location) +# returns location of .git repo +__gitdir () +{ + if [ -z "${1-}" ]; then + if [ -n "${__git_dir-}" ]; then + echo "$__git_dir" + elif [ -d .git ]; then + echo .git + else + git rev-parse --git-dir 2>/dev/null + fi + elif [ -d "$1/.git" ]; then + echo "$1/.git" + else + echo "$1" + fi +} + +# __git_ps1 accepts 0 or 1 arguments (i.e., format string) +# returns text to add to bash PS1 prompt (includes branch name) +__git_ps1 () +{ + local g="$(__gitdir)" + if [ -n "$g" ]; then + local r + local b + if [ -f "$g/rebase-merge/interactive" ]; then + r="|REBASE-i" + b="$(cat "$g/rebase-merge/head-name")" + elif [ -d "$g/rebase-merge" ]; then + r="|REBASE-m" + b="$(cat "$g/rebase-merge/head-name")" + else + if [ -d "$g/rebase-apply" ]; then + if [ -f "$g/rebase-apply/rebasing" ]; then + r="|REBASE" + elif [ -f "$g/rebase-apply/applying" ]; then + r="|AM" + else + r="|AM/REBASE" + fi + elif [ -f "$g/MERGE_HEAD" ]; then + r="|MERGING" + elif [ -f "$g/BISECT_LOG" ]; then + r="|BISECTING" + fi + + b="$(git symbolic-ref HEAD 2>/dev/null)" || { + + b="$( + case "${GIT_PS1_DESCRIBE_STYLE-}" in + (contains) + git describe --contains HEAD ;; + (branch) + git describe --contains --all HEAD ;; + (describe) + git describe HEAD ;; + (* | default) + git describe --exact-match HEAD ;; + esac 2>/dev/null)" || + + b="$(cut -c1-7 "$g/HEAD" 2>/dev/null)..." || + b="unknown" + b="($b)" + } + fi + + local w + local i + local s + local u + local c + + if [ "true" = "$(git rev-parse --is-inside-git-dir 2>/dev/null)" ]; then + if [ "true" = "$(git rev-parse --is-bare-repository 2>/dev/null)" ]; then + c="BARE:" + else + b="GIT_DIR!" + fi + elif [ "true" = "$(git rev-parse --is-inside-work-tree 2>/dev/null)" ]; then + if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ]; then + if [ "$(git config --bool bash.showDirtyState)" != "false" ]; then + git diff --no-ext-diff --ignore-submodules \ + --quiet --exit-code || w="*" + if git rev-parse --quiet --verify HEAD >/dev/null; then + git diff-index --cached --quiet \ + --ignore-submodules HEAD -- || i="+" + else + i="#" + fi + fi + fi + if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ]; then + git rev-parse --verify refs/stash >/dev/null 2>&1 && s="$" + fi + + if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ]; then + if [ -n "$(git ls-files --others --exclude-standard)" ]; then + u="%" + fi + fi + fi + + if [ -n "${1-}" ]; then + printf "$1" "$c${b##refs/heads/}$w$i$s$u$r" + else + printf " (%s)" "$c${b##refs/heads/}$w$i$s$u$r" + fi + fi +} + +# __gitcomp_1 requires 2 arguments +__gitcomp_1 () +{ + local c IFS=' '$'\t'$'\n' + for c in $1; do + case "$c$2" in + --*=*) printf %s$'\n' "$c$2" ;; + *.) printf %s$'\n' "$c$2" ;; + *) printf %s$'\n' "$c$2 " ;; + esac + done +} + +# __gitcomp accepts 1, 2, 3, or 4 arguments +# generates completion reply with compgen +__gitcomp () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + if [ $# -gt 2 ]; then + cur="$3" + fi + case "$cur" in + --*=) + COMPREPLY=() + ;; + *) + local IFS=$'\n' + COMPREPLY=($(compgen -P "${2-}" \ + -W "$(__gitcomp_1 "${1-}" "${4-}")" \ + -- "$cur")) + ;; + esac +} + +# __git_heads accepts 0 or 1 arguments (to pass to __gitdir) +__git_heads () +{ + local cmd i is_hash=y dir="$(__gitdir "${1-}")" + if [ -d "$dir" ]; then + git --git-dir="$dir" for-each-ref --format='%(refname:short)' \ + refs/heads + return + fi + for i in $(git ls-remote "${1-}" 2>/dev/null); do + case "$is_hash,$i" in + y,*) is_hash=n ;; + n,*^{}) is_hash=y ;; + n,refs/heads/*) is_hash=y; echo "${i#refs/heads/}" ;; + n,*) is_hash=y; echo "$i" ;; + esac + done +} + +# __git_tags accepts 0 or 1 arguments (to pass to __gitdir) +__git_tags () +{ + local cmd i is_hash=y dir="$(__gitdir "${1-}")" + if [ -d "$dir" ]; then + git --git-dir="$dir" for-each-ref --format='%(refname:short)' \ + refs/tags + return + fi + for i in $(git ls-remote "${1-}" 2>/dev/null); do + case "$is_hash,$i" in + y,*) is_hash=n ;; + n,*^{}) is_hash=y ;; + n,refs/tags/*) is_hash=y; echo "${i#refs/tags/}" ;; + n,*) is_hash=y; echo "$i" ;; + esac + done +} + +# __git_refs accepts 0 or 1 arguments (to pass to __gitdir) +__git_refs () +{ + local i is_hash=y dir="$(__gitdir "${1-}")" + local cur="${COMP_WORDS[COMP_CWORD]}" format refs + if [ -d "$dir" ]; then + case "$cur" in + refs|refs/*) + format="refname" + refs="${cur%/*}" + ;; + *) + if [ -e "$dir/HEAD" ]; then echo HEAD; fi + format="refname:short" + refs="refs/tags refs/heads refs/remotes" + ;; + esac + git --git-dir="$dir" for-each-ref --format="%($format)" \ + $refs + return + fi + for i in $(git ls-remote "$dir" 2>/dev/null); do + case "$is_hash,$i" in + y,*) is_hash=n ;; + n,*^{}) is_hash=y ;; + n,refs/tags/*) is_hash=y; echo "${i#refs/tags/}" ;; + n,refs/heads/*) is_hash=y; echo "${i#refs/heads/}" ;; + n,refs/remotes/*) is_hash=y; echo "${i#refs/remotes/}" ;; + n,*) is_hash=y; echo "$i" ;; + esac + done +} + +# __git_refs2 requires 1 argument (to pass to __git_refs) +__git_refs2 () +{ + local i + for i in $(__git_refs "$1"); do + echo "$i:$i" + done +} + +# __git_refs_remotes requires 1 argument (to pass to ls-remote) +__git_refs_remotes () +{ + local cmd i is_hash=y + for i in $(git ls-remote "$1" 2>/dev/null); do + case "$is_hash,$i" in + n,refs/heads/*) + is_hash=y + echo "$i:refs/remotes/$1/${i#refs/heads/}" + ;; + y,*) is_hash=n ;; + n,*^{}) is_hash=y ;; + n,refs/tags/*) is_hash=y;; + n,*) is_hash=y; ;; + esac + done +} + +__git_remotes () +{ + local i ngoff IFS=$'\n' d="$(__gitdir)" + shopt -q nullglob || ngoff=1 + shopt -s nullglob + for i in "$d/remotes"/*; do + echo ${i#$d/remotes/} + done + [ "$ngoff" ] && shopt -u nullglob + for i in $(git --git-dir="$d" config --get-regexp 'remote\..*\.url' 2>/dev/null); do + i="${i#remote.}" + echo "${i/.url*/}" + done +} + +__git_merge_strategies () +{ + if [ -n "${__git_merge_strategylist-}" ]; then + echo "$__git_merge_strategylist" + return + fi + git merge -s help 2>&1 | + sed -n -e '/[Aa]vailable strategies are: /,/^$/{ + s/\.$// + s/.*:// + s/^[ ]*// + s/[ ]*$// + p + }' +} +__git_merge_strategylist= +__git_merge_strategylist=$(__git_merge_strategies 2>/dev/null) + +__git_complete_file () +{ + local pfx ls ref cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + ?*:*) + ref="${cur%%:*}" + cur="${cur#*:}" + case "$cur" in + ?*/*) + pfx="${cur%/*}" + cur="${cur##*/}" + ls="$ref:$pfx" + pfx="$pfx/" + ;; + *) + ls="$ref" + ;; + esac + + case "$COMP_WORDBREAKS" in + *:*) : great ;; + *) pfx="$ref:$pfx" ;; + esac + + local IFS=$'\n' + COMPREPLY=($(compgen -P "$pfx" \ + -W "$(git --git-dir="$(__gitdir)" ls-tree "$ls" \ + | sed '/^100... blob /{ + s,^.* ,, + s,$, , + } + /^120000 blob /{ + s,^.* ,, + s,$, , + } + /^040000 tree /{ + s,^.* ,, + s,$,/, + } + s/^.* //')" \ + -- "$cur")) + ;; + *) + __gitcomp "$(__git_refs)" + ;; + esac +} + +__git_complete_revlist () +{ + local pfx cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + *...*) + pfx="${cur%...*}..." + cur="${cur#*...}" + __gitcomp "$(__git_refs)" "$pfx" "$cur" + ;; + *..*) + pfx="${cur%..*}.." + cur="${cur#*..}" + __gitcomp "$(__git_refs)" "$pfx" "$cur" + ;; + *) + __gitcomp "$(__git_refs)" + ;; + esac +} + +__git_complete_remote_or_refspec () +{ + local cmd="${COMP_WORDS[0]}" + local cur="${COMP_WORDS[COMP_CWORD]}" + local i c=1 remote="" pfx="" lhs=1 no_complete_refspec=0 + + # adjust args upward when completing git * + [ "$cmd" = "git" ] && { + cmd="${COMP_WORDS[1]}" + c=2 + } + + while [ $c -lt $COMP_CWORD ]; do + i="${COMP_WORDS[c]}" + case "$i" in + --all|--mirror) [ "$cmd" = "push" ] && no_complete_refspec=1 ;; + -*) ;; + *) remote="$i"; break ;; + esac + c=$((++c)) + done + if [ -z "$remote" ]; then + __gitcomp "$(__git_remotes)" + return + fi + if [ $no_complete_refspec = 1 ]; then + COMPREPLY=() + return + fi + [ "$remote" = "." ] && remote= + case "$cur" in + *:*) + case "$COMP_WORDBREAKS" in + *:*) : great ;; + *) pfx="${cur%%:*}:" ;; + esac + cur="${cur#*:}" + lhs=0 + ;; + +*) + pfx="+" + cur="${cur#+}" + ;; + esac + case "$cmd" in + fetch) + if [ $lhs = 1 ]; then + __gitcomp "$(__git_refs2 "$remote")" "$pfx" "$cur" + else + __gitcomp "$(__git_refs)" "$pfx" "$cur" + fi + ;; + pull) + if [ $lhs = 1 ]; then + __gitcomp "$(__git_refs "$remote")" "$pfx" "$cur" + else + __gitcomp "$(__git_refs)" "$pfx" "$cur" + fi + ;; + push) + if [ $lhs = 1 ]; then + __gitcomp "$(__git_refs)" "$pfx" "$cur" + else + __gitcomp "$(__git_refs "$remote")" "$pfx" "$cur" + fi + ;; + esac +} + +__git_complete_strategy () +{ + case "${COMP_WORDS[COMP_CWORD-1]}" in + -s|--strategy) + __gitcomp "$(__git_merge_strategies)" + return 0 + esac + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --strategy=*) + __gitcomp "$(__git_merge_strategies)" "" "${cur##--strategy=}" + return 0 + ;; + esac + return 1 +} + +__git_all_commands () +{ + if [ -n "${__git_all_commandlist-}" ]; then + echo "$__git_all_commandlist" + return + fi + local i IFS=" "$'\n' + for i in $(git help -a|egrep '^ [a-zA-Z0-9]') + do + case $i in + *--*) : helper pattern;; + *) echo $i;; + esac + done +} +__git_all_commandlist= +__git_all_commandlist="$(__git_all_commands 2>/dev/null)" + +__git_porcelain_commands () +{ + if [ -n "${__git_porcelain_commandlist-}" ]; then + echo "$__git_porcelain_commandlist" + return + fi + local i IFS=" "$'\n' + for i in "help" $(__git_all_commands) + do + case $i in + *--*) : helper pattern;; + applymbox) : ask gittus;; + applypatch) : ask gittus;; + archimport) : import;; + cat-file) : plumbing;; + check-attr) : plumbing;; + check-ref-format) : plumbing;; + checkout-index) : plumbing;; + commit-tree) : plumbing;; + count-objects) : infrequent;; + cvsexportcommit) : export;; + cvsimport) : import;; + cvsserver) : daemon;; + daemon) : daemon;; + diff-files) : plumbing;; + diff-index) : plumbing;; + diff-tree) : plumbing;; + fast-import) : import;; + fast-export) : export;; + fsck-objects) : plumbing;; + fetch-pack) : plumbing;; + fmt-merge-msg) : plumbing;; + for-each-ref) : plumbing;; + hash-object) : plumbing;; + http-*) : transport;; + index-pack) : plumbing;; + init-db) : deprecated;; + local-fetch) : plumbing;; + lost-found) : infrequent;; + ls-files) : plumbing;; + ls-remote) : plumbing;; + ls-tree) : plumbing;; + mailinfo) : plumbing;; + mailsplit) : plumbing;; + merge-*) : plumbing;; + mktree) : plumbing;; + mktag) : plumbing;; + pack-objects) : plumbing;; + pack-redundant) : plumbing;; + pack-refs) : plumbing;; + parse-remote) : plumbing;; + patch-id) : plumbing;; + peek-remote) : plumbing;; + prune) : plumbing;; + prune-packed) : plumbing;; + quiltimport) : import;; + read-tree) : plumbing;; + receive-pack) : plumbing;; + reflog) : plumbing;; + repo-config) : deprecated;; + rerere) : plumbing;; + rev-list) : plumbing;; + rev-parse) : plumbing;; + runstatus) : plumbing;; + sh-setup) : internal;; + shell) : daemon;; + show-ref) : plumbing;; + send-pack) : plumbing;; + show-index) : plumbing;; + ssh-*) : transport;; + stripspace) : plumbing;; + symbolic-ref) : plumbing;; + tar-tree) : deprecated;; + unpack-file) : plumbing;; + unpack-objects) : plumbing;; + update-index) : plumbing;; + update-ref) : plumbing;; + update-server-info) : daemon;; + upload-archive) : plumbing;; + upload-pack) : plumbing;; + write-tree) : plumbing;; + var) : infrequent;; + verify-pack) : infrequent;; + verify-tag) : plumbing;; + *) echo $i;; + esac + done +} +__git_porcelain_commandlist= +__git_porcelain_commandlist="$(__git_porcelain_commands 2>/dev/null)" + +__git_aliases () +{ + local i IFS=$'\n' + for i in $(git --git-dir="$(__gitdir)" config --get-regexp "alias\..*" 2>/dev/null); do + case "$i" in + alias.*) + i="${i#alias.}" + echo "${i/ */}" + ;; + esac + done +} + +# __git_aliased_command requires 1 argument +__git_aliased_command () +{ + local word cmdline=$(git --git-dir="$(__gitdir)" \ + config --get "alias.$1") + for word in $cmdline; do + if [ "${word##-*}" ]; then + echo $word + return + fi + done +} + +# __git_find_on_cmdline requires 1 argument +__git_find_on_cmdline () +{ + local word subcommand c=1 + + while [ $c -lt $COMP_CWORD ]; do + word="${COMP_WORDS[c]}" + for subcommand in $1; do + if [ "$subcommand" = "$word" ]; then + echo "$subcommand" + return + fi + done + c=$((++c)) + done +} + +__git_has_doubledash () +{ + local c=1 + while [ $c -lt $COMP_CWORD ]; do + if [ "--" = "${COMP_WORDS[c]}" ]; then + return 0 + fi + c=$((++c)) + done + return 1 +} + +__git_whitespacelist="nowarn warn error error-all fix" + +_git_am () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" dir="$(__gitdir)" + if [ -d "$dir"/rebase-apply ]; then + __gitcomp "--skip --resolved --abort" + return + fi + case "$cur" in + --whitespace=*) + __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}" + return + ;; + --*) + __gitcomp " + --3way --committer-date-is-author-date --ignore-date + --ignore-whitespace --ignore-space-change + --interactive --keep --no-utf8 --signoff --utf8 + --whitespace= --scissors + " + return + esac + COMPREPLY=() +} + +_git_apply () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --whitespace=*) + __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}" + return + ;; + --*) + __gitcomp " + --stat --numstat --summary --check --index + --cached --index-info --reverse --reject --unidiff-zero + --apply --no-add --exclude= + --ignore-whitespace --ignore-space-change + --whitespace= --inaccurate-eof --verbose + " + return + esac + COMPREPLY=() +} + +_git_add () +{ + __git_has_doubledash && return + + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp " + --interactive --refresh --patch --update --dry-run + --ignore-errors --intent-to-add + " + return + esac + COMPREPLY=() +} + +_git_archive () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --format=*) + __gitcomp "$(git archive --list)" "" "${cur##--format=}" + return + ;; + --remote=*) + __gitcomp "$(__git_remotes)" "" "${cur##--remote=}" + return + ;; + --*) + __gitcomp " + --format= --list --verbose + --prefix= --remote= --exec= + " + return + ;; + esac + __git_complete_file +} + +_git_bisect () +{ + __git_has_doubledash && return + + local subcommands="start bad good skip reset visualize replay log run" + local subcommand="$(__git_find_on_cmdline "$subcommands")" + if [ -z "$subcommand" ]; then + __gitcomp "$subcommands" + return + fi + + case "$subcommand" in + bad|good|reset|skip) + __gitcomp "$(__git_refs)" + ;; + *) + COMPREPLY=() + ;; + esac +} + +_git_branch () +{ + local i c=1 only_local_ref="n" has_r="n" + + while [ $c -lt $COMP_CWORD ]; do + i="${COMP_WORDS[c]}" + case "$i" in + -d|-m) only_local_ref="y" ;; + -r) has_r="y" ;; + esac + c=$((++c)) + done + + case "${COMP_WORDS[COMP_CWORD]}" in + --*) + __gitcomp " + --color --no-color --verbose --abbrev= --no-abbrev + --track --no-track --contains --merged --no-merged + " + ;; + *) + if [ $only_local_ref = "y" -a $has_r = "n" ]; then + __gitcomp "$(__git_heads)" + else + __gitcomp "$(__git_refs)" + fi + ;; + esac +} + +_git_bundle () +{ + local cmd="${COMP_WORDS[1]}" + case "$COMP_CWORD" in + 2) + __gitcomp "create list-heads verify unbundle" + ;; + 3) + # looking for a file + ;; + *) + case "$cmd" in + create) + __git_complete_revlist + ;; + esac + ;; + esac +} + +_git_checkout () +{ + __git_has_doubledash && return + + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --conflict=*) + __gitcomp "diff3 merge" "" "${cur##--conflict=}" + ;; + --*) + __gitcomp " + --quiet --ours --theirs --track --no-track --merge + --conflict= --patch + " + ;; + *) + __gitcomp "$(__git_refs)" + ;; + esac +} + +_git_cherry () +{ + __gitcomp "$(__git_refs)" +} + +_git_cherry_pick () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp "--edit --no-commit" + ;; + *) + __gitcomp "$(__git_refs)" + ;; + esac +} + +_git_clean () +{ + __git_has_doubledash && return + + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp "--dry-run --quiet" + return + ;; + esac + COMPREPLY=() +} + +_git_clone () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp " + --local + --no-hardlinks + --shared + --reference + --quiet + --no-checkout + --bare + --mirror + --origin + --upload-pack + --template= + --depth + " + return + ;; + esac + COMPREPLY=() +} + +_git_commit () +{ + __git_has_doubledash && return + + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp " + --all --author= --signoff --verify --no-verify + --edit --amend --include --only --interactive + --dry-run + " + return + esac + COMPREPLY=() +} + +_git_describe () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp " + --all --tags --contains --abbrev= --candidates= + --exact-match --debug --long --match --always + " + return + esac + __gitcomp "$(__git_refs)" +} + +__git_diff_common_options="--stat --numstat --shortstat --summary + --patch-with-stat --name-only --name-status --color + --no-color --color-words --no-renames --check + --full-index --binary --abbrev --diff-filter= + --find-copies-harder + --text --ignore-space-at-eol --ignore-space-change + --ignore-all-space --exit-code --quiet --ext-diff + --no-ext-diff + --no-prefix --src-prefix= --dst-prefix= + --inter-hunk-context= + --patience + --raw + --dirstat --dirstat= --dirstat-by-file + --dirstat-by-file= --cumulative +" + +_git_diff () +{ + __git_has_doubledash && return + + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp "--cached --staged --pickaxe-all --pickaxe-regex + --base --ours --theirs + $__git_diff_common_options + " + return + ;; + esac + __git_complete_file +} + +__git_mergetools_common="diffuse ecmerge emerge kdiff3 meld opendiff + tkdiff vimdiff gvimdiff xxdiff araxis +" + +_git_difftool () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --tool=*) + __gitcomp "$__git_mergetools_common kompare" "" "${cur##--tool=}" + return + ;; + --*) + __gitcomp "--tool=" + return + ;; + esac + COMPREPLY=() +} + +__git_fetch_options=" + --quiet --verbose --append --upload-pack --force --keep --depth= + --tags --no-tags +" + +_git_fetch () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp "$__git_fetch_options" + return + ;; + esac + __git_complete_remote_or_refspec +} + +_git_format_patch () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --thread=*) + __gitcomp " + deep shallow + " "" "${cur##--thread=}" + return + ;; + --*) + __gitcomp " + --stdout --attach --no-attach --thread --thread= + --output-directory + --numbered --start-number + --numbered-files + --keep-subject + --signoff + --in-reply-to= --cc= + --full-index --binary + --not --all + --cover-letter + --no-prefix --src-prefix= --dst-prefix= + --inline --suffix= --ignore-if-in-upstream + --subject-prefix= + " + return + ;; + esac + __git_complete_revlist +} + +_git_fsck () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp " + --tags --root --unreachable --cache --no-reflogs --full + --strict --verbose --lost-found + " + return + ;; + esac + COMPREPLY=() +} + +_git_gc () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp "--prune --aggressive" + return + ;; + esac + COMPREPLY=() +} + +_git_grep () +{ + __git_has_doubledash && return + + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp " + --cached + --text --ignore-case --word-regexp --invert-match + --full-name + --extended-regexp --basic-regexp --fixed-strings + --files-with-matches --name-only + --files-without-match + --max-depth + --count + --and --or --not --all-match + " + return + ;; + esac + COMPREPLY=() +} + +_git_help () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp "--all --info --man --web" + return + ;; + esac + __gitcomp "$(__git_all_commands) + attributes cli core-tutorial cvs-migration + diffcore gitk glossary hooks ignore modules + repository-layout tutorial tutorial-2 + workflows + " +} + +_git_init () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --shared=*) + __gitcomp " + false true umask group all world everybody + " "" "${cur##--shared=}" + return + ;; + --*) + __gitcomp "--quiet --bare --template= --shared --shared=" + return + ;; + esac + COMPREPLY=() +} + +_git_ls_files () +{ + __git_has_doubledash && return + + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp "--cached --deleted --modified --others --ignored + --stage --directory --no-empty-directory --unmerged + --killed --exclude= --exclude-from= + --exclude-per-directory= --exclude-standard + --error-unmatch --with-tree= --full-name + --abbrev --ignored --exclude-per-directory + " + return + ;; + esac + COMPREPLY=() +} + +_git_ls_remote () +{ + __gitcomp "$(__git_remotes)" +} + +_git_ls_tree () +{ + __git_complete_file +} + +# Options that go well for log, shortlog and gitk +__git_log_common_options=" + --not --all + --branches --tags --remotes + --first-parent --merges --no-merges + --max-count= + --max-age= --since= --after= + --min-age= --until= --before= +" +# Options that go well for log and gitk (not shortlog) +__git_log_gitk_options=" + --dense --sparse --full-history + --simplify-merges --simplify-by-decoration + --left-right +" +# Options that go well for log and shortlog (not gitk) +__git_log_shortlog_options=" + --author= --committer= --grep= + --all-match +" + +__git_log_pretty_formats="oneline short medium full fuller email raw format:" +__git_log_date_formats="relative iso8601 rfc2822 short local default raw" + +_git_log () +{ + __git_has_doubledash && return + + local cur="${COMP_WORDS[COMP_CWORD]}" + local g="$(git rev-parse --git-dir 2>/dev/null)" + local merge="" + if [ -f "$g/MERGE_HEAD" ]; then + merge="--merge" + fi + case "$cur" in + --pretty=*) + __gitcomp "$__git_log_pretty_formats + " "" "${cur##--pretty=}" + return + ;; + --format=*) + __gitcomp "$__git_log_pretty_formats + " "" "${cur##--format=}" + return + ;; + --date=*) + __gitcomp "$__git_log_date_formats" "" "${cur##--date=}" + return + ;; + --decorate=*) + __gitcomp "long short" "" "${cur##--decorate=}" + return + ;; + --*) + __gitcomp " + $__git_log_common_options + $__git_log_shortlog_options + $__git_log_gitk_options + --root --topo-order --date-order --reverse + --follow --full-diff + --abbrev-commit --abbrev= + --relative-date --date= + --pretty= --format= --oneline + --cherry-pick + --graph + --decorate --decorate= + --walk-reflogs + --parents --children + $merge + $__git_diff_common_options + --pickaxe-all --pickaxe-regex + " + return + ;; + esac + __git_complete_revlist +} + +__git_merge_options=" + --no-commit --no-stat --log --no-log --squash --strategy + --commit --stat --no-squash --ff --no-ff +" + +_git_merge () +{ + __git_complete_strategy && return + + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp "$__git_merge_options" + return + esac + __gitcomp "$(__git_refs)" +} + +_git_mergetool () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --tool=*) + __gitcomp "$__git_mergetools_common tortoisemerge" "" "${cur##--tool=}" + return + ;; + --*) + __gitcomp "--tool=" + return + ;; + esac + COMPREPLY=() +} + +_git_merge_base () +{ + __gitcomp "$(__git_refs)" +} + +_git_mv () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp "--dry-run" + return + ;; + esac + COMPREPLY=() +} + +_git_name_rev () +{ + __gitcomp "--tags --all --stdin" +} + +_git_pull () +{ + __git_complete_strategy && return + + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp " + --rebase --no-rebase + $__git_merge_options + $__git_fetch_options + " + return + ;; + esac + __git_complete_remote_or_refspec +} + +_git_push () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "${COMP_WORDS[COMP_CWORD-1]}" in + --repo) + __gitcomp "$(__git_remotes)" + return + esac + case "$cur" in + --repo=*) + __gitcomp "$(__git_remotes)" "" "${cur##--repo=}" + return + ;; + --*) + __gitcomp " + --all --mirror --tags --dry-run --force --verbose + --receive-pack= --repo= + " + return + ;; + esac + __git_complete_remote_or_refspec +} + +_git_rebase () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" dir="$(__gitdir)" + if [ -d "$dir"/rebase-apply ] || [ -d "$dir"/rebase-merge ]; then + __gitcomp "--continue --skip --abort" + return + fi + __git_complete_strategy && return + case "$cur" in + --*) + __gitcomp "--onto --merge --strategy --interactive" + return + esac + __gitcomp "$(__git_refs)" +} + +__git_send_email_confirm_options="always never auto cc compose" +__git_send_email_suppresscc_options="author self cc bodycc sob cccmd body all" + +_git_send_email () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --confirm=*) + __gitcomp " + $__git_send_email_confirm_options + " "" "${cur##--confirm=}" + return + ;; + --suppress-cc=*) + __gitcomp " + $__git_send_email_suppresscc_options + " "" "${cur##--suppress-cc=}" + + return + ;; + --smtp-encryption=*) + __gitcomp "ssl tls" "" "${cur##--smtp-encryption=}" + return + ;; + --*) + __gitcomp "--annotate --bcc --cc --cc-cmd --chain-reply-to + --compose --confirm= --dry-run --envelope-sender + --from --identity + --in-reply-to --no-chain-reply-to --no-signed-off-by-cc + --no-suppress-from --no-thread --quiet + --signed-off-by-cc --smtp-pass --smtp-server + --smtp-server-port --smtp-encryption= --smtp-user + --subject --suppress-cc= --suppress-from --thread --to + --validate --no-validate" + return + ;; + esac + COMPREPLY=() +} + +__git_config_get_set_variables () +{ + local prevword word config_file= c=$COMP_CWORD + while [ $c -gt 1 ]; do + word="${COMP_WORDS[c]}" + case "$word" in + --global|--system|--file=*) + config_file="$word" + break + ;; + -f|--file) + config_file="$word $prevword" + break + ;; + esac + prevword=$word + c=$((--c)) + done + + git --git-dir="$(__gitdir)" config $config_file --list 2>/dev/null | + while read line + do + case "$line" in + *.*=*) + echo "${line/=*/}" + ;; + esac + done +} + +_git_config () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + local prv="${COMP_WORDS[COMP_CWORD-1]}" + case "$prv" in + branch.*.remote) + __gitcomp "$(__git_remotes)" + return + ;; + branch.*.merge) + __gitcomp "$(__git_refs)" + return + ;; + remote.*.fetch) + local remote="${prv#remote.}" + remote="${remote%.fetch}" + __gitcomp "$(__git_refs_remotes "$remote")" + return + ;; + remote.*.push) + local remote="${prv#remote.}" + remote="${remote%.push}" + __gitcomp "$(git --git-dir="$(__gitdir)" \ + for-each-ref --format='%(refname):%(refname)' \ + refs/heads)" + return + ;; + pull.twohead|pull.octopus) + __gitcomp "$(__git_merge_strategies)" + return + ;; + color.branch|color.diff|color.interactive|\ + color.showbranch|color.status|color.ui) + __gitcomp "always never auto" + return + ;; + color.pager) + __gitcomp "false true" + return + ;; + color.*.*) + __gitcomp " + normal black red green yellow blue magenta cyan white + bold dim ul blink reverse + " + return + ;; + help.format) + __gitcomp "man info web html" + return + ;; + log.date) + __gitcomp "$__git_log_date_formats" + return + ;; + sendemail.aliasesfiletype) + __gitcomp "mutt mailrc pine elm gnus" + return + ;; + sendemail.confirm) + __gitcomp "$__git_send_email_confirm_options" + return + ;; + sendemail.suppresscc) + __gitcomp "$__git_send_email_suppresscc_options" + return + ;; + --get|--get-all|--unset|--unset-all) + __gitcomp "$(__git_config_get_set_variables)" + return + ;; + *.*) + COMPREPLY=() + return + ;; + esac + case "$cur" in + --*) + __gitcomp " + --global --system --file= + --list --replace-all + --get --get-all --get-regexp + --add --unset --unset-all + --remove-section --rename-section + " + return + ;; + branch.*.*) + local pfx="${cur%.*}." + cur="${cur##*.}" + __gitcomp "remote merge mergeoptions rebase" "$pfx" "$cur" + return + ;; + branch.*) + local pfx="${cur%.*}." + cur="${cur#*.}" + __gitcomp "$(__git_heads)" "$pfx" "$cur" "." + return + ;; + guitool.*.*) + local pfx="${cur%.*}." + cur="${cur##*.}" + __gitcomp " + argprompt cmd confirm needsfile noconsole norescan + prompt revprompt revunmerged title + " "$pfx" "$cur" + return + ;; + difftool.*.*) + local pfx="${cur%.*}." + cur="${cur##*.}" + __gitcomp "cmd path" "$pfx" "$cur" + return + ;; + man.*.*) + local pfx="${cur%.*}." + cur="${cur##*.}" + __gitcomp "cmd path" "$pfx" "$cur" + return + ;; + mergetool.*.*) + local pfx="${cur%.*}." + cur="${cur##*.}" + __gitcomp "cmd path trustExitCode" "$pfx" "$cur" + return + ;; + pager.*) + local pfx="${cur%.*}." + cur="${cur#*.}" + __gitcomp "$(__git_all_commands)" "$pfx" "$cur" + return + ;; + remote.*.*) + local pfx="${cur%.*}." + cur="${cur##*.}" + __gitcomp " + url proxy fetch push mirror skipDefaultUpdate + receivepack uploadpack tagopt pushurl + " "$pfx" "$cur" + return + ;; + remote.*) + local pfx="${cur%.*}." + cur="${cur#*.}" + __gitcomp "$(__git_remotes)" "$pfx" "$cur" "." + return + ;; + url.*.*) + local pfx="${cur%.*}." + cur="${cur##*.}" + __gitcomp "insteadOf pushInsteadOf" "$pfx" "$cur" + return + ;; + esac + __gitcomp " + add.ignore-errors + alias. + apply.ignorewhitespace + apply.whitespace + branch.autosetupmerge + branch.autosetuprebase + clean.requireForce + color.branch + color.branch.current + color.branch.local + color.branch.plain + color.branch.remote + color.diff + color.diff.commit + color.diff.frag + color.diff.meta + color.diff.new + color.diff.old + color.diff.plain + color.diff.whitespace + color.grep + color.grep.external + color.grep.match + color.interactive + color.interactive.header + color.interactive.help + color.interactive.prompt + color.pager + color.showbranch + color.status + color.status.added + color.status.changed + color.status.header + color.status.nobranch + color.status.untracked + color.status.updated + color.ui + commit.template + core.autocrlf + core.bare + core.compression + core.createObject + core.deltaBaseCacheLimit + core.editor + core.excludesfile + core.fileMode + core.fsyncobjectfiles + core.gitProxy + core.ignoreCygwinFSTricks + core.ignoreStat + core.logAllRefUpdates + core.loosecompression + core.packedGitLimit + core.packedGitWindowSize + core.pager + core.preferSymlinkRefs + core.preloadindex + core.quotepath + core.repositoryFormatVersion + core.safecrlf + core.sharedRepository + core.symlinks + core.trustctime + core.warnAmbiguousRefs + core.whitespace + core.worktree + diff.autorefreshindex + diff.external + diff.mnemonicprefix + diff.renameLimit + diff.renameLimit. + diff.renames + diff.suppressBlankEmpty + diff.tool + diff.wordRegex + difftool. + difftool.prompt + fetch.unpackLimit + format.attach + format.cc + format.headers + format.numbered + format.pretty + format.signoff + format.subjectprefix + format.suffix + format.thread + gc.aggressiveWindow + gc.auto + gc.autopacklimit + gc.packrefs + gc.pruneexpire + gc.reflogexpire + gc.reflogexpireunreachable + gc.rerereresolved + gc.rerereunresolved + gitcvs.allbinary + gitcvs.commitmsgannotation + gitcvs.dbTableNamePrefix + gitcvs.dbdriver + gitcvs.dbname + gitcvs.dbpass + gitcvs.dbuser + gitcvs.enabled + gitcvs.logfile + gitcvs.usecrlfattr + guitool. + gui.blamehistoryctx + gui.commitmsgwidth + gui.copyblamethreshold + gui.diffcontext + gui.encoding + gui.fastcopyblame + gui.matchtrackingbranch + gui.newbranchtemplate + gui.pruneduringfetch + gui.spellingdictionary + gui.trustmtime + help.autocorrect + help.browser + help.format + http.lowSpeedLimit + http.lowSpeedTime + http.maxRequests + http.noEPSV + http.proxy + http.sslCAInfo + http.sslCAPath + http.sslCert + http.sslKey + http.sslVerify + i18n.commitEncoding + i18n.logOutputEncoding + imap.folder + imap.host + imap.pass + imap.port + imap.preformattedHTML + imap.sslverify + imap.tunnel + imap.user + instaweb.browser + instaweb.httpd + instaweb.local + instaweb.modulepath + instaweb.port + interactive.singlekey + log.date + log.showroot + mailmap.file + man. + man.viewer + merge.conflictstyle + merge.log + merge.renameLimit + merge.stat + merge.tool + merge.verbosity + mergetool. + mergetool.keepBackup + mergetool.prompt + pack.compression + pack.deltaCacheLimit + pack.deltaCacheSize + pack.depth + pack.indexVersion + pack.packSizeLimit + pack.threads + pack.window + pack.windowMemory + pager. + pull.octopus + pull.twohead + push.default + rebase.stat + receive.denyCurrentBranch + receive.denyDeletes + receive.denyNonFastForwards + receive.fsckObjects + receive.unpackLimit + repack.usedeltabaseoffset + rerere.autoupdate + rerere.enabled + sendemail.aliasesfile + sendemail.aliasesfiletype + sendemail.bcc + sendemail.cc + sendemail.cccmd + sendemail.chainreplyto + sendemail.confirm + sendemail.envelopesender + sendemail.multiedit + sendemail.signedoffbycc + sendemail.smtpencryption + sendemail.smtppass + sendemail.smtpserver + sendemail.smtpserverport + sendemail.smtpuser + sendemail.suppresscc + sendemail.suppressfrom + sendemail.thread + sendemail.to + sendemail.validate + showbranch.default + status.relativePaths + status.showUntrackedFiles + tar.umask + transfer.unpackLimit + url. + user.email + user.name + user.signingkey + web.browser + branch. remote. + " +} + +_git_remote () +{ + local subcommands="add rename rm show prune update set-head" + local subcommand="$(__git_find_on_cmdline "$subcommands")" + if [ -z "$subcommand" ]; then + __gitcomp "$subcommands" + return + fi + + case "$subcommand" in + rename|rm|show|prune) + __gitcomp "$(__git_remotes)" + ;; + update) + local i c='' IFS=$'\n' + for i in $(git --git-dir="$(__gitdir)" config --get-regexp "remotes\..*" 2>/dev/null); do + i="${i#remotes.}" + c="$c ${i/ */}" + done + __gitcomp "$c" + ;; + *) + COMPREPLY=() + ;; + esac +} + +_git_replace () +{ + __gitcomp "$(__git_refs)" +} + +_git_reset () +{ + __git_has_doubledash && return + + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp "--merge --mixed --hard --soft --patch" + return + ;; + esac + __gitcomp "$(__git_refs)" +} + +_git_revert () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp "--edit --mainline --no-edit --no-commit --signoff" + return + ;; + esac + __gitcomp "$(__git_refs)" +} + +_git_rm () +{ + __git_has_doubledash && return + + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp "--cached --dry-run --ignore-unmatch --quiet" + return + ;; + esac + COMPREPLY=() +} + +_git_shortlog () +{ + __git_has_doubledash && return + + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp " + $__git_log_common_options + $__git_log_shortlog_options + --numbered --summary + " + return + ;; + esac + __git_complete_revlist +} + +_git_show () +{ + __git_has_doubledash && return + + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --pretty=*) + __gitcomp "$__git_log_pretty_formats + " "" "${cur##--pretty=}" + return + ;; + --format=*) + __gitcomp "$__git_log_pretty_formats + " "" "${cur##--format=}" + return + ;; + --*) + __gitcomp "--pretty= --format= --abbrev-commit --oneline + $__git_diff_common_options + " + return + ;; + esac + __git_complete_file +} + +_git_show_branch () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp " + --all --remotes --topo-order --current --more= + --list --independent --merge-base --no-name + --color --no-color + --sha1-name --sparse --topics --reflog + " + return + ;; + esac + __git_complete_revlist +} + +_git_stash () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + local save_opts='--keep-index --no-keep-index --quiet --patch' + local subcommands='save list show apply clear drop pop create branch' + local subcommand="$(__git_find_on_cmdline "$subcommands")" + if [ -z "$subcommand" ]; then + case "$cur" in + --*) + __gitcomp "$save_opts" + ;; + *) + if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then + __gitcomp "$subcommands" + else + COMPREPLY=() + fi + ;; + esac + else + case "$subcommand,$cur" in + save,--*) + __gitcomp "$save_opts" + ;; + apply,--*|pop,--*) + __gitcomp "--index --quiet" + ;; + show,--*|drop,--*|branch,--*) + COMPREPLY=() + ;; + show,*|apply,*|drop,*|pop,*|branch,*) + __gitcomp "$(git --git-dir="$(__gitdir)" stash list \ + | sed -n -e 's/:.*//p')" + ;; + *) + COMPREPLY=() + ;; + esac + fi +} + +_git_submodule () +{ + __git_has_doubledash && return + + local subcommands="add status init update summary foreach sync" + if [ -z "$(__git_find_on_cmdline "$subcommands")" ]; then + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + __gitcomp "--quiet --cached" + ;; + *) + __gitcomp "$subcommands" + ;; + esac + return + fi +} + +_git_svn () +{ + local subcommands=" + init fetch clone rebase dcommit log find-rev + set-tree commit-diff info create-ignore propget + proplist show-ignore show-externals branch tag blame + migrate + " + local subcommand="$(__git_find_on_cmdline "$subcommands")" + if [ -z "$subcommand" ]; then + __gitcomp "$subcommands" + else + local remote_opts="--username= --config-dir= --no-auth-cache" + local fc_opts=" + --follow-parent --authors-file= --repack= + --no-metadata --use-svm-props --use-svnsync-props + --log-window-size= --no-checkout --quiet + --repack-flags --use-log-author --localtime + --ignore-paths= $remote_opts + " + local init_opts=" + --template= --shared= --trunk= --tags= + --branches= --stdlayout --minimize-url + --no-metadata --use-svm-props --use-svnsync-props + --rewrite-root= --prefix= --use-log-author + --add-author-from $remote_opts + " + local cmt_opts=" + --edit --rmdir --find-copies-harder --copy-similarity= + " + + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$subcommand,$cur" in + fetch,--*) + __gitcomp "--revision= --fetch-all $fc_opts" + ;; + clone,--*) + __gitcomp "--revision= $fc_opts $init_opts" + ;; + init,--*) + __gitcomp "$init_opts" + ;; + dcommit,--*) + __gitcomp " + --merge --strategy= --verbose --dry-run + --fetch-all --no-rebase --commit-url + --revision $cmt_opts $fc_opts + " + ;; + set-tree,--*) + __gitcomp "--stdin $cmt_opts $fc_opts" + ;; + create-ignore,--*|propget,--*|proplist,--*|show-ignore,--*|\ + show-externals,--*) + __gitcomp "--revision=" + ;; + log,--*) + __gitcomp " + --limit= --revision= --verbose --incremental + --oneline --show-commit --non-recursive + --authors-file= --color + " + ;; + rebase,--*) + __gitcomp " + --merge --verbose --strategy= --local + --fetch-all --dry-run $fc_opts + " + ;; + commit-diff,--*) + __gitcomp "--message= --file= --revision= $cmt_opts" + ;; + info,--*) + __gitcomp "--url" + ;; + branch,--*) + __gitcomp "--dry-run --message --tag" + ;; + tag,--*) + __gitcomp "--dry-run --message" + ;; + blame,--*) + __gitcomp "--git-format" + ;; + migrate,--*) + __gitcomp " + --config-dir= --ignore-paths= --minimize + --no-auth-cache --username= + " + ;; + *) + COMPREPLY=() + ;; + esac + fi +} + +_git_tag () +{ + local i c=1 f=0 + while [ $c -lt $COMP_CWORD ]; do + i="${COMP_WORDS[c]}" + case "$i" in + -d|-v) + __gitcomp "$(__git_tags)" + return + ;; + -f) + f=1 + ;; + esac + c=$((++c)) + done + + case "${COMP_WORDS[COMP_CWORD-1]}" in + -m|-F) + COMPREPLY=() + ;; + -*|tag) + if [ $f = 1 ]; then + __gitcomp "$(__git_tags)" + else + COMPREPLY=() + fi + ;; + *) + __gitcomp "$(__git_refs)" + ;; + esac +} + +_git () +{ + local i c=1 command __git_dir + + while [ $c -lt $COMP_CWORD ]; do + i="${COMP_WORDS[c]}" + case "$i" in + --git-dir=*) __git_dir="${i#--git-dir=}" ;; + --bare) __git_dir="." ;; + --version|-p|--paginate) ;; + --help) command="help"; break ;; + *) command="$i"; break ;; + esac + c=$((++c)) + done + + if [ -z "$command" ]; then + case "${COMP_WORDS[COMP_CWORD]}" in + --*) __gitcomp " + --paginate + --no-pager + --git-dir= + --bare + --version + --exec-path + --html-path + --work-tree= + --help + " + ;; + *) __gitcomp "$(__git_porcelain_commands) $(__git_aliases)" ;; + esac + return + fi + + local expansion=$(__git_aliased_command "$command") + [ "$expansion" ] && command="$expansion" + + case "$command" in + am) _git_am ;; + add) _git_add ;; + apply) _git_apply ;; + archive) _git_archive ;; + bisect) _git_bisect ;; + bundle) _git_bundle ;; + branch) _git_branch ;; + checkout) _git_checkout ;; + cherry) _git_cherry ;; + cherry-pick) _git_cherry_pick ;; + clean) _git_clean ;; + clone) _git_clone ;; + commit) _git_commit ;; + config) _git_config ;; + describe) _git_describe ;; + diff) _git_diff ;; + difftool) _git_difftool ;; + fetch) _git_fetch ;; + format-patch) _git_format_patch ;; + fsck) _git_fsck ;; + gc) _git_gc ;; + grep) _git_grep ;; + help) _git_help ;; + init) _git_init ;; + log) _git_log ;; + ls-files) _git_ls_files ;; + ls-remote) _git_ls_remote ;; + ls-tree) _git_ls_tree ;; + merge) _git_merge;; + mergetool) _git_mergetool;; + merge-base) _git_merge_base ;; + mv) _git_mv ;; + name-rev) _git_name_rev ;; + pull) _git_pull ;; + push) _git_push ;; + rebase) _git_rebase ;; + remote) _git_remote ;; + replace) _git_replace ;; + reset) _git_reset ;; + revert) _git_revert ;; + rm) _git_rm ;; + send-email) _git_send_email ;; + shortlog) _git_shortlog ;; + show) _git_show ;; + show-branch) _git_show_branch ;; + stash) _git_stash ;; + stage) _git_add ;; + submodule) _git_submodule ;; + svn) _git_svn ;; + tag) _git_tag ;; + whatchanged) _git_log ;; + *) COMPREPLY=() ;; + esac +} + +_gitk () +{ + __git_has_doubledash && return + + local cur="${COMP_WORDS[COMP_CWORD]}" + local g="$(__gitdir)" + local merge="" + if [ -f "$g/MERGE_HEAD" ]; then + merge="--merge" + fi + case "$cur" in + --*) + __gitcomp " + $__git_log_common_options + $__git_log_gitk_options + $merge + " + return + ;; + esac + __git_complete_revlist +} + +complete -o bashdefault -o default -o nospace -F _git git 2>/dev/null \ + || complete -o default -o nospace -F _git git +complete -o bashdefault -o default -o nospace -F _gitk gitk 2>/dev/null \ + || complete -o default -o nospace -F _gitk gitk + +# The following are necessary only for Cygwin, and only are needed +# when the user has tab-completed the executable name and consequently +# included the '.exe' suffix. +# +if [ Cygwin = "$(uname -o 2>/dev/null)" ]; then +complete -o bashdefault -o default -o nospace -F _git git.exe 2>/dev/null \ + || complete -o default -o nospace -F _git git.exe +fi +#!/bin/bash +# These are the standard set of aliases enabled by default in all +# git-sh sessions. Aliases defined in the gitconfig [alias] section override +# these. + +gitalias a='git add' +gitalias b='git branch' +gitalias c='git checkout' +gitalias d='git diff' +gitalias f='git fetch --prune' +gitalias k='git cherry-pick' +gitalias l='git log --pretty=oneline --abbrev-commit' +gitalias n='git commit --verbose --amend' +gitalias r='git remote' +gitalias s='git commit --dry-run --short' +gitalias t='git diff --cached' + +# git add and the staging area +gitalias a='git add' +gitalias aa='git add --update' # mnemonic: "add all" +gitalias stage='git add' +gitalias ap='git add --patch' +gitalias p='git diff --cached' # mnemonic: "patch" +gitalias ps='git diff --cached --stat' # mnemonic: "patch stat" +gitalias unstage='git reset HEAD' + +# commits and history +gitalias ci='git commit --verbose' +gitalias ca='git commit --verbose --all' +gitalias amend='git commit --verbose --amend' +gitalias n='git commit --verbose --amend' +gitalias k='git cherry-pick' +gitalias re='git rebase --interactive' +gitalias pop='git reset --soft HEAD^' +gitalias peek='git log -p --max-count=1' + +# git fetch +gitalias f='git fetch' +gitalias pm='git pull' # mnemonic: pull merge +gitalias pr='git pull --rebase' # mnemonic: pull rebase + +# git diff +gitalias d='git diff' +gitalias ds='git diff --stat' # mnemonic: "diff stat" + +# git reset +gitalias hard='git reset --hard' +gitalias soft='git reset --soft' +gitalias scrap='git checkout HEAD' + +# CONFIG ============================================================== + +# load gitconfig [alias] section as top-level aliases. +_git_import_aliases + +# source the system-wide rc file +[ -r /etc/gitshrc ] && . /etc/gitshrc + +# source the user's rc file +[ -r ~/.gitshrc ] && . ~/.gitshrc diff --git a/bin/git-thanks b/bin/git-thanks new file mode 100755 index 0000000..643a022 --- /dev/null +++ b/bin/git-thanks @@ -0,0 +1,17 @@ +#!/bin/sh +# Usage: git-thanks .. +# Display the various commit-authors and the # of commits each has made. +# +# All commits on master, ever: +# git-thanks master +# +# All commits on master since the 0.9.0 tag: +# git-thanks 0.9.0..master + +git log "$1" | + grep Author: | + sed 's/Author: \(.*\) <.*/\1/' | + sort | + uniq -c | + sort -rn | + sed 's/ *\([0-9]\{1,\}\) \(.*\)/\2 (\1)/' diff --git a/bin/git-track b/bin/git-track new file mode 100755 index 0000000..9aaba1d --- /dev/null +++ b/bin/git-track @@ -0,0 +1,73 @@ +#!/bin/sh +## Usage: git track +## git track +## Point the current local branch at for the purpose +## of merge tracking, pull, and status features. With no , +## write the currently tracked branch to standard output. +## +## If you have git's bash-completion support enabled, add this: +## complete -o default -o nospace -F _git_checkout git-track +set -e + +# bail out with message to stderr and exit status 1 +die() { + echo "$(basename $0):" "$@" 1>&2 + exit 1 +} + +# deal with argv +case "$1" in + --help) + grep '^##' "$0" | cut -c4- + exit + ;; + "") + remote= + merge= + ;; + */*) + git rev-parse "$1" >/dev/null + remote=$(echo "$1" | sed 's@^\(.*\)/.*@\1@') + merge=$(echo "$1" | sed 's@^.*/\(.*\)@\1@') + ;; + *) + git rev-parse "$1" >/dev/null + remote= + merge="$1" + ;; +esac + +# get the current branch in refs/heads/ form +ref=$(git symbolic-ref -q HEAD) +test -n "$ref" || +die "you're not on a branch" + +# just the branch name please +branch=$(echo "$ref" | sed 's@^refs/heads/@@') +test -n "$branch" || +die "you're in a weird place; get on a local branch" + +# if we don't have a target to track, show the +# currently tracked stuff. +test -z "$merge" && { + remote=$(git config --get "branch.$branch.remote" || true) + merge=$( + (git config --get "branch.$branch.merge") | + sed 's@refs/heads/@@' + ) + if test -n "$remote" -a -n "$merge"; then + echo "$branch -> $remote/$merge" + elif test -n "$merge"; then + echo "$branch -> $merge" + else + echo "$branch is not tracking anything" + fi + exit 0 +} + +# set the remote if a full remote/branch ref was given +test -n "$remote" && +git config "branch.$branch.remote" "$remote" + +# set the ref in said remote we should track +git config "branch.$branch.merge" "refs/heads/$merge" diff --git a/bin/git-up b/bin/git-up new file mode 100755 index 0000000..fc061d8 --- /dev/null +++ b/bin/git-up @@ -0,0 +1,33 @@ +#!/bin/sh + +# Usage: git-up +# git-reup +# +# Like git-pull but show a short and sexy log of changes +# immediately after merging (git-up) or rebasing (git-reup). +# +# Inspired by Kyle Neath's `git up' alias: +# http://gist.github.com/249223 + +set -e + +PULL_ARGS="$@" + +# when invoked as git-reup, run as `git pull --rebase' +test "$(basename $0)" = "git-reup" && +PULL_ARGS="--rebase $PULL_ARGS" + +git pull $PULL_ARGS + +# show diffstat of all changes if we're pulling with --rebase. not +# sure why git-pull only does this when merging. +test "$(basename $0)" = "git-reup" && { + echo "Diff:" + git --no-pager diff --color --stat HEAD@{1}.. | + sed 's/^/ /' +} + +# show an abbreviated commit log of stuff that was just merged. +echo "Log:" +git log --color --pretty=oneline --abbrev-commit HEAD@{1}.. | +sed 's/^/ /' diff --git a/bin/github-grab b/bin/github-grab new file mode 100755 index 0000000..a51acc1 --- /dev/null +++ b/bin/github-grab @@ -0,0 +1,22 @@ +#!/bin/sh + +[ $# -eq 0 ] && { + echo "usage: github-grab username [repo]" + exit 1 +} + +username="$1" + +if [ -n "$2" ] ; then + repo="$2" +else + repo=$(basename $(pwd)) +fi + +command="git remote add $username git://github.com/$username/$repo.git" +echo $command +$command + +command="git fetch $username" +echo $command +$command diff --git a/bin/gxpr b/bin/gxpr new file mode 100755 index 0000000..6e467f5 --- /dev/null +++ b/bin/gxpr @@ -0,0 +1,47 @@ +#!/bin/sh +# Usage: gxpr +# Like expr(1), but uses Google's calculator to evaluate . +# +# Math examples: +# $ gxpr '1 + 1' +# 2 +# +# $ gxpr 2 ^ 16 +# 65536 +# +# $ gxpr '(2 ^ 1) + (2 ^ 2) + (2 ^ 3) + (2 ^ 5)' +# 46 +# +# $ gxpr '5*9+(sqrt 10)^3=' +# 76.6227766 +# +# Conversion examples: +# $ gxpr 1GB in KB +# 1048576 kilobytes +# +# $ gxpr 10 megabits in megabytes +# 1.25 megabytes +# +# $ gxpr 2 miles in inches +# 126720 inches + +CURL='curl -s --header User-Agent:gxpr/1.0' +SEARCH="http://www.google.com/search" +EXPR=$(echo "$@" | sed -e 's/+/%2B/g' -e 's/ /+/g') + +res=$( + $CURL "$SEARCH?q=$EXPR" | + grep '

.*?= (.*?).*@\1@' | + perl -pe 's@\x{a0}@@g' | + perl -pe 's@ @@g' | + perl -pe 's@<.*?>@@g' +) + +# if we don't have a result, assume it's an invalid expression +test -z "$res" && { + echo "invalid expression:" "$@" 1>&2 + exit 1 +} + +echo "$res" diff --git a/bin/gzball b/bin/gzball new file mode 100755 index 0000000..0cd8f86 --- /dev/null +++ b/bin/gzball @@ -0,0 +1,23 @@ +#!/bin/sh +# create tar.gz archives and remove original dirs +# usage: gzball [-q] DIR [DIR] ... + +ECHO="echo" + +# be totally quite with -q argument +if [ "$1" == "-q" ] ; then + TAR="tar czf" + shift +else + TAR="tar cvzf" +fi + +# bail on first error +set -e + +for p in "$@" ; do + $ECHO "$p.tar.gz" # what we're building + $TAR "$p.tar.gz" "$p" # create tar.gz archive + touch -r "$p" "$p.tar.gz" # update modified time to match original DIR + rm -rf "$p" # remove original dir +done diff --git a/bin/headers b/bin/headers new file mode 100755 index 0000000..cec2faf --- /dev/null +++ b/bin/headers @@ -0,0 +1,5 @@ +#!/bin/sh +curl -sv "$@" 2>&1 >/dev/null | + grep -v "^\*" | + grep -v "^}" | + cut -c3- diff --git a/bin/hide b/bin/hide new file mode 100755 index 0000000..54b343a --- /dev/null +++ b/bin/hide @@ -0,0 +1,8 @@ +#!/bin/sh +# hide file by putting a dot in front +# usage: hide FILE [FILE]... +set -e +for f in "$@" +do + mv -v "$f" $(dirname "$f")/.$(basename "$f") +done diff --git a/bin/latest-ack b/bin/latest-ack new file mode 100755 index 0000000..bbfaac6 --- /dev/null +++ b/bin/latest-ack @@ -0,0 +1,3 @@ +#!/bin/sh -e +curl http://betterthangrep.com/ack-standalone > ~/bin/ack +chmod +x ~/bin/ack diff --git a/bin/latest-hub b/bin/latest-hub new file mode 100755 index 0000000..167eb73 --- /dev/null +++ b/bin/latest-hub @@ -0,0 +1,7 @@ +#!/bin/sh +# Usage: latest-hub +# Grabs the latest standalone version of Chris Wanstrath's hub +# and puts its in your HOME/bin. +set -e +curl -o ~/bin/hub http://defunkt.github.com/hub/standalone +chmod 755 ~/bin/hub diff --git a/bin/lgrep b/bin/lgrep new file mode 100755 index 0000000..bdea340 --- /dev/null +++ b/bin/lgrep @@ -0,0 +1,6 @@ +#!/bin/sh +# Usage: lgrep [] +# Shorthand for: grep --line-buffer +# This is useful when using grep in a pipeline with tail -f or +# where buffering would delay output. +exec grep --line-buffer "$@" diff --git a/bin/license b/bin/license new file mode 100755 index 0000000..4065329 --- /dev/null +++ b/bin/license @@ -0,0 +1,31 @@ +#!/bin/sh +# Usage: license +# Prints an MIT license appropriate for totin' around. +# +# $ license > COPYING +# +# Original version by Chris Wanstrath: +# http://gist.github.com/287717 +exec sh -c "tail -n +$(($LINENO + 2)) < $0 | sed s/DATE/$(date +%Y)/" + +Copyright (c) DATE Ryan Tomayko + +Permission is hereby granted, free of charge, to any person ob- +taining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without restric- +tion, including without limitation the rights to use, copy, modi- +fy, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is fur- +nished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONIN- +FRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/bin/orig b/bin/orig new file mode 100755 index 0000000..7a830a6 --- /dev/null +++ b/bin/orig @@ -0,0 +1,10 @@ +#!/bin/sh + +if [ $# = 0 ] ; then + echo "usage: orig FILE ..." + echo "copy FILE(s) to FILE.orig" +else + for f in "$@" ; do + cp -p "$f" "$f.orig" + done +fi diff --git a/bin/prune-dirs b/bin/prune-dirs new file mode 100755 index 0000000..94eb371 --- /dev/null +++ b/bin/prune-dirs @@ -0,0 +1,7 @@ +#!/bin/sh +# Usage: prune-dirs ... +# Remove empty directories under and including s. + +for dir in "$@" +do find "$dir" -type d -empty -depth | xargs rmdir +done diff --git a/bin/sync-home b/bin/sync-home new file mode 100755 index 0000000..b227c69 --- /dev/null +++ b/bin/sync-home @@ -0,0 +1,51 @@ +#!/bin/sh +# Usage: sync-home [user@]host ... +# Copy crucial dotfiles and scripts to one or more remote machines. +# +# Copyright (c) 2008 Ryan Tomayko +set -e + +test -z "$1" || echo "$@" | grep -q -- '--help' && { + echo "Usage: $0 [user@]host ..." + exit 1 +} + +cd ~ +for host in "$@"; do + echo "sync: $host" + rsync -avz --include-from=- --exclude='*' ./ "${host}:" < "$f" +done -- 2.47.1