diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2012-06-01 10:45:46 +0000 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2012-06-01 10:45:46 +0000 |
commit | f9ef6481fc1fc49e2d23988e2def6d2a6dcb8f8e (patch) | |
tree | 3e5d004bc955e702d09e02779c86968c01b6ed1e | |
download | zsh-f9ef6481fc1fc49e2d23988e2def6d2a6dcb8f8e.tar.gz |
Initial import
-rw-r--r-- | debian/changelog | 5 | ||||
-rw-r--r-- | debian/clean | 30 | ||||
-rw-r--r-- | debian/compat | 1 | ||||
-rw-r--r-- | debian/control | 74 | ||||
-rw-r--r-- | debian/copyright | 36 | ||||
-rw-r--r-- | debian/examples/carstenh.zshrc | 392 | ||||
-rw-r--r-- | debian/examples/compctl.dpkg | 92 | ||||
-rw-r--r-- | debian/examples/jhm.zshrc | 516 | ||||
-rw-r--r-- | debian/examples/ssh_completion | 66 | ||||
-rw-r--r-- | debian/examples/ssh_completion2 | 37 | ||||
-rw-r--r-- | debian/newuser.zshrc.recommended | 37 | ||||
-rw-r--r-- | debian/patches/run-help.patch | 31 | ||||
-rw-r--r-- | debian/patches/series | 2 | ||||
-rw-r--r-- | debian/patches/solaris-shared.patch | 22 | ||||
-rw-r--r-- | debian/postinst | 23 | ||||
-rw-r--r-- | debian/postrm | 9 | ||||
-rw-r--r-- | debian/prerm | 22 | ||||
-rwxr-xr-x | debian/rules | 59 | ||||
-rw-r--r-- | debian/source/format | 1 | ||||
-rw-r--r-- | debian/zsh-dev.install | 3 | ||||
-rw-r--r-- | debian/zsh-doc.install | 3 | ||||
-rw-r--r-- | debian/zsh.examples | 3 | ||||
-rw-r--r-- | debian/zsh.install | 7 | ||||
-rw-r--r-- | debian/zsh.links | 2 | ||||
-rw-r--r-- | debian/zsh.menu | 1 | ||||
-rw-r--r-- | debian/zshenv | 18 | ||||
-rw-r--r-- | debian/zshrc | 88 |
27 files changed, 1580 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..be29db3 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +zsh (4.3.17-1+dyson1) unstable; urgency=low + + * Initial release for Dyson. + + -- Igor Pashev <pashev.igor@gmail.com> Thu, 31 May 2012 22:10:52 +0000 diff --git a/debian/clean b/debian/clean new file mode 100644 index 0000000..b3335c0 --- /dev/null +++ b/debian/clean @@ -0,0 +1,30 @@ +Doc/Zsh/manmodmenu.yo +Doc/Zsh/modlist.yo +Doc/Zsh/modmenu.yo +Doc/version.yo +Doc/zsh.1 +Doc/zsh.idx +Doc/zsh.kys +Doc/zsh.texi +Doc/zshall.1 +Doc/zshbuiltins.1 +Doc/zshcalsys.1 +Doc/zshcompctl.1 +Doc/zshcompsys.1 +Doc/zshcompwid.1 +Doc/zshcontrib.1 +Doc/zshexpn.1 +Doc/zshmisc.1 +Doc/zshmodules.1 +Doc/zshoptions.1 +Doc/zshparam.1 +Doc/zshroadmap.1 +Doc/zshtcpsys.1 +Doc/zshzftpsys.1 +Doc/zshzle.1 +META-FAQ +Src/Modules/curses_keys.h +Src/patchlevel.h +Src/zshcurses.h +Src/zshterm.h +stamp-h.in diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +8 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..19c6a4e --- /dev/null +++ b/debian/control @@ -0,0 +1,74 @@ +Source: zsh +Section: shells +Priority: optional +Build-Depends: debhelper (>= 8), dh-autoreconf, + bsdmainutils, groff-base, libcap-dev [linux-any], + libncursesw5-dev, libpcre3-dev, texi2html (>= 1.76-3), texinfo, texlive-latex-base, yodl, + gawk +Maintainer: Debian Zsh Maintainers <pkg-zsh-devel@lists.alioth.debian.org> +Uploaders: Michael Prokop <mika@debian.org>, Axel Beckert <abe@debian.org>, Clint Adams <clint@debian.org>, Frank Terbeck <ft@bewatermyfriend.org>, Richard Hartmann <richih.mailinglist@gmail.com> +Standards-Version: 3.9.3 +Homepage: http://www.zsh.org/ +Vcs-Git: git://git.debian.org/collab-maint/zsh.git +Vcs-Browser: http://git.debian.org/?p=collab-maint/zsh.git;a=summary + +Package: zsh +Architecture: any +Depends: ${shlibs:Depends} +Recommends: ${shlibs:Recommends} +Suggests: zsh-doc +Description: shell with lots of features + Zsh is a UNIX command interpreter (shell) usable as an + interactive login shell and as a shell script command + processor. Of the standard shells, zsh most closely resembles + ksh but includes many enhancements. Zsh has command-line editing, + built-in spelling correction, programmable command completion, + shell functions (with autoloading), a history mechanism, and a + host of other features. + +Package: zsh-doc +Architecture: all +Section: doc +Depends: dpkg (>= 1.15.4) | install-info +Description: zsh documentation - info/HTML format + Zsh is a UNIX command interpreter (shell) usable as an + interactive login shell and as a shell script command + processor. Of the standard shells, zsh most closely resembles + ksh but includes many enhancements. Zsh has command-line editing, + built-in spelling correction, programmable command completion, + shell functions (with autoloading), a history mechanism, and a + host of other features. + . + This contains the documentation in GNU info and HTML formats. + +Package: zsh-dev +Architecture: any +Section: libdevel +Description: shell with lots of features (development files) + Zsh is a UNIX command interpreter (shell) usable as an + interactive login shell and as a shell script command + processor. Of the standard shells, zsh most closely resembles + ksh but includes many enhancements. Zsh has command-line editing, + built-in spelling correction, programmable command completion, + shell functions (with autoloading), a history mechanism, and a + host of other features. + . + This package contains headers and scripts necessary to compile + third-party modules. + +Package: zsh-dbg +Architecture: any +Section: debug +Priority: extra +Depends: zsh (= ${binary:Version}) +Description: shell with lots of features (debugging symbols) + Zsh is a UNIX command interpreter (shell) usable as an + interactive login shell and as a shell script command + processor. Of the standard shells, zsh most closely resembles + ksh but includes many enhancements. Zsh has command-line editing, + built-in spelling correction, programmable command completion, + shell functions (with autoloading), a history mechanism, and a + host of other features. + . + This package contains gdb debugging symbols for the 'zsh' + package. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..7a42be7 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,36 @@ +This is the Debian Linux prepackaged version of the Z Shell (zsh), a shell +with lots of features. + +This package was put together by Robert Leslie <rob@mars.org> with sources +obtained from: + ftp://ftp.math.gatech.edu/pub/zsh/ + +Source can now be obtained from ftp://ftp.zsh.org/pub/zsh/ + +The following copyright and license apply to this software: + +The Z Shell is copyright (c) 1992-2000 Paul Falstad, Richard Coleman, +Zoltán Hidvégi, Andrew Main, Peter Stephenson, Sven Wischnowsky, and +others. All rights reserved. Individual authors, whether or not +specifically named, retain copyright in all changes; in what follows, they +are referred to as `the Zsh Development Group'. This is for convenience +only and this body has no legal status. The Z shell is distributed under +the following licence; any provisions made in individual files take +precedence. + +Permission is hereby granted, without written agreement and without +licence or royalty fees, to use, copy, modify, and distribute this +software and to distribute modified versions of this software for any +purpose, provided that the above copyright notice and the following +two paragraphs appear in all copies of this software. + +In no event shall the Zsh Development Group be liable to any party for +direct, indirect, special, incidental, or consequential damages arising out +of the use of this software and its documentation, even if and the Zsh +Development Group have been advised of the possibility of such damage. + +The Zsh Development Group specifically disclaim any warranties, including, +but not limited to, the implied warranties of merchantability and fitness +for a particular purpose. The software provided hereunder is on an "as is" +basis, and the Zsh Development Group have no obligation to provide +maintenance, support, updates, enhancements, or modifications. diff --git a/debian/examples/carstenh.zshrc b/debian/examples/carstenh.zshrc new file mode 100644 index 0000000..d8a0186 --- /dev/null +++ b/debian/examples/carstenh.zshrc @@ -0,0 +1,392 @@ +# ~/.zshrc file for zsh(1). +# +# This file is sourced only for interactive shells. It should contain +# commands to set up aliases, functions, options, key bindings, etc. +# +# Global Order: zshenv, zprofile, zshrc, zlogin +# +# To enable the below-mentioned features uncomment the according lines. + + +# ### Include user name, host name and current working directory in the prompt: +PS1='%(!..%n@)%m:%~%# ' + +# ### Select emacs like key bindings: +# bindkey -e + +# ### Define some useful aliases: +# { ls --help | grep -- --color } >/dev/null 2>&1 && alias ls='ls --color=auto' +# alias l='ls -F' +# alias ll='ls -F -l' +# alias la='ls -F -A' + +# ### Keep 1000 lines of history within the shell and save it to ~/.zsh_history: +# HISTSIZE=1000 +# SAVEHIST=1000 +# HISTFILE=~/.zsh_history + +# ### Teach less, e.g., reading compressed files and listing archive content: +# which lesspipe >/dev/null && eval "$(lesspipe)" + +# ### Turn on completion with the default options: +# autoload -Uz compinit; compinit +# ### Enable completion menu: +# zstyle ':completion:*' menu select=2 +# ### Activate colored completion: +# which dircolors >/dev/null && eval "$(dircolors -b)" +# zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} + +# ### If we are in a Debian chroot display its name in the prompt: +# [[ -r /etc/debian_chroot ]] && : ${debian_chroot:="$(cat /etc/debian_chroot)"} +# PS1="${debian_chroot:+($debian_chroot)}%(!..%n@)%m:%~%# " + +# ### Use vcs_info to include version control system information in the prompt: +# setopt prompt_subst +# autoload -Uz vcs_info; vcs_info 2>/dev/null && precmd() { vcs_info } +# PS1="${debian_chroot:+($debian_chroot)}%(!..%n@)%m:%~\${vcs_info_msg_0_}%# " +# ### Configure vcs_info to be colorful: +# zstyle ':vcs_info:*' actionformats ' %F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f ' +# zstyle ':vcs_info:*' formats ' %F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{5}]%f ' +# zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' + + + +# ### ######################################################################## +# ### All features below this line are disabled, uncomment the according # +# ### lines to enable them. # +# ### ######################################################################## + +# ### Content: +# ### * Environment variables: +# ### - LESS: Set default options for less. +# ### - GIT_PAGER: Set pager used by git. +# ### - GIT_EXEC_PATH: Tell git to look in ~/bin/git for git executables. +# ### - TIMEFMT: Set outputformat of shell builtin time. +# ### * Zsh options: +# ### - Not listed here. +# ### * Precmd / preexec: +# ### - Set xterm / rxvt title. +# ### - Set screen's window title. +# ### - Transparent directory replacement. +# ### * Aliases: +# ### - Not listed here. +# ### * Functions: +# ### - Start(), Restart(), Stop(), Reload(), Force-Reload(): +# ### Start, restart, stop, reload or force-reload a System-V +# ### style init script. +# ### - accessed(), changed(), modified(): +# ### List files which have been changed / modified / accessed +# ### within the last n days, n defaults to 1. +# ### - accessed.(), changed.(), modified.(): +# ### Same as above, but list files whose name start with +# ### a dot. +# ### - bk(): Make a backup of a file. +# ### - cdt(): Create temporary directory and chdir into it. +# ### - edalias(): Edit an alias via zle. +# ### - edfunc(): Edit a function via zle. +# ### - md(): Create given directory recursively and chdir into it. +# ### - sll(): List symlinks in detail (more detailed 'readlink -f'). +# ### - unik(): Print unique lines, input does not need to be sorted. +# ### * Misc: +# ### - Chdir to ~ if zsh was started in a non-existent directory. +# ### - Cat ~/dead.letter. +# ### - Source ~/.zshrc.local if it exists and is readable. + + + +# ### ######################################################################## +# ### Environment variables: # +# ### ####################################################################{{{1 + +# ### Set default options for less: +# ### -~ -- Display lines after end of file as blank lines. +# ### -# -- Specifies the default number of positions to scroll horizontally +# ### in the RIGHTARROW and LEFTARROW commands. +# ### -K -- Causes less to exit immediately when ^C is typed. +# ### -M -- Causes less to prompt even more verbosely than more. +# ### -R -- Causes ANSI "color" escape sequences to be displayed. +# ### -i -- Causes searches to ignore case like vim's smartcase does. +# ### -q -- Use visual bell but not the terminal bell. +# ### -w -- Temporarily highlight the first "new" line after a forward movement. +# which less >/dev/null && export LESS='-~#20KMRiqw' + +# ### Set pager used by git: +# ### -E -- Automatically exit the first time it reaches end-of-file. +# ### -F -- Automatically exit if the entire file fits on the first screen. +# ### -X -- Disable sending the termcap initialization and deinitialization +# ### strings to the terminal. Prevents clearing the screen. +# which less >/dev/null && export GIT_PAGER='less -EFX' + +# ### Tell git to look in ~/bin/git for git executables: +# which git >/dev/null && export GIT_EXEC_PATH="`git --exec-path`:$HOME/bin/git" + +# ### Set outputformat of shell builtin time: +# TIMEFMT=" +# Time spent in user mode: %U +# Time spent in kernel mode: %S +# Total time: %E +# CPU utilisation: %P +# " + + +# ### #####################################################################}}} +# ### Zsh options: # +# ### ####################################################################{{{1 + +# ### Changing directories: +# ### Try chdir if there is no matching executeable. +# setopt autocd +# ### Chdir to hashed directories without the need to prepend ~. +# setopt cdablevars +# ### Make cd push the old directory onto the directory stack. +# setopt autopushd +# ### Don't push multiple copies of the same directory onto the stack. +# setopt pushdignoredups +# ### Do not print the directory stack after pushd or popd. +# setopt pushdsilent +# ### Make pushd with no arguments act like `pushd $HOME'. +# setopt pushdtohome + +# ### Completion: +# ### Use different widths whilst displaying completion menu to reduce size. +# setopt listpacked +# ### Try to complete when cursor is in the word. +# setopt complete_in_word +# ### Automatically list choices on an ambiguous completion. +# setopt autolist + +# ### History: +# ### Don't display duplicates in while searching in history. +# setopt histfindnodups +# ### Don't put duplicate lines in history. +# setopt histignoredups +# ### Remove superfluous blanks from history. +# setopt histreduceblanks +# ### Reload line into editing buffer instead of executing it. +# setopt histverify +# ### Don't add lines prefixed by a space to history. +# setopt histignorespace + +# ### Job Control: +# ### Don't nice backgrounded jobs. +# setopt nobgnice +# ### Don't send HUP signal to running jobs when the shell exists and don't +# ### complain about still running background jobs. +# setopt nohup nocheckjobs +# ### Print backgrounded jobs when they finish. +# setopt notify +# ### Disable flow-control with ^S and ^Q. +# setopt noflowcontrol + +# ### Prompt: +# ### Print exitvalues != 0. +# setopt printexitvalue +# ### Send \r on new line. +# setopt promptcr + +# ### Zle: +# ### Be quiet. +# setopt nobeep + + +# ### #####################################################################}}} +# ### Precmd / preexec: # +# ### ####################################################################{{{1 + +# ### Set xterm / rxvt title: +# preexec_xterm_title() { +# [[ "$TERM" != "xterm" ]] && [[ "$TERM" == "${TERM#rxvt}" ]] && return +# print -nR $'\033]0;'$1$'\a' +# } +# precmd_xterm_title() { +# [[ "$TERM" != "xterm" ]] && [[ "$TERM" == "${TERM#rxvt}" ]] && return +# print -nR $'\033]0;'Terminal$'\a' +# } +# preexec_functions=( ${preexec_functions} preexec_xterm_title ) +# precmd_functions=( ${precmd_functions} precmd_xterm_title ) + +# ### Set screen's window title: +# preexec_screen_window_title() { +# [[ "$TERM" == "${TERM#screen}" ]] && return +# setopt localoptions extendedglob shwordsplit noksharrays +# typeset -a cmd m_bracket m_brace m_paren m_percent +# cmd=(${${1}[(wr)^(*=*|nice|sudo|time|env|fakeroot|trickle|-*),-1]}) +# [[ -n "$cmd[2]" ]] || { echo -ne "\ek$cmd[1]\e\\"; return; } +# m_bracket=( vi vim emacs mcedit nano ee joe less more most ) +# m_percent=( make ) +# m_paren=( man perldoc ) +# m_brace=( ) +# local cmd1="$cmd[1]" m1 m2 +# if { [[ ${m_bracket[(i)$cmd1]} -le ${#m_bracket} ]] && m1='[' && m2=']' } \ +# || { [[ ${m_brace[(i)$cmd1]} -le ${#m_brace} ]] && m1='{' && m2='}' } \ +# || { [[ ${m_paren[(i)$cmd1]} -le ${#m_paren} ]] && m1='(' && m2=')' } \ +# || { [[ ${m_percent[(i)$cmd1]} -le ${#m_percent} ]] && m1='%' && m2='%' } +# then +# shift 1 cmd +# cmd=(${${cmd}[(wr)^(*=*|-*|1|2|3|4|5|6|7|8),-1]}) +# cmd[1]="${${${${cmd[1]}##*/}%=}:-$cmd1}" +# fi +# echo -ne "\ek$m1$cmd[1]$m2\e\\" +# } +# precmd_screen_window_title() { +# [[ "$TERM" == "${TERM#screen}" ]] && return +# echo -ne "\ekzsh\e\\" +# } +# preexec_functions=( ${preexec_functions} preexec_screen_window_title ) +# precmd_functions=( ${precmd_functions} precmd_screen_window_title ) + +# ### Transparent directory replacement: +# ### http://chris-lamb.co.uk/2009/11/19/transparent-directory-replacement-zsh/ +# precmd_transparent_dir_replacement() { +# [ . -ef "$PWD" ] && return 0 +# local OLDOLDPWD="$OLDPWD" +# builtin cd -q -- "$PWD" >/dev/null 2>&1 || { +# echo >&2 "W: $PWD does not exist anymore." +# return 1 +# } +# OLDPWD="$OLDOLDPWD" +# } +# precmd_functions=( ${precmd_functions} precmd_transparent_dir_replacement ) + + +# ### #####################################################################}}} +# ### Aliases: # +# ### ####################################################################{{{1 + +# ### Ordinary aliases: +# { grep --help | grep -- --color } >/dev/null 2>&1 && \ +# alias grep='grep --color=auto' +# { egrep --help | grep -- --color } >/dev/null 2>&1 && \ +# alias egrep='egrep --color=auto' +# alias cp='nocorrect cp' +# alias ln='nocorrect ln' +# alias mkdir='nocorrect mkdir' +# alias mv='nocorrect mv' +# alias rm='nocorrect rm' + +# ### Suffix aliases: +# ### http://dev.codemac.net/config.git?p=config.git;a=blob;f=zsh/alias +# ### Automatically open images: +# if which feh >/dev/null; then +# alias -s {jpg,JPG,jpeg,JPEG,png,PNG,gif,GIF}="feh -FZd" +# fi +# ### Automatically open movies: +# if which mplayer >/dev/null; then +# alias -s {mpg,mpeg,avi,ogm,wmv,m4v,mp4,mov,3GP}="mplayer -idx" +# fi +# ### Automatically open web addresses (requires $BROWSER to be set): +# if [[ -n "$BROWSER" ]] && which "$BROWSER" >/dev/null; then +# alias -s {html,htm,com,net,org,gov,edu,de}="$BROWSER" +# fi +# ### Automatically open text files (requires $EDITOR to be set): +# if [[ -n "$EDITOR" ]] && which "$EDITOR" >/dev/null; then +# alias -s {txt,c,h}="$EDITOR" +# fi +# ### Automatically open other known files: +# which evince >/dev/null && alias -s pdf="evince" +# which evince >/dev/null && alias -s ps="evince" +# which java >/dev/null && alias -s jar="java -jar" + + +# ### #####################################################################}}} +# ### Functions: # +# ### ####################################################################{{{1 + +# ### Start(), Restart(), Stop(), Reload(), Force-Reload(): +# ### Start, restart, stop, reload or force-reload a System-V +# ### style init script. +# eval {Start,Restart,Stop,Reload,Force-Reload}'() { ( +# builtin cd -q / || { echo >&2 "E: Could not chdir to /"; return 1; } +# env -i PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \ +# "/etc/init.d/${1:?}" "${0:l}" +# ) };' +# compctl -g "/etc/init.d/*(:t)" Start Restart Stop Reload Force-Reload + +# ### accessed(), changed(), modified(): +# ### List files which have been changed / modified / accessed +# ### within the last n days, n defaults to 1. +# accessed() { emulate -L zsh; print -l -- *(a-${1:-1}); } +# changed() { emulate -L zsh; print -l -- *(c-${1:-1}); } +# modified() { emulate -L zsh; print -l -- *(m-${1:-1}); } +# ### accessed.(), changed.(), modified.(): +# ### Same as above, but list files whose name starts with +# ### a dot. +# accessed.() { emulate -L zsh; print -l -- .*(a-${1:-1}); } +# changed.() { emulate -L zsh; print -l -- .*(c-${1:-1}); } +# modified.() { emulate -L zsh; print -l -- .*(m-${1:-1}); } + +# ### bk(): Make a backup of a file. +# bk() { +# cp -a "$1" "${1}_$(date --iso-8601=seconds)"; +# } + +# ### cdt(): Create temporary directory and chdir into it. +# cdt() { +# [[ $# -eq 0 ]] || printf 'Usage: %s\n' "$0"; +# builtin cd "$(mktemp -t -d cdt.XXXXXXXXXX)"; +# } + +# ### edalias(): Edit an alias via zle. +# edalias() { +# [[ -z "$1" ]] && { echo "Usage: edalias <alias_to_edit>" ; return 1 } +# vared aliases'[$1]' +# } +# compdef _aliases edalias + +# ### edfunc(): Edit a function via zle. +# edfunc() { +# [[ -z "$1" ]] && { echo "Usage: edfun <function_to_edit>" ; return 1 } +# zed -f "$1" +# } +# compdef _functions edfunc + +# ### md(): Create given directory recursively and chdir into it. +# md() { +# [[ $# -eq 1 ]] || printf 'Usage: %s <directory>\n' "$0"; +# mkdir -p "$1" && builtin cd "$1"; +# } +# compdef md=mkdir + +# ### sll(): List symlinks in detail (more detailed 'readlink -f'). +# sll() { +# [[ -z "$1" ]] && printf 'Usage: %s <file(s)>\n' "$0" && return 1 +# local file +# for file in "$@"; do +# ( +# while [[ -h "$file" ]]; do +# ls -l "$file" +# builtin cd -q "${file:h}" +# file="$(readlink "${file:t}")" +# done +# ls -l "$file" +# ) +# done +# } + +# ### unik(): Print unique lines, input does not need to be sorted. +# unik() { +# perl -ne 'print unless $seen{$_}++' "$@" +# } + + +# ### #####################################################################}}} +# ### Misc: # +# ### ####################################################################{{{1 + +# ### Chdir to ~ if zsh was started in a non-existent directory: +# [[ "$PWD" == . ]] && builtin cd ~ + +# ### Cat ~/dead.letter: +# if [[ -r ~/dead.letter ]]; then +# echo ~/dead.letter: +# cat ~/dead.letter +# echo +# fi +# if [[ "$USERNAME" == root ]] && [[ -r /dead.letter ]]; then +# echo /dead.letter: +# cat /dead.letter +# echo +# fi + +# ### Source ~/.zshrc.local if it exists and is readable: +# [[ -r ~/.zshrc.local ]] && . ~/.zshrc.local || true diff --git a/debian/examples/compctl.dpkg b/debian/examples/compctl.dpkg new file mode 100644 index 0000000..d8c142e --- /dev/null +++ b/debian/examples/compctl.dpkg @@ -0,0 +1,92 @@ +############################################################################# +# Dpkg completion control for zsh. +# +# NOTE: Completion for these commands (dpkg, dpkg-source, bug) +# are included # upstream as part of the new completion system. +# Seriously consider using that instead. +# +# Originally by Joey Hess <joey@kite.ml.org>, GPL copyright. +# Contributions and fixes from Karl Hegbloom, Fabien Ninoles, +# Gregor Hoffleit, Csaba Benedek, &c. +# +# Currently doesn't handle correctly: +# Options after -D or --debug. +# --force- and friends,--ignore-depends,--root= and friends. + +# A function to return all available package names. +# This could be done without grep and awk by replacing that line with +# reply=(${${(M)${(f)"$(</var/lib/dpkg/status)"}:#Package:*}#Package: }) +function DpkgPackages { + reply=(`grep '^Package:' /var/lib/dpkg/status | awk '{ print $2 }'`) +} + +# This array lists all the dpkg options and actions. +dpkg_options=(-i --install --unpack --configure -r --remove --purge -A \ +--avail --update-avail --merge-avail --yet-to-unpack -l --list -L \ +--listfiles -C --audit -S --search -s --status --help -c --contents -I \ +--info -B --auto-deconfigure -D --debug --largemem --smallmem --no-act \ +-R --recursive -G -O --selected-only -E -e --control --skip-same-version \ +-x --extract -f --field --fsys-tarfile -X --vextract --licence --version \ +-b --build) + +# This string lists all dpkg actions that operate on *.deb files, +# separated by |'s. There can't be any extra whitespace in it! +dpkg_deb_actions="-i|--install|--unpack|-A|--avail|-c|--contents|-I|--info|-e" +dpkg_deb_actions="$dpkg_deb_actions|--control|-x|--extract|-f|--field" +dpkg_deb_actions="$dpkg_deb_actions|--fsys-tarfile|-X|--vextract|-info" + +# This string lists all dpkg actions that normally operate on *.deb files, +# but can operate on directory names if the --recursive option is given to +# dpkg. +dpkg_deb_rec_actions="-i|--install|--unpack|-A|--avail" + +# This string lists all other dpkg actions that take a directory name as +# their first parameter, and a filename as their second parameter. +dpkg_df_actions="-b|--build" + +# This string lists dpkg actions that take a directory name as +# their second parameter. +dpkg_dir2_actions="-e|--control|-x|--extract|--vextract" + +# This string lists all dpkg actions that take a filename as their first +# parameter (ie, a Packages file). +dpkg_file_actions="-S|--search|--update-avail|--merge-avail" + +# This string lists all dpkg actions that operate on the names of packages +# and can also be used with the --pending option. +dpkg_pkg_pending_actions="--configure|-r|--remove|--purge|-s|--status" + +# This string lists all other dpkg actions that operate on the names of +# packages. +dpkg_pkg_actions="-L|--listfiles|-s|--status|-l|--list" + +# Now the command that puts it all together.. +compctl -k dpkg_options \ + -x "C[-1,$dpkg_deb_rec_actions],R[-R|--recursive,]" -g '*(-/D)' \ + - "C[-1,$dpkg_deb_actions]" -g '*.deb' + -g '*(-/D)' \ + - "C[-1,$dpkg_pkg_pending_actions]" -K DpkgPackages + -k "(-a,--pending)" \ + - "C[-1,$dpkg_pkg_actions]" -K DpkgPackages \ + - "C[-1,$dpkg_file_actions],C[-2,$dpkg_df_actions]" -f \ + - "C[-2,$dpkg_dir2_actions],C[-1,$dpkg_df_actions]" -g '*(-/D)' \ + -- dpkg + +# Also, set up package name completion for bug program. +compctl -K DpkgPackages bug + +# This section by Karl M. Hegbloom + +dpkg_source_options=(-x -b -c -l -F -V -T -D -U \ +-sa -sk -sp -su -sr -ss -sn -sA -sK -sP -sU -sR \ +-h --help) + +compctl -k dpkg_source_options \ + -x "C[-1,-x]" -g '*.dsc' \ + - "C[-1,-b]" -g '*(-/D)' \ + -- dpkg-source + +# Unset the temporary variables. +unset dpkg_deb_actions dpkg_deb_rec_actions dpkg_df_actions \ + dpkg_dir2_actions dpkg_file_actions dpkg_pkg_pending_actions \ + dpkg_pkg_actions # dpkg_source_options dpkg_options + +############################################################################# diff --git a/debian/examples/jhm.zshrc b/debian/examples/jhm.zshrc new file mode 100644 index 0000000..86dacc7 --- /dev/null +++ b/debian/examples/jhm.zshrc @@ -0,0 +1,516 @@ +# Ray's .zshrc +# Note that completions for dpkg-deb, mutt, mount, and dupload are +# included as part of the new completion system. See docs for details. + +# Zsh settings + +# TODO +# - completions for dpkg-deb +# - completions for lintian +# - completions for dupload +# - completions for nm +# - completions for objdump +# - completions for mount +# - completion for man -l + +bindkey -e # Emacs-style commandline editing + +case "$TERM" in + linux) # Linux console + bindkey '\e[1~' beginning-of-line # Home + bindkey '\e[4~' end-of-line # End + bindkey '\e[3~' delete-char # Del + bindkey '\e[2~' overwrite-mode # Insert +# bindkey '\e[A' up-line-or-history # cursor up +# bindkey '\e[B' down-line-or-history # cursor down +# bindkey '\e[C' forward-char # cursor right +# bindkey '\e[D' backward-char # cursor left + ;; + screen) # The textmode window manager + # In Linux console + bindkey '\e[1~' beginning-of-line # Home + bindkey '\e[4~' end-of-line # End + bindkey '\e[3~' delete-char # Del + bindkey '\e[2~' overwrite-mode # Insert + bindkey '\e[7~' beginning-of-line # home + bindkey '\e[8~' end-of-line # end + # In rxvt + bindkey '\eOc' forward-word # ctrl cursor right + bindkey '\eOd' backward-word # ctrl cursor left + bindkey '\e[3~' backward-delete-char # This should not be necessary! +# bindkey '\e[A' up-line-or-history # cursor up +# bindkey '\e[B' down-line-or-history # cursor down +# bindkey '\e[C' forward-char # cursor right +# bindkey '\e[D' backward-char # cursor left + ;; + rxvt) + bindkey '\e[7~' beginning-of-line # home + bindkey '\e[8~' end-of-line # end + bindkey '\eOc' forward-word # ctrl cursor right + bindkey '\eOd' backward-word # ctrl cursor left + bindkey '\e[3~' backward-delete-char # This should not be necessary! + bindkey '\e[2~' overwrite-mode # Insert + ;; + xterm*) + bindkey '\e[H' beginning-of-line # Home + bindkey '\e[F' end-of-line # End + bindkey '\e[3~' delete-char # Del + bindkey '\e[2~' overwrite-mode # Insert + ;; + sun) + bindkey '\e[214z' beginning-of-line # Home + bindkey '\e[220z' end-of-line # End + bindkey '^J' delete-char # Del + bindkey '^H' backward-delete-char # Backspace + bindkey '\e[247z' overwrite-mode # Insert + ;; +esac + +#if test "X$TERM" = "Xscreen" || test "X$TERM" = "Xlinux"; then +# bindkey '\e[A' up-line-or-history # cursor up +# bindkey '\e[B' down-line-or-history # cursor down +# bindkey '\e[C' forward-char # cursor right +# bindkey '\e[D' backward-char # cursor left +#fi +# +#if test "X$TERM" = "Xscreen" || test "X$TERM" = "Xrxvt"; then +# bindkey '\e[7~' beginning-of-line # home +# bindkey '\e[8~' end-of-line # end +# bindkey '\eOc' forward-word # ctrl cursor right +# bindkey '\eOd' backward-word # ctrl cursor left +# bindkey '\e[3~' backward-delete-char # This should not be necessary! +#fi + +export DEBEMAIL=jhm@cistron.nl +export IRCNICK=JHM +export IRCSERVER=irc.nl.openprojects.org +eval `lesspipe` + +alias glimpse='glimpse -z -i -w' + +# All functions used for defining completion rules start with `c_'. +setopt extendedglob # required for some of our completion magic +setopt list_types # Put a file type indicator after file names when + # completing. +setopt correct # Attempt spelling correction on command names only. +setopt print_exit_value +setopt list_ambiguous +setopt bash_auto_list # Make <tab><tab> do the right thing. +setopt list_packed # Compacter display of completion list. +setopt interactive_comments +setopt nohup # So backgrounded jobs don't get terminated when + # the shell is. + +# A sensible prompt: +# hostname username(underlined) time pwd(bold; max 30 chars.) > or # +if test "X$TERM" = "Xscreen"; then + # include a hint that screen(1) can use to set window titles. + PROMPT='%m %U%n%u %T %B%30<..<%~%b %{[0000mk\%}%(!.#.>) ' +else + # We don't include the hint outside screen, as it causes problems + # with xterm + PROMPT='%m %U%n%u %T %B%30<..<%~%b %(!.#.>) ' +fi + +c_groups=( $(cut -d: -f1 /etc/group) ) + +############################################################################ +# Shell builtins + +compctl -k '( )' pushln +compctl -z -P '%' bg +compctl -j -P '%' fg jobs disown +compctl -j -P '%' + -s '`ps -x | tail +2 | cut -c1-5`' wait + +compctl -A shift +compctl -caF type whence which +compctl -c unhash +compctl -F functions unfunction +compctl -x 'w[1,-d] p[2]' -n - 'w[1,-d] p[3]' -g '*(-/)' - \ + 'p[1]' -c - 'p[2]' -g '*(-x)' -- hash +compctl -a unalias +compctl -v getln getopts read unset vared +compctl -v -S '=' -q declare export integer local readonly typeset +compctl -e disable +compctl -d enable + +eval compctl -k "'("`limit | cut -d\ -f1`")'" limit unlimit + +compctl -l '' -x 'p[1]' -f -- . source +compctl -s '`unsetopt`' setopt +# Redirection below makes zsh silent when completing unsetopt xtrace +compctl -s '`setopt 2> /dev/null`' unsetopt +compctl -s '${^fpath}/*(N:t)' autoload + +compctl -b bindkey +compctl -c -x 'C[-1,-*k]' -A - 'C[-1,-*K]' -F -- compctl +compctl -x 'C[-1,-*e]' -c - 'C[-1,-[ARWI]##]' -f -- fc +compctl -x 'p[1]' - 'p[2,-1]' -l '' -- sched +compctl -x 'C[-1,[+-]o]' -o - 'c[-1,-A]' -A -- set + +# Anything after nohup is a command by itself with its own completion +compctl -l '' nohup exec nice eval sudo fakeroot +compctl -x 'p[1]' -c - 'p[2,-1]' -k signals -- trap +compctl -l '' -x 'p[1]' -B -- builtin + +# kill takes signal names as the first argument after -, but job names after % +# or PIDs as a last resort +compctl -j -P '%' + -s '`ps -x | tail +2 | cut -c1-5`' + \ + -x 's[-] p[1]' -k "($signals[1,-3])" -- kill + + +############################################################################ +# Basic commands and file manipulation commands + +compctl -k '( )' pwd +compctl -g '*(/)' cd +compctl -g '^*.(c|cc|C|cxx|cpp|h|in|l|y|tex)' rm +compctl -g '*(/)' rmdir +compctl -g '*.Z' + -g '*(/)' znew +compctl -s '$(groups)' + -k groups newgrp +compctl -f -x 'p[1], p[2] C[-1,-*]' -k groups -- chgrp +compctl -f -x 'p[1] n[-1,.], p[2] C[-1,-*] n[-1,.]' -k groups \ + - 'p[1], p[2] C[-1,-*]' -u -S '.' -- chown + +# GNU ls, dir: complete files, options (both - and -- kind), and option params. +compctl -f \ + -x s'[--format]' -P '=' -k '(long verbose commas horizontal across vertical si +ngle-column)' \ + - s'[--sort]' -P '=' -k '(none time size extension)' \ + - s'[--time]' -P '=' -k '(atime ctime access use status)' \ + - s'[--width=][--tabsize=][--ignore=][-w][-T][-I],c[-1,-w][-1,-T][-1,-I]' \ + -k '( )' \ + - s'[--]' -S '' -k '(all\ escape\ directory\ inode\ kilobytes\ numeric-uid-gid\ no-group\ hide-control-chars\ reverse\ size\ width= tabsize= almost-all\ ignore-backups\ classify\ file-type\ full-time\ ignore= dereference\ literal\ quote-name\ dired\ no-color\ 7bit\ 8bit\ recursive\ sort= format= time= no-group\ help\ version\ )' \ + - s'[-]' -k '(a b c d f g i k l m n o p q r s t u x A B C F G L N Q R S U X 1 +w T I)' \ + -- ls dir + + +# Debian tar: viewing/extracting gzipped/compressed/bzip2ed/normal tar archives. +compctl -f -x \ + 'C[-1,*[xt]*f*z*] p[2]' -g '*.tar.gz *.tar.Z *.tgz' + -g '*(/)' - \ + 'C[-1,*[xt]*f*I*] p[2]' -g '*.tar.bz *.tar.bz2 *.tbz' + -g '*(/)' - \ + 'C[-1,*[xt]*f*] p[2]' -g '*.tar' -- \ + + -g '*(/)' tar + +## tar: complete tar files (only .tar or .tar.* format) after -f, disable +## completion for certain options, let user choose directory with -C, +## complete GNU tar long options beginning with --. The match-taropts +## function prompts for GNU tar options, ensures one of the seven +## mandatory options is given in the first argument to tar, and enforces +## spaces after options that take an argument (this is required by GNU +## tar and also makes filename completion possible for the -f option). +## Note that the -[0-7][lmh] options are not completed, but they're +## hardly ever used. +#compctl -f \ +# -x 'C[-1,-*f],p[2] C[-1,*f],c[-1,--file]' -g '*.tar(|.*)' + -g '*(-/)' \ +# - 'C[-1,-*[bLN]],p[2] C[-1,*[bLN]],c[-1,--block-size][-1,tape-length][-1,--after-date][-1,--newer]' -k '( )' \ +# - 'C[-1,-*C],p[2] C[-1,*C],c[-1,directory]' -g '*(-/)' \ +# - 'C[-1,-*[FgKTV]],p[2] C[-1,*[FgKTV]],c[-1,--info-script][-1,--new-volume-script][-1,--starting-file][-1,--files-from][-1,--label][-1,--exclude]' -f \ +# - 's[--]' -k '(catenate concatenate create diff compare delete append list update extract get atime-preserve block-size read-full-blocks directory checkpoint file force-local info-script new-volume-script incremental dereference ignore-zeros ignore-failed-read keep-old-files starting-file one-file-system tape-length modification-time multi-volume after-date newer old-archive portability to-stdout same-permissions preserve-permissions absolute-paths preserve record-number remove-files same-order preserve-order same-owner sparse files-from null totals verbose label version interactive confirmation verify exclude exclude-from compress uncompress gzip ungzip use-compress-program block-compress)' \ +# - 's[-],p[1]' -S '' -K 'match-taropts' \ +# -- tar + +# GNU find. +# Note that 'r[-exec,;]' must come first. +# We hardwire the filesystem types rather than use /proc/filesystems, in order +# not to exclude filesystems that are supported through modules that are +# currently not loaded. +compctl -x 'r[-exec,;][-ok,;]' -l '' - \ +'s[-]' -s 'daystart {max,min,}depth follow noleaf version xdev mount \ + {a,c,}newer {a,c,m}{min,time} empty false {fs,x,}type {u,g}id inum \ + links {i,}{l,}name {no,}{user,group} {i,}path perm {i,}regex size \ + true used exec {f,}print{f,0,} ok prune {f,}ls or not and' - \ +'p[1]' -g '. .. *(-/)' - \ +'C[-1,-((a|c|)newer|fprint(|0|f))]' -f - \ +'c[-1,-fstype]' -k '(ext2 fat iso9660 minix nfs vfat)' - \ +'c[-1,-type]' -k '(b c d p f l s)' -X '[b]lock dev, [c]har dev, [d]ir, named [p]ipe, regular [f]ile, [s]ocket' - \ +'c[-1,-size]' -k '(1234c 567k)' -X '512-byte [b]locks, [c] bytes, [k]ilobytes, 2-byte [w]ords' - \ +'c[-1,-group]' -k c_groups - \ +'c[-1,-user]' -u -- find + + +############################################################################ +# Commands that are usually used on non-generated files. + +compctl -g '*.gz *.Z *.bz2' \ + + -g '*.web *.docbook' \ + + -g '*.c *.cc *.C *.cxx *.cpp *.h *.tex *.txt *.html' \ + + -g '^*.(o|a|so|aux|dvi|log|swp|fig|bbl|blg|bst|idx|ind|out|toc)' \ + + -g '.*' \ + + -g '*(/)' vi vim gvim less grep zgrep + +############################################################################ +# Mail +# TODO: mutt + +############################################################################ +# Document processing + +compctl -g '*.tex' + -g '*(/)' tex +compctl -g '*.tex *.ltx' + -g '*(/)' {latex,pdflatex} +compctl -g '*.texi' + -g '*(/)' texi2{dvi,pdf,html} + +function c_bibtex { + reply=(`ls *.aux | sed -e 's/\.aux//'`); +} +compctl -K c_bibtex bibtex + + +############################################################################ +# Viewers, editors etc. + +compctl -g '*.gz *.Z' + -g '*(/)' zcat gunzip gzcat zless +compctl -g '*.bz *.bz2' + -g '*(/)' bzcat bz2cat bunzip2 +compctl -g '*.ps *.ps.gz *.pdf *.pdf.gz *.eps *.eps.gz' + -g '*(/)' gv +compctl -g '*.(e|)ps' + -g '*(-/)' gs ghostview ps2ascii ps2text psnup ps2pdf +compctl -g '*.pdf' + -g '*(/)' acroread xpdf +compctl -g '*.dvi *.dvi.gz' + -g '*(/)' xdvi +compctl -g '*.dvi' + -g '*(/)' dvi2fax dvidvi dvilj dvilj4 dvips dvitomp \ + dvicopydvihp dvilj2p dvilj4l dvired dvitype +compctl -g '*.html' + -g '*.htm' + -g '*(/)' w3m lynx mozilla netscape +compctl -g '*.zip' + -g '*(/)' unzip +compctl -g '*.fig' + -g '*(/)' xfig +compctl -g '*.rtf' + -g '*(/)' Ted +compctl -g '*.web' + -g '*(/)' tangle weave ftangle fweave ctangle cweave ctanglex cweavex + +# man: complete commands, otherwise complete by search of $MANPATH. +# This is placed as an all-encompassing pattern at the end because making it +# the default before the -x doesn't work. (It becomes +# '-c + (-K 'match-man' -x ...), not (-c + -K 'match-man') -x ...). +# We also complete paths for -M (override manpath), commands for -P (pager) and +# disable for -S (search sections). After an explicit number (which it helps +# to complete for you), these completion rules assume a thorough search is +# needed and no longer use the '-c' hashed commands, relying entirely on +# what's really in the manpath. +# Also support -l <file> and -T<device> +c_man_var() { + man_pages=( /usr/share/man/man*/*(N:t:r) /usr/man/man*/*(N:t:r) ) + compctl -k man_pages man + reply=( $man_pages ) +} +compctl -x 'S[1][2][3][4][5][6][7][8][9]' -k '(1 2 3 4 5 6 7 8 9)' \ + - 'R[[1-9nlo]|[1-9](|[a-z]),^*]' -K 'match-man' \ + - 's[-M],c[-1,-M]' -g '*(-/)' \ + - 's[-P],c[-1,-P]' -c \ + - 's[-S],s[-1,-S]' -k '( )' \ + - 's[-l],c[-1,-l]' -g '*.[0-9] *.man' \ + - 's[-T]' -k '(X100 X75 ascii latin1 ps X100-12 X75-12 dvi lj4)' \ + - 's[-]' -k '(a d f h k t M P l)' \ + - 'p[1,-1]' -c + -K 'c_man_var' \ + -- man + +function c_enscript_langs { +# languages and file formats for which enscript supports pretty-printing + reply=(`enscript --help-pretty-print | grep '^Name:' | sed -e 's/Name: //'`) +} +compctl -g '*' + -g '*(/)' -x s'[-E][--pretty-print]' -P '=' -K c_enscript_langs \ + - s'[--]' -S '' -k '(columns= pages= file-align= header= no-header\ truncate-lines\ line-numbers\ setpagedevice= escapes\ pretty-print\ pretty-print= font= header-font= fancy-header\ no-job-header\ highlight-bars= indent= filter= borders\ page-prefeed\ no-page-prefeed\ lineprinter\ lines-per-page= mail\ media= copies= newline= missing-characters\ output= printer= quiet\ silent\ landscape\ portrait\ baselineskip= statusdict= title= tabsize= underlay\ nup= verbose\ version\ language= encoding= no-formfeed\ pass-through\ ps-level= rotate-even-pages\ toc\ word-wrap\ )' \ + -- enscript + +############################################################################ +# Networking + +function c_lftp_bookmarks { +# extract the names of bookmarks from the lftp bookmarks file. + reply=(`cut -c '1-17' ~/.lftp/bookmarks \ + | sed -e 's/[^a-zA-Z0-9\-]//g' `); +} +compctl -K c_lftp_bookmarks lftp + +function c_ssh_knownhosts { +# extract the hosts which are known to ssh. + reply=(`sed -e 's/ .*$//' \ + -e 's/,[0-9]\{3\}\..*//' ~/.ssh/known_hosts`); +} +#compctl -K c_ssh_knownhosts ssh + +# Complete the current word with files after a `:', with ssh +# hosts after a `@', and with hosts or files (in that order) +# at the start of a word. +compctl -x 'n[0,:]' -f - 'n[0,@],s[]' -K c_ssh_knownhosts -S: + -f -- \ + scp + +# This completes `ssh [username@]host remotecommand'. +# TODO: how do we get the -X working? +compctl -x \ + 'C[-1,*@*]' -X '<Remote command>' - \ + 'n[0,@],s[]' -K c_ssh_knownhosts \ + -- ssh +#compctl -K c_ssh_knownhosts -x 'c[-1,-l]' -k '()' -X 'Remote user name' -- slogin +#compctl -x 'n[0,@],s[]' -K c_ssh_knownhosts - \ +# 'c[-1,-l]' -k '()' -X 'Remote user name' - \ +# 'C[-1,*@*]' -k '(kiekeboe)' -- ssh + +## As above, but do 'ssh [host] [-l user] [command]' where +## <command> is a separate command line (i.e., to be executed +## via ssh as <user> on <host>). +#compctl -x 'p[1], p[2] C[-1,-*]' -K c_ssh_knownhosts \ +# - 'c[-1,-l]' -K userlist -- \ +# + -x 'w[2,-l] p[4,-1],p[2,-1]' -l '' -- ssh + + +############################################################################ +# Program development + +# strip, profile, and debug only executables. The compctls for the +# debuggers could be better, of course. +compctl -g '*(*)' strip gprof gdb ddd + +# GCC completion, based on Andrew Main's; updated for gcc 2.95.2 . +# completes to filenames (*.c, *.C, *.o, etc.); to miscellaneous options after +# a -; to various -f options after -f (and similarly -W, -g and -m); and to a +# couple of other things at different points. +# The -m completion should be tailored to each system; the one below is i386. +compctl -g '*.([cCmisSoa]|cc|cxx|cpp|ii)' -x \ + 's[-l]' -s '${(s.:.)^LD_LIBRARY_PATH}/lib*.a(:t:r:s/lib//)' - \ + 'c[-1,-x]' -k '(none c objective-c c-header c++ cpp-output assembler ass +embler-with-cpp)' - \ + 'c[-1,-o]' -f - \ + 'C[-1,-i(nclude|macros)]' -g '*.h' - \ + 'C[-1,-i(dirafter|prefix)]' -g '*(-/)' - \ + 's[-B][-I][-L]' -g '*(-/)' - \ + 's[-fno-],s[-f]' -k '(lang-isoc9x + allow-single-precision cond-mismatch asm + builtin freestanding hosted signed-bitfields signed-char + unsigned-bitfields unsigned-char writable-strings + access-control check-new conserve-space dollars-in-identifiers + elide-constructors external-templates for-scope gnu-keywords + guiding-decls handle-signatures honor-std huge-objects + implicit-templates init-priority implement-inlines + name-mangling-version-N default-inline operator-names optional-diags + permissive repo strict-prototype squangle template-depth-N + this-is-variable vtable-chunks + syntax-only + all-virtual dollars-in-identifiers elide-constructors enum-int-equiv + memoize-lookups nonnull-objects + dump-unnumbered pretend-float profile-arcs test-coverage + branch-probabilities optimize-register-moves caller-saves + cse-follow-jumps cse-skip-blocks delayed-branch + expensive-optimizations fast-math float-store force-addr force-mem + data-sections function-sections gcse inline-functions inline-limit-3 + keep-inline-functions default-inline defer-pop function-cse inline + peephole omit-frame-pointer regmove rerun-cse-after-loop + rerun-loop-opt schedule-insns schedule-insns2 strength-reduce + thread-jumps unroll-all-loops unroll-loops move-all-movables + reduce-all-givs strict-aliasing + call-saved- call-used- exceptions fixed- inhibit-size-directive + check-memory-usage prefix-function-name common ident gnu-linker + pcc-struct-return pic PIC reg-struct-return shared-data short-enums + short-double volatile volatile-global volatile-static verbose-asm + pack-struct stack-check argument-alias argument-noalias + argument-noalias-global leading-underscore)' - \ + 's[-g]' -k '(gdb stabs stabs+ coff xcoff xcoff+ dwarf dwarf+ + dwarf-2)' - \ + 's[-mno-][-mno][-m]' -k '(486 ieee-fp no-fancy-math-387 fp-ret-in-387 + soft-float svr3-shlib no-wide-multiply rtd align-double align-jumps= + align-loops= align-functions= preferred-stack-boundary=)' - \ + 's[-Wno-][-W]' -k '( + all aggregate-return bad-function-cast cast-align cast-qual + char-subscripts comment conversion error format id-clash-8 + implicit implicit-int implicit-function-declaration import + error-implicit-function-declaration inline larger-than-64 + long-long main missing-declarations missing-noreturn + missing-prototypes multichar nested-externs import parentheses + pointer-arith redundant-decls return-type shadow sign-compare + strict-prototypes switch traditional trigraphs undef uninitialized + unused write-strings unknown-pragmas + template-debugging + ctor-dtor-privacy deprecated effc++ non-template-friend + non-virtual-dtor old-style-cast overloaded-virtual pmf-conversions + reorder sign-promo synth)' - \ + 's[-]' -k '(pipe ansi traditional traditional-cpp trigraphs pedantic + pedantic-errors nostartfiles nostdlib static shared symbolic include + imacros idirafter iprefix iwithprefix nostdinc nostdinc++ undef + print-file-name= print-libgcc-file-name print-prog-name= + -print-search-dirs -save-temps)' \ + -X 'Use "-f", "-g", "-m" or "-W" for more options' -- gcc g++ + +compctl -x 's[--]' -S '' -k '(verbose\ prefix= exec-prefix= help\ build= host= + norecursion\ program-prefix= program-suffix= program-transform-name= + site= srcdir= target= tmpdir= with- without- enable- disable- )' -- \ + ./configure + +compctl -g '*(/)' \ + -x 's[-]' -P '-' -k '( + sign clearsign detachsign encrypt symmetric store decrypt verify + listkeys listsigs checksigs fingerprint listsecretkeys genkey + deletekey editkey genrevoke export import listpackets + armor localuser remoteuser textmode output verbose batch yes + no keyring secretkeyring defaultkey options debug debugall + statusfd nocomment completesneeded marginalsneeded + loadextension rfc1991 s2kmode s2kdigestalgo s2kcipheralgo + cipheralgo digestalgo compressalgo throwkeyid)' -- gpg + +# procps +# ps +# uptime +compctl -x 'p[1]' -k '(-V)' -- uptime +compctl -x 'p[1]' -k '(-V)' + -k '(-s -d)' -- tload + + +############################################################################ +# Administrative commands + +compctl -u -x 'w[2,-c] p[3,-1]' -l '' - \ + 's[--]' -s 'fast help login preserve-environment shell version' -- su + +#if type rpm >/dev/null; then +#function pkg_glob () { +# if [[ ${REDHAT_PACKAGES:-0} = 0 ]]; then +# export REDHAT_PACKAGES="`rpm -qa`" +# fi +# reply=(${=REDHAT_PACKAGES}) +#} +#function refreshpkgcache () { +# export REDHAT_PACKAGES="`rpm -qa`" +#} +#compctl -f -x \ +# 'c[-1,--root]' -g '*(/)' - \ +# 'W[1,-(-install|i*)] s[--]' -k (hash percent force test replacepkgs replacefiles search root) - \ +# 'W[1,-(-upgrade|u*)] s[--]' -k (hash percent force test search oldpackage root) - \ +# 'C[-1,--(install|upgrade)] s[-],p[1] s[-i],p[1] s[-U]' -X "(h)ash (v)erbose" - \ +# 'W[1,-(-erase|e|-verify|V|y)] s[--]' -k (root) - \ +# 'W[1,-(-erase|e)]' -K pkg_glob - \ +# 'w[1,--query] s[-],p[1] s[-q],p[1] s[-V],p[1] s[-y]' -X \ +#"(a)ll (f)ile+ (F)ile-stdin (p)kg+ (P)kg-Stdin \ +#(i)nfo (l)ist-of-files (s)tates-of-files (d)ocumentation (c)onfiguration" - \ +# 'w[1,--verify] s[-],p[1] s[-V],p[1] s[-y]' -X \ +#"(a)ll (f)ile+ (F)ile-stdin (p)kg+ (P)kg-Stdin" - \ +# 'W[1,-(-verify|-query|q*|V*|y*)] C[-1,*f]' -f - \ +# 'W[1,-(-verify|-query|q*|V*|y*)] C[-1,*p*]' -g '*(D-/) *.rpm(N)' - \ +# 'W[1,-(-verify|-query|q*|V*|y*)]' -K pkg_glob - \ +# 'W[1,--(where|checksig)]' -K pkg_glob - \ +# 'W[1,--rebuild] s[-]' -k (v) - \ +# 'p[1] s[-b]' -X "(p)rep (l)ist (c)ompile (i)install (b)inary (a)ll" - \ +# 'p[2] C[-1,-b*] s[--]' -k (short-circuit clean sign keep-temps test time-check) - \ +# 's[--]' -k (help version install upgrade query verify erase rebuild where checksig) - \ +# 's[-]' -k (- i U q V e b) - \ +# 'c[-1,rpm]' -X "$(rpm)" -- rpm +#fi #if rpm exists + + +compctl -k '(if of conv ibs obs bs cbs files skip file seek count)' \ + -S '=' -x 's[if=], s[of=]' -f - 'C[0,conv=*,*] n[-1,,], s[conv=]' \ + -k '(ascii ebcdic ibm block unblock lcase ucase swap noerror sync)' \ + -q -S ',' - 'n[-1,=]' -X '' -- dd + + +############################################################################ +# Debian specific +source "/usr/share/doc/zsh/examples/compctl.dpkg" + +compctl -x 'c[-1,-x]' -g '*.dsc' + -g '*(/)' - \ + 'c[-1,-b]' -g '*(/)' -- dpkg-source +compctl -g '*.deb' + -g '*(/)' lintian +compctl -g '*.changes' + -g '*(/)' dupload + +#compctl \ +# -x 'p[1]s[--]' \ +# -k '(setup-lab remove-lab check check-part unpack remove \ +# help verbose version debug)' -- \ +# + -x 's[--]' -k '(help verbose version debug)' -- \ +# + -g '*.deb' + -g '*(/)' \ +# lintian + + diff --git a/debian/examples/ssh_completion b/debian/examples/ssh_completion new file mode 100644 index 0000000..53e61d1 --- /dev/null +++ b/debian/examples/ssh_completion @@ -0,0 +1,66 @@ +NOTE: In order for this to work with newer versions of ssh, you must +insure that "HashKnownHosts" is set to "no". + +This will set the variable $hosts to an array containing +all the hosts in ~/.ssh/known_hosts and ~/.ssh/known_hosts2 +that do not start with a digit. + +hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts <$HOME/.ssh/known_hosts2)"}:#[0-9]*}%%\ *}%%,*}) + +This will set the variable $hosts to an array containing +all the hosts in ~/.ssh/known_hosts that do not start with +a digit. + +hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[0-9]*}%%\ *}%%,*}) + +If you are using the new completion system, you can then place + +zstyle ':completion:*:hosts' hosts $hosts + +after compinit is autoloaded to use those anywhere hosts would be +completed, or + +zstyle ':completion:*:complete:ssh:*:hosts' hosts $hosts + +to use those hosts to complete only ssh. + +An explanation of the $hosts assignment, written by Peter Stephenson, +follows. + +$(<$HOME/.ssh/known_hosts) + +is a standard substitution: it simply takes the file and sticks it onto the +command line at that point. + +"$(<$HOME/.ssh/known_hosts)" + +Now it's quoted, it doesn't do word splitting; we have the complete file as +one word. From now on, we do nested substitutions: you just have to +remember that ${${...}}, or ${${...}}, essentially does nothing but an +ordinary parameter expansion --- the whole point is the extra bits tacked +on with each extra set of braces. For example, we're now going to do + +${(f)"$(<$HOME/.ssh/known_hosts)"} + +so we get the same answer, but with the effect of putting the (f) flag at +the start, which splits the result of that into lines. So we now have the +entire file as an array, one line per element. + +${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[0-9]*} +(Clint says the ^ shouldn't be there) says take the array elements (= lines +of the original file) which completely match [0-9]*, i.e. elements +beginning with a digit, and remove them, which is what ${...:#...} is for. + +${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[0-9]*}%%\ *} + +takes the result of that, and strips off from the end the largest pattern +matching ' *', i.e. a space followed by anything else, in other words it +leaves the largest initial string with no whitespace, which is a hostname +(this is a standard ${...%%...} which even ordinary shells do, although not +nested). + +${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[0-9]*}%%\ *}%%,*} + +does another strip at the end, this time for everything from the first +comma on. If there wasn't a comma, nothing changes. You could have +combined the last two as ${...%%[[:blank:],]*}, or something. diff --git a/debian/examples/ssh_completion2 b/debian/examples/ssh_completion2 new file mode 100644 index 0000000..7c6fcb2 --- /dev/null +++ b/debian/examples/ssh_completion2 @@ -0,0 +1,37 @@ +NOTE: In order for this to work with newer versions of ssh, you must +insure that "HashKnownHosts" is set to "no". + +This is what I would call overkill, but it should help illustrate +what some people like to do with ssh completion. +---------- + +zstyle ':completion:*' format 'Completing %d' +zstyle ':completion:*' group-name '' + +zstyle ':completion:*:scp:*' tag-order \ + 'hosts:-host hosts:-domain:domain hosts:-ipaddr:IP\ address *' +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 -e ':completion:*:(ssh|scp):*' hosts 'reply=( + ${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) \ + /dev/null)"}%%[# ]*}//,/ } + ${=${(f)"$(cat /etc/hosts(|)(N) <<(ypcat hosts 2>/dev/null))"}%%\#*} + )' + +zstyle ':completion:*:(ssh|scp):*:my-accounts' users-hosts \ + my.secret.account@student.uu.se + diff --git a/debian/newuser.zshrc.recommended b/debian/newuser.zshrc.recommended new file mode 100644 index 0000000..55be3ab --- /dev/null +++ b/debian/newuser.zshrc.recommended @@ -0,0 +1,37 @@ +# Set up the prompt + +autoload -Uz promptinit +promptinit +prompt adam1 + +setopt histignorealldups sharehistory + +# Use emacs keybindings even if our EDITOR is set to vi +bindkey -e + +# Keep 1000 lines of history within the shell and save it to ~/.zsh_history: +HISTSIZE=1000 +SAVEHIST=1000 +HISTFILE=~/.zsh_history + +# Use modern completion system +autoload -Uz compinit +compinit + +zstyle ':completion:*' auto-description 'specify: %d' +zstyle ':completion:*' completer _expand _complete _correct _approximate +zstyle ':completion:*' format 'Completing %d' +zstyle ':completion:*' group-name '' +zstyle ':completion:*' menu select=2 +eval "$(dircolors -b)" +zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} +zstyle ':completion:*' list-colors '' +zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s +zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*' +zstyle ':completion:*' menu select=long +zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s +zstyle ':completion:*' use-compctl false +zstyle ':completion:*' verbose true + +zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31' +zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd' diff --git a/debian/patches/run-help.patch b/debian/patches/run-help.patch new file mode 100644 index 0000000..cb61b62 --- /dev/null +++ b/debian/patches/run-help.patch @@ -0,0 +1,31 @@ +Index: zsh-new/Functions/Misc/run-help +=================================================================== +--- zsh-new.orig/Functions/Misc/run-help 2012-02-23 21:39:30.000000000 +0000 ++++ zsh-new/Functions/Misc/run-help 2012-06-01 09:39:23.201633945 +0000 +@@ -10,7 +10,7 @@ + + emulate -RL zsh + +-local HELPDIR="${HELPDIR:-/usr/share/zsh/$ZSH_VERSION/help}" ++local HELPDIR="${HELPDIR:-/usr/share/zsh/help}" + + [[ $1 == "." ]] && 1="dot" + [[ $1 == ":" ]] && 1="colon" +@@ -29,7 +29,7 @@ + return 0 + elif [[ -n "${HELPDIR:-}" && -r $HELPDIR/$1 && $1 != compctl ]] + then +- ${=PAGER:-more} $HELPDIR/$1 ++ ${=PAGER:-/usr/bin/pager} $HELPDIR/$1 + return $? + fi + +@@ -65,7 +65,7 @@ + (comp*) man zshcompsys;; + (zf*) man zshftpsys;; + (run-help) man zshcontrib;; +- (*) builtin functions ${what[(w)1]} | ${=PAGER:-more};; ++ (*) builtin functions ${what[(w)1]} | ${=PAGER:-/usr/bin/pager};; + esac;; + (*( is a * builtin)) + case ${what[(w)1]} in diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..1494ed6 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,2 @@ +solaris-shared.patch +run-help.patch diff --git a/debian/patches/solaris-shared.patch b/debian/patches/solaris-shared.patch new file mode 100644 index 0000000..47ab57a --- /dev/null +++ b/debian/patches/solaris-shared.patch @@ -0,0 +1,22 @@ +Index: zsh-new/configure.ac +=================================================================== +--- zsh-new.orig/configure.ac 2012-02-23 21:39:30.000000000 +0000 ++++ zsh-new/configure.ac 2012-05-31 23:01:56.935837293 +0000 +@@ -2689,7 +2689,8 @@ + sysv4*|esix*) DLLDFLAGS="${DLLDFLAGS=-G $ldflags}" ;; + netbsd*) DLLDFLAGS="${DLLDFLAGS=${DLLDARG}-x -shared --whole-archive}" ;; + aix*) DLLDFLAGS="${DLLDFLAGS=-G -bexpall -lc}" ;; +- solaris*|sysv4*|esix*) DLLDFLAGS="${DLLDFLAGS=-G}" ;; ++ solaris*) DLLDFLAGS="${DLLDFLAGS=-shared}" ;; ++ sysv4*|esix*) DLLDFLAGS="${DLLDFLAGS=-G}" ;; + darwin*) DLLDFLAGS="${DLLDFLAGS=-bundle -flat_namespace -undefined suppress}" ;; + beos*|haiku*) DLLDFLAGS="${DLLDFLAGS=-nostart}" ;; + openbsd*) +@@ -2827,7 +2828,6 @@ + + if test "x$dynamic" = xyes; then + zsh_SHARED_VARIABLE([environ], [char **]) +- test "$zsh_cv_shared_environ" = yes || dynamic=no + if test "$ac_cv_func_tgetent" = yes; then + zsh_SHARED_FUNCTION([tgetent]) + fi diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000..d887aed --- /dev/null +++ b/debian/postinst @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e + +case "$1" in + (configure) +# if test -z "$2"; then + add-shell /usr/bin/zsh +# fi + ;; + (abort-upgrade|abort-remove|abort-deconfigure) + exit 0 + ;; + (*) + echo "postinst called with unknown argument \`$1'" >&2 + exit 0 + ;; +esac + +mkdir -m2775 -p /usr/local/share/zsh/site-functions && chown root:staff \ + /usr/local/share/zsh/site-functions || true + +exit 0 diff --git a/debian/postrm b/debian/postrm new file mode 100644 index 0000000..be24d07 --- /dev/null +++ b/debian/postrm @@ -0,0 +1,9 @@ +#!/bin/sh + +set -e + +case "$1" in + (remove) + remove-shell /usr/bin/zsh + ;; +esac diff --git a/debian/prerm b/debian/prerm new file mode 100644 index 0000000..caf9c75 --- /dev/null +++ b/debian/prerm @@ -0,0 +1,22 @@ +#!/bin/sh + +set -e + +case "$1" in + (remove|deconfigure) + rmdir /usr/local/share/zsh/site-functions || true + rmdir /usr/local/share/zsh || true + ;; + (upgrade) + ;; + + (failed-upgrade) + ;; + + (*) + echo "prerm called with unknown argument \`$1'" >&2 + exit 0 + ;; +esac + +exit 0 diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..e094f17 --- /dev/null +++ b/debian/rules @@ -0,0 +1,59 @@ +#!/usr/bin/make -f + +export LDFLAGS = -Wl,--as-needed + +%: + dh $@ --with autoreconf + +override_dh_auto_configure: + dh_auto_configure -- \ + --enable-maildir-support \ + --enable-etcdir=/etc/zsh \ + --enable-function-subdirs \ + --enable-site-fndir=/usr/local/share/zsh/site-functions \ + --enable-fndir=/usr/share/zsh/functions \ + --with-tcsetpgrp --with-term-lib="ncursesw tinfo" \ + --enable-cap --enable-pcre \ + --enable-readnullcmd=pager \ + --enable-custom-patchlevel=Debian \ + --enable-additional-fpath=/usr/share/zsh/vendor-functions,/usr/share/zsh/vendor-completions + +override_dh_auto_build: + $(MAKE) + $(MAKE) pdf + +override_dh_auto_install: + $(MAKE) \ + install \ + install.info \ + install.html \ + DESTDIR=$(CURDIR)/debian/tmp \ + htmldir=/usr/share/doc/zsh-doc/html + cp Doc/zsh.pdf debian/tmp/usr/share/doc/zsh-doc/ + + mkdir -p debian/tmp/usr/share/zsh/help + nroff -mandoc -Tascii Doc/zshbuiltins.1 | colcrt - | \ + ( cd debian/tmp/usr/share/zsh/help && perl $(CURDIR)/Util/helpfiles ) + + mkdir -p debian/tmp/usr/include/zsh + mkdir -p debian/tmp/usr/share/zsh-dev + mkdir -p debian/tmp/usr/share/aclocal + cp Src/*.epro debian/tmp/usr/include/zsh/ + cp Src/makepro.awk debian/tmp/usr/share/zsh-dev/ + cp Config/aczshoot.m4 debian/tmp/usr/share/aclocal/zshoot.m4 + cp \ + Src/hashtable.h \ + Src/prototypes.h \ + Src/sigcount.h \ + Src/signals.h \ + Src/zsh.h \ + Src/zsh_system.h \ + Src/ztype.h \ + debian/tmp/usr/include/zsh/ + + +override_dh_strip: + dh_strip --dbg-package=zsh-dbg + +override_dh_compress: + dh_compress -X.pdf -Xhtml diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/zsh-dev.install b/debian/zsh-dev.install new file mode 100644 index 0000000..df8423a --- /dev/null +++ b/debian/zsh-dev.install @@ -0,0 +1,3 @@ +usr/include/zsh/* +usr/share/zsh-dev/* +usr/share/aclocal/* diff --git a/debian/zsh-doc.install b/debian/zsh-doc.install new file mode 100644 index 0000000..7df98e3 --- /dev/null +++ b/debian/zsh-doc.install @@ -0,0 +1,3 @@ +usr/share/doc/zsh-doc/html/ +usr/share/doc/zsh-doc/zsh.pdf +usr/share/info/zsh* diff --git a/debian/zsh.examples b/debian/zsh.examples new file mode 100644 index 0000000..2b26c00 --- /dev/null +++ b/debian/zsh.examples @@ -0,0 +1,3 @@ +Functions/Example/* +Misc/* +debian/examples/* diff --git a/debian/zsh.install b/debian/zsh.install new file mode 100644 index 0000000..5f3d574 --- /dev/null +++ b/debian/zsh.install @@ -0,0 +1,7 @@ +debian/newuser.zshrc.recommended etc/zsh/ +debian/zshenv etc/zsh/ +debian/zshrc etc/zsh/ +usr/bin/zsh* +usr/lib/zsh/* +usr/share/man/man1/* +usr/share/zsh/* diff --git a/debian/zsh.links b/debian/zsh.links new file mode 100644 index 0000000..6843bbd --- /dev/null +++ b/debian/zsh.links @@ -0,0 +1,2 @@ +usr/bin/zsh usr/bin/rzsh +usr/share/man/man1/zsh.1 usr/share/man/man1/rzsh.1 diff --git a/debian/zsh.menu b/debian/zsh.menu new file mode 100644 index 0000000..991e111 --- /dev/null +++ b/debian/zsh.menu @@ -0,0 +1 @@ +?package(zsh):needs="text" section="Applications/Shells" title="Zsh" command="/usr/bin/zsh" diff --git a/debian/zshenv b/debian/zshenv new file mode 100644 index 0000000..e2613c3 --- /dev/null +++ b/debian/zshenv @@ -0,0 +1,18 @@ +# /etc/zsh/zshenv: system-wide .zshenv file for zsh(1). +# +# This file is sourced on all invocations of the shell. +# If the -f flag is present or if the NO_RCS option is +# set within this file, all other initialization files +# are skipped. +# +# This file should contain commands to set the command +# search path, plus other important environment variables. +# This file should not contain commands that produce +# output or assume the shell is attached to a tty. +# +# Global Order: zshenv, zprofile, zshrc, zlogin + +if [[ -z "$PATH" || "$PATH" == "/bin:/usr/bin" ]] +then + export PATH="/usr/local/bin:/usr/bin:/bin:/usr/games" +fi diff --git a/debian/zshrc b/debian/zshrc new file mode 100644 index 0000000..4a0bfb4 --- /dev/null +++ b/debian/zshrc @@ -0,0 +1,88 @@ +# /etc/zsh/zshrc: system-wide .zshrc file for zsh(1). +# +# This file is sourced only for interactive shells. It +# should contain commands to set up aliases, functions, +# options, key bindings, etc. +# +# Global Order: zshenv, zprofile, zshrc, zlogin + +READNULLCMD=${PAGER:-/usr/bin/pager} + +if [[ -z "$DEBIAN_PREVENT_KEYBOARD_CHANGES" ]] && + [[ "$TERM" != 'emacs' ]] +then + + typeset -A key + key=( + Home "${terminfo[khome]}" + End "${terminfo[kend]}" + Insert "${terminfo[kich1]}" + Delete "${terminfo[kdch1]}" + Up "${terminfo[kcuu1]}" + Down "${terminfo[kcud1]}" + Left "${terminfo[kcub1]}" + Right "${terminfo[kcuf1]}" + PageUp "${terminfo[kpp]}" + PageDown "${terminfo[knp]}" + ) + + function bind2maps () { + local i sequence widget + local -a maps + + while [[ "$1" != "--" ]]; do + maps+=( "$1" ) + shift + done + shift + + sequence="${key[$1]}" + widget="$2" + + [[ -z "$sequence" ]] && return 1 + + for i in "${maps[@]}"; do + bindkey -M "$i" "$sequence" "$widget" + done + } + + bind2maps emacs -- Home beginning-of-line + bind2maps viins vicmd -- Home vi-beginning-of-line + bind2maps emacs -- End end-of-line + bind2maps viins vicmd -- End vi-end-of-line + bind2maps emacs viins -- Insert overwrite-mode + bind2maps vicmd -- Insert vi-insert + bind2maps emacs -- Delete delete-char + bind2maps viins vicmd -- Delete vi-delete-char + bind2maps emacs viins vicmd -- Up up-line-or-history + bind2maps emacs viins vicmd -- Down down-line-or-history + bind2maps emacs -- Left backward-char + bind2maps viins vicmd -- Left vi-backward-char + bind2maps emacs -- Right forward-char + bind2maps viins vicmd -- Right vi-forward-char + + # Make sure the terminal is in application mode, when zle is + # active. Only then are the values from $terminfo valid. + function zle-line-init () { + echoti smkx + } + function zle-line-finish () { + echoti rmkx + } + zle -N zle-line-init + zle -N zle-line-finish + + unfunction bind2maps + +fi # [[ -z "$DEBIAN_PREVENT_KEYBOARD_CHANGES" ]] && [[ "$TERM" != 'emacs' ]] + +zstyle ':completion:*:sudo:*' command-path /usr/local/sbin \ + /usr/local/bin \ + /usr/sbin \ + /usr/bin \ + /sbin \ + /bin \ + /usr/X11R6/bin + +(( ${+aliases[run-help]} )) && unalias run-help +autoload -Uz run-help |