| ... | ... |
@@ -34,9 +34,31 @@ zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm |
| 34 | 34 |
zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories |
| 35 | 35 |
cdpath=(.) |
| 36 | 36 |
|
| 37 |
+# use /etc/hosts and known_hosts for hostname completion |
|
| 38 |
+[ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
|
|
| 39 |
+[ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=()
|
|
| 40 |
+hosts=( |
|
| 41 |
+ "$_ssh_hosts[@]" |
|
| 42 |
+ "$_etc_hosts[@]" |
|
| 43 |
+ `hostname` |
|
| 44 |
+ localhost |
|
| 45 |
+) |
|
| 46 |
+zstyle ':completion:*:hosts' hosts $hosts |
|
| 47 |
+ |
|
| 48 |
+# Use caching so that commands like apt and dpkg complete are useable |
|
| 49 |
+zstyle ':completion::complete:*' use-cache 1 |
|
| 50 |
+zstyle ':completion::complete:*' cache-path ~/.oh-my-zsh/cache/ |
|
| 51 |
+ |
|
| 52 |
+# Don't complete uninteresting users |
|
| 53 |
+zstyle ':completion:*:*:*:users' ignored-patterns \ |
|
| 54 |
+ adm amanda apache avahi beaglidx bin cacti canna clamav daemon \ |
|
| 55 |
+ dbus distcache dovecot fax ftp games gdm gkrellmd gopher \ |
|
| 56 |
+ hacluster haldaemon halt hsqldb ident junkbust ldap lp mail \ |
|
| 57 |
+ mailman mailnull mldonkey mysql nagios \ |
|
| 58 |
+ named netdump news nfsnobody nobody nscd ntp nut nx openvpn \ |
|
| 59 |
+ operator pcap postfix postgres privoxy pulse pvm quagga radvd \ |
|
| 60 |
+ rpc rpcuser rpm shutdown squid sshd sync uucp vcsa xfs |
|
| 61 |
+ |
|
| 62 |
+# ... unless we really want to. |
|
| 63 |
+zstyle '*' single-ignored show |
|
| 37 | 64 |
|
| 38 |
-# Load known hosts file for auto-completion with ssh and scp commands |
|
| 39 |
-if [ -f ~/.ssh/known_hosts ]; then |
|
| 40 |
- zstyle ':completion:*' hosts $( sed 's/[, ].*$//' $HOME/.ssh/known_hosts ) |
|
| 41 |
- zstyle ':completion:*:*:(ssh|scp):*:*' hosts `sed 's/^\([^ ,]*\).*$/\1/' ~/.ssh/known_hosts` |
|
| 42 |
-fi |
| ... | ... |
@@ -37,3 +37,39 @@ function take() {
|
| 37 | 37 |
mkdir -p $1 |
| 38 | 38 |
cd $1 |
| 39 | 39 |
} |
| 40 |
+ |
|
| 41 |
+function extract() {
|
|
| 42 |
+ unset REMOVE_ARCHIVE |
|
| 43 |
+ |
|
| 44 |
+ if test "$1" = "-r"; then |
|
| 45 |
+ REMOVE=1 |
|
| 46 |
+ shift |
|
| 47 |
+ fi |
|
| 48 |
+ if [[ -f $1 ]]; then |
|
| 49 |
+ case $1 in |
|
| 50 |
+ *.tar.bz2) tar xvjf $1;; |
|
| 51 |
+ *.tar.gz) tar xvzf $1;; |
|
| 52 |
+ *.tar.xz) tar xvJf $1;; |
|
| 53 |
+ *.tar.lzma) tar --lzma -xvf $1;; |
|
| 54 |
+ *.bz2) bunzip $1;; |
|
| 55 |
+ *.rar) unrar $1;; |
|
| 56 |
+ *.gz) gunzip $1;; |
|
| 57 |
+ *.tar) tar xvf $1;; |
|
| 58 |
+ *.tbz2) tar xvjf $1;; |
|
| 59 |
+ *.tgz) tar xvzf $1;; |
|
| 60 |
+ *.zip) unzip $1;; |
|
| 61 |
+ *.Z) uncompress $1;; |
|
| 62 |
+ *.7z) 7z x $1;; |
|
| 63 |
+ *) echo "'$1' cannot be extracted via >extract<";; |
|
| 64 |
+ esac |
|
| 65 |
+ |
|
| 66 |
+ if [[ $REMOVE_ARCHIVE -eq 1 ]]; then |
|
| 67 |
+ echo removing "$1"; |
|
| 68 |
+ /bin/rm "$1"; |
|
| 69 |
+ fi |
|
| 70 |
+ |
|
| 71 |
+ else |
|
| 72 |
+ echo "'$1' is not a valid file" |
|
| 73 |
+ fi |
|
| 74 |
+} |
|
| 75 |
+ |
| ... | ... |
@@ -14,6 +14,9 @@ for config_file ($ZSH/custom/*.zsh) source $config_file |
| 14 | 14 |
plugin=${plugin:=()}
|
| 15 | 15 |
for plugin ($plugins) source $ZSH/plugins/$plugin/$plugin.plugin.zsh |
| 16 | 16 |
|
| 17 |
+# Load the theme |
|
| 18 |
+source "$ZSH/themes/$ZSH_THEME.zsh-theme" |
|
| 19 |
+ |
|
| 17 | 20 |
# Check for updates on initial load... |
| 18 | 21 |
if [ "$DISABLE_AUTO_UPDATE" = "true" ] |
| 19 | 22 |
then |
| ... | ... |
@@ -8,6 +8,7 @@ alias gd='git diff | mate' |
| 8 | 8 |
alias gdv='git diff -w "$@" | vim -R -' |
| 9 | 9 |
alias gc='git commit -v' |
| 10 | 10 |
alias gca='git commit -v -a' |
| 11 |
+alias gco='git checkout' |
|
| 11 | 12 |
alias gb='git branch' |
| 12 | 13 |
alias gba='git branch -a' |
| 13 | 14 |
alias gcount='git shortlog -sn' |
| ... | ... |
@@ -26,7 +27,7 @@ function current_branch() {
|
| 26 | 26 |
echo ${ref#refs/heads/}
|
| 27 | 27 |
} |
| 28 | 28 |
|
| 29 |
-# these aliases take advangate of the previous function |
|
| 29 |
+# these aliases take advantage of the previous function |
|
| 30 | 30 |
alias ggpull='git pull origin $(current_branch)' |
| 31 | 31 |
alias ggpush='git push origin $(current_branch)' |
| 32 |
-alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)' |
|
| 33 | 32 |
\ No newline at end of file |
| 33 |
+alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)' |
| ... | ... |
@@ -4,7 +4,7 @@ |
| 4 | 4 |
# Example usage: http://screencast.com/t/ZDgwNDUwNT |
| 5 | 5 |
open_lighthouse_ticket () {
|
| 6 | 6 |
if [ ! -f .lighthouse-url ]; then |
| 7 |
- echo "There is no .lighthouse file in the current directory..." |
|
| 7 |
+ echo "There is no .lighthouse-url file in the current directory..." |
|
| 8 | 8 |
return 0; |
| 9 | 9 |
else |
| 10 | 10 |
lighthouse_url=$(cat .lighthouse-url); |
| ... | ... |
@@ -13,4 +13,4 @@ open_lighthouse_ticket () {
|
| 13 | 13 |
fi |
| 14 | 14 |
} |
| 15 | 15 |
|
| 16 |
-alias lho='open_lighthouse_ticket' |
|
| 17 | 16 |
\ No newline at end of file |
| 17 |
+alias lho='open_lighthouse_ticket' |
| 18 | 18 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,20 @@ |
| 0 |
+_phing_does_target_list_need_generating () {
|
|
| 1 |
+ if [ ! -f .phing_targets ]; then return 0; |
|
| 2 |
+ else |
|
| 3 |
+ accurate=$(stat -f%m .phing_targets) |
|
| 4 |
+ changed=$(stat -f%m build.xml) |
|
| 5 |
+ return $(expr $accurate '>=' $changed) |
|
| 6 |
+ fi |
|
| 7 |
+} |
|
| 8 |
+ |
|
| 9 |
+_phing () {
|
|
| 10 |
+ if [ -f build.xml ]; then |
|
| 11 |
+ if _phing_does_target_list_need_generating; then |
|
| 12 |
+ echo "\nGenerating .phing_targets..." > /dev/stderr |
|
| 13 |
+ phing -l |grep -v ":" |grep -v "^$"|grep -v "\-" > .phing_targets |
|
| 14 |
+ fi |
|
| 15 |
+ compadd `cat .phing_targets` |
|
| 16 |
+ fi |
|
| 17 |
+} |
|
| 18 |
+ |
|
| 19 |
+compdef _phing phing |
| 0 | 20 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,8 @@ |
| 0 |
+alias rs='ruby script/rails server' |
|
| 1 |
+alias rg='ruby script/rails generate' |
|
| 2 |
+alias rd='ruby script/rails destroy' |
|
| 3 |
+alias rp='ruby script/rails plugin' |
|
| 4 |
+alias rdbm='rake db:migrate db:test:clone' |
|
| 5 |
+alias rc='ruby script/rails console' |
|
| 6 |
+alias rd='ruby script/rais server --debugger' |
|
| 7 |
+alias devlog='tail -f log/development.log' |
| 0 | 8 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,42 @@ |
| 0 |
+function svn_prompt_info {
|
|
| 1 |
+ if [[ -d .svn ]]; then |
|
| 2 |
+ echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_PREFIX\ |
|
| 3 |
+$ZSH_THEME_REPO_NAME_COLOR$(svn_get_repo_name)$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(svn_dirty)$ZSH_PROMPT_BASE_COLOR" |
|
| 4 |
+ fi |
|
| 5 |
+} |
|
| 6 |
+ |
|
| 7 |
+ |
|
| 8 |
+function in_svn() {
|
|
| 9 |
+ if [[ -d .svn ]]; then |
|
| 10 |
+ echo 1 |
|
| 11 |
+ fi |
|
| 12 |
+} |
|
| 13 |
+ |
|
| 14 |
+function svn_get_repo_name {
|
|
| 15 |
+ if [ is_svn ]; then |
|
| 16 |
+ svn info | sed -n 's/Repository\ Root:\ .*\///p' | read SVN_ROOT |
|
| 17 |
+ |
|
| 18 |
+ svn info | sed -n "s/URL:\ .*$SVN_ROOT\///p" | sed "s/\/.*$//" |
|
| 19 |
+ fi |
|
| 20 |
+} |
|
| 21 |
+ |
|
| 22 |
+function svn_get_rev_nr {
|
|
| 23 |
+ if [ is_svn ]; then |
|
| 24 |
+ svn info 2> /dev/null | sed -n s/Revision:\ //p |
|
| 25 |
+ fi |
|
| 26 |
+} |
|
| 27 |
+ |
|
| 28 |
+function svn_dirty_choose {
|
|
| 29 |
+ if [ is_svn ]; then |
|
| 30 |
+ s=$(svn status 2>/dev/null) |
|
| 31 |
+ if [ $s ]; then |
|
| 32 |
+ echo $1 |
|
| 33 |
+ else |
|
| 34 |
+ echo $2 |
|
| 35 |
+ fi |
|
| 36 |
+ fi |
|
| 37 |
+} |
|
| 38 |
+ |
|
| 39 |
+function svn_dirty {
|
|
| 40 |
+ svn_dirty_choose $ZSH_THEME_SVN_PROMPT_DIRTY $ZSH_THEME_SVN_PROMPT_CLEAN |
|
| 41 |
+} |
|
| 0 | 42 |
\ No newline at end of file |
| 1 | 43 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,104 @@ |
| 0 |
+#compdef vagrant |
|
| 1 |
+#autoload |
|
| 2 |
+ |
|
| 3 |
+# vagrant zsh completion |
|
| 4 |
+ |
|
| 5 |
+local -a _1st_arguments |
|
| 6 |
+_1st_arguments=( |
|
| 7 |
+ 'box:Box commands' |
|
| 8 |
+ 'destroy:Destroys the vagrant environment' |
|
| 9 |
+ 'halt:Halts the currently running vagrant environment' |
|
| 10 |
+ 'help:[TASK] Describe available tasks or one specific task' |
|
| 11 |
+ 'init:[box_name] [box_url] Initializes current folder for Vagrant usage' |
|
| 12 |
+ 'package:Packages a vagrant environment for distribution' |
|
| 13 |
+ 'provision:Run the provisioner' |
|
| 14 |
+ 'reload:Reload the vagrant environment' |
|
| 15 |
+ 'resume:Resumes a suspend vagrant environment' |
|
| 16 |
+ 'ssh:SSH into the currently running environment' |
|
| 17 |
+ 'ssh_config:outputs .ssh/config valid syntax for connecting to this environment via ssh.' |
|
| 18 |
+ 'status:Shows the status of the current Vagrant environment.' |
|
| 19 |
+ 'suspend:Suspends the currently running vagrant environment' |
|
| 20 |
+ 'up:Creates the vagrant environment' |
|
| 21 |
+ 'version:Prints the Vagrant version information' |
|
| 22 |
+) |
|
| 23 |
+ |
|
| 24 |
+local -a _box_arguments |
|
| 25 |
+_box_arguments=( |
|
| 26 |
+ 'add:NAME URI Add a box to the system' |
|
| 27 |
+ 'help:COMMAND Describe subcommands or one specific subcommand' |
|
| 28 |
+ 'list:Lists all installed boxes' |
|
| 29 |
+ 'remove:NAME Remove a box from the system' |
|
| 30 |
+ 'repackage:NAME Repackage an installed box into a `.box` file.' |
|
| 31 |
+) |
|
| 32 |
+ |
|
| 33 |
+__task_list () |
|
| 34 |
+{
|
|
| 35 |
+ local expl |
|
| 36 |
+ declare -a tasks |
|
| 37 |
+ |
|
| 38 |
+ tasks=(box destroy halt init package provision reload resume ssh ssh_config status suspend up version) |
|
| 39 |
+ |
|
| 40 |
+ _wanted tasks expl 'help' compadd $tasks |
|
| 41 |
+} |
|
| 42 |
+ |
|
| 43 |
+__box_list () |
|
| 44 |
+{
|
|
| 45 |
+ _wanted application expl 'command' compadd $(command ls -1 $HOME/.vagrant/boxes 2>/dev/null| sed -e 's/ /\\ /g') |
|
| 46 |
+} |
|
| 47 |
+ |
|
| 48 |
+__vagrant-box () |
|
| 49 |
+{
|
|
| 50 |
+ local curcontext="$curcontext" state line |
|
| 51 |
+ typeset -A opt_args |
|
| 52 |
+ |
|
| 53 |
+ _arguments -C \ |
|
| 54 |
+ ':command:->command' \ |
|
| 55 |
+ '*::options:->options' |
|
| 56 |
+ |
|
| 57 |
+ case $state in |
|
| 58 |
+ (command) |
|
| 59 |
+ _describe -t commands "gem subcommand" _box_arguments |
|
| 60 |
+ return |
|
| 61 |
+ ;; |
|
| 62 |
+ |
|
| 63 |
+ (options) |
|
| 64 |
+ case $line[1] in |
|
| 65 |
+ (repackage|remove) |
|
| 66 |
+ _arguments ':feature:__box_list' |
|
| 67 |
+ ;; |
|
| 68 |
+ esac |
|
| 69 |
+ ;; |
|
| 70 |
+ esac |
|
| 71 |
+} |
|
| 72 |
+ |
|
| 73 |
+ |
|
| 74 |
+ |
|
| 75 |
+ |
|
| 76 |
+local expl |
|
| 77 |
+local -a boxes installed_boxes |
|
| 78 |
+ |
|
| 79 |
+local curcontext="$curcontext" state line |
|
| 80 |
+typeset -A opt_args |
|
| 81 |
+ |
|
| 82 |
+_arguments -C \ |
|
| 83 |
+ ':command:->command' \ |
|
| 84 |
+ '*::options:->options' |
|
| 85 |
+ |
|
| 86 |
+case $state in |
|
| 87 |
+ (command) |
|
| 88 |
+ _describe -t commands "gem subcommand" _1st_arguments |
|
| 89 |
+ return |
|
| 90 |
+ ;; |
|
| 91 |
+ |
|
| 92 |
+ (options) |
|
| 93 |
+ case $line[1] in |
|
| 94 |
+ (help) |
|
| 95 |
+ _arguments ':feature:__task_list' |
|
| 96 |
+ ;; |
|
| 97 |
+ |
|
| 98 |
+ (box) |
|
| 99 |
+ __vagrant-box |
|
| 100 |
+ ;; |
|
| 101 |
+ esac |
|
| 102 |
+ ;; |
|
| 103 |
+esac |
| 5 | 5 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,18 @@ |
| 0 |
+# the svn plugin has to be activated for this to work. |
|
| 1 |
+ |
|
| 2 |
+PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}$(svn_prompt_info)%{$reset_color%}'
|
|
| 3 |
+ |
|
| 4 |
+ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
|
|
| 5 |
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
|
| 6 |
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%})%{$fg[yellow]%} ✗ %{$reset_color%}"
|
|
| 7 |
+ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}) "
|
|
| 8 |
+ |
|
| 9 |
+ |
|
| 10 |
+ |
|
| 11 |
+ZSH_PROMPT_BASE_COLOR="%{$fg_bold[blue]%}"
|
|
| 12 |
+ZSH_THEME_REPO_NAME_COLOR="%{$fg_bold[red]%}"
|
|
| 13 |
+ |
|
| 14 |
+ZSH_THEME_SVN_PROMPT_PREFIX="svn:("
|
|
| 15 |
+ZSH_THEME_SVN_PROMPT_SUFFIX=")" |
|
| 16 |
+ZSH_THEME_SVN_PROMPT_DIRTY="%{$fg[red]%} ✘ %{$reset_color%}"
|
|
| 17 |
+ZSH_THEME_SVN_PROMPT_CLEAN=" " |
|
| 0 | 18 |
\ No newline at end of file |
| 1 | 19 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,14 @@ |
| 0 |
+# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png |
|
| 1 |
+local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
|
| 2 |
+ |
|
| 3 |
+local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}'
|
|
| 4 |
+local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}'
|
|
| 5 |
+local rvm_ruby='%{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v g)›%{$reset_color%}'
|
|
| 6 |
+local git_branch='$(git_prompt_info)%{$reset_color%}'
|
|
| 7 |
+ |
|
| 8 |
+PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch}
|
|
| 9 |
+╰─%B$%b " |
|
| 10 |
+RPS1="${return_code}"
|
|
| 11 |
+ |
|
| 12 |
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹"
|
|
| 13 |
+ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}"
|
| ... | ... |
@@ -1,4 +1,4 @@ |
| 1 |
-if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="white"; fi |
|
| 1 |
+if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="white"; fi |
|
| 2 | 2 |
|
| 3 | 3 |
PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $(git_prompt_info)%(!.#.$) '
|
| 4 | 4 |
RPROMPT='[%*]' |
| 5 | 5 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,56 @@ |
| 0 |
+# the idea of this theme is to contain a lot of info in a small string, by |
|
| 1 |
+# compressing some parts and colorcoding, which bring useful visual cues, |
|
| 2 |
+# while limiting the amount of colors and such to keep it easy on the eyes. |
|
| 3 |
+# When a command exited >0, the timestamp will be in red and the exit code |
|
| 4 |
+# will be on the right edge. |
|
| 5 |
+# The exit code visual cues will only display once. |
|
| 6 |
+# (i.e. they will be reset, even if you hit enter a few times on empty command prompts) |
|
| 7 |
+ |
|
| 8 |
+typeset -A host_repr |
|
| 9 |
+ |
|
| 10 |
+# translate hostnames into shortened, colorcoded strings |
|
| 11 |
+host_repr=('dieter-ws-a7n8x-arch' "%{$fg_bold[green]%}ws" 'dieter-p4sci-arch' "%{$fg_bold[blue]%}p4")
|
|
| 12 |
+ |
|
| 13 |
+# local time, color coded by last return code |
|
| 14 |
+time_enabled="%(?.%{$fg[green]%}.%{$fg[red]%})%*%{$reset_color%}"
|
|
| 15 |
+time_disabled="%{$fg[green]%}%*%{$reset_color%}"
|
|
| 16 |
+time=$time_enabled |
|
| 17 |
+ |
|
| 18 |
+# user part, color coded by privileges |
|
| 19 |
+local user="%(!.%{$fg[blue]%}.%{$fg[blue]%})%n%{$reset_color%}"
|
|
| 20 |
+ |
|
| 21 |
+# Hostname part. compressed and colorcoded per host_repr array |
|
| 22 |
+# if not found, regular hostname in default color |
|
| 23 |
+local host="@${host_repr[$(hostname)]:-$(hostname)}%{$reset_color%}"
|
|
| 24 |
+ |
|
| 25 |
+# Compacted $PWD |
|
| 26 |
+local pwd="%{$fg[blue]%}%c%{$reset_color%}"
|
|
| 27 |
+ |
|
| 28 |
+PROMPT='${time} ${user}${host} ${pwd} $(git_prompt_info)'
|
|
| 29 |
+ |
|
| 30 |
+# i would prefer 1 icon that shows the "most drastic" deviation from HEAD, |
|
| 31 |
+# but lets see how this works out |
|
| 32 |
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}"
|
|
| 33 |
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
|
|
| 34 |
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%} %{$fg[yellow]%}?%{$fg[green]%}%{$reset_color%}"
|
|
| 35 |
+ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}"
|
|
| 36 |
+ |
|
| 37 |
+# elaborate exitcode on the right when >0 |
|
| 38 |
+return_code_enabled="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
|
| 39 |
+return_code_disabled= |
|
| 40 |
+return_code=$return_code_enabled |
|
| 41 |
+ |
|
| 42 |
+RPS1='${return_code}'
|
|
| 43 |
+ |
|
| 44 |
+function accept-line-or-clear-warning () {
|
|
| 45 |
+ if [[ -z $BUFFER ]]; then |
|
| 46 |
+ time=$time_disabled |
|
| 47 |
+ return_code=$return_code_disabled |
|
| 48 |
+ else |
|
| 49 |
+ time=$time_enabled |
|
| 50 |
+ return_code=$return_code_enabled |
|
| 51 |
+ fi |
|
| 52 |
+ zle accept-line |
|
| 53 |
+} |
|
| 54 |
+zle -N accept-line-or-clear-warning |
|
| 55 |
+bindkey '^M' accept-line-or-clear-warning |
| ... | ... |
@@ -5,7 +5,7 @@ ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}!"
|
| 5 | 5 |
ZSH_THEME_GIT_PROMPT_CLEAN="" |
| 6 | 6 |
|
| 7 | 7 |
function prompt_char {
|
| 8 |
- if [ "$(whoami)" = "root" ]; then echo "%{$fg[red]%}#%{$reset_color%}"; else echo $; fi
|
|
| 8 |
+ if [ $UID -eq 0 ]; then echo "%{$fg[red]%}#%{$reset_color%}"; else echo $; fi
|
|
| 9 | 9 |
} |
| 10 | 10 |
|
| 11 | 11 |
PROMPT='%(?, ,%{$fg[red]%}FAIL%{$reset_color%}
|
| 12 | 12 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,9 @@ |
| 0 |
+# ZSH Theme emulating the Fish shell's default prompt. |
|
| 1 |
+ |
|
| 2 |
+local user_color='green'; [ $UID -eq 0 ] && user_color='red' |
|
| 3 |
+PROMPT='%n@%m %{$fg[$user_color]%}%~%{$reset_color%}%(!.#.>) '
|
|
| 4 |
+PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
|
|
| 5 |
+RPS1='%(?..%{$fg[red]%}%? ↵%{$reset_color%})$(git_prompt_info)'
|
|
| 6 |
+ |
|
| 7 |
+ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[cyan]%}"
|
|
| 8 |
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
| 0 | 9 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,19 @@ |
| 0 |
+if [ "$(whoami)" = "root" ] |
|
| 1 |
+then CARETCOLOR="red" |
|
| 2 |
+else CARETCOLOR="blue" |
|
| 3 |
+fi |
|
| 4 |
+ |
|
| 5 |
+local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
|
| 6 |
+ |
|
| 7 |
+PROMPT='%m%{${fg_bold[magenta]}%} :: %{$reset_color%}%{${fg[green]}%}%3~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}%#%{${reset_color}%} '
|
|
| 8 |
+ |
|
| 9 |
+RPS1='$(vi_mode_prompt_info) ${return_code}'
|
|
| 10 |
+ |
|
| 11 |
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[cyan]%}‹"
|
|
| 12 |
+ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}"
|
|
| 13 |
+ |
|
| 14 |
+MODE_INDICATOR="%{$fg_bold[magenta]%}<%{$reset_color%}%{$fg[magenta]%}<<%{$reset_color%}"
|
|
| 15 |
+ |
|
| 16 |
+# TODO use 265 colors |
|
| 17 |
+#MODE_INDICATOR="$FX[bold]$FG[020]<$FX[no_bold]%{$fg[blue]%}<<%{$reset_color%}"
|
|
| 18 |
+# TODO use two lines if git |
| ... | ... |
@@ -1,6 +1,6 @@ |
| 1 | 1 |
# ZSH Theme - Preview: http://dl.dropbox.com/u/1552408/Screenshots/2010-04-08-oh-my-zsh.png |
| 2 | 2 |
|
| 3 |
-if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="green"; fi |
|
| 3 |
+if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi |
|
| 4 | 4 |
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
| 5 | 5 |
|
| 6 | 6 |
PROMPT='%{$fg[$NCOLOR]%}%n%{$fg[green]%}@%m%{$reset_color%} %~ \
|
| 7 | 7 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,12 @@ |
| 0 |
+# Simple theme based on my old zsh settings. |
|
| 1 |
+ |
|
| 2 |
+function get_host {
|
|
| 3 |
+ echo '@'`hostname`'' |
|
| 4 |
+} |
|
| 5 |
+ |
|
| 6 |
+PROMPT='> ' |
|
| 7 |
+RPROMPT='%~$(git_prompt_info)$(get_host)' |
|
| 8 |
+ |
|
| 9 |
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}✗%{$reset_color%}"
|
|
| 10 |
+ZSH_THEME_GIT_PROMPT_PREFIX="("
|
|
| 11 |
+ZSH_THEME_GIT_PROMPT_SUFFIX=")" |
|
| 0 | 12 |
\ No newline at end of file |
| ... | ... |
@@ -1,4 +1,4 @@ |
| 1 |
-if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="green"; fi |
|
| 1 |
+if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi |
|
| 2 | 2 |
|
| 3 | 3 |
PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $(git_prompt_info)%(!.#.$) '
|
| 4 | 4 |
RPROMPT='[%*]' |
| 5 | 5 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,24 @@ |
| 0 |
+# /|/ Code by Stephen |
|
| 1 |
+# /|/ "Rixius" Middleton |
|
| 2 |
+# |
|
| 3 |
+# name in folder (github) |
|
| 4 |
+# ± if in github repo, or ≥ if otherwise Time in 24-hour format is on right. |
|
| 5 |
+function collapse_pwd {
|
|
| 6 |
+ echo $(pwd | sed -e "s,^$HOME,~,") |
|
| 7 |
+} |
|
| 8 |
+function prompt_char {
|
|
| 9 |
+ echo -n "%{$bg[white]%}%{$fg[red]%}"
|
|
| 10 |
+ git branch >/dev/null 2>/dev/null && echo "±%{$reset_color%}" && return
|
|
| 11 |
+ echo "≥%{$reset_color%}"
|
|
| 12 |
+} |
|
| 13 |
+RIXIUS_PRE="%{$bg[white]%}%{$fg[red]%}"
|
|
| 14 |
+ |
|
| 15 |
+PROMPT=' |
|
| 16 |
+%{$RIXIUS_PRE%}%n%{$reset_color%} in %{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(git_prompt_info)
|
|
| 17 |
+$(prompt_char) ' |
|
| 18 |
+RPROMPT='%{$RIXIUS_PRE%}%T%{$reset_color%}'
|
|
| 19 |
+ |
|
| 20 |
+ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}"
|
|
| 21 |
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
|
| 22 |
+ZSH_THEME_GIT_PROMPT_DIRTY=" %{$RIXIUS_PRE%}!%{$reset_color%}"
|
|
| 23 |
+ZSH_THEME_GIT_PROMPT_CLEAN=" %{$RIXIUS_PRE%}√%{$reset_color%}"
|
| ... | ... |
@@ -1,6 +1,16 @@ |
| 1 |
-# Comment |
|
| 1 |
+# Comment |
|
| 2 | 2 |
|
| 3 |
-ZSH_THEME_GIT_PROMPT_PREFIX=' (git:' |
|
| 4 |
-ZSH_THEME_GIT_PROMPT_SUFFIX=')' |
|
| 3 |
+PROMPT='%{$fg[magenta]%}[%c] %{$reset_color%}'
|
|
| 5 | 4 |
|
| 6 |
-PROMPT='%{$fg[magenta]%}[%c]$(git_prompt_info) $ %{$reset_color%}'
|
|
| 7 | 5 |
\ No newline at end of file |
| 6 |
+RPROMPT='%{$fg[magenta]%}$(git_prompt_info)%{$reset_color%} $(git_prompt_status)%{$reset_color%}'
|
|
| 7 |
+ |
|
| 8 |
+ZSH_THEME_GIT_PROMPT_PREFIX="" |
|
| 9 |
+ZSH_THEME_GIT_PROMPT_SUFFIX="" |
|
| 10 |
+ZSH_THEME_GIT_PROMPT_DIRTY="" |
|
| 11 |
+ZSH_THEME_GIT_PROMPT_CLEAN="" |
|
| 12 |
+ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%} ✈"
|
|
| 13 |
+ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%} ✭"
|
|
| 14 |
+ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✗"
|
|
| 15 |
+ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%} ➦"
|
|
| 16 |
+ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%} ✂"
|
|
| 17 |
+ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%} ✱"
|
|
| 8 | 18 |
\ No newline at end of file |