guest@dotshare [~/groups/shells/zsh] $ ls ZSH-alicious/ | cat

ZSH-alicious (scrot) (+10 likes)

crshd Jun 29, 2011 (shells/zsh)

.zshrc(raw, dl)

SCROT

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#==============================================================
#
# C O N F I G U R A T I O N  F O R  Z S H
#

#=-=-=-=-=-=-=
# load stuffs
#=-=-=-=-=-=-=

autoload -U colors && colors
autoload -U compinit && compinit
autoload -U vcs_info && vcs_info

zmodload zsh/complist
zmodload zsh/terminfo

# setopt
setopt \
  autocd \
  ksh_glob \
  extendedglob \
  prompt_subst \
  inc_append_history

bindkey -v

#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Import seperate config files
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

for r in $HOME/etc/zsh/*.zsh; do
  if [[ $DEBUG > 0 ]]; then
    echo "zsh: sourcing $r"
  fi
  source $r
done

eval $( dircolors -b $XDG_CONFIG_HOME/zsh/LS_COLORS/LS_COLORS )
export LS_COLORS

CLICK TO VIEW

x

01-envars.zsh(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# HOMEs
export XDG_CONFIG_HOME="$HOME/etc"
export XDG_CACHE_HOME="$HOME/etc/cache"
export XDG_DATA_HOME="$HOME/var"
export DEVEL_HOME="$HOME/dev"
export BIN_HOME="$HOME/bin"

export LANG="de_DE.utf8"

export PATH="$PATH:$BIN_HOME:/sbin:/usr/sbin:/usr/local/bin:/opt/jre1.6.0_29/bin"

# JAVA
#export LD_LIBRARY_PATH=/usr/lib/jre1.7.0/lib/amd64
export LD_LIBRARY_PATH=/opt/jre1.6.0_29/lib/

export HISTSIZE=1000
export SAVEHIST=1000
export HISTFILE=$XDG_CONFIG_HOME/zsh/history
export DISPLAY=:0

export SHELL='/bin/zsh'
export EDITOR='vim'
export MANPAGER='vimpager'
 

x

02-functions.zsh(raw, dl)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
# {{{ Title stuffs
precmd() {

	vcs_info
	setprompt

	case $TERM in
		rxvt-256color | screen-256color ) 
			print -Pn "\e]0;%n@%m: %~\a" ;;
	esac
}

preexec() {
	case $TERM in
		rxvt-256color | screen-256color )
			print -Pn "\e]0;$1\a" ;;
	esac
} # }}}

# {{{ Oneliners
goto() { [ -d "$1" ] && cd "$1" || cd "$(dirname "$1")"; }
cpf() { cp "$@" && goto "$_"; }
mvf() { mv "$@" && goto "$_"; }
mkf() { mkdir -p $1; cd $1 }
cdl() { cd $@; ls++ }
d() { ($1 &) }
zsh_stats() { history | awk '{print $2}' | sort | uniq -c | sort -rn | head }
du1() { du -h --max-depth=1 "$@" | sort -k 1,1hr -k 2,2f; }
epoch() { print $(( `echo $1 | cut -b 1-2` * 3600 + `echo $1 | cut -b 4-5` * 60 + `echo $1 | cut -b 7-8` )) }
# }}}

# {{{ Create ZSH named directory
namedir() {
	echo "$1=$PWD ;  : ~$1" >> ~/.config/zsh/directories
	. $XDG_CONFIG_HOME/zsh/directories
} # }}}

# {{{ Most used Commands
mostused() {
	sed -n 's/^\([a-z]*\) .*/\1/p' $HISTFILE |
	sort |
	uniq -c |
	sort -n -k1 |
	tail -25 |
	tac
} # }}}

# {{{ FFMPEG stuffs

# Split Video
ffmpeg_splitvid()
{
	local t=$(epoch `ffprobe $1 2>&1 | grep Duration | cut -b 13-20`)
	local first=$(( $t / 3 ))
	local second=$(( $first * 2 ))
	local duration=$(( $first + 30 ))

	ffmpeg -i $1 -ss 0 -t $duration -vcodec copy -sameq -acodec copy -async 100 -threads 0 ${1%.*}.part1.avi
	ffmpeg -i $1 -ss $first -t $duration -vcodec copy -sameq -acodec copy -async 100 -threads 0 ${1%.*}.part2.avi
	ffmpeg -i $1 -ss $second -t $duration -vcodec copy -sameq -acodec copy -async 100 -threads 0 ${1%.*}.part3.avi
}

ffmpeg_bframes()
{
	ffmpeg -i $1 -vcodec copy -sameq -acodec libmp3lame -ab 128k -ar 48000 -ac 2 -threads 0 ${1%.*}.fix.avi
}

# Convert to x264 (stupid railscasts with their stupid .mov that won't play in mplayer)
ffmpeg_x264() {
	ffmpeg -i $1 -acodec aac -strict experimental -ab 96k -vcodec libx264 -vpre slow -crf 22 -threads 0 -f matroska ${1%.*}.mkv
} 

# Rip Audio as MP3
ffmpeg_mp3() {
	ffmpeg -i $1 -acodec libmp3lame -sameq -threads 0 ${1%.*}.mp3
}

# Convert anything to iPhone and move to LAMP for streaming
ffmpeg_iphone()
{
	ffmpeg -i $1 -acodec libfaac -ab 128k -vcodec libx264 -vpre ipod640 -s 480x320 -r 29 -threads 0 ${1%.*}.mp4
	mv ${1%.*}.mp4 ~/www/iphone/
} # }}}

# {{{ Rip Audio CDs to MP3
ripdatshit()
{
	echo "MP3 VBR quality setting: [0-9]"
	read $q
	mkdir $HOME/tmp/rip
	cd $HOME/tmp/rip
	cdparanoia -B
	for i in *.wav; do
		lame -V $q $i mp3/${i%.*.*}.mp3
	done
	echo "Tag mp3 files with Easytag? [y/n]"
	read $yn
	if [[ "$yn" == "y" ]]; then
		easytag $HOME/tmp/rip
	fi
} # }}}

# {{{ Create ISO from device or directory
mkiso()
{
	case $1 in
		/dev/*)
			dd if=$1 of=$2 ;;
		*)
			mkisofs -o $2 $1 ;;
	esac
} # }}}

# {{{ Setup empty github repo
mkgit() {
	mkdir $1
	cd $1
	git init
	touch README.markdown
	git add README.markdown
	git commit -m 'inital setup - automated'
	git remote add origin git@github.com:crshd/$1.git
	git push origin master
} # }}}

# {{{ Archiving - Compress/decompress various archive types with a single command
ark() {
	case $1 in

		e)
			case $2 in
				*.tar.bz2)   tar xvjf $2      ;;
				*.tar.gz)    tar xvzf $2      ;;
				*.bz2)       bunzip2 $2       ;;
				*.rar)       unrar x $2       ;;
				*.gz)        gunzip $2        ;;
				*.tar)       tar xvf $2       ;;
				*.tbz2)      tar xvjf $2      ;;
				*.tgz)       tar xvzf $2      ;;
				*.zip)       unzip $2         ;;
				*.Z)         uncompress $2    ;;
				*.7z)        7z x $2          ;;
				*)           echo "'$2' kann nicht mit >ark< entpackt werden" ;;
			esac ;;

		c)
			case $2 in
				*.tar.*)    arch=$2; shift 2;
					tar cvf ${arch%.*} $@
					case $arch in
						*.gz)   gzip -9r ${arch%.*}   ;;
						*.bz2)  bzip2 -9zv ${arch%.*} ;;
					esac                                ;;
				*.rar)      shift; rar a -m5 -r $@; rar k $1    ;;
				*.zip)      shift; zip -9r $@                   ;;
				*.7z)       shift; 7z a -mx9 $@                 ;;
				*)          echo "Kein gültiger Archivtyp"      ;;
			esac ;;

		*)
			echo "WATT?" ;;

	esac
} # }}}

# {{{ Quick Link saving for fast saves/recalls
addfile() {echo $2 >> /media/data/Filez/$1}
searchfile() {ls /media/data/Filez | grep $1}
getfile() {cat /media/data/Filez/$1 | xclip}
losefile() {rm /media/data/Filez/$1}
# }}}

# {{{ Functions for more comfortable use of DropboxCLI
# requires:
# dropbox-cli
# cush
# xclip
# ZSH named directory "~Dropbox"

dbheader() {
	echo -e " Dropbox - $(dropbox status)
======================================================"
}

dbshorturl() {
	url=$(cush -o -- $(dropbox puburl ~Dropbox/Public/$1))
	echo -n $url | xclip
	echo $url
}

dbup() {
	dbheader
	cp $1 /media/data/Dropbox/Public
	dbshorturl $1
}

dbls() {
	dbheader
	dropbox ls /media/data/Dropbox/$1
}

dburl() {
	dbheader
	dbshorturl $1
}
# }}}

# {{{ Function to switch packer/pacman-color, depending on options used
pac() {
	case $1 in

		-S | -Ss | -Ssq | -Si | -G )
			sudo packer $@ ;;

		-Su | -Syu )
			sudo packer $@
			echo "" > $HOME/.pacmanupdates ;;

		* )
			sudo pacman-color $@ ;;

	esac
} # }}}

port() {
	case $1 in
		install )
			shift
			prt-get depinst $@ ;;
		remove | lock | unlock )
			sudo prt-get $@ ;;
		new )
			mkdir $HOME/ports/$2
			chmod 777 $HOME/ports/$2
			cd $HOME/ports/$2
			touch Pkgfile ;;
		fetchup )
			sudo ports -u
			ports -d ;;
		list )
			ports -l ;;
		pre-install )
			sudo sh $(prt-get path $2)/pre-install ;;
		post-install )
			sudo sh $(prt-get path $2)/post-install ;;
		* )
			prt-get $@ ;;
	esac
}

rc.d() {
	sudo /etc/rc.d/$@
}
 

x

02-aliases.zsh(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# Sudo
alias s='sudo'

# CD
alias cd..='cd ..'
alias ..='cd ..'
alias ...='cd ../..'
alias ~='cd ~'

# RM
alias rm='rm -r'
alias rmf='rm -rf'

# CP
alias cp='cp -r'
alias cpp='rsync -PrlpE'
alias cpz='rsync -PrlpEz'

# LS
alias l='ls -Xp --color=auto'
alias ls='ls -Xp --color=auto'
alias ll='ls++'

# MKDIR
alias mk='mkdir -p'
alias mkdir='mkdir -p'

# Various
alias cls='clear'
alias h='history'
alias mplayer='mplayer -msgcolor'
alias utorrent='utserver -configfile ~/.config/utorrent/utserver.conf'
alias wget='wget -c'
alias aria='aria2c -c -x 10 -s 10 -k 10M'
alias burniso='cdrecord -eject dev=1,0,0 -data'
alias sxiv='sxiv -dr'
alias osstest='osstest -g 5'
alias pychrom='pychrom -c /usr/share/X11/rgb.txt'
alias rtorrent="rtorrent -n -o import=${XDG_CONFIG_HOME}/rtorrent/config.rc"

# Mounting
alias musb='sudo mount /dev/sdb'
alias uusb='sudo umount /mnt/usb'

# Apache
alias apache='sudo apache2ctl'

# Tmux
alias irc='tmux -2 a -t irc'
alias imap='tmux -2 a -t imap'
alias torrent='tmux -2 a -t torrent'
alias t='tmux -2 a -t tmux'

# Ping
alias pr='ping -c 1 192.168.1.1 | tail -3'
alias pg='ping -c 1 google.com | tail -3'

# Git
alias g='git'
alias ga='git add'
alias gst='git status'
alias gl='git pull'
alias gup='git fetch && git rebase'
alias gp='git push'
alias gd='git diff | mate'
alias gdv='git diff -w "$@" | vim -R -'
alias gc='git commit -m'
alias gca='git commit -v -a'
alias gb='git branch'
alias gba='git branch -a'
alias gcount='git shortlog -sn'
alias gcp='git cherry-pick'

# Ruby
alias gem='sudo gem'

# Handbrake (What the fuck is wrong with you guys?)
alias handbrake='ghb'
alias handbrakecli='HandBrakeCLI'

# Fun with sed
alias df='df -h | grep sd |\
	sed -e "s_/dev/sda[1-9]_\x1b[34m&\x1b[0m_" |\
	sed -e "s_/dev/sd[b-z][1-9]_\x1b[33m&\x1b[0m_" |\
	sed -e "s_[,0-9]*[MG]_\x1b[36m&\x1b[0m_" |\
	sed -e "s_[0-9]*%_\x1b[32m&\x1b[0m_" |\
	sed -e "s_9[0-9]%_\x1b[31m&\x1b[0m_" |\
	sed -e "s_/mnt/[-_A-Za-z0-9]*_\x1b[34;1m&\x1b[0m_"'

alias duch='du -ch | grep insgesamt |\
	sed -e "s_[0-9]*,[0-9]*[B|G|K|M|T]_\x1b[32m&\x1b[0m_"'
 

x

03-bindkeys.zsh(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
bindkey "\e[1~" beginning-of-line
bindkey "\e[4~" end-of-line
bindkey "\e[5~" beginning-of-history
bindkey "\e[6~" end-of-history
bindkey "\e[3~" delete-char
bindkey "\e[2~" quoted-insert
bindkey "\e[5C" forward-word
bindkey "\eOc" emacs-forward-word
bindkey "\e[5D" backward-word
bindkey "\eOd" emacs-backward-word
bindkey "\e\e[C" forward-word
bindkey "\e\e[D" backward-word
# for rxvt
bindkey "\e[8~" end-of-line
bindkey "\e[7~" beginning-of-line
# for non RH/Debian xterm, can't hurt for RH/Debian xterm
bindkey "\eOH" beginning-of-line
bindkey "\eOF" end-of-line
# for freebsd console
bindkey "\e[H" beginning-of-line
bindkey "\e[F" end-of-line
bindkey '\e[A' history-beginning-search-backward
bindkey '\e[B' history-beginning-search-forward

# vim: set ft=zsh :
 

x

06-prompt.zsh(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
local IT="${terminfo[sitm]}${terminfo[bold]}"
local ST="${terminfo[sgr0]}${terminfo[ritm]}"

local FMT_BRANCH="%F{9}(%s:%F{7}%{$IT%}%r%{$ST%}%F{9}) %F{11}%B%b %K{235}%{$IT%}%u%c%{$ST%}%k"
local FMT_ACTION="(%F{3}%a%f)"
local FMT_PATH="%F{1}%R%F{2}/%S%f"

setprompt() {
  local USER="%(#.%F{1}.%F{3})%n%f"
  local HOST="%F{1}%M%f"
  local PWD="%F{7}$($XDG_CONFIG_HOME/zsh/rzsh_path)%f"
  local TTY="%F{4}%y%f"
  local EXIT="%(?..%F{202}%?%f)"
  local PRMPT="${USER}@$HOST:${TTY}: ${PWD}
${EXIT} %F{202}»%f "

  if [[ "${vcs_info_msg_0_}" == "" ]]; then
    PROMPT="$PRMPT"
  else
    PROMPT="${vcs_info_msg_0_}
$PRMPT"
  fi
}
 

x

06-syntax-rules.zsh(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern)

# STYLES
# Aliases and functions
ZSH_HIGHLIGHT_STYLES[alias]='fg=blue,bold'
ZSH_HIGHLIGHT_STYLES[function]='fg=blue,bold'

# Commands and builtins
ZSH_HIGHLIGHT_STYLES[command]="fg=blue,bold"
ZSH_HIGHLIGHT_STYLES[hashed-command]="fg=blue,bold"
ZSH_HIGHLIGHT_STYLES[builtin]="fg=blue,bold"

# Paths
ZSH_HIGHLIGHT_STYLES[path]='fg=white'

# Globbing
ZSH_HIGHLIGHT_STYLES[globbing]='fg=yellow,bold'

# Options and arguments
ZSH_HIGHLIGHT_STYLES[single-hyphen-option]='fg=red'
ZSH_HIGHLIGHT_STYLES[double-hyphen-option]='fg=red'

ZSH_HIGHLIGHT_STYLES[back-quoted-argument]="fg=green"
ZSH_HIGHLIGHT_STYLES[single-quoted-argument]="fg=green"
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]="fg=green"
ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]="fg=green"
ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]="fg=green"

# PATTERNS
# rm -rf
ZSH_HIGHLIGHT_PATTERNS+=('rm -rf *' 'fg=white,bold,bg=red')

# Sudo
ZSH_HIGHLIGHT_PATTERNS+=('sudo ' 'fg=white,bold,bg=red')
 

x

07-zstyle.zsh(raw, dl)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# ignore completion to commands we don't have
zstyle ':completion:*:functions'          ignored-patterns '_*'

# format autocompletion style
zstyle ':completion:*:descriptions'       format "%{$c1%}%d%{$reset_color%}"
zstyle ':completion:*:corrections'        format "%{$c3%}%d%{$reset_color%}"
zstyle ':completion:*:messages'           format "%{$c1%}%d%{$reset_color%}"
zstyle ':completion:*:warnings'           format "%{$c1%}%d%{$reset_color%}"

# zstyle show completion menu if 2 or more items to select
zstyle ':completion:*'                    menu select=2

# zstyle kill menu
zstyle ':completion:*:*:kill:*'           menu yes select
zstyle ':completion:*:kill:*'             force-list always
zstyle ':completion:*:*:kill:*:processes' list-colors "=(#b) #([0-9]#)*=36=31"

## VCS
# vcs_info
zstyle ':vcs_info:*'                      enable git hg svn
# check-for-changes can be really slow.
# you should disable it, if you work with large repositories   
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' unstagedstr '%F{62}D%F{237}IRTY%f'  # display ¹ if there are unstaged changes
zstyle ':vcs_info:*' stagedstr '%F{62}S%F{237}TAGED'    # display ² if there are staged changes
zstyle ':vcs_info:*' actionformats "${FMT_BRANCH}${FMT_ACTION}" "${FMT_PATH}"
zstyle ':vcs_info:*' formats       "${FMT_BRANCH}"              "${FMT_PATH}"
zstyle ':vcs_info:*' nvcsformats   ""                           "%~"


zstyle ':completion:*'                       accept-exact '*(N)'
zstyle ':completion:*'                       separate-sections 'yes'
zstyle ':completion:*'                       list-dirs-first true
zstyle ':completion:*:default'               list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*'                       menu select=200
zstyle ':completion:*'                       use-perl=1
zstyle ':completion:*'                       my-accounts='m@japh.se'

zstyle ':completion:*'                       squeeze-slashes true
zstyle ':completion:*:cd:*'                  ignore-parents parent pwd
#zstyle ':completion:*:cd:*'                  tag-order 'named-directories'

zstyle ':completion:*:(all-|)files'          ignored-patterns '*.un~'
zstyle ':completion:*:*:kill:*:processes' \
  list-colors '=(#b) #([0-9]#)*=0=01;31'

zstyle ':completion::complete:*'             use-cache on
zstyle ':completion::complete:*'             cache-path ~/etc/cache/$HOST
zstyle ':completion:*:processes'             command 'ps -axw'
zstyle ':completion:*:processes-names'       command 'ps -awxho command'
zstyle ':completion:*'                       matcher-list 'm:{a-z}={A-Z}'
zstyle ':completion:*:functions'             ignored-patterns '_*'

zstyle ':completion:*' group-name            ''
zstyle ':completion:*:*:mplayer:*'           tag-order files
zstyle ':completion:*:*:mplayer:*'           file-patterns   \
       '*.(rmvb|mkv|mpg|wmv|mpeg|avi|flv|mp3|mp4|flac|ogg):video' \
       '*:all-files' '*(-/):directories'

zstyle ':completion:*:*:(vim|rview|vimdiff|xxd):*:*files' \
  ignored-patterns '*~|*.(old|bak|zwc|viminfo|rxvt-*|zcompdump)|pm_to_blib|cover_db|blib' \
  file-sort modification
zstyle ':completion:*:*:(vim|rview|vimdiff|xxd):*' \
  file-sort modification
zstyle ':completion:*:*:(vim|rview|vimdiff|xxd):*' \
  tag-order files
#zstyle ':completion:*:vim:*:directories' ignored-patterns \*

zstyle ':completion:*:*:(scp):*' \
  file-sort modification

zstyle ':completion:*:*:(cd):*:*files' ignored-patterns '*~' file-sort access
zstyle ':completion:*:*:(cd):*'        file-sort access
zstyle ':completion:*:*:(cd):*'        menu select
zstyle ':completion:*:*:(cd):*'        completer _history

zstyle ':completion:*:*:perl:*'        file-patterns '*'


zstyle ':completion:*:descriptions' \
  format $'%{- \e[38;5;137;1m\e[48;5;234m%}%B%d%b%{\e[m%}'
zstyle ':completion:*:warnings' \
  format $'%{No match for \e[38;5;240;1m%}%d%{\e[m%}'

zstyle ':completion:*:*:apvlv:*'             tag-order files
zstyle ':completion:*:*:apvlv:*'             file-patterns '*.pdf'

zstyle ':completion:most-accessed-file:*' match-original both
zstyle ':completion:most-accessed-file:*' file-sort access
zstyle ':completion:most-accessed-file:*' file-patterns '*:all\ files'
zstyle ':completion:most-accessed-file:*' hidden all
zstyle ':completion:most-accessed-file:*' completer _files


zstyle ':completion:*:scp:*' group-order \
      users files all-files hosts-domain hosts-host hosts-ipaddr

zstyle ':completion:*:ssh:*' tag-order \
      users 'hosts:-host hosts:-domain:domain hosts:-ipaddr:IP\ address *'

zstyle ':completion:*:ssh:*' group-order \
      hosts-domain hosts-host users hosts-ipaddr

zstyle ':completion:*:(ssh|scp):*:hosts-host' ignored-patterns \
      '*.*' loopback localhost

zstyle ':completion:*:(ssh|scp):*:hosts-domain' ignored-patterns \
      '<->.<->.<->.<->' '^*.*' '*@*'

zstyle ':completion:*:(ssh|scp):*:hosts-ipaddr' ignored-patterns \
      '^<->.<->.<->.<->' '127.0.0.<->'

zstyle ':completion:*:(ssh|scp):*:users' ignored-patterns \
      adm bin daemon halt lp named shutdown sync

zstyle ':completion:*:(ssh|scp):*:my-accounts' users-hosts \
  'crshd@shellmix.com' 'mobile@192.168.0.112' 'mobile@192.168.1.49'


zstyle ':completion:*:*:*:users' ignored-patterns \
        adm amanda apache avahi beaglidx bin cacti canna clamav daemon \
        dbus distcache dovecot fax ftp games gdm gkrellmd gopher \
        hacluster haldaemon halt hsqldb ident junkbust ldap lp mail \
        mailman mailnull mldonkey mysql nagios \
        named netdump news nfsnobody nobody nscd ntp nut nx openvpn \
        operator pcap postfix postgres privoxy pulse pvm quagga radvd \
        rpc rpcuser rpm shutdown squid sshd sync uucp vcsa xfs
zstyle '*' single-ignored show
 

x

rzsh_path(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-

@i = 0

# print "%F{1}/"

ENV["PWD"].gsub(/home\/[a-zA-Z0-9]*/, "~").split("/").each { |d|
	print "%F{#{@i}} \u00BB " unless @i < 2
	print "%F{240}#{d}"
	@i += 1
}
 

x

Notes

Using zsh-syntax-highlighting and LS_COLORS. Actually, I’ve borrowed quite a bit of trapd00r’s Shit.

Font: Gohufont
Colors: Jellybeans

Comments

lchr said about 13 years ago

This is a badass collection, crshd! Thanks! You guys are doing a phenomenal job.

crshd said about 13 years ago

@lchr thanks for the kind words, I appreciate it :D

RedLotus said about 13 years ago

@crshd Great work.

asonunique said about 13 years ago

How do I use the zsh-syntax-highlight thing?

even though your link is dead now, i found other version but I keep getting this error when I run zsh

/home/aestark/.config/zsh/06-syntax-rules.zsh:5: ZSH_HIGHLIGHT_STYLES: assignment to invalid subscript range
/home/aestark/.config/zsh/zsh-syntax-highlighting.zsh:5: parse error near \n'

help please

edited about 13 years ago

crshd said about 13 years ago

@asonunique: You need to load zsh-syntax-highlighting.zsh before you can change it’s settings…

edited about 13 years ago

RedLotus said about 12 years ago

@crshd I get this error when run zsh with your config on no-X environment
…rzsh_patch:7:in “.undefined method ‘gsub’ for nil:NilClass (No Method Error)
Can you explain this error for me? I don’t have knowledge about shell code and ruby code so I can not understand what it mean.
I very appreciate if you can instruct me how to solve it. Thanks you.

P/s Sorry for my bad english.

edited about 12 years ago

crshd said about 12 years ago

@RedLotus it means whatever you’re calling .gsub on is nil, in this case, the environment variable “PWD” is not set.

Alternatively, instead of using the variable, you can execute pwd and use the output. That seems to work better in the TTY, while using the variable seems more reliable in X.

Or you can add
export PWD=$(pwd)
to the precmd function to force setting the PWD variable before displaying the prompt.

edited about 12 years ago

RedLotus said about 12 years ago

@crshd Thanks, it work. Shell programming is sometimes useful, I will try to learn a little about it.

edited about 12 years ago

v0rt3k said about 12 years ago

@crshd; I use your script but mine prompt isn’t working, it uses a standard prompt and the script doesn’t set the one from you.
When I use setprompt in .zshrc it works but then rzsh_path doesn’t working…

crshd said about 12 years ago

@v0rt3k Do you have Ruby installed, and did you chmod +x rzsh_path? Also you need to make sure you tell ZSH where to find it.

v0rt3k said about 12 years ago

@crshd; I did that, ruby is installed and I chmod the file. All file locations are ok.
The prompt doesn’t set bij default, I do this manually, I searched in the 06-prompt file and saw the if-statement. vcsinfo_msg_0 = “” is correct and when I echo vcsinfo_msg_0 it returns a empty line, so that is “” but the prompt isn’t set…

crshd said about 12 years ago

@v0rt3k Did you copy the entire config? You need setprompt in precmd() to set the prompt.

v0rt3k said about 12 years ago

@crshdOMG, I deleted that line in functions :). Thank you for pointing to this problem! This zsh script is really awesome, thank you!

edited about 12 years ago

rootbox said about 11 years ago

which font is this (in screenshot)?

Edit: m( i found it Gohufont

edited about 11 years ago

rootbox said about 11 years ago

i have a problem launching vim with this config:

vim: Visual needs addressible cursor or upline capability

with old zshrc it works.. i have no idea

jwflol said about 10 years ago

Could you please tell me where the colors for the prompt are actually defined? Can’t seem to find it. That is, where F{1}, F{2} etc are defined.

crshd said about 10 years ago

@jwflol In 06-prompt.zsh. All over the file, in each of the variables that make up the prompt.

edited about 10 years ago

Dubtygah said about 8 years ago

Where do i put all of these files to make it work?