From a2e767e164cb1e8859a30078c89df25e1f611f38 Mon Sep 17 00:00:00 2001 From: Thomas Schneider Date: Sun, 15 Feb 2015 12:31:57 +0100 Subject: Initial import of own zshrc files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit They depend on grml’s zshrc. Signed-off-by: Thomas Schneider --- dot.zshenv | 3 +++ dot.zshrc.from_grml | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++ dot.zshrc.local | 14 ++++++++++ dot.zshrc.pre | 2 ++ 4 files changed, 93 insertions(+) create mode 100644 dot.zshenv create mode 100644 dot.zshrc.from_grml create mode 100644 dot.zshrc.local create mode 100644 dot.zshrc.pre diff --git a/dot.zshenv b/dot.zshenv new file mode 100644 index 0000000..907f97d --- /dev/null +++ b/dot.zshenv @@ -0,0 +1,3 @@ +export GOPATH=~/.go/ +export LESS="FSRX" +export PATH=${PATH/::/:} diff --git a/dot.zshrc.from_grml b/dot.zshrc.from_grml new file mode 100644 index 0000000..d9050ca --- /dev/null +++ b/dot.zshrc.from_grml @@ -0,0 +1,74 @@ +## Settings for umask +if (( EUID == 0 )); then + umask 002 +else + umask 022 +fi + +# Virtualenv support + +function virtual_env_prompt () { + REPLY=${VIRTUAL_ENV+(${VIRTUAL_ENV:t}) } +} +grml_theme_add_token virtual-env -f virtual_env_prompt '%F{magenta}' '%f' +zstyle ':prompt:grml:left:setup' items rc virtual-env change-root user at host path vcs percent + +## ZLE tweaks ## + +## use the vi navigation keys (hjkl) besides cursor keys in menu completion +bindkey -M menuselect 'h' vi-backward-char # left +bindkey -M menuselect 'k' vi-up-line-or-history # up +bindkey -M menuselect 'l' vi-forward-char # right +bindkey -M menuselect 'j' vi-down-line-or-history # bottom + +## set command prediction from history, see 'man 1 zshcontrib' +is4 && zrcautoload predict-on && \ +zle -N predict-on && \ +zle -N predict-off && \ +bindkey "^X^Z" predict-on && \ +bindkey "^Z" predict-off + +# just type '...' to get '../..' +rationalise-dot() { +local MATCH +if [[ $LBUFFER =~ '(^|/| | |'$'\n''|\||;|&)\.\.$' ]]; then + LBUFFER+=/ + zle self-insert + zle self-insert +else + zle self-insert +fi +} +zle -N rationalise-dot +bindkey . rationalise-dot +## without this, typing a . aborts incremental history search +bindkey -M isearch . self-insert + +## add `|' to output redirections in the history +setopt histallowclobber + +## alert me if something failed +setopt printexitvalue + +## Allow comments even in interactive shells +setopt interactivecomments + +## get top 10 shell commands: +alias top10='print -l ${(o)history%% *} | uniq -c | sort -nr | head -n 10' + +## miscellaneous code ## + +## Use a default width of 80 for manpages for more convenient reading +export MANWIDTH=${MANWIDTH:-80} + +## List all occurrences of programm in current PATH +plap() { + emulate -L zsh + if [[ $# = 0 ]] ; then + echo "Usage: $0 program" + echo "Example: $0 zsh" + echo "Lists all occurrences of program in the current PATH." + else + ls -l ${^path}/*$1*(*N) + fi +} \ No newline at end of file diff --git a/dot.zshrc.local b/dot.zshrc.local new file mode 100644 index 0000000..65aae4c --- /dev/null +++ b/dot.zshrc.local @@ -0,0 +1,14 @@ +. ~/.zshrc.from_grml +prompt grml +zstyle :prompt:grml:left:items:percent pre ' +' +(( $+commands[bsdtar] )) && alias tar=bsdtar || echo "bsdtar not installed" +alias g=git +alias hl="highlight -O ansi" +#export PATH="${PATH}/usr/sbin:/usr/local/sbin:/sbin" +export PATH="${HOME}/.cabal/bin:${PATH}" +export SVN_SSH="ssh -i /home/qsuscs/.ssh/id_rsa_subversion" +ssh-add -l +function countdown { + ENDTIME=$(date -d "$1" +%s) watch -b -e -n 1 -x sh -c 'DIFF=$(($ENDTIME - $(date +%s))); echo $(($DIFF / 60)) min $(($DIFF % 60)) s; if [ $DIFF -lt 1 ]; then exit 1; fi' +} diff --git a/dot.zshrc.pre b/dot.zshrc.pre new file mode 100644 index 0000000..5fd3e88 --- /dev/null +++ b/dot.zshrc.pre @@ -0,0 +1,2 @@ +export GRML_DISPLAY_BATTERY=1 +export COMMAND_NOT_FOUND=1 -- cgit v1.2.3