-
Notifications
You must be signed in to change notification settings - Fork 2
zshrcmanual
Chris Hofstaedtler edited this page Jun 22, 2025
·
2 revisions
################################################################################
#
# Okay then, here is a list of items that need to be documented in the
# reference manual for grml's zsh setup.
#
# If you plan to work on one item, go to the line, open a new line and tell
# who you are (a nickname would be enough) and when you made the entry (here
# the output of 'date -u' would make sense to be independent of timezones).
# So, for example:
#
# setopt append_history
# ft, Tue Aug 4 08:35:28 UTC 2009
#
# The easiest picks are probably functions, aliases and a few keybindings.
# It is probably also a good idea to start off documenting items that you are
# using yourself.
# The workflow you need to apply will probably look something like this:
# 1. pick an item
# 2. change the wikipage so people know you're working on it.
# (two people working on the same thing without knowing about each other
# would suck. a lot.)
# 3. Find the position in the actual zshrc, that defines the item you are
# documenting.
# 4. Read the code.
# 5. Understand the code. :-)
# 6. Write an item in the grmlzshrc.t2t file (at a reasonable position).
#
# When you are happy with what you've written:
# 7. Commit your changes ('man git-commit')
# 8. Create a patch - or patches if you got more ('man git-format-patch')
# 9. Finally send your patch(es) to the mail address mentioned below.
# (preferably via 'git send-email' - see 'man git-send-email' for details)
#
# If you have any questions, please contact: grml-etc-core <at> grml.org
#
# See also: http://lists.mur.at/pipermail/grml/2009-August/004609.html
#
# If you are a first time git user, here is a number of places, that you
# may find helpful:
#
# http://progit.org/book/
# http://book.git-scm.com/
# http://git-scm.com/documentation
# man 7 gittutorial
# man 7 gittutorial-2
# man 7 gitworkflows
#
# And for people capable of reading German texts (maybe the command transcripts
# are useful for people who can't, too), an introduction into git format-patch
# and git send-email:
# http://bewatermyfriend.org/posts/2007/10-02.17-22-07-computer.html
################################################################################
# variables (that are *not* exported):
# environment variables:
export JIKESPATH
# J"oW"o (Fri Sep 11 16:22:11 UTC 2009)
check_com -c dircolors && eval $(dircolors -b)
isdarwin && export CLICOLOR=1
# do MacPorts setup on darwin
if isdarwin && [[ -d /opt/local ]]; then
PATH="/opt/local/bin:/opt/local/sbin:$PATH"
MANPATH="/opt/local/share/man:$MANPATH"
fi
# do Fink setup on darwin
isdarwin && xsource /sw/bin/init.sh
# load our function and completion directories
for fdir in /usr/share/grml/zsh/completion /usr/share/grml/functions; do
fpath=( ${fdir} ${fdir}/**/*(/N) ${fpath} )
if [[ ${fpath} == '/usr/share/grml/zsh/functions' ]] ; then
for func in ${fdir}/**/[^_]*[^~](N.) ; do
zrcautoload ${func:t}
done
fi
done
for mod in complist deltochar mathfunc ; do
zmodload -i zsh/${mod} 2>/dev/null || print "Notice: no ${mod} available :("
done
tmpargs=(
a stat
a zpty
ap mapfile
)
while (( ${#tmpargs} > 0 )) ; do
zmodload -${tmpargs[1]} zsh/${tmpargs[2]} ${tmpargs[2]}
shift 2 tmpargs
done
grmlcomp() {
# grml's completion setup as a whole could use a section in the manual
}
# Change vcs_info formats for the grml prompt. The 2nd format sets up
# $vcs_info_msg_1_ to contain "zsh: repo-name" used to set our screen title.
zstyle ':vcs_info:*' actionformats "${MAGENTA}(${NO_COLOUR}%s${MAGENTA})${YELLOW}-${MAGENTA}[${GREEN}%b${YELLOW}|${RED}%a${MAGENTA}]${NO_COLOUR} " \
"zsh: %r"
zstyle ':vcs_info:*' formats "${MAGENTA}(${NO_COLOUR}%s${MAGENTA})${YELLOW}-${MAGENTA}[${GREEN}%b${MAGENTA}]${NO_COLOUR}%} " \
"zsh: %r"
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat "%b${RED}:${YELLOW}%r"
# keybindings:
bindkey -e
J"oW"o (Sat Aug 28 16:54:47 UTC 2010)
bindkey -M emacs "$terminfo[kdch1]" delete-char
J"oW"o (Sat Aug 28 16:54:47 UTC 2010)
bindkey -M emacs "$terminfo[khome]" beginning-of-line
J"oW"o (Sat Aug 28 16:54:47 UTC 2010)
bindkey -M emacs "$terminfo[kend]" end-of-line
J"oW"o (Sat Aug 28 16:54:47 UTC 2010)
bindkey -M vicmd "$terminfo[kdch1]" vi-delete-char
J"oW"o (Sat Aug 28 16:54:47 UTC 2010)
bindkey -M vicmd "$terminfo[khome]" vi-beginning-of-line
J"oW"o (Sat Aug 28 16:54:47 UTC 2010)
bindkey -M vicmd "$terminfo[kend]" vi-end-of-line
J"oW"o (Sat Aug 28 16:54:47 UTC 2010)
bindkey -M viins "$terminfo[cuu1]" vi-up-line-or-history
bindkey -M viins "$terminfo[cuf1]" vi-forward-char
bindkey -M viins "$terminfo[kcuu1]" vi-up-line-or-history
bindkey -M viins "$terminfo[kcud1]" vi-down-line-or-history
bindkey -M viins "$terminfo[kcuf1]" vi-forward-char
bindkey -M viins "$terminfo[kcub1]" vi-backward-char
bindkey '^xP' history-beginning-search-forward
bindkey '^Xi' insert-unicode-char
bindkey '^xA' grml_toggle_abbrev
bindkey "^x^h" commit-to-history
bindkey "^Xf" insert-files
bindkey ' ' magic-space
bindkey '\ei' menu-complete
bindkey -M menuselect '\e^M' accept-and-menu-complete
bindkey -M menuselect '^o' accept-and-infer-next-history
bindkey '^Ed' _bkdate
bindkey "\em" insert-last-typed-word
bindkey "^Os" sudo-command-line
# buffer expansion
# see http://zshwiki.org/home/examples/zleiab for details
# less risky than the global aliases but powerful as well
# just type the abbreviation key and afterwards ',.' to expand it
bindkey ",." globalias
zrcautoload run-help # use via 'esc-h'
# hashed directories:
hash -d deb=
hash -d doc=
hash -d linux=
hash -d log=
hash -d slog=
hash -d src=
hash -d templ=
hash -d tt=
hash -d www=
# Functions:
# I've seen that some of these functions are doubling the features of others.
# Also, I'm not completely convinced all of these functions are too useful.
# If you're unsure about any of the functions after reading their code,
# contact us via email at the address mentioned on top of this page.
# Aliases: