X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=zsh%2Frc;h=2a3ff4c34622a7840a5a070e165a475f7cae77e6;hb=3710002bb73bca18ebd0b762aecdaabdbf8ef80e;hp=21b65a9c76ee9f09bbff519ce43fdb0e0120860b;hpb=4294da34e17d28287d38170da63c7b09904f95ac;p=config%2Fdotfiles.git diff --git a/zsh/rc b/zsh/rc index 21b65a9..2a3ff4c 100644 --- a/zsh/rc +++ b/zsh/rc @@ -1,7 +1,7 @@ # Zsh configuration file. -source_debug "sourcing ~/.zsh/rc" +source_debug ". ~/.zsh/rc" # MISCELLANEOUS SETTINGS @@ -319,7 +319,7 @@ if [[ $TERM == screen* || $TERM == xterm* || $TERM == rxvt* ]]; then # precmd() call. window_reset=yes # Is set to a non empty value when the shell is running as root. - if [[ $(id -u) -eq 0 ]]; then + if [[ $UID -eq 0 ]]; then window_root=yes fi @@ -340,7 +340,7 @@ if [[ $TERM == screen* || $TERM == xterm* || $TERM == rxvt* ]]; then # Ignore often used commands which are only running for a very short # time. This prevents a "blinking" name when it's changed to "cd" for # example and then some milliseconds later back to "zsh". - [[ $program_name == (cd*|ls|la|ll|clear|c) ]] && return + [[ $program_name == (cd*|d|ls|l|la|ll|clear|c) ]] && return # Change my shortcuts so the real name of the program is displayed. case $program_name in @@ -372,10 +372,10 @@ if [[ $TERM == screen* || $TERM == xterm* || $TERM == rxvt* ]]; then # If screen is running in SSH then display "@:hostname" as title # in the term/outer screen. if [[ $program_name == @screen ]]; then - program_name="@:${$(hostname)//.*/}" + program_name="@:${HOST//.*/}" # Use "@:!hostname" for root screens. elif [[ $program_name == @!screen ]]; then - program_name="@:!${$(hostname)//.*/}" + program_name="@:!${HOST//.*/}" fi fi @@ -492,6 +492,11 @@ zstyle ':completion:*:(mv|cp):*' ignore-line no # simpler. Thanks to Nomexous in #zsh on Freenode (2010-03-16 01:54) zstyle ':completion:*:*:-command-:*' ignored-patterns './config.*' +# Don't complete unwanted files with Vim. Thanks to Nomexous in #zsh on +# Freenode (2010-06-06 04:54 CEST). See below to complete them. +zstyle ':completion:*:*:vim:*:all-files' ignored-patterns '*.aux' '*.log' \ + '*.pdf' '*.class' + # Provide a fallback completer which always completes files. Useful when Zsh's # completion is too "smart". Thanks to Frank Terbeck # (http://www.zsh.org/mla/users/2009/msg01038.html). @@ -580,48 +585,39 @@ tig() { $@ } +# Pipe output through less. +tree() { + command tree -C "$@" | less +} -# OS SPECIFIC SETTINGS +# Automatically disown. +xpdf() { + command xpdf "$@" & + disown %command +} -local uname=$(uname) -if [[ $uname == Linux ]]; then +# OS SPECIFIC SETTINGS + +if [[ $OSTYPE == linux* ]]; then # Settings when creating Debian packages. DEBEMAIL=simon@ruderich.org export DEBEMAIL DEBFULLNAME='Simon Ruderich' export DEBFULLNAME - -elif [[ $uname == Darwin ]]; then # Mac OS X - # Store the current clipboard in CLIPBOARD before every command so it can - # be used in commands. - os_darwin_preexec() { - export CLIPBOARD="$(pbpaste)" - } - # Add the function as preexec hook. - add-zsh-hook preexec os_darwin_preexec - - # Initialize CLIPBOARD so it's available for completion directly after - # startup. - CLIPBOARD="" - export CLIPBOARD - - # Fetch current URL in clipboard with wget. - alias wnc='wget --no-proxy $CLIPBOARD' fi # LOAD ADDITIONAL CONFIGURATION FILES -# Load rc file for current hostname (first part before a dot) or rc.local. -source_config ~/.zsh host rc ${$(hostname)//.*/} +source_config ~/.zsh/rc.local # RUN COMMANDS # If not already in screen reattach to a running session or create a new one. # This also starts screen one a remote server when connecting through ssh. -if [[ $TERM != dumb && -z $STY ]]; then +if [[ $TERM != dumb && $TERM != linux && -z $STY ]]; then # Get running detached sessions. session=$(screen -list | grep 'Detached' | awk '{ print $1; exit }') @@ -638,6 +634,6 @@ if [[ $TERM != dumb && -z $STY ]]; then fi -source_debug "finished sourcing ~/.zsh/rc" +source_debug ". ~/.zsh/rc (done)" # vim: ft=zsh