From dd5427baaf49f8de4355abeb6bc8c6dd14f74e25 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Wed, 7 Oct 2009 17:05:19 +0200 Subject: Initial check-in of files --- .zsh/functions/VCS_INFO_get_data_bzr | 33 ++++++ .zsh/zshenv | 10 ++ .zsh/zshfunctions | 53 ++++++++++ .zsh/zshrc | 197 +++++++++++++++++++++++++++++++++++ 4 files changed, 293 insertions(+) create mode 100644 .zsh/functions/VCS_INFO_get_data_bzr create mode 100644 .zsh/zshenv create mode 100644 .zsh/zshfunctions create mode 100644 .zsh/zshrc (limited to '.zsh') diff --git a/.zsh/functions/VCS_INFO_get_data_bzr b/.zsh/functions/VCS_INFO_get_data_bzr new file mode 100644 index 0000000..374988a --- /dev/null +++ b/.zsh/functions/VCS_INFO_get_data_bzr @@ -0,0 +1,33 @@ +## vim:ft=zsh +## bazaar support by: Frank Terbeck +## Distributed under the same BSD-ish license as zsh itself. + +## Modified by René 'Necoro' Neumann + +setopt localoptions noksharrays extendedglob NO_shwordsplit +local bzrbase bzrbr +local -a bzrinfo +local bzrunstaged + +if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" "use-simple" ; then + bzrbase=${vcs_comm[basedir]} + bzrinfo[2]=${bzrbase:t} + if [[ -f ${bzrbase}/.bzr/branch/last-revision ]] ; then + bzrinfo[1]=$(< ${bzrbase}/.bzr/branch/last-revision) + bzrinfo[1]=${${bzrinfo[1]}%% *} + fi +else + bzrbase=${${(M)${(f)"$( ${vcs_comm[cmd]} info )"}:# ##branch\ root:*}/*: ##/} + bzrinfo=( ${${${(M)${(f)"$( ${vcs_comm[cmd]} version-info )"}:#(#s)(revno|branch-nick)*}/*: /}/*\//} ) + bzrbase="$(VCS_INFO_realpath ${bzrbase})" + + if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" "check-for-changes" ; then + [[ -n $(${vcs_comm[cmd]} status -S -V 2> /dev/null) && $? == 0 ]] && bzrunstaged=1 + fi +fi + +rrn=${bzrbase:t} +zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" branchformat bzrbr || bzrbr="%b:%r" +zformat -f bzrbr "${bzrbr}" "b:${bzrinfo[2]}" "r:${bzrinfo[1]}" +VCS_INFO_formats '' "${bzrbr}" "${bzrbase}" '' "${bzrunstaged}" "${bzrinfo[1]}" '' +return 0 diff --git a/.zsh/zshenv b/.zsh/zshenv new file mode 100644 index 0000000..4a4c063 --- /dev/null +++ b/.zsh/zshenv @@ -0,0 +1,10 @@ +typeset -U path fpath + +export ECHANGELOG_USER="René Neumann (Necoro) " + +fpath=(~/.zsh/functions $fpath) + +# load all things in there +autoload ${fpath[1]}/*(:t) + +[[ -d ~/bin ]] && path=(~/bin $path) diff --git a/.zsh/zshfunctions b/.zsh/zshfunctions new file mode 100644 index 0000000..118e74d --- /dev/null +++ b/.zsh/zshfunctions @@ -0,0 +1,53 @@ +# Nice mappings to restart/... the services +Start Stop Reload Restart () +{ + [[ $UID != 0 ]] && SUDO="sudo" + $SUDO /etc/init.d/$1 ${0:l} +} + +# Change to the directory of a specific package +cdu () +{ + local cp + + [[ -n $1 ]] && cp=$(eix -e $1 --format "/" 2>/dev/null | head -n1) + + cd /usr/portage/${cp} +} + +# Open the ebuild with a specified command +open_ebuild () +{ + local ebuild=$(equery w $2 2> /dev/null) + + if [[ -z $ebuild ]]; then + echo "Trying masked packages too..." + ebuild=$(equery w -m $2 2> /dev/null) + fi + + if [[ -n $ebuild ]]; then + $1 $ebuild + else + echo "No ebuild found" + fi +} + +if [[ $UID == 0 ]]; then + + # unpack a package + unpack() + { + ebuild $(equery w -m $1) clean unpack + } + + # set job count to 1 if there is only one package to install + emerge() + { + local e=$(whence -p emerge) + if [[ $# < 3 ]]; then + $e --jobs=1 $@ + else + $e $@ + fi + } +fi diff --git a/.zsh/zshrc b/.zsh/zshrc new file mode 100644 index 0000000..5b749be --- /dev/null +++ b/.zsh/zshrc @@ -0,0 +1,197 @@ +# Alias definition {{{ +################################################# + +# the | cmd aliases +alias -g L='| less' +alias -g H='| head' +alias -g T='| tail' +alias -g G='| grep' + +# > aliases +alias -g NE='2> /dev/null' +alias -g NO='> /dev/null' +alias -g NOE='&> /dev/null' + +# "vim" mappings +alias :e='gvim' +alias :q='exit' + +# ls +alias ls='ls --color=auto' +alias ll='ls -l' +alias la='ls -a' + +# emerge stuff +alias AK='ACCEPT_KEYWORDS="~x86"' +alias NS='FEATURES="nostrip" CFLAGS="-O0 -ggdb -pipe -march=native" CXXFLAGS="${CFLAGS}"' +alias e="eix -e" +alias i="eix -I" +alias ee='open_ebuild vim' +alias eeg='open_ebuild gvim' + +# misc +alias cdp='cd ~/dev/portato' +alias g='git' +alias h='history' +alias pstart='./portato.py -F' +alias quickweb='python -c "import SimpleHTTPServer;SimpleHTTPServer.test()"' +alias CH='./configure --help | less' +alias FF='noglob firefox' +alias IE='isabelle emacs' + +# }}} + +# Functions {{{ +################################################# + +source ~/.zsh/zshfunctions + +# }}} + +# Test for an interactive shell {{{ +# There is no need to set anything past this point for scp and rcp, +# and it's important to refrain from outputting anything in those cases. +if [[ $- != *i* ]] ; then + # Shell is non-interactive. Be done now! + return +fi +# }}} + +# Completion {{{ +################################################# +autoload -U compinit +compinit + +zmodload -i zsh/complist +zstyle ':completion::complete:*' use-cache 1 + +# the different style options +zstyle ":completion:*" verbose yes # be verbose +zstyle ":completion:*:descriptions" format "%S%d%s" # show descriptions +zstyle ":completion:*:corrections" format "%S%d%s" +zstyle ":completion:*:warnings" format "%S%d%s" +zstyle ":completion:*:errors" format "%S%d%s" + +zstyle ":completion:*" menu select=2 # show menu +zstyle ":completion:*:default" select-prompt "%SMatch %M %P%s" # show statusline + +zstyle ":completion::complete:*" rehash true # rehash always :) + +[[ -z $LS_COLORS ]] && eval $(dircolors) # needed for next line +zstyle ":completion:*:default" list-colors ${(s.:.)LS_COLORS} # make filecompletions being colored + +# }}} + +# Prompt {{{ +################################################# +autoload -U promptinit +promptinit; prompt gentoo + +# remove RPROMPT when command finished +setopt transient_rprompt + +# load colors +autoload -U colors +colors + +# show smilies in prompt :) +RPROMPT="%(?.%S%{$fg[green]%}:).%S%{$fg[red]%}:()%{$reset_color%}%s" + +# vcs stuff for prompt +setopt prompt_subst + +if [[ $ZSH_VERSION == 4.3.<->* ]]; then + autoload -Uz vcs_info + + zstyle ":vcs_info:*" enable bzr cvs svn git hg + zstyle ":vcs_info:*" formats "%B%{$fg[yellow]%}[%{$fg[green]%}(%u%c) %{$fg[yellow]%}%b:%1.6i%f%%b (%s)%B%{$fg[yellow]%}]%f%%b" + zstyle ":vcs_info:*" branchformat "%b" + zstyle ":vcs_info:*" get-revision true + zstyle ":vcs_info:*" check-for-changes true + zstyle ":vcs_info:*" max-exports 1 + zstyle ":vcs_info:bzr:*" unstagedstr '*' + + if type bzr NOE; then + if type bzrc NOE; then + bzr service NOE &! + zstyle ":vcs_info:bzr:*" command bzrc + zstyle ":vcs_info:bzr:*" use-simple false + else + zstyle ":vcs_info:bzr:*" use-simple true + fi + fi + + RPROMPT='${vcs_info_msg_0_:+"${vcs_info_msg_0_} "}'"${RPROMPT}" +else + vcs_info () {} # dummy +fi + +# }}} + +# XTerm Window Title {{{ +################################################# +autoload promptnl +case $TERM in +xterm*|rxvt*|Eterm) + precmd() + { + echo -ne "\033]0;${USER}@$(hostname):${PWD/$HOME/~}\007"; + promptnl + vcs_info + } +;; +screen) + precmd() + { + echo -ne "\033_${USER}@$(hostname):${PWD/$HOME/~}\033\\"; + promptnl + vcs_info + } +;; +esac +# }}} + +# Key bindings {{{ +################################################# +bindkey -e # use emacs style :) +case $TERM in (xterm*|aterm|rxvt) + bindkey "^[OH" beginning-of-line + bindkey "^[OF" end-of-line + bindkey "^[[3~" delete-char + if [[ $ZSH_VERSION == 4.3.10 ]]; then + bindkey "^R" history-incremental-pattern-search-backward + bindkey "^S" history-incremental-pattern-search-forward + else + bindkey "^R" history-incremental-search-backward + bindkey "^S" history-incremental-search-forward + fi + ;; +esac +# }}} + +# History {{{ +################################################# +HISTSIZE=10000 +SAVEHIST=12000 +HISTFILE=~/.zshhistory +setopt hist_no_store # no not store history related commands +setopt inc_append_history # append incrementally instead of waiting until the shell exists +setopt hist_verify # for history related commands: reload the expanded version instead of executing it directly +setopt hist_no_functions # do not store function definitions + +setopt hist_ignore_dups # ignore duplicates +setopt hist_ignore_all_dups # ignore _all_ duplicates + +# }}} + +# Misc Options {{{ +################################################# +setopt no_notify # do not disturb if bg-process has quit +setopt no_bg_nice # start bg-processes with the same nice-level as fg-p~ +setopt auto_cd # if you type a dir take it as a cd +setopt correct # correct possibly wrong command names +setopt complete_in_word + +# }}} + +# vim: fdm=marker -- cgit v1.2.3-54-g00ecf