now use antigen
This commit is contained in:
parent
d01d6c8be9
commit
ade8a562cc
10 changed files with 70 additions and 446 deletions
15
README.md
15
README.md
|
|
@ -1,17 +1,6 @@
|
|||
zsh
|
||||
===
|
||||
|
||||
Zsh configuration
|
||||
Zsh configuration using antigen. Clone in ~/.zsh and do
|
||||
|
||||
Install
|
||||
-------
|
||||
|
||||
* clone oh-my-zsh
|
||||
|
||||
git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-myzsh
|
||||
|
||||
* Link configuration
|
||||
|
||||
ln -s $PWD/zshrc ~/.zshrc
|
||||
|
||||
for i in `ls custom`; do ln -s $PWD/custom/$i ~/.oh-my-zsh/custom/$i; done
|
||||
ln -s $HOME/.zsh/zshrc $HOME/.zshrc
|
||||
|
|
|
|||
|
|
@ -1,46 +0,0 @@
|
|||
# Scripts files
|
||||
if [ -d $HOME/scripts ]
|
||||
then
|
||||
files=`ls $HOME/scripts`
|
||||
if [ "x$files" != "x" ]
|
||||
then
|
||||
for i in `ls --file-type $HOME/scripts`
|
||||
do
|
||||
ALIAS=`echo $i | cut -d. -f1`
|
||||
alias $ALIAS=$HOME/scripts/$i
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
# Everyday aliases
|
||||
alias cp='nocorrect cp' # no spelling correction on cp
|
||||
alias cvlc-add='cvlc --playlist-enqueue'
|
||||
alias grep='grep --color=auto'
|
||||
alias h=history
|
||||
alias j=jobs
|
||||
alias l='ls -l'
|
||||
alias la='ls -la'
|
||||
alias ll='ls -l'
|
||||
alias ls='ls --color=auto -F'
|
||||
alias mkdir='nocorrect mkdir' # no spelling correction on mkdir
|
||||
alias mv='nocorrect mv' # no spelling correction on mv
|
||||
alias wi='wicd-curses'
|
||||
|
||||
alias -g M='|more'
|
||||
alias -g H='|head'
|
||||
alias -g T='|tail'
|
||||
|
||||
configupdate() {cd ~/; git add config; git commit -m "config update"; git push; cd -}
|
||||
e() {emacsclient -n $@ > /dev/null 2>&1}
|
||||
git-send-email() {git send-email --smtp-server /usr/bin/msmtp $@}
|
||||
history() {perl -lne 'm#: (\d+):\d+;(.+)# && printf "\033[94m%s\033[0m %s\n",scalar localtime $1,$2' ~/.zhist}
|
||||
logtail() {tail -f $1 | ccze -A}
|
||||
mutt() {echo -ne "\033]0;screen mutt\007" ; /usr/bin/screen -O -S mutt -c ~/.screenrc_mutt}
|
||||
quicksave() {cp --backup=numbered "$@" /tmp/}
|
||||
wallpaper() {rm -f /home/hybris/Pictures/wallpaper; ln -s `pwd`/$1 /home/hybris/Pictures/wallpaper}
|
||||
whiteboard() {convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"}
|
||||
|
||||
# System
|
||||
mouseon() {xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 8 1}
|
||||
mouseoff() {xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 8 0}
|
||||
pulse-restart() {killall pulseaudio && /usr/bin/pulseaudio --start --log-target=syslog}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# Shut the f*ck up.
|
||||
xset b off
|
||||
|
||||
# bip at command end
|
||||
function precmd() {
|
||||
echo -n -e "\a"
|
||||
if [ "$TERM" != dumb ]; then echo -en "\033]0;${USER}@$(hostname)\007"; fi
|
||||
}
|
||||
|
||||
# do not share history between terms...
|
||||
unsetopt share_history
|
||||
|
||||
# "ctrl-x e" to edit command
|
||||
autoload edit-command-line
|
||||
zle -N edit-command-line
|
||||
bindkey '^Xe' edit-command-line
|
||||
|
||||
# dir colors
|
||||
eval `dircolors $HOME/.oh-my-zsh/custom/hybris-dir-colors`
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
# Personnal
|
||||
export EDITOR=emacsclient
|
||||
export HISTFILE=~/.zhist
|
||||
export HISTSIZE=5000
|
||||
export LESS=-cex3MRX
|
||||
export LESSOPEN='|~/.lessfilter %s'
|
||||
export LOGCHECK=60
|
||||
export READNULLCMD=${PAGER:-/usr/bin/pager}
|
||||
export SAVEHIST=5000
|
||||
export WATCH=all
|
||||
export WATCHFMT="%n has %a %l from %M"
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
if [ $UID -eq 0 ]; then
|
||||
umask 077;
|
||||
else
|
||||
umask 022;
|
||||
fi
|
||||
|
||||
autoload incremental-complete-word
|
||||
autoload insert-files
|
||||
autoload mere zed zfinit
|
||||
autoload run-help
|
||||
autoload -U compinit
|
||||
autoload -U promptinit
|
||||
autoload -U zen
|
||||
compinit
|
||||
promptinit
|
||||
zle -N incremental-complete-word
|
||||
zle -N insert-files
|
||||
zmodload zsh/complist
|
||||
|
||||
bindkey m menu-select
|
||||
bindkey i incremental-complete-word
|
||||
bindkey j insert-files
|
||||
|
||||
fignore=(.o .c~ .pro)
|
||||
fpath=(
|
||||
$fpath
|
||||
/root/.zen/zsh/scripts
|
||||
/root/.zen/zsh/zle )
|
||||
|
||||
limit core 0
|
||||
|
||||
setopt correct
|
||||
setopt auto_cd
|
||||
setopt hist_ignore_dups
|
||||
setopt auto_list
|
||||
setopt append_history
|
||||
setopt auto_param_keys
|
||||
setopt auto_param_slash
|
||||
setopt no_bg_nice
|
||||
setopt complete_aliases
|
||||
setopt equals
|
||||
setopt extended_glob
|
||||
setopt extendedhistory
|
||||
setopt hash_cmds
|
||||
setopt hash_dirs
|
||||
setopt mail_warning
|
||||
setopt magic_equal_subst
|
||||
setopt numericglobsort
|
||||
setopt interactivecomments
|
||||
setopt printeightbit
|
||||
|
||||
zstyle ':completion:*:sudo:*' command-path /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/X11R6/bin
|
||||
zstyle ':completion:*' format '-=> %d'
|
||||
zstyle ':completion:*' auto-description 'specify: %d'
|
||||
zstyle ':completion:*' completer _complete _correct _approximate
|
||||
zstyle ':completion:*' group-name ''
|
||||
zstyle ':completion:*' insert-unambiguous true
|
||||
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
|
||||
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'l:|=* r:|=*' 'r:|[
|
||||
._-]=* r:|=*'
|
||||
zstyle ':completion:*' max-errors 2
|
||||
zstyle ':completion:*' menu select=5
|
||||
zstyle ':completion:*' original true
|
||||
zstyle ':completion:*' squeeze-slashes true
|
||||
zstyle ':completion:*' verbose true
|
||||
zstyle ':completion:*:rm:*' ignore-line yes
|
||||
zstyle ':completion:*:mv:*' ignore-line yes
|
||||
zstyle ':completion:*:cp:*' ignore-line yes
|
||||
|
||||
unsetopt inc_append_history
|
||||
|
||||
if [ "$TERM" != dumb ]; then echo -en "\033]0;${USER}@$(hostname)\007"; fi
|
||||
245
custom/z.zsh
245
custom/z.zsh
|
|
@ -1,245 +0,0 @@
|
|||
# Copyright (c) 2009 rupa deadwyler under the WTFPL license
|
||||
|
||||
# maintains a jump-list of the directories you actually use
|
||||
#
|
||||
# INSTALL:
|
||||
# * put something like this in your .bashrc/.zshrc:
|
||||
# . /path/to/z.sh
|
||||
# * cd around for a while to build up the db
|
||||
# * PROFIT!!
|
||||
# * optionally:
|
||||
# set $_Z_CMD in .bashrc/.zshrc to change the command (default z).
|
||||
# set $_Z_DATA in .bashrc/.zshrc to change the datafile (default ~/.z).
|
||||
# set $_Z_NO_RESOLVE_SYMLINKS to prevent symlink resolution.
|
||||
# set $_Z_NO_PROMPT_COMMAND if you're handling PROMPT_COMMAND yourself.
|
||||
# set $_Z_EXCLUDE_DIRS to an array of directories to exclude.
|
||||
#
|
||||
# USE:
|
||||
# * z foo # cd to most frecent dir matching foo
|
||||
# * z foo bar # cd to most frecent dir matching foo and bar
|
||||
# * z -r foo # cd to highest ranked dir matching foo
|
||||
# * z -t foo # cd to most recently accessed dir matching foo
|
||||
# * z -l foo # list matches instead of cd
|
||||
# * z -c foo # restrict matches to subdirs of $PWD
|
||||
|
||||
export _Z_EXCLUDE_DIRS="/tmp /lost+found"
|
||||
|
||||
[ -d "${_Z_DATA:-$HOME/.z}" ] && {
|
||||
echo "ERROR: z.sh's datafile (${_Z_DATA:-$HOME/.z}) is a directory."
|
||||
}
|
||||
|
||||
_z() {
|
||||
|
||||
local datafile="${_Z_DATA:-$HOME/.z}"
|
||||
|
||||
# bail if we don't own ~/.z (we're another user but our ENV is still set)
|
||||
[ -f "$datafile" -a ! -O "$datafile" ] && return
|
||||
|
||||
# add entries
|
||||
if [ "$1" = "--add" ]; then
|
||||
shift
|
||||
|
||||
# $HOME isn't worth matching
|
||||
[ "$*" = "$HOME" ] && return
|
||||
|
||||
# don't track excluded dirs
|
||||
local exclude
|
||||
for exclude in "${_Z_EXCLUDE_DIRS[@]}"; do
|
||||
[ "$*" = "$exclude" ] && return
|
||||
done
|
||||
|
||||
# maintain the data file
|
||||
local tempfile="$datafile.$RANDOM"
|
||||
while read line; do
|
||||
# only count directories
|
||||
[ -d "${line%%\|*}" ] && echo $line
|
||||
done < "$datafile" | awk -v path="$*" -v now="$(date +%s)" -F"|" '
|
||||
BEGIN {
|
||||
rank[path] = 1
|
||||
time[path] = now
|
||||
}
|
||||
$2 >= 1 {
|
||||
# drop ranks below 1
|
||||
if( $1 == path ) {
|
||||
rank[$1] = $2 + 1
|
||||
time[$1] = now
|
||||
} else {
|
||||
rank[$1] = $2
|
||||
time[$1] = $3
|
||||
}
|
||||
count += $2
|
||||
}
|
||||
END {
|
||||
if( count > 6000 ) {
|
||||
# aging
|
||||
for( x in rank ) print x "|" 0.99*rank[x] "|" time[x]
|
||||
} else for( x in rank ) print x "|" rank[x] "|" time[x]
|
||||
}
|
||||
' 2>/dev/null >| "$tempfile"
|
||||
# do our best to avoid clobbering the datafile in a race condition
|
||||
if [ $? -ne 0 -a -f "$datafile" ]; then
|
||||
env rm -f "$tempfile"
|
||||
else
|
||||
env mv -f "$tempfile" "$datafile" || env rm -f "$tempfile"
|
||||
fi
|
||||
|
||||
# tab completion
|
||||
elif [ "$1" = "--complete" ]; then
|
||||
while read line; do
|
||||
[ -d "${line%%\|*}" ] && echo $line
|
||||
done < "$datafile" | awk -v q="$2" -F"|" '
|
||||
BEGIN {
|
||||
if( q == tolower(q) ) imatch = 1
|
||||
split(substr(q, 3), fnd, " ")
|
||||
}
|
||||
{
|
||||
if( imatch ) {
|
||||
for( x in fnd ) tolower($1) !~ tolower(fnd[x]) && $1 = ""
|
||||
} else {
|
||||
for( x in fnd ) $1 !~ fnd[x] && $1 = ""
|
||||
}
|
||||
if( $1 ) print $1
|
||||
}
|
||||
' 2>/dev/null
|
||||
|
||||
else
|
||||
# list/go
|
||||
while [ "$1" ]; do case "$1" in
|
||||
--) while [ "$1" ]; do shift; local fnd="$fnd${fnd:+ }$1";done;;
|
||||
-*) local opt=${1:1}; while [ "$opt" ]; do case ${opt:0:1} in
|
||||
c) local fnd="^$PWD $fnd";;
|
||||
h) echo "${_Z_CMD:-z} [-chlrtx] args" >&2; return;;
|
||||
x) sed -i -e "\:^${PWD}|.*:d" "$datafile";;
|
||||
l) local list=1;;
|
||||
r) local typ="rank";;
|
||||
t) local typ="recent";;
|
||||
esac; opt=${opt:1}; done;;
|
||||
*) local fnd="$fnd${fnd:+ }$1";;
|
||||
esac; local last=$1; shift; done
|
||||
[ "$fnd" -a "$fnd" != "^$PWD " ] || local list=1
|
||||
|
||||
# if we hit enter on a completion just go there
|
||||
case "$last" in
|
||||
# completions will always start with /
|
||||
/*) [ -z "$list" -a -d "$last" ] && cd "$last" && return;;
|
||||
esac
|
||||
|
||||
# no file yet
|
||||
[ -f "$datafile" ] || return
|
||||
|
||||
local cd
|
||||
cd="$(while read line; do
|
||||
[ -d "${line%%\|*}" ] && echo $line
|
||||
done < "$datafile" | awk -v t="$(date +%s)" -v list="$list" -v typ="$typ" -v q="$fnd" -F"|" '
|
||||
function frecent(rank, time) {
|
||||
# relate frequency and time
|
||||
dx = t - time
|
||||
if( dx < 3600 ) return rank * 4
|
||||
if( dx < 86400 ) return rank * 2
|
||||
if( dx < 604800 ) return rank / 2
|
||||
return rank / 4
|
||||
}
|
||||
function output(files, out, common) {
|
||||
# list or return the desired directory
|
||||
if( list ) {
|
||||
cmd = "sort -n >&2"
|
||||
for( x in files ) {
|
||||
if( files[x] ) printf "%-10s %s\n", files[x], x | cmd
|
||||
}
|
||||
if( common ) {
|
||||
printf "%-10s %s\n", "common:", common > "/dev/stderr"
|
||||
}
|
||||
} else {
|
||||
if( common ) out = common
|
||||
print out
|
||||
}
|
||||
}
|
||||
function common(matches) {
|
||||
# find the common root of a list of matches, if it exists
|
||||
for( x in matches ) {
|
||||
if( matches[x] && (!short || length(x) < length(short)) ) {
|
||||
short = x
|
||||
}
|
||||
}
|
||||
if( short == "/" ) return
|
||||
# use a copy to escape special characters, as we want to return
|
||||
# the original. yeah, this escaping is awful.
|
||||
clean_short = short
|
||||
gsub(/[\(\)\[\]\|]/, "\\\\&", clean_short)
|
||||
for( x in matches ) if( matches[x] && x !~ clean_short ) return
|
||||
return short
|
||||
}
|
||||
BEGIN { split(q, words, " "); hi_rank = ihi_rank = -9999999999 }
|
||||
{
|
||||
if( typ == "rank" ) {
|
||||
rank = $2
|
||||
} else if( typ == "recent" ) {
|
||||
rank = $3 - t
|
||||
} else rank = frecent($2, $3)
|
||||
matches[$1] = imatches[$1] = rank
|
||||
for( x in words ) {
|
||||
if( $1 !~ words[x] ) delete matches[$1]
|
||||
if( tolower($1) !~ tolower(words[x]) ) delete imatches[$1]
|
||||
}
|
||||
if( matches[$1] && matches[$1] > hi_rank ) {
|
||||
best_match = $1
|
||||
hi_rank = matches[$1]
|
||||
} else if( imatches[$1] && imatches[$1] > ihi_rank ) {
|
||||
ibest_match = $1
|
||||
ihi_rank = imatches[$1]
|
||||
}
|
||||
}
|
||||
END {
|
||||
# prefer case sensitive
|
||||
if( best_match ) {
|
||||
output(matches, best_match, common(matches))
|
||||
} else if( ibest_match ) {
|
||||
output(imatches, ibest_match, common(imatches))
|
||||
}
|
||||
}
|
||||
')"
|
||||
[ $? -gt 0 ] && return
|
||||
[ "$cd" ] && cd "$cd"
|
||||
fi
|
||||
}
|
||||
|
||||
alias ${_Z_CMD:-z}='_z 2>&1'
|
||||
|
||||
[ "$_Z_NO_RESOLVE_SYMLINKS" ] || _Z_RESOLVE_SYMLINKS="-P"
|
||||
|
||||
if compctl >/dev/null 2>&1; then
|
||||
# zsh
|
||||
[ "$_Z_NO_PROMPT_COMMAND" ] || {
|
||||
# populate directory list, avoid clobbering any other precmds.
|
||||
if [ "$_Z_NO_RESOLVE_SYMLINKS" ]; then
|
||||
_z_precmd() {
|
||||
_z --add "${PWD:a}"
|
||||
}
|
||||
else
|
||||
_z_precmd() {
|
||||
_z --add "${PWD:A}"
|
||||
}
|
||||
fi
|
||||
[[ -n "${precmd_functions[(r)_z_precmd]}" ]] || {
|
||||
precmd_functions[$(($#precmd_functions+1))]=_z_precmd
|
||||
}
|
||||
}
|
||||
_z_zsh_tab_completion() {
|
||||
# tab completion
|
||||
local compl
|
||||
read -l compl
|
||||
reply=(${(f)"$(_z --complete "$compl")"})
|
||||
}
|
||||
compctl -U -K _z_zsh_tab_completion _z
|
||||
elif complete >/dev/null 2>&1; then
|
||||
# bash
|
||||
# tab completion
|
||||
complete -o filenames -C '_z --complete "$COMP_LINE"' ${_Z_CMD:-z}
|
||||
[ "$_Z_NO_PROMPT_COMMAND" ] || {
|
||||
# populate directory list. avoid clobbering other PROMPT_COMMANDs.
|
||||
grep "_z --add" <<< "$PROMPT_COMMAND" >/dev/null || {
|
||||
PROMPT_COMMAND="$PROMPT_COMMAND"$'\n''_z --add "$(command pwd '$_Z_RESOLVE_SYMLINKS' 2>/dev/null)" 2>/dev/null;'
|
||||
}
|
||||
}
|
||||
fi
|
||||
|
||||
46
hybris.plugin.zsh
Normal file
46
hybris.plugin.zsh
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
# bip at command end
|
||||
function precmd() {echo -n -e "\a"}
|
||||
function preexec() {print -Pn "\e]0;toto\a"}
|
||||
|
||||
# do not share history between terms...
|
||||
unsetopt share_history
|
||||
|
||||
# SSH agent lives for 2 hours
|
||||
# zstyle :omz:plugins:ssh-agent lifetime 2h
|
||||
|
||||
# Scripts files
|
||||
SCRIPT_DIR=$HOME/.scripts
|
||||
if [ -d $SCRIPT_DIR ]
|
||||
then
|
||||
files=`ls $SCRIPT_DIR`
|
||||
if [ "x$files" != "x" ]
|
||||
then
|
||||
for i in `ls --file-type $SCRIPT_DIR`
|
||||
do
|
||||
ALIAS=`echo $i | cut -d. -f1`
|
||||
alias $ALIAS=$SCRIPT_DIR/$i
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
# Everyday aliases
|
||||
alias j=jump
|
||||
alias dnsfix="sudo service bind9 restart"
|
||||
cless() {for a in $@; do colorize_via_pygmentize $a | less; done}
|
||||
|
||||
# Some exports
|
||||
export EDITOR=emacsclient
|
||||
export HISTFILE=~/.zhist
|
||||
export HISTSIZE=5000
|
||||
export INFRA=/home/hybris/dev/bearstech/bearstech/infra
|
||||
export LESS=-cex2MRX
|
||||
export LESSOPEN='|~/.lessfilter %s'
|
||||
export LOGCHECK=60
|
||||
export PATH=/usr/local/bin:$INFRA/bin:/home/hybris/dev/bearstech/bearstech/xen:$PATH
|
||||
export READNULLCMD=${PAGER:-/usr/bin/pager}
|
||||
export SAVEHIST=5000
|
||||
export WATCH=all
|
||||
export WATCHFMT="%n has %a %l from %M"
|
||||
|
||||
# dir colors
|
||||
eval `dircolors $HOME/.zsh/dir-colors`
|
||||
62
zshrc
62
zshrc
|
|
@ -1,45 +1,27 @@
|
|||
# Path to your oh-my-zsh configuration.
|
||||
ZSH=$HOME/.oh-my-zsh
|
||||
source /usr/share/zsh-antigen/antigen.zsh
|
||||
|
||||
# Set name of the theme to load.
|
||||
# Look in ~/.oh-my-zsh/themes/
|
||||
# Optionally, if you set this to "random", it'll load a random theme each
|
||||
# time that oh-my-zsh is loaded.
|
||||
ZSH_THEME="hybris"
|
||||
antigen use oh-my-zsh
|
||||
|
||||
# Example aliases
|
||||
# alias zshconfig="mate ~/.zshrc"
|
||||
# alias ohmyzsh="mate ~/.oh-my-zsh"
|
||||
antigen bundles <<EOBUNDLES
|
||||
# omz
|
||||
colored-man-pages
|
||||
colorize
|
||||
copydir
|
||||
copyfile
|
||||
extract
|
||||
git
|
||||
jump
|
||||
rsync
|
||||
ssh-agent
|
||||
systemadmin
|
||||
web-search
|
||||
z
|
||||
zsh_reload
|
||||
|
||||
# Set to this to use case-sensitive completion
|
||||
# CASE_SENSITIVE="true"
|
||||
# local
|
||||
$HOME/.zsh --no-local-clone
|
||||
EOBUNDLES
|
||||
|
||||
# Comment this out to disable bi-weekly auto-update checks
|
||||
DISABLE_AUTO_UPDATE="true"
|
||||
antigen theme $HOME/.zsh/hybris.zsh-theme
|
||||
|
||||
# Uncomment to change how often before auto-updates occur? (in days)
|
||||
# export UPDATE_ZSH_DAYS=13
|
||||
|
||||
# Uncomment following line if you want to disable colors in ls
|
||||
# DISABLE_LS_COLORS="true"
|
||||
|
||||
# Uncomment following line if you want to disable autosetting terminal title.
|
||||
DISABLE_AUTO_TITLE="true"
|
||||
|
||||
# Uncomment following line if you want to disable command autocorrection
|
||||
# DISABLE_CORRECTION="true"
|
||||
|
||||
# Uncomment following line if you want red dots to be displayed while waiting for completion
|
||||
COMPLETION_WAITING_DOTS="true"
|
||||
|
||||
# Uncomment following line if you want to disable marking untracked files under
|
||||
# VCS as dirty. This makes repository status check for large repositories much,
|
||||
# much faster.
|
||||
# DISABLE_UNTRACKED_FILES_DIRTY="true"
|
||||
|
||||
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
|
||||
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
|
||||
# Example format: plugins=(rails git textmate ruby lighthouse)
|
||||
plugins=(colored-man git ssh-agent web-search)
|
||||
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
antigen apply
|
||||
|
|
|
|||
Loading…
Reference in a new issue