summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
Diffstat (limited to 'etc')
-rw-r--r--etc/alias/default3
-rw-r--r--etc/alias/short62
-rw-r--r--etc/completion2
-rw-r--r--etc/completions/_devtodo84
-rw-r--r--etc/completions/_pkill3
-rw-r--r--etc/completions/_sort32
-rw-r--r--etc/directories6
-rw-r--r--etc/env1
-rw-r--r--etc/function3
-rw-r--r--etc/functions/confirm_no3
-rw-r--r--etc/functions/confirm_yes9
-rwxr-xr-xetc/functions/newsbeuter12
-rwxr-xr-xetc/functions/off6
-rwxr-xr-xetc/functions/put29
-rw-r--r--etc/keys3
-rw-r--r--etc/profile6
-rw-r--r--etc/rc18
-rw-r--r--etc/unicode34
-rw-r--r--etc/zle5
19 files changed, 166 insertions, 155 deletions
diff --git a/etc/alias/default b/etc/alias/default
index 4766580..0dd7bfd 100644
--- a/etc/alias/default
+++ b/etc/alias/default
@@ -51,7 +51,6 @@ linux: salias netstat='netstat --program --all --tcp --extend' ||
#
alias cal='cal -m'
-alias calendar='calendar -A 14'
alias cp='cp -i'
alias fbi='fbi -readahead'
alias feh='feh --quiet --verbose'
@@ -78,7 +77,7 @@ alias screen='screen -ADRUa'
alias tilp='gksudo "tilp --calc=ti84+ --cable=DirectLink"'
# Don't collapse trees
-alias todo='todo -f +children'
+alias todo='noglob todo -f +children'
# smooth scrolling
alias xload='xload -jumpscroll 1'
diff --git a/etc/alias/short b/etc/alias/short
index cb15df2..164b0ac 100644
--- a/etc/alias/short
+++ b/etc/alias/short
@@ -21,38 +21,42 @@ alias fbif='fbi -a'
alias fbij='fbi -a -u'
## Git
-alias gita='git add'
-alias gitc='git commit -v'
-alias gitd='git diff --color'
-alias gitdc='gitd --cached'
-alias gitf='git pull'
-alias gitl='git log'
-alias gitp='git push'
-alias gits='git status'
-alias grep-nogit='grep --exclude-dir=.git -r'
-alias git-serve='git-daemon --verbose --export-all --base-path=. .'
+if check_com -c git; then
+ alias gita='git add'
+ alias gitc='git commit -v'
+ alias gitd='git diff --color'
+ alias gitdc='gitd --cached'
+ alias gitf='git pull'
+ alias gitl='git log'
+ alias gitp='git push'
+ alias gits='git status'
+ alias grep-nogit='grep --exclude-dir=.git -r'
+ alias git-serve='git-daemon --verbose --export-all --base-path=. .'
+fi
-alias gtd-later='todo --database ~/var/gtd/later'
-alias gtd-todo='todo --database ~/var/gtd/todo'
-alias gtd-wait='todo --database ~/var/gtd/waiting-for'
+for i in ~/var/gtd/*(.N); {
+ alias gtd-${i:t}='todo --database '$i
+}
## Mercurial (hg)
-alias hga='hg add'
-alias hgar='hg addremove'
-alias hgc='hg commit'
-alias hgd='hg diff | less'
-alias hgf='hg fetch'
-alias hgg='hg glog | less'
-alias hgh='hg heads'
-alias hgi='hg incoming'
-alias hgl='hg log | less'
-alias hgm='hg merge'
-alias hgp='hg push'
-alias hgrm='hg remove'
-alias hgrv='hg revert'
-alias hgs='hg status'
-alias hgu='hg update'
-alias hgv='hg verify'
+if check_com -c hg; then
+ alias hga='hg add'
+ alias hgar='hg addremove'
+ alias hgc='hg commit'
+ alias hgd='hg diff | less'
+ alias hgf='hg fetch'
+ alias hgg='hg glog | less'
+ alias hgh='hg heads'
+ alias hgi='hg incoming'
+ alias hgl='hg log | less'
+ alias hgm='hg merge'
+ alias hgp='hg push'
+ alias hgrm='hg remove'
+ alias hgrv='hg revert'
+ alias hgs='hg status'
+ alias hgu='hg update'
+ alias hgv='hg verify'
+fi
# File listings
alias lsb='tar tvjf'
diff --git a/etc/completion b/etc/completion
index 98f4e4f..09031ca 100644
--- a/etc/completion
+++ b/etc/completion
@@ -13,7 +13,7 @@ zstyle ':completion:*' menu select=1
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z} m:_=\\\ ' ''
# Be verbose
-char=${ps_yellow}$(zchar compdelim)${ps_reset}
+char=${ps_yellow}·${ps_reset}
zstyle ':completion:*' verbose true
zstyle ':completion:*:descriptions' format \
"$char %d $char"
diff --git a/etc/completions/_devtodo b/etc/completions/_devtodo
index 79f6fe1..b367eea 100644
--- a/etc/completions/_devtodo
+++ b/etc/completions/_devtodo
@@ -18,31 +18,31 @@ for ((i=2; i <= $#words; i++)) {
priorities=(verylow low medium high veryhigh)
arg_add=(
- '-p[priority]:priority:_priority'
- '-g[parent item]:parent:_index'
+ '-p[priority]:priority:_todo_priority'
+ '-g[parent item]:parent:_todo_index'
)
arg_generic=(
- '--remove[remove items]:index:_index'
+ '--remove[remove items]:index:_todo_index'
'--database[database file]:file:_files'
'--global-database[global database file]:file:_files'
- '*--colour[item color]:color:_color'
+ '*--colour[item color]:color:_todo_color'
'--force-colour[force use of colors]'
'--mono[no colors]'
'--help[display help]'
'--version[display version]'
'--title[todo title]:string: '
'--date-format[strftime time formet]:time string: '
- '*--format[define format]:format:_format'
- '*--use-format[output format]:format:_format'
- '--sort[sort database]:expression: '
+ '*--format[define format]:format:_todo_format'
+ '*--use-format[output format]:format:_todo_format'
+ '--sort[sort database]:sort expression:_todo_sort'
'--paranoid[paranoid parmissions etc]'
'--database-loaders[loader order]:database loader: '
'--backup[backup database]:count: '
'--timeout[display timeout]:seconds: '
'--purge[purge completed items]:days: '
- '*'{'--filter','-f'}'[show items matching filter]:filter:_filter'
-# '*::item:_index'
+ '*'{'--filter','-f'}'[show items matching filter]:filter:_todo_filter'
+# '*::item:_todo_index'
)
arg_pair=(
@@ -63,13 +63,13 @@ arg_pair=(
arg_desc=(
'verbose' '[be verbose]'
'add' '[add item]:item'
- 'graft' '[parent item]:parent:_index'
+ 'graft' '[parent item]:parent:_todo_index'
'link' '[link file into database]:database:_files'
- 'reparent' '[change item parent]:index:_index'
- 'priority' '[item priority]:priority:_priority'
- 'edit' '[edit item]:index:_index'
- 'done' '[mark as done]:index:_index'
- 'not-done' '[mark as undone]:index:_index -u'
+ 'reparent' '[change item parent]:index:_todo_index'
+ 'priority' '[item priority]:priority:_todo_priority'
+ 'edit' '[edit item]:index:_todo_index'
+ 'done' '[mark as done]:index:_todo_index'
+ 'not-done' '[mark as undone]:index:_todo_index -u'
'global' '[use global database]'
'TODO' '[generate TODO file]'
'all' '[show all items]'
@@ -80,21 +80,29 @@ for arg in ${(k)arg_pair}; {
arg_generic+='(-'${arg_pair[$arg]}')--'${arg}${arg_desc[$arg]}
}
-function _index () {
- typeset i
+function _todo_index () {
+ typeset number text i entry last_entry depth last_depth=0 IFS=$'\n'
typeset -a index desc
for i in $*; do
case $i in
-u) todo_opts+=(--filter done)
esac
done
- for i in $(todo $todo_opts --format display='%n '); do
- index+=${i}:$(todo $todo_opts --format display='%t' $i)
+ for entry in $(todo $todo_opts -f +children --format display='%1>%i%n:%t\n'); do
+ number=${entry%%:*}
+ depth=$(( ${#number} - ${#${number// }} ))
+ ((depth)) && entry=${(j:.:)${${(s:.:):-a.${last_entry%%:*}}[2,depth+1]}}.$entry
+ text=${entry#*:}
+ number=${${entry%%:*}// }
+ entry=$number:$text
+ index+=$entry
+ last_depth=$depth
+ last_entry=$entry
done
_describe -t items index index
}
-function _color () {
+function _todo_color () {
if compset -P '*='; then
_wanted color expl 'color' \
compadd black red green yellow blue magenta cyan white default
@@ -104,7 +112,7 @@ function _color () {
fi
}
-function _filter {
+function _todo_filter {
typeset prefix
if [[ ${#${words[$CURRENT]}} -gt 0 ]] {
prefix=${${words[$CURRENT]}[1]}
@@ -117,24 +125,50 @@ function _filter {
}
}
-function _format () {
+function _todo_format () {
+ typeset prefix
+ if [[ -prefix *= ]] {
+ _message 'format string'
+ } else {
+ _wanted expression expl 'format name' \
+ compadd -S '=' display generated verbose-display verbose-generated
+ }
}
-function _priority () {
+function _todo_priority () {
_wanted priority expl 'priority' \
compadd default $priorities
}
+function _todo_sort () {
+ typeset -a keys used_prefixes
+ typeset key prefix=''
+ keys=(created completed text priority duration none done)
+ for key in $keys; {
+ [[ $key != none ]] && keys+="-$key"
+ }
+
+ if [[ -prefix *, ]] {
+ prefix=${words[$CURRENT]%,*},
+ used_prefixes=(${(s:,:)prefix})
+ for key in $used_prefixes; {
+ [[ $key == -* ]] && used_prefixes+=$key[2,-1] || used_prefixes+=-$key
+ }
+ }
+ _wanted expression expl 'sort expression' \
+ compadd -F used_prefixes -qS , -P "$prefix" $keys
+}
+
case $service in
tda)
_arguments -s $arg_add
;;
tde|tdd)
- _arguments -s ':index:_index'
+ _arguments -s ':index:_todo_index'
;;
tdr)
zstyle ':completion:*:tdr:*' ignore-line yes
- _arguments -s '*:index:_index'
+ _arguments -s '*:index:_todo_index'
;;
*todo)
_arguments -s $arg_generic
diff --git a/etc/completions/_pkill b/etc/completions/_pkill
index 35f5082..150cf32 100644
--- a/etc/completions/_pkill
+++ b/etc/completions/_pkill
@@ -42,7 +42,8 @@ function _named_process {
if (( EUID )) {
pgrep_user=(-u $EUID)
}
- _wanted pattern expl 'pattern or process name' \
+ _message 'pattern'
+ _wanted pattern expl 'process name' \
compadd ${$(pgrep $pgrep_user -l '')#* }
}
diff --git a/etc/completions/_sort b/etc/completions/_sort
deleted file mode 100644
index 6d6bc55..0000000
--- a/etc/completions/_sort
+++ /dev/null
@@ -1,32 +0,0 @@
-#compdef sort
-## Quick, dirty and probably incomplete sort completion
-## Copyright (C) 2008 by Daniel Friesel <derf@derf.homelinux.org>
-## License: WTFPL <http://sam.zoy.org/wtfpl>
-
-typeset -a arguments
-
-arguments=(
- '-b[ignore leading blanks]'
- '-d[dictionary/alphabetical sort]'
- '-f[ignore case]'
- '-g[general numeric sort]'
- '-i[ignore non-printable characters]'
- '-M[sort by month]'
- '-n[string numeric sort]'
- '-R[random sort]'
- '--random-source=-[entropy source]:file:_files'
- '-r[reverse sort]'
- '-c[check if input is sorted]'
- '-C[quietly check if input is sorted]'
- '-k'
- '-m[merge sorted files]'
- '-o[output file]:output file:_files'
- '-s[stabilize sort]'
- '-S[set buffer size]:buffer size'
- '-t[set field separator]:field seprarator'
- '-T[set temporary directory]:tmpdir:_path_files -/'
- '-u[unique output]'
- '-z[end lines with 0 byte]'
-)
-
-_arguments -s $arguments
diff --git a/etc/directories b/etc/directories
index 02d227d..907694e 100644
--- a/etc/directories
+++ b/etc/directories
@@ -1,20 +1,20 @@
## Named directories
## vim:ft=zsh
+
+hash -d vcs=$HOME/var/svn
+
case $HOST in
aneurysm)
hash -d www=/var/www
hash -d web=$HOME/public_html
- hash -d vcs=$HOME/var/svn
hash -d lyrics=/home/wildernet/html/lyrics
;;
saviour)
hash -d music=$HOME/lib/audio
hash -d www=/var/www
hash -d cgi=/usr/lib/cgi-bin
- hash -d vcs=$HOME/var/svn
hash -d lyrics=~vcs/lyrics
;;
nemesis)
- hash -d vcs=$HOME/var/svn
hash -d lyrics=~vcs/lyrics
esac
diff --git a/etc/env b/etc/env
index 3d5e567..6d61f04 100644
--- a/etc/env
+++ b/etc/env
@@ -1,7 +1,6 @@
## vim:ft=zsh
ZDIR=$HOME/packages/zsh/etc
-(( ${unicode-1} )) &&
PS4='%{'$'\e[0;36m''%}%N%{'$'\e[0m''%}:%{'$'\e[0;33m''%}%i%{'$'\e[0m''%}│'
fpath=($ZDIR/functions $ZDIR/completions $fpath)
[[ -r $ZDIR/../provided/env ]] && source $ZDIR/../provided/env
diff --git a/etc/function b/etc/function
index 7f4cbb7..bd92211 100644
--- a/etc/function
+++ b/etc/function
@@ -2,7 +2,6 @@
# zsh functions
autoload -U compinit
-autoload colors
autoload catch throw
autoload zargs
@@ -11,8 +10,6 @@ for funcfile in $ZDIR/functions/*(*N);
autoload ${funcfile:t}
unset funcfile
-colors
-
# from https://git.tabularazor.org/~mikael/etc/tree/zsh/functions
for action in Start Stop Restart Reload; {
eval "function $action {
diff --git a/etc/functions/confirm_no b/etc/functions/confirm_no
new file mode 100644
index 0000000..c69b4c6
--- /dev/null
+++ b/etc/functions/confirm_no
@@ -0,0 +1,3 @@
+## vim:ft=zsh
+echo -n "$* [y/N] "
+read -q
diff --git a/etc/functions/confirm_yes b/etc/functions/confirm_yes
new file mode 100644
index 0000000..7389d1d
--- /dev/null
+++ b/etc/functions/confirm_yes
@@ -0,0 +1,9 @@
+## vim:ft=zsh
+echo -n "$* [Y/n] "
+read -k 1
+[[ $REPLY != $'\n' ]] && echo
+if [[ $REPLY == 'y' || $REPLY == 'Y' || $REPLY == $'\n' ]] {
+ true
+} else {
+ false
+}
diff --git a/etc/functions/newsbeuter b/etc/functions/newsbeuter
new file mode 100755
index 0000000..bd0e217
--- /dev/null
+++ b/etc/functions/newsbeuter
@@ -0,0 +1,12 @@
+## vim:ft=zsh
+autoload fdie
+
+function __sync {
+ if [[ $HOST != aneurysm ]] {
+ unisync unison aneurysm .newsbeuter || fdie "sync failed"
+ }
+}
+
+__sync || return 1
+command newsbeuter $*
+__sync
diff --git a/etc/functions/off b/etc/functions/off
index 12555d3..9af768a 100755
--- a/etc/functions/off
+++ b/etc/functions/off
@@ -44,7 +44,11 @@ if [[ $force != 1 && $hosts[$HOST] == *:server:* ]] {
return 1
}
-execute uinit stop-all
+if pgrep -x amarokapp &> /dev/null; then
+ execute dcop amarok MainApplication-Interface quit
+fi
+
+execute uinit -o text stop-all
for line in $(cat /etc/fstab); {
if [[ $line == *[12] ]] {
filesystems+=${${(s: :)line}[1]}
diff --git a/etc/functions/put b/etc/functions/put
index 4f408ca..7c0354a 100755
--- a/etc/functions/put
+++ b/etc/functions/put
@@ -9,7 +9,7 @@ autoload check_com fdie warn
typeset hostname
typeset -a ssh_options hosts
typeset target_dir server_prefix
-typeset file
+typeset file remote_file illegal
typeset -i n_hosts n_ping n_curl
if ! check_com curl; then
@@ -22,13 +22,12 @@ function put_aneurysm_vpn {
ssh_options=(-q)
target_dir='public_html/tmp/'
server_prefix='http://aneurysm.wildernet.org/~derf/tmp/'
+ illegal='*.(cgi|pl|php|py)'
}
function put_aneurysm_int {
+ put_aneurysm
hostname='aneurysm'
- ssh_options=(-q)
- target_dir='public_html/tmp/'
- server_prefix='https://derf.homelinux.org/~derf/tmp/'
}
function put_aneurysm () {
@@ -36,10 +35,11 @@ function put_aneurysm () {
ssh_options=(-q)
target_dir='public_html/tmp/'
server_prefix='https://derf.homelinux.org/~derf/tmp/'
+ illegal='*.(cgi|pl|php|py)'
}
function put_sievert () {
- hostname='sievert.tabularazor.org'
+ hostname='sievert'
ssh_options=(-q)
target_dir='www/tmp/'
server_prefix='https://tabularazor.org/~derf/tmp/'
@@ -57,17 +57,22 @@ while [[ $1 == -* ]] {
shift
}
+
n_hosts=$#hosts
if [[ -f $1 ]] {
file=$1
while (( $#hosts )) {
+ remote_file=${file:t}
put_$hosts[1]
ping -c 1 $hostname &> /dev/null || ping6 -c 1 $hostname &> /dev/null
if (( ? == 0 )) {
- scp $ssh_options $file $hostname:$target_dir
- ssh $ssh_options $hostname "chmod 644 $target_dir${file:t}"
- if $(curl -fI $server_prefix${file:t} &> /dev/null); then
- echo $server_prefix${file:t}
+ if [[ $remote_file == ${~illegal} ]] {
+ remote_file=${remote_file:r}
+ }
+ scp $ssh_options $file $hostname:$target_dir/$remote_file
+ ssh $ssh_options $hostname "chmod 644 $target_dir$remote_file"
+ if $(curl -fI $server_prefix$remote_file &> /dev/null); then
+ echo $server_prefix$remote_file
return 0
else
(( n_curl++ ))
@@ -77,9 +82,9 @@ if [[ -f $1 ]] {
}
shift hosts
}
- fdie "Tried uploading to $n_hosts hosts without success\n" \
- " - $n_ping hosts are unreachable\n" \
- " - $n_curl errors while uploading"
+ fdie "Tried uploading to $n_hosts hosts without success"
+ ((n_ping)) && fdie " - $n_ping hosts are unreachable"
+ ((n_curl)) && fdie " - $n_curl errors while uploading"
} else {
fdie "$1: No such file"
}
diff --git a/etc/keys b/etc/keys
index 2507aaa..6527cd2 100644
--- a/etc/keys
+++ b/etc/keys
@@ -1,4 +1,7 @@
## vim:ft=zsh
+bindkey -e
[[ -z $terminfo[kdch1] ]] || bindkey -M emacs $terminfo[kdch1] delete-char
[[ -z $terminfo[khome] ]] || bindkey -M emacs $terminfo[khome] beginning-of-line
[[ -z $terminfo[kend] ]] || bindkey -M emacs $terminfo[kend] end-of-line
+bindkey '^Z' predict-on
+bindkey '^X^Z' predict-off
diff --git a/etc/profile b/etc/profile
index 88ba6a4..4abd99f 100644
--- a/etc/profile
+++ b/etc/profile
@@ -1,12 +1,12 @@
## vim:ft=zsh
if (( ZPROFILE == 0 )) {
source $HOME/packages/zsh/etc/colors
- print -P "${info}>>${reset} this is ${info}`uname -srm`${reset} on ${info}%y${reset}"
+ print -P "${info}>>${reset} this is ${info}$(uname -srm)${reset} on ${info}%y${reset}"
[[ -n $(echo Maildir/new/*(N)) ]] && echo "${info}>>${reset} You have mail!"
[[ -r $HOME/packages/zsh/etc/local-profile ]] && source $HOME/packages/zsh/etc/local-profile
ZPROFILE=1
} else {
- check_com -c todo && gtd-todo
- calendar
+ check_com -c todo && [[ -r ~/var/gtd/todo ]] && gtd-todo
+ check_com -c calendar && [[ -r ~/stuff/calendar ]] && calendar
unset ZPROFILE
}
diff --git a/etc/rc b/etc/rc
index 7d827de..087d137 100644
--- a/etc/rc
+++ b/etc/rc
@@ -1,20 +1,22 @@
## vim:ft=zsh
-## Written 2008 by Daniel Friesel <derf@derf.homelinux.org>
+## Copyright (c) 2008, 2009 by Daniel Friesel <derf@derf.homelinux.org>
## Unless otherwise noted, this Licence applies to all files sourced here:
## 0. You just DO WHAT THE FUCK YOU WANT TO.
##
## https://derf.homelinux.org/~derf/dotfiles/zsh/rc
## see also: https://derf.homelinux.org/~derf/dotfiles/zsh/
-## mostly internal stuff
-uname=$(uname)
-alias 'linux:'='[[ $uname = Linux ]] &&'
-alias 'openbsd:'='[[ $uname = OpenBSD ]] &&'
+## What are we running on?
+system=${$(uname):l}
+alias 'linux:'='[[ $system == linux ]] &&'
+alias 'openbsd:'='[[ $system == openbsd ]] &&'
+if [[ $system == linux ]] {
+ [[ -f /etc/debian_version ]] && distro=debian
+}
## include the actual config
source $ZDIR/options
source $ZDIR/parameters
-source $ZDIR/unicode
source $ZDIR/function
source $ZDIR/zle
source $ZDIR/colors
@@ -29,12 +31,12 @@ source $ZDIR/alias/short
source $ZDIR/../provided/includes
xsource $ZDIR/local
xsource $HOME/var/tmp/envstore-raw-$UID
+xsource $ZDIR/hosts/$HOST
source $ZDIR/completion
(( ZPROFILE )) && source $ZDIR/profile
## misc
-bindkey -e
check_com -c dircolors && eval $(dircolors -b $HOME/packages/zsh/etc/dircolors)
mesg n
umask 077
@@ -46,5 +48,5 @@ unalias 'openbsd:'
unfunction check_com
unfunction xexport
unfunction xsource
-unset uname
+unset system distro
unset ps_fail ps_green ps_info ps_red ps_reset ps_yellow
diff --git a/etc/unicode b/etc/unicode
deleted file mode 100644
index 2c5941a..0000000
--- a/etc/unicode
+++ /dev/null
@@ -1,34 +0,0 @@
-## vim:ft=zsh
-## This snippet serves two purposes:
-## - it offers a central place to manage 'special' characters
-## - it's used to enable / disable unicode
-##
-## The parameter unicode decides whether unicode is used or not,
-## the default is to use unicode.
-##
-## In the associative array chars, the 'special' characters are stored.
-## Each entry contains two characters, the first is ASCII,
-## the second may be unicode.
-##
-## To get a ascii-/unicode-char, the function zchar is used, which outputs a
-## character based on the setting of the unicode parameter
-##
-## disable unicode: unicode=0; reload
-## disable ALL unicode, even in PS4 and such: unicode=0 zsh
-##
-## Note: This only affects zsh, for other programs set $LANG or similar
-
-typeset -A chars
-typeset unicode=${unicode-1}
-chars=(
- compdelim '-·'
-)
-
-function zchar () {
- typeset char=$1
- if (( unicode == 1 )) {
- echo -n - ${chars[$char][2]}
- } else {
- echo -n - ${chars[$char][1]}
- }
-}
diff --git a/etc/zle b/etc/zle
index 3617f57..f0fb108 100644
--- a/etc/zle
+++ b/etc/zle
@@ -1,3 +1,8 @@
## vim:ft=zsh
autoload -U url-quote-magic
zle -N self-insert url-quote-magic
+
+autoload predict-on
+zle -N predict-on
+zle -N predict-off
+zstyle ':predict' verbose true