You are not logged in.

#26 2010-08-05 14:50:10

Giselher
Member
From: Austria
Registered: 2010-02-02
Posts: 150
Website

Re: Post your .zshrc

autoload -U compinit promptinit
autoload -Uz vcs_info
compinit
promptinit

# Set keymap to neo 2
if [ -n "$DISPLAY" ]; then
        setxkbmap de neo -option 
fi

alias ls="ls --color=auto"
alias psg="ps aux | grep" 
alias sudo="sudo -E"
alias packer="packer --auronly"
alias aurup-devel="sudo packer -Suy --auronly --noconfirm --devel"
alias mount-loop="sudo mount -o loop,offset=32256"

alias -g qnet="-net nic,vlan=1,model=pcnet -net user,vlan=1"

hash -d perpege="$HOME/workplace/perpege/trunk"
hash -d archhurd="$HOME/workplace/archhurd"

export EDITOR="vim"
export VISUAL="vim"
export PYTHONSTARTUP=/home/alexander/.pythonrc
export PATH=$PATH:/home/alexander/bin
export CC="clang"
export CXX="clang"

precmd() {
    psvar=()
    vcs_info
    [[ -n $vcs_info_msg_0_ ]] && \
   # psvar[1]=r`echo "$vcs_info_msg_0_" | sed "s/[^0-9]\+//g"` && \
    psvar[1]="$vcs_info_msg_0_" && \
    psvar[2]='[' && psvar[3]=']' 
}

PROMPT=$'%{\e[1;34m%}%n%{\e[0m%}:%{\e[0;34m%}%~%{\e[0m%}$ '
RPROMPT=$'%2v%{\e[1;34m%}%1v%{\e[0m%}%3v[%{\e[1;34m%}%T%{\e[0m%}]'

compdef _pacman clyde=pacman

clyde() {
    case $1 in
        (-V | -Ss | -Si | -G* | -Q* | -T)
            /usr/bin/clyde "$@" ;;
        (-S* | -R* | -U | *)
            /usr/bin/sudo -E /usr/bin/clyde "$@" || return $? ;;
    esac
}

pacman() {
    case $1 in
        (-V | -Ss | -Si* | -Q* | -h)
            /usr/bin/pacman "$@" ;;
        (-D| -S* | -R* | -U | *)
            /usr/bin/sudo -E /usr/bin/pacman "$@" || return $? ;;
    esac
}

compdef _pacman pachurd=pacman

pachurd() {
    HURD=/home/alexander/workplace/archhurd/
    /usr/bin/sudo /usr/bin/pacman --root $HURD/hurd --config $HURD/pacman.conf "$@" 
}

# allow approximate
zstyle ':completion:*' completer _complete _match _approximate
zstyle ':completion:*:match:*' original only
zstyle ':completion:*:approximate:*' max-errors 1 numeric

# # tab completion for PID :D
zstyle ':completion:*:*:kill:*' menu yes select
zstyle ':completion:*:kill:*' force-list always

# # cd not select parent dir. 
zstyle ':completion:*:cd:*' ignore-parents parent pwd

bindkey "\e[4~" end-of-line
bindkey "\e[5~" beginning-of-history
bindkey "\e[6~" end-of-history
bindkey "\e[3~" delete-char
bindkey "\e[2~" quoted-insert
bindkey "\e[5C" forward-word
bindkey "\eOc" emacs-forward-word
bindkey "\e[5D" backward-word
bindkey "\eOd" emacs-backward-word
bindkey "\e\e[C" forward-word
bindkey "\e\e[D" backward-word
bindkey "^H" backward-delete-word
# for rxvt
bindkey "\e[8~" end-of-line
bindkey "\e[7~" beginning-of-line
# # for non RH/Debian xterm, can't hurt for RH/DEbian xterm
bindkey "\eOH" beginning-of-line
bindkey "\eOF" end-of-line
# # for freebsd console
bindkey "\e[H" beginning-of-line
bindkey "\e[F" end-of-line
# # completion in the middle of a line
bindkey '^i' expand-or-complete-prefix

Last edited by Giselher (2010-08-05 14:51:55)

Offline

#27 2010-08-05 21:46:15

Kooothor
Member
From: Paname
Registered: 2008-08-02
Posts: 226

Re: Post your .zshrc

Plop,

o1911 wrote:
bindkey -e

This is to use the keybindings of emacs;
and yet :

o1911 wrote:
export EDITOR="vim"

??

Also,


o1911 wrote:
   PROMPT=$'%{\e[1;31m%}%n%{\e[0m%}'
    PROMPT+=$'@%{\e[1;32m%}%m%{\e[0m%}'
    PROMPT+=$':%{\e[0;34m%}%~%{\e[0m%}# '

Why three prompts and what is the difference between the = and =+  ?
Cheers
~ktr


ktr

Offline

#28 2010-08-05 21:55:53

o1911
Member
From: Hobart, Australia
Registered: 2009-04-28
Posts: 106

Re: Post your .zshrc

Kooothor wrote:
bindkey -e

This is to use the keybindings of emacs;
and yet :


export EDITOR="vim"

??

To be honest, I know very little about emacs, but I like what little I know over vi.  That said, I do most of my quick dirty edits in vim.


Kooothor wrote:

Also,


   PROMPT=$'%{\e[1;31m%}%n%{\e[0m%}'
    PROMPT+=$'@%{\e[1;32m%}%m%{\e[0m%}'
    PROMPT+=$':%{\e[0;34m%}%~%{\e[0m%}# '

Why three prompts and what is the difference between the = and =+  ?
Cheers
~ktr


The += just appends; it's like saying

$ A="hello"
$ A+=" world"
$ echo $A
hello world

Perhaps you're more familiar with PROMPT=$PROMPT:<extra stuff> ?

I spaced it out so it's more clear what it's doing... but basically it will only display the machine name if we're logged in over ssh, or I'm root (which changes the username red).


Arch x86_64

Offline

#29 2010-08-08 10:40:11

Kooothor
Member
From: Paname
Registered: 2008-08-02
Posts: 226

Re: Post your .zshrc

mmmmkay thx smile


ktr

Offline

#30 2010-08-08 11:24:05

Ramses de Norre
Member
From: Leuven - Belgium
Registered: 2007-03-27
Posts: 1,289

Re: Post your .zshrc

#!/bin/zsh

source /etc/profile

autoload colors
colors
fpath=(~/myfns $fpath)
autoload -U compinit
compinit

# next lets set some enviromental/shell pref stuff up
# setopt NOHUP
#setopt NOTIFY
#setopt NO_FLOW_CONTROL
setopt INC_APPEND_HISTORY
setopt APPEND_HISTORY
# setopt AUTO_LIST        # these two should be turned off
# setopt AUTO_REMOVE_SLASH
# setopt AUTO_RESUME        # tries to resume command of same name
unsetopt BG_NICE        # do NOT nice bg commands
setopt CORRECT            # command CORRECTION
setopt EXTENDED_HISTORY        # puts timestamps in the history
setopt HASH_CMDS        # turns on hashing
setopt MENUCOMPLETE
setopt ALL_EXPORT

# Set/unset  shell options
setopt   notify globdots correct pushdtohome cdablevars autolist
setopt   correctall autocd recexact longlistjobs
setopt   autoresume histignoredups pushdsilent 
setopt   autopushd pushdminus extendedglob rcquotes mailwarning
unsetopt bgnice autoparamslash

# Autoload zsh modules when they are referenced
zmodload -a zsh/stat stat
zmodload -a zsh/zpty zpty
zmodload -a zsh/zprof zprof
zmodload -a zsh/mapfile mapfile

setopt PROMPT_SUBST
local _RED=%{${fg[red]}%}
local _DEFAULT=%{${fg[default]}%}

precmd() {
  if [ $? -eq 0 ]; then
    PROMPT="${_RED}$(tty|cut -d/ -f3,4) %# ${_DEFAULT}"
  else
    PROMPT="${_RED}cmd failed!($?) %# ${_DEFAULT}"
  fi
}
PROMPT2="${_RED}%_ %#${_DEFAULT} " # Continuation prompt
RPROMPT="${_DEFAULT}[${_RED}%n${_DEFAULT}@${_RED}%m${_DEFAULT}]%~"

export HISTFILE=~/.zsh/zsh_history
export HISTSIZE=50000
export SAVEHIST=50000

umask 0037

alias ls="ls --color=auto -h"
alias grep="grep --color"
alias nano="nano -w" #Disable annoying line wrapping
alias startx="startx --dpi 100 -nolisten tcp -nolisten udp -deferglyphs 16"
alias chown="chown --preserve-root"
alias chmod="chmod --preserve-root"
VIMDIR=$(ls /usr/share/vim|egrep '^vim([0-9])+$')
alias less="/usr/share/vim/$VIMDIR/macros/less.sh"
alias hostip="wget http://checkip.dyndns.org/ -O - -o /dev/null | cut -d: -f 2 | cut -d\< -f 1"
alias mkpkg="makepkg -csi"
alias go="startx"
alias v="vim -p"
alias mpfb="mplayer -vo fbdev2 -fs -zoom -xy 1440"
alias rsync="rsync --progress"
alias lftp_telenet="lftp -p 21 -u ##### users.telenet.be"
alias lftp_kul="lftp -p 990 -u #### ####.kuleuven.be"
alias lftp_hekeko="lftp -u ######,###### chirohekeko.be"
alias sudo="sudo "    #Sudo wont recognize aliases without this
alias !="sudo"
alias po="popd"
alias mute="amixer set Master toggle"
alias df="df -h"
alias du="du -h"
alias su="su -"
alias alsamixer="alsamixer -V all"
alias wake_icarus="wol -p 50000 -i ramses.homelinux.net 00:13:D3:8B:9E:89"
alias rh="rehash"
alias du0="du --max-depth=0"
alias du1="du --max-depth=1"
alias startx="( startx || logout ) && logout"
alias mounticarus="sshfs ramses@ramses.homelinux.net:/home/ramses /home/ramses/icarus"
alias unmounticarus="fusermount -u /home/ramses/icarus"
alias mount_secure_drop="encfs /home/ramses/Dropbox/.secure /home/ramses/decrypted_drop"
alias umount_secure_drop="fusermount -u /home/ramses/decrypted_drop"
alias mount_secure="encfs /home/ramses/.encrypted /home/ramses/decrypted"
alias umount_secure="fusermount -u /home/ramses/decrypted"
alias lstexfont='ls {/usr/share/texmf-dist/tex/latex/psnfss/*.sty,/usr/share/texmf-dist/tex/latex/pxfonts/*.sty}' 
alias dmenu_run="dmenu_run -b -i -fn '-misc-fixed-medium-r-normal-*-10-*-100-100-*-*-*-*' -nb '#000000' -nf '#ffffff' -sb '#49ccdf' -sf '#000000'"
alias p="pacman"
alias spacman="/usr/bin/trickle -sd 30 /usr/bin/pacman"
alias c="clyde"
alias rm="rm -i"
alias git="nocorrect git"

export VNC_VIA_CMD="/usr/bin/ssh -2 -c aes128-cbc -X -p 10023 -l ramses -f -L %L:%H:%R %G sleep 20"
alias vncicarus="vncviewer -geometry 1400x800 -x11cursor -compresslevel 2 -via localhost icarus:1" 
alias vncicarusext="vncviewer -geometry 1400x800 -x11cursor -compresslevel 2 -via localhost ramses.homelinux.net:1" 

alias start_mon="sudo airmon-ng start wlan0"
alias air_global_info="sudo airodump-ng mon0"

export LANGUAGE="EN_GB"
export _JAVA_OPTIONS="-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel"
export OOO_FORCE_DESKTOP="gnome"
export EDITOR="vim"
export VISUAL=$EDITOR
export MANPAGER="sh -c \"col -b | /usr/share/vim/$VIMDIR/macros/less.sh -c 'set ft=man nonu nomod nolist' -\""
export BROWSER="firefox"

function urxvt_mod()
{
  urxvtc "$@"
  if [ $? -eq 2 ]; then
    urxvtd -q -o -f
    urxvtc "$@"
  fi
}
alias urxvt="urxvt_mod"
alias urxvtc="urxvt_mod"

function mount_fat()
{
  # $1 is the device or the label
  # $2 is the mountpoint
  local _DEF_PATH="/media/tmp1"
  if [ -n "$2" ];then
    sudo mount -t vfat -o rw,users,flush,umask=0000 "$1" "$2"
  else
    sudo mount -t vfat -o rw,users,flush,umask=0000 "$1" $_DEF_PATH
  fi
}

function vacuum_mozilla()
{
  echo "vacuum ramses' firefox..."
  for i in /home/ramses/.mozilla/firefox/FF3/*.sqlite
  do
      echo "VACUUM;"|sqlite3 $i
      echo "REINDEX;"|sqlite3 $i
  done
  echo "vacuum elien's firefox"
  for i in /home/elien/.mozilla/firefox/tjdcnbqz.elien/*.sqlite
  do
      echo "VACUUM;"|sudo -u elien sqlite3 $i
      echo "REINDEX;"|sudo -u elien sqlite3 $i
  done
  echo "vacuum ramses' thunderbird"
  for i in /home/ramses/.thunderbird/0dkivq1s.default/*.sqlite
  do
      echo "VACUUM;"|sqlite3 $i
      echo "REINDEX;"|sqlite3 $i
  done
}

# transmission
function allow_bittorrent()
{
  if [ $1 = eth0 ]; then
    sudo iptables -A INPUT -i eth0 -p tcp --syn --dport ## -j ACCEPT
    sudo iptables -A INPUT -i eth0 -p udp --dport ## -j ACCEPT
  elif [ $1 = wlan0 ]; then
    sudo iptables -A INPUT -i wlan0 -p tcp --syn --dport ## -j ACCEPT
    sudo iptables -A INPUT -i wlan0 -p udp --dport ## -j ACCEPT
  else
    echo "Interface is required as argument!"
  fi
}

function allow_ssh()
{
    sudo iptables -A INPUT -i eth0 -p tcp --syn --dport ## -j ACCEPT
    sudo iptables -A INPUT -i eth0 -p udp --dport ## -j ACCEPT
}

function killcontainer()
{
    # it seems process names are truncated...
    pkill -9 plugin-containe
}

# Set up auto extension stuff
alias -s html=$BROWSER
alias -s org=$BROWSER
alias -s php=$BROWSER
alias -s com=$BROWSER
alias -s net=$BROWSER
alias -s png=eog
alias -s jpg=eog
alias -s gif=eog
alias -s eps=eog
alias -s pdf=evince
alias -s sxw=soffice
alias -s doc=soffice
alias -s xls=soffice
alias -s ppt=soffice
alias -s odt=soffice
alias -s gz=tar -xzvf
alias -s bz2=tar -xjvf
alias -s java=$EDITOR
alias -s txt=$EDITOR
alias -s tex=$EDITOR
alias -s mws=maple
alias -s install=$EDITOR

# key bindings
bindkey "\e[1~" beginning-of-line
bindkey "\e[4~" end-of-line
bindkey "\e[5~" beginning-of-history
bindkey "\e[6~" end-of-history
bindkey "\e[3~" delete-char
bindkey "\e[2~" quoted-insert
bindkey "\e[5C" forward-word
bindkey "\eOc" emacs-forward-word
bindkey "\e[5D" backward-word
bindkey "\eOd" emacs-backward-word
bindkey "\e\e[C" forward-word
bindkey "\e\e[D" backward-word
bindkey "^H" backward-delete-word
# for rxvt
bindkey "\e[8~" end-of-line
bindkey "\e[7~" beginning-of-line
# for non RH/Debian xterm, can't hurt for RH/DEbian xterm
bindkey "\eOH" beginning-of-line
bindkey "\eOF" end-of-line
# for freebsd console
bindkey "\e[H" beginning-of-line
bindkey "\e[F" end-of-line
# completion in the middle of a line
bindkey '^i' expand-or-complete-prefix
bindkey '^R' history-incremental-search-backward
bindkey '\e[A' history-search-backward
bindkey '\e[B' history-search-forward

zstyle ':completion::complete:*' use-cache on
zstyle ':completion::complete:*' cache-path ~/.zsh/cache/$HOST

zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' list-prompt '%SAt %p: Hit TAB for more, or the character to insert%s'
zstyle ':completion:*' menu select=1 _complete _ignored _approximate
zstyle -e ':completion:*:approximate:*' max-errors \
    'reply=( $(( ($#PREFIX+$#SUFFIX)/2 )) numeric )'
zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s'

# Completion Styles

# list of completers to use
zstyle ':completion:*::::' completer _expand _complete _ignored _approximate

# allow one error for every three characters typed in approximate completer
zstyle -e ':completion:*:approximate:*' max-errors \
    'reply=( $(( ($#PREFIX+$#SUFFIX)/2 )) numeric )'
    
# insert all expansions for expand completer
zstyle ':completion:*:expand:*' tag-order all-expansions

# formatting and messages
zstyle ':completion:*' verbose yes
zstyle ':completion:*:descriptions' format '%B%d%b'
zstyle ':completion:*:messages' format '%d'
zstyle ':completion:*:warnings' format 'No matches for: %d'
zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b'
zstyle ':completion:*' group-name ''

# match uppercase from lowercase
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'

# offer indexes before parameters in subscripts
zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters

# command for process lists, the local web server details and host completion
# on processes completion complete all user processes
# zstyle ':completion:*:processes' command 'ps -au$USER'

## add colors to processes for kill completion
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'

#zstyle ':completion:*:processes' command 'ps ax -o pid,s,nice,stime,args | sed "/ps/d"'
zstyle ':completion:*:*:kill:*:processes' command 'ps --forest -A -o pid,user,cmd'
zstyle ':completion:*:processes-names' command 'ps axho command' 
#zstyle ':completion:*:urls' local 'www' '/var/www/htdocs' 'public_html'
#
#NEW completion:
# 1. All /etc/hosts hostnames are in autocomplete
# 2. If you have a comment in /etc/hosts like #%foobar.domain,
#    then foobar.domain will show up in autocomplete!
zstyle ':completion:*' hosts $(awk '/^[^#]/ {print $2 $3" "$4" "$5}' /etc/hosts | grep -v ip6- && grep "^#%" /etc/hosts | awk -F% '{print $2}') 
# Filename suffixes to ignore during completion (except after rm command)
zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns '*?.o' '*?.c~' \
    '*?.old' '*?.pro'
# the same for old style completion
#fignore=(.o .c~ .old .pro)

# ignore completion functions (until the _ignored completer)
zstyle ':completion:*:functions' ignored-patterns '_*'
zstyle ':completion:*:*:*:users' ignored-patterns \
        adm apache bin daemon games gdm halt ident junkbust lp mail mailnull \
        named news nfsnobody nobody nscd ntp operator pcap postgres radvd \
        rpc rpcuser rpm shutdown squid sshd sync uucp vcsa xfs avahi-autoipd\
        avahi backup messagebus beagleindex debian-tor dhcp dnsmasq fetchmail\
        firebird gnats haldaemon hplip irc klog list man cupsys postfix\
        proxy syslog www-data mldonkey sys snort
# SSH Completion
zstyle ':completion:*:scp:*' tag-order \
   files users 'hosts:-host hosts:-domain:domain hosts:-ipaddr"IP\ Address *'
zstyle ':completion:*:scp:*' group-order \
   files all-files users 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 '*' single-ignored show

Last edited by Ramses de Norre (2010-08-08 11:37:18)

Offline

#31 2010-12-03 13:41:10

Drexya
Member
Registered: 2009-07-28
Posts: 23

Re: Post your .zshrc

#!/usr/bin/env zsh
#   _________  _   _ ____   ____ 
#  |__  / ___|| | | |  _ \ / ___|
#    / /\___ \| |_| | |_) | |    
# _ / /_ ___) |  _  |  _ <| |___ 
#(_)____|____/|_| |_|_| \_\\____|
#

# prompt
autoload -U promptinit
promptinit
prompt fade

# Completion
autoload -U bashcompinit
autoload -U incremental-complete-word
autoload -U compinit
bashcompinit
compinit -C
zmodload zsh/complist

# Language
LANG=fr_FR.UTF-8; export LANG
MM_CHARSET=UTF-8; export MM_CHARSET
LC_ALL=fr_FR.UTF-8; export LC_ALL

# Unicode
setopt printeightbit

# mv zsh
autoload zmv

# Colors
if [[ -x `which dircolors` ]]; then
    if [[ -f ~/.dir_colors ]]; then
        eval $(dircolors -b ~/.dir_colors)
    elif  [[ -f /etc/dir_colors ]]; then
        eval $(dircolors -b /etc/dir_colors)
    else
        eval $(dircolors -b)
    fi
else
    LS_COLORS='no=00:fi=00:di=00;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:';
    export LS_COLORS
fi
export ZLS_COLORS=$LS_COLORS

# Comments
setopt  interactive_comments

# completion style
zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
zstyle ':completion:*:warnings' format '%BDésolé, pas de résultats pour : %d%b'
zstyle ':completion:*' menu select=2
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s

# sudo completion
zstyle ':completion:*:sudo:*' command-path /usr/local/sbin /usr/local/bin \
                           /usr/sbin /usr/bin /sbin /bin /usr/X11R6/bin /home/mich/bin

# Completion cache
zstyle ':completion:complete:*' use-cache 1
zstyle ':completion:complete:*' cache-path ~/.zsh/cache/$HOST

# History
export HISTFILE=~/.zsh/history/historique
export HISTSIZE=1000
export SAVEHIST=1000

# completion colors
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}

# autocd...
setopt autopushd pushdminus pushdsilent pushdtohome
setopt autocd
setopt hist_ignore_all_dups

# correction
setopt correctall

# Welcome message... #################################################
   ##                            
if [ -x /usr/bin/fortune ]; then                                   ##
    /usr/bin/fortune -s     # makes our day a bit more fun.... :-) ##
fi                                                                 ##
#####################################################################

# better ls ;)
function ll()
{ ls -l "$@"| egrep "^d" ; ls -lXB "$@" 2>&-| egrep -v "^d|total "; }

# cvs(1) completion
_cvs ()
{
    local cur prev
    COMPREPLY=()
    cur=${COMP_WORDS[COMP_CWORD]}
    prev=${COMP_WORDS[COMP_CWORD-1]}

    if [ $COMP_CWORD -eq 1 ] || [ "${prev:0:1}" = "-" ]; then
        COMPREPLY=( $( compgen -W 'add admin checkout commit diff \
        export history import log rdiff release remove rtag status \
        tag update' $cur ))
    else
        COMPREPLY=( $( compgen -f $cur ))
    fi
    return 0
}
complete -F _cvs cvs

# killall completion
_killall ()
{
    local cur prev
    COMPREPLY=()
    cur=${COMP_WORDS[COMP_CWORD]}

    # get a list of processes (the first sed evaluation
    # takes care of swapped out processes, the second
    # takes care of getting the basename of the process)
    COMPREPLY=( $( /bin/ps -u $USER -o comm  | \
        sed -e '1,1d' -e 's#[]\[]##g' -e 's#^.*/##'| \
        awk '{if ($0 ~ /^'$cur'/) print $0}' ))

    return 0
}
complete -F _killall killall killps

##################################################################################
# Change the window title of X terminals 
    if [[ $TERM =~ "xterm|rxvt" ]]; then
        # There are lots of other info to add. See 'prompt expansion' in
        # man zshmisc
        precmd()  { print -Pn "\e]0;%~\a"} ;
        preexec() { print -Pn "\e]0;$1\a"} ;
    fi
##################################################################################

export GREP_COLOR=31

# Alias #
alias grep='egrep --color=auto'
alias mkdir='mkdir -p'
alias ..='cd ..'
alias du='du -kh'
alias df='df -kTh'
#alias effacer="mv -t ~/.local/share/Trash/files --backup=t"
alias usinit="sudo invoke-rc.d"
alias modprobe="sudo modprobe"
alias ncmpc="ncmpcpp"
alias vi="vim"
alias svi="sudo vim"
alias sgvi="sudo gvim"
alias dezip="unfoo"
alias rmmod="sudo rmmod"
alias cpr="cp -R"
alias date="date +%c"
alias less="vimpager"
alias more="vimpager"

# Pacman
alias pac="sudo pacman"
alias pacS="sudo pacman -S"
alias pacR="sudo pacman -R"
alias pacRs="sudo pacman -Rs"
alias pacSyu="sudo pacman -Syu"
alias pacSu="sudo pacman -Su"
alias pacRd="sudo pacman -Rd"
alias pacSs="pacman -Ss"
alias pacQs="pacman -Qs"
alias pacSi="pacman -Si"
alias pacQi="pacman -Qi"
alias pacQl="pacman -Ql"
alias pacQo="sudo pacman -Qo" 
alias pacQtd="sudo pacman -Qtd"
alias pacScc="sudo pacman -Scc" 
alias pacU="sudo pacman -U"

# The 'ls' family (this assumes you use the GNU ls)
alias la='ls -Al'               # show hidden files
alias ls='ls -hF --color'    # add colors for filetype recognition
alias lx='ls -lXB'              # sort by extension
alias lk='ls -lSr'              # sort by size
alias lc='ls -lcr'        # sort by change time  
alias lu='ls -lur'        # sort by access time   
alias lr='ls -lR'               # recursive ls
alias lt='ls -ltr'              # sort by date
alias lm='ls -al |more'         # pipe through 'more'

# Paths
export PATH=$PATH:/home/mich/bin/:/sbin/:/usr/sbin/:/usr/local/bin/:/usr/games/

# Keyboard
#bindkey     "^[[3~"          delete-char
#bindkey     "^[3;5~"         delete-char
#bindkey     "^[[7~"          beginning-of-line
#bindkey     "^[[8~"          end-of-line
#bindkey     "^[[2~"          overwrite-mode

typeset -A key

key[Home]=${terminfo[khome]}
key[End]=${terminfo[kend]}
key[Insert]=${terminfo[kich1]}
key[Delete]=${terminfo[kdch1]}
key[Up]=${terminfo[kcuu1]}
key[Down]=${terminfo[kcud1]}
key[Left]=${terminfo[kcub1]}
key[Right]=${terminfo[kcuf1]}
key[PageUp]=${terminfo[kpp]}
key[PageDown]=${terminfo[knp]}

[[ -n "${key[Home]}"    ]]  && bindkey  "${key[Home]}"    beginning-of-line
[[ -n "${key[End]}"     ]]  && bindkey  "${key[End]}"     end-of-line
[[ -n "${key[Insert]}"  ]]  && bindkey  "${key[Insert]}"  overwrite-mode
[[ -n "${key[Delete]}"  ]]  && bindkey  "${key[Delete]}"  delete-char
[[ -n "${key[Up]}"      ]]  && bindkey  "${key[Up]}"      up-line-or-history
[[ -n "${key[Down]}"    ]]  && bindkey  "${key[Down]}"    down-line-or-history
[[ -n "${key[Left]}"    ]]  && bindkey  "${key[Left]}"    backward-char
[[ -n "${key[Right]}"   ]]  && bindkey  "${key[Right]}"   forward-char

bindkey "\e[5~" history-search-backward # touche "page précédente"
bindkey "\e[6~" history-search-forward # touche "page suivante"

# Pager
export PAGER=/usr/bin/vimpager
export EDITOR=/usr/bin/vim
export VISUAL=/usr/bin/vim

#export VDPAU_NVIDIA_NO_OVERLAY=1
export WINEARCH=win32

# Cgroups, should be included in kernel 2.6.38
if [ "$PS1" ] ; then  
   mkdir -m 0700 /dev/cgroup/cpu/user/$$ > /dev/null 2>&1
   echo $$ > /dev/cgroup/cpu/user/$$/tasks
   echo "1" > /dev/cgroup/cpu/user/$$/notify_on_release
fi

Sorry for my poor english.

Offline

#32 2010-12-11 19:37:44

Archie_Enthusiasm
Member
Registered: 2010-10-23
Posts: 99

Re: Post your .zshrc

Hi guys,

I think it is the right place to post my question:


can you guys please have a look on my post?

https://bbs.archlinux.org/viewtopic.php?id=109919

My .zshrc configuration file does not evaluate the .dir_colors file in ~ folder.

Thanks in advance

Offline

#33 2010-12-14 03:16:24

cirkit
Member
From: San Francisco
Registered: 2008-01-29
Posts: 80
Website

Re: Post your .zshrc

And here is my .zshrc :-)

# Zsh options

# Coloring is fun
fg_black=%{$'\e[0;30m'%}
fg_red=%{$'\e[0;31m'%}
fg_green=%{$'\e[0;32m'%}
fg_brown=%{$'\e[0;33m'%}
fg_blue=%{$'\e[0;34m'%}
fg_purple=%{$'\e[0;35m'%}
fg_cyan=%{$'\e[0;36m'%}
fg_lgray=%{$'\e[0;37m'%}
fg_dgray=%{$'\e[1;30m'%}
fg_lred=%{$'\e[1;31m'%}
fg_lgreen=%{$'\e[1;32m'%}
fg_yellow=%{$'\e[1;33m'%}
fg_lblue=%{$'\e[1;34m'%}
fg_pink=%{$'\e[1;35m'%}
fg_lcyan=%{$'\e[1;36m'%}
fg_white=%{$'\e[1;37m'%}
#Text Background Colors
bg_red=%{$'\e[0;41m'%}
bg_green=%{$'\e[0;42m'%}
bg_brown=%{$'\e[0;43m'%}
bg_blue=%{$'\e[0;44m'%}
bg_purple=%{$'\e[0;45m'%}
bg_cyan=%{$'\e[0;46m'%}
bg_gray=%{$'\e[0;47m'%}
#Attributes
at_normal=%{$'\e[0m'%}
at_bold=%{$'\e[1m'%}
at_italics=%{$'\e[3m'%}
at_underl=%{$'\e[4m'%}
at_blink=%{$'\e[5m'%}
at_outline=%{$'\e[6m'%}
at_reverse=%{$'\e[7m'%}
at_nondisp=%{$'\e[8m'%}
at_strike=%{$'\e[9m'%}
at_boldoff=%{$'\e[22m'%}
at_italicsoff=%{$'\e[23m'%}
at_underloff=%{$'\e[24m'%}
at_blinkoff=%{$'\e[25m'%}
at_reverseoff=%{$'\e[27m'%}
at_strikeoff=%{$'\e[29m'%}

export HISTFILE=~/.zsh_history
export HISTSIZE=50000
export SAVEHIST=50000
export EDITOR="vim"
export PAGER="most -s"
export PATH="${PATH}:${HOME}/bin"
eval `dircolors -b`

zstyle ':completion:*' completer _list _oldlist _expand _complete _ignored _match _correct _approximate
zstyle ':completion:*' file-sort access
zstyle ':completion:*' matcher-list '' ''
zstyle ':completion:*' max-errors 100 numeric
zstyle ':completetion:*' menu select

autoload -Uz compinit
compinit
# http://www.acm.uiuc.edu/workshops/zsh/prompt/escapes.html

### Prompts
autoload -U colors && colors
export PROMPT="%n@%m %c %# "
PS1="%{$fg[blue]%}%n%{$reset_color%}@%{$fg[green]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% "

autoload colors zsh/terminfo
    if [[ "$terminfo[colors]" -ge 8 ]]; then
        colors
    fi
    for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
        eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
        eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
        (( count = $count + 1 ))
    done
    PR_NO_COLOUR="%{$terminfo[sgr0]%}"


setopt autopushd pushdminus pushdsilent pushdtohome
setopt autocd
setopt cdablevars
setopt ignoreeof
setopt interactivecomments
setopt nobanghist
setopt noclobber
setopt HIST_REDUCE_BLANKS
setopt HIST_IGNORE_SPACE
setopt SH_WORD_SPLIT
setopt CORRECT
setopt EXTENDED_HISTORY   # Timestamp history
setopt MENUCOMPLETE
setopt nohup
setopt ALL_EXPORT

# History search
bindkey "^[[A" history-search-backward
bindkey "^[[B" history-search-forward

# Set up auto extension stuff
alias -s html=$BROWSER
alias -s org=$BROWSER
alias -s php=$BROWSER
alias -s com=$BROWSER
alias -s net=$BROWSER
alias -s png=feh
alias -s jpg=feh
alias -s gif=feg
alias -s sxw=soffice
alias -s doc=soffice
alias -s gz=tar -xzvf
alias -s bz2=tar -xjvf
alias -s java=$EDITOR
alias -s txt=$EDITOR
alias -s PKGBUILD=$EDITOR

# Normal aliases
alias ls='ls --color=auto -F'
alias lsd='ls -ld *(-/DN)'
alias lsa='ls -ld .*'
alias c='clear'
alias rm='rm -i'
alias trash="mv $1 ~/.local/share/Trash"
alias grep="grep --colour"
alias dir='ls -1'
alias v="vim"
alias ..='cd ..'
alias free="free -m"
alias b='acpi'
alias mstream='mplayer -playlist'
alias twit='ttytter -ansi -ssl'
alias rss='newsbeuter'
alias pacman='pacman-color'
alias packer='sudo packer'
alias pill='sudo powerpill'

PATH=/usr/share/perl5/vendor_perl/auto/share/dist/Cope:$PATH
TZ="America/Los_Angeles"
HOSTNAME="`hostname`"
    LC_ALL='en_US.UTF-8'
    LANG='en_US.UTF-8'
    LC_CTYPE=C

    unsetopt ALL_EXPORT

Only 145 lines

Offline

#34 2010-12-14 05:33:13

teh
Member
From: Tijuana, Mexico
Registered: 2009-07-07
Posts: 374
Website

Re: Post your .zshrc

My new version:

# ------------------------------------------------------
# file:     $HOME/.zshrc
# author:   Ramon Solis - http://cyb3rpunk.wordpress.com
# modified: December 2010
# vim:fenc=utf-8:nu:ai:si:et:ts=4:sw=4:ft=sh:
# ------------------------------------------------------

# -------
# History
# -------
export HISTFILE=$HOME/.zsh_history
export HISTSIZE=666
export SAVEHIST=$HISTSIZE

# ----------
# Completion
# ----------
zstyle :compinstall filename '$HOME/.zshrc'
autoload -Uz compinit
compinit
autoload -U incremental-complete-word
zmodload zsh/complist 

zstyle ':completion::complete:*' use-cache 1
zstyle ':completion::complete:*' cache-path $HOME/.zshcache
zstyle ':completion:*:*:kill:*' menu yes select
zstyle ':completion:*:kill:*' force-list always
zstyle ':completion:*:*:killall:*' menu yes select
zstyle ':completion:*:killall:*'   force-list always
zstyle ':completion:*:pacman:*' force-list always
zstyle ':completion:*:*:pacman:*' menu yes select
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*:cd:*' ignore-parents parent pwd
zstyle ':completion:*' completer _complete _match _approximate
zstyle ':completion:*:match:*' original only
zstyle ':completion:*:approximate:*' max-errors 1 numeric

# -----
# Paths
# -----
export PATH="/bin:/sbin:/usr/bin:/usr/sbin:$HOME/Scripts:$PATH"

# ------
# Colors
# ------
export GREP_COLORS="38;5;230:sl=38;5;240:cs=38;5;100:mt=38;5;161:fn=38;5;197:ln=38;5;212:bn=38;5;44:se=38;5;166"
export LS_COLORS="*.tar.bz2=38;5;226:*.tar.xz=38;5;130:*PKGBUILD=48;5;233;38;5;160:*.html=38;5;213:*.htm=38;5;213:*.vim=38;5;142:*.css=38;5;209:*.screenrc=38;5;120:*.procmailrc=38;5;120:*.zshrc=38;5;120:*.bashrc=38;5;120:*.xinitrc=38;5;120:*.vimrc=38;5;120:*.htoprc=38;5;120:*.muttrc=38;5;120:*.gtkrc-2.0=38;5;120:*.fehrc=38;5;120:*.rc=38;5;120:*.md=38;5;130:*.markdown=38;5;130:*.conf=38;5;148:*.h=38;5;81:*.rb=38;5;192:*.c=38;5;110:*.diff=38;5;31:*.yml=38;5;208:*.pl=38;5;178:*.csv=38;5;136:tw=38;5;003:*.chm=38;5;144:*.bin=38;5;249:*.pdf=38;5;203:*.mpg=38;5;38:*.ts=38;5;39:*.sfv=38;5;191:*.m3u=38;5;172:*.txt=38;5;192:*.log=38;5;190:*.swp=38;5;241:*.swo=38;5;240:*.theme=38;5;109:*.zsh=38;5;173:*.nfo=38;5;113:mi=38;5;124:or=38;5;160:ex=38;5;197:ln=target:pi=38;5;130:ow=38;5;208:fi=38;5;007:so=38;5;167:di=38;5;30:*.pm=38;5;197:*.pl=38;5;166:*.sh=38;5;243:*.patch=38;5;37:*.tar=38;5;118:*.tar.gz=38;5;172:*.zip=38;5;11::*.rar=38;5;11:*.tgz=38;5;11:*.7z=38;5;11:*.mp3=38;5;173:*.flac=38;5;166:*.mkv=38;5;115:*.avi=38;5;114:*.wmv=38;5;113:*.jpg=38;5;66:*.jpeg=38;5;67:*.png=38;5;68:*.pacnew=38;5;33"

# ----
# Mode
# ----
#bindkey -v                      # Set vi mode
bindkey -e                       # Set emacs mode

# -------
# Options
# -------
setopt extended_glob             # Extended glob 
setopt interactive_comments      # Allow comments in shells
setopt auto_cd                   # Change directory magic
setopt complete_in_word          # 
setopt no_beep                   # Don't beep on errors
setopt hist_ignore_all_dups      #
setopt hist_ignore_space         #
setopt hist_reduce_blanks        # Remove blanks from history
setopt correct_all               # Command correction in a line
setopt promptsubst               
setopt no_clobber                # Don't overwrite files when redirect
setopt always_to_end             # when complete from middle, move cursor

# --------
# ENV VARS
# --------
export EDITOR='/usr/bin/vim'       \
       VISUAL='/usr/bin/vim'       \
       PAGER='/usr/bin/vimpager'   \
       BROWSER='/usr/bin/opera'    \
       SHELL='/bin/zsh'            \
       LANG='en_US.utf8'           \
       LC_ALL='en_US.utf8'         \
       LC='en_US.utf8'             \
       LESSCHARSET='utf-8'         \

# --------------------------
# Load aliases and functions
#---------------------------
[[ -r $HOME/.zsh_aliases    ]] && source $HOME/.zsh_aliases
[[ -r $HOME/.zsh_functions  ]] && source $HOME/.zsh_functions

# ------------
# Key bindings
# ------------
bindkey "\e[1~" beginning-of-line
bindkey "\e[4~" end-of-line
bindkey "\e[5~" beginning-of-history
bindkey "\e[6~" end-of-history
bindkey "\e[3~" delete-char
bindkey "\e[2~" quoted-insert
bindkey "\e[5C" forward-word
bindkey "\e[5D" backward-word
bindkey "\e[8~" end-of-line            # For rxvt
bindkey "\e[7~" beginning-of-line      # For rxvt
bindkey '^i' expand-or-complete-prefix # Completion in the middle of a line
bindkey '^z' undo                      # C-x-u is overkill
bindkey '^w' kill-word                  
bindkey '^b' backward-kill-word
bindkey ' ' magic-space                # Do history expansion on space

# --------------
# For WMII title
# --------------
#WMII_IS_RUNNING=`ps a | grep wmii | awk '/[^"grep"] wmii$/'`
#if [ -n "$WMII_IS_RUNNING" ]; then
#  PROMPT_COMMAND='dirs | wmiir write /client/sel/label'
#fi

# -----------------------
# Colors in TTY (Zenburn)
# -----------------------
if [[ $TERM == "linux" ]]; then
echo -en "\e]P01e2320" # zen-black (norm. black)
echo -en "\e]P8709080" # zen-bright-black (norm. darkgrey)
echo -en "\e]P1705050" # zen-red (norm. darkred)
echo -en "\e]P9dca3a3" # zen-bright-red (norm. red)
echo -en "\e]P260b48a" # zen-green (norm. darkgreen)
echo -en "\e]PAc3bf9f" # zen-bright-green (norm. green)
echo -en "\e]P3dfaf8f" # zen-yellow (norm. brown)
echo -en "\e]PBf0dfaf" # zen-bright-yellow (norm. yellow)
echo -en "\e]P4506070" # zen-blue (norm. darkblue)
echo -en "\e]PC94bff3" # zen-bright-blue (norm. blue)
echo -en "\e]P5dc8cc3" # zen-purple (norm. darkmagenta)
echo -en "\e]PDec93d3" # zen-bright-purple (norm. magenta)
echo -en "\e]P68cd0d3" # zen-cyan (norm. darkcyan)
echo -en "\e]PE93e0e3" # zen-bright-cyan (norm. cyan)
echo -en "\e]P7dcdccc" # zen-white (norm. lightgrey)
echo -en "\e]PFffffff" # zen-bright-white (norm. white)
fi

# ------
# Prompt 
# ------
function precmd {

    local TERMWIDTH
    (( TERMWIDTH = ${COLUMNS} - 1 ))


    ###
    # Truncate the path if it's too long.
    
    PR_FILLBAR=""
    PR_PWDLEN=""
    
    local promptsize=${#${(%):---(%n@%m:%l)---()--}}
    local pwdsize=${#${(%):-%~}}
    
    if [[ "$promptsize + $pwdsize" -gt $TERMWIDTH ]]; then
        ((PR_PWDLEN=$TERMWIDTH - $promptsize))
    else
    PR_FILLBAR="\${(l.(($TERMWIDTH - ($promptsize + $pwdsize)))..${PR_HBAR}.)}"
    fi


    ###
    # Get APM info.

    if which ibam > /dev/null; then
    PR_APM_RESULT=`ibam --percentbattery`
    elif which apm > /dev/null; then
    PR_APM_RESULT=`apm`
    fi
}


setopt extended_glob
preexec () {
    if [[ "$TERM" == "screen" ]]; then
    local CMD=${1[(wr)^(*=*|sudo|-*)]}
    echo -n "\ek$CMD\e\\"
    fi
}


setprompt () {
    ###
    # Need this so the prompt will work.

    setopt prompt_subst


    ###
    # See if we can use colors.

    autoload colors zsh/terminfo
    if [[ "$terminfo[colors]" -ge 8 ]]; then
    colors
    fi
    for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
    eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
    eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
    (( count = $count + 1 ))
    done
    PR_NO_COLOUR="%{$terminfo[sgr0]%}"


    ###
    # See if we can use extended characters to look nicer.
    
    typeset -A altchar
    set -A altchar ${(s..)terminfo[acsc]}
    PR_SET_CHARSET="%{$terminfo[enacs]%}"
    PR_SHIFT_IN="%{$terminfo[smacs]%}"
    PR_SHIFT_OUT="%{$terminfo[rmacs]%}"
    PR_HBAR=${altchar[q]:--}
    PR_ULCORNER=${altchar[l]:--}
    PR_LLCORNER=${altchar[m]:--}
    PR_LRCORNER=${altchar[j]:--}
    PR_URCORNER=${altchar[k]:--}

    
    ###
    # Decide if we need to set titlebar text.
    
    case $TERM in
    xterm*)
        PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\a%}'
        ;;
    screen)
        PR_TITLEBAR=$'%{\e_screen \005 (\005t) | %(!.-=[ROOT]=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\e\\%}'
        ;;
    *)
        PR_TITLEBAR=''
        ;;
    esac
    
    
    ###
    # Decide whether to set a screen title
    if [[ "$TERM" == "screen" ]]; then
    PR_STITLE=$'%{\ekzsh\e\\%}'
    else
    PR_STITLE=''
    fi
    
    
    ###
    # APM detection
    
    if which ibam > /dev/null; then
    PR_APM='$PR_RED${${PR_APM_RESULT[(f)1]}[(w)-2]}%%(${${PR_APM_RESULT[(f)3]}[(w)-1]})$PR_LIGHT_BLUE:'
    elif which apm > /dev/null; then
    PR_APM='$PR_RED${PR_APM_RESULT[(w)5,(w)6]/\% /%%}$PR_LIGHT_BLUE:'
    else
    PR_APM=''
    fi
    
    
    ###
    # Finally, the prompt.

    PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\
$PR_CYAN$PR_SHIFT_IN$PR_ULCORNER$PR_CYAN$PR_HBAR$PR_SHIFT_OUT(\
$PR_BLUE%(!.%SROOT%s.%n)$PR_BLUE@%m:%l\
$PR_CYAN)$PR_SHIFT_IN$PR_HBAR$PR_CYAN$PR_HBAR${(e)PR_FILLBAR}$PR_CYAN$PR_HBAR$PR_SHIFT_OUT(\
$PR_GREEN%$PR_PWDLEN<...<%~%<<\
$PR_CYAN)$PR_SHIFT_IN$PR_HBAR$PR_CYAN$PR_URCORNER$PR_SHIFT_OUT\

$PR_CYAN$PR_SHIFT_IN$PR_LLCORNER$PR_CYAN$PR_HBAR$PR_SHIFT_OUT(\
%(?..$PR_LIGHT_RED%?$PR_CYAN:)\
${(e)PR_APM}$PR_YELLOW%D{%H:%M}\
$PR_LIGHT_CYAN:%(!.$PR_RED.$PR_WHITE)%#$PR_CYAN)$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\
$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\
$PR_CYAN> '

    RPROMPT=' $PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_CYAN$PR_HBAR$PR_SHIFT_OUT\
($PR_YELLOW%D{%a,%b%d}$PR_CYAN)$PR_SHIFT_IN$PR_HBAR$PR_CYAN$PR_LRCORNER$PR_SHIFT_OUT$PR_NO_COLOUR'

    PS2='$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\
$PR_BLUE$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT(\
$PR_LIGHT_GREEN%_$PR_BLUE)$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\
$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT$PR_NO_COLOUR '
}

setprompt

################################## Stolen from http://bbs.archlinux.org/viewtopic.php?pid=549482#p549482 ####### modified by me


# -------------------
# Some shitty prompts 
# -------------------

#PROMPT=$'%{\e[0;34m%}%B[%b%{\e[0m%}%~%{\e[0;34m%}%B]%b%{\e[0;34m%}>%{\e[0m%} '
# [~]> 

#PROMPT=$'%{\e[0;31m%}%B┌─[%b%{\e[0;34m%}%n%{\e[0m%}@%{\e[0;34m%}%m%{\e[0;31m%}%B]%{\e[0;31m%}%B[%b%{\e[0;34m%}%~%{\e[0;31m%}%B] 
#%{\e[0;31m%}%B└─╼%b%{\e[1;30m%}%{\e[0m%} '
# ┌─[ramonoid@arch][~]
# └─╼                                                                                            
#export PS1=$'%{\e[0;30m%}>%{\e[1;30m%}>%{\e[1;37m%}>%{\e[0m%} ' 
# >>>

#export PS1=$'%{\e[0;35m%}%B┌─[%b%{\e[0;34m%}%n%{\e[0m%}@%{\e[0;34m%}%m%{\e[0;35m%}%B]%b%{\e[1;35m%}[%b%{\e[0;34m%}%~%{\e[0;35m%}%B]
#%{\e[0;35m%}%B└─╼%b%{\e[1;30m%}%{\e[0m%} '
# ┌─[ramonoid@arch][~]
# └─╼         

Functions and aliases here: https://github.com/ramonoid/dotfiles/


arst

Offline

#35 2010-12-14 07:46:43

o1911
Member
From: Hobart, Australia
Registered: 2009-04-28
Posts: 106

Re: Post your .zshrc

I've learned so much and spent so many hours on my .zshrc thanks to this thread.  My updated one:

#!/bin/zsh

HISTFILE=$HOME/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt appendhistory notify correctall prompt_subst

autoload -Uz compinit promptinit vcs_info colors

compinit # tab-completion
promptinit # advanced prompt support
colors

zstyle ':compinstall' filename '$HOME/.zshrc'
zstyle ':completion:*' menu select
zstyle ':completion:*:*:kill:*' menu yes select
zstyle ':completion:*:kill:*' force-list always
zstyle ':completion:*:*:killall:*' menu yes select
zstyle ':completion:*:killall:*'   force-list always

########################################
## Prompt - [url]http://kriener.org/articles/2009/06/04/zsh-prompt-magic[/url]
for COLOR in BLACK RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
    eval PR_$COLOR='%{$fg[${(L)COLOR}]%}'        
    eval PR_BRIGHT_$COLOR='%{$fg_bold[${(L)COLOR}]%}'
done                                                
PR_RESET="%{${reset_color}%}";   

zstyle ':vcs_info:*' enable git hg
FMT_BRANCH="${PR_BRIGHT_MAGENTA}%b%u%c${PR_RESET}" # e.g. master¹²
FMT_ACTION="(${PR_CYAN}%a${PR_RESET}%)"   # e.g. (rebase-i)
FMT_PATH="%R${PR_MAGENTA}/%S"              # e.g. ~/repo/subdir
 
# check-for-changes can be really slow.
# you should disable it, if you work with large repositories   
zstyle ':vcs_info:*:prompt:*' check-for-changes true
zstyle ':vcs_info:*:prompt:*' unstagedstr '¹'  # display ¹ if there are unstaged changes
zstyle ':vcs_info:*:prompt:*' stagedstr '²'    # display ² if there are staged changes
zstyle ':vcs_info:*:prompt:*' actionformats "[${FMT_BRANCH}${FMT_ACTION}]" "${FMT_PATH}"
zstyle ':vcs_info:*:prompt:*' formats       "[${FMT_BRANCH}]"              "${FMT_PATH}"
zstyle ':vcs_info:*:prompt:*' nvcsformats   ""                             "%~"        


function lprompt {
    local brackets=$1
    local color1=$2 
    local color2=$3 
                      
    local bracket_open="${color1}${brackets[1]}${PR_RESET}"
    local bracket_close="${color1}${brackets[2]}"

    local user="${color1}%n${PR_RESET}"
    local machine="@${color2}%m${PR_RESET}"
    local symbol="$ "

if [[ `whoami` == "root" ]]; then
    local user="${PR_BRIGHT_RED}%n${PR_RESET}${machine}"
    local symbol="# "
fi

if [[ $SSH_CONNECTION != "" ]]; then
    local user="${user}${machine}"
fi

    local vcs='$vcs_info_msg_0_'

    PROMPT="${PR_RESET}${user}${vcs}${symbol}${PR_RESET}"
}                                                                                       
 
function rprompt {
    local brackets=$1
    local color1=$2 
    local color2=$3 
                      
    local bracket_open="${color1}${brackets[1]}${PR_RESET}"
    local bracket_close="${color1}${brackets[2]}${PR_RESET}"
                                                             
    local vcs_cwd='${${vcs_info_msg_1_%%.}/$HOME/~}'       
    local cwd="${color2}%B%25<..<${vcs_cwd}%<<%b"

    RPROMPT="${PR_RESET}${bracket_open}${cwd}${bracket_close}${PR_RESET}"
}

lprompt '[]' $PR_GREEN $PR_YELLOW
rprompt '()' $PR_RESET $PR_RESET

export PROMPT
export PROMPT2="${PR_GREEN}>${PR_RESET} "
export RPROMPT

########################################
## Key bindings
# Press Ctrl-V <key> 
#  to test. e.g.
#  bindkey '^[[3~' delete-char

bindkey -e
bindkey ^f history-beginning-search-backward
bindkey ^b history-beginning-search-forward

typeset -A key

key[Home]=${terminfo[khome]}
key[End]=${terminfo[kend]}
key[Delete]=${terminfo[kdch1]}

[[ -n "${key[Home]}"    ]]  && bindkey  "${key[Home]}"    beginning-of-line
[[ -n "${key[End]}"     ]]  && bindkey  "${key[End]}"     end-of-line
[[ -n "${key[Delete]}"  ]]  && bindkey  "${key[Delete]}"  delete-char

case $TERM in
    linux) # tty "linux" terminal
    function precmd { vcs_info 'prompt' } 
    ;;    
    *)
    function precmd { vcs_info 'prompt'; print -Pn "\e]2;%n@%M:%~\a" }   
    if [[ $(echo $XTERM_VERSION | cut -d'(' -f-1) == "XTerm" ]]; then
        bindkey '^[[H' beginning-of-line
        bindkey '^[[F' end-of-line
    fi
    ;;
esac

########################################
## Other stuff

DAYSLEFT=$(( (( (( $(date +%s -d "September 24 2010") - $(date +%s) )) / (( 24 * 60 * 60 )) )) * -1 ))
#if [[ DAYSLEFT -lt "15" ]]
#then
#    echo "Thesis is due in" $(( (( (( $(date +%s -d $(date +%F -d "September 24")) - $(date +%s) )) / (( 60 * 60 )) + 14 )) )) "hours!"
#else
    echo "Thesis was due $DAYSLEFT days ago. Be happy!"
#fi


## Editor
export EDITOR="vim"


## Aliases
alias ls='ls -F --color=auto'
alias ll='ls -lhF --color=auto'
alias la='ls -lahF --color=auto'
alias grep='grep --color=auto'


## Appended paths
PATH+=:/usr/local/bin
PATH+=:$HOME/bin

# optional ones
if [[ -d $HOME/Data/livedata/ ]]; then
    # MIRIAD
    . /usr/local/miriad/MIRRC.sh
    PATH+=:$MIRBIN
    
    # livedata / gridzilla
    . $HOME/Data/livedata/init.sh
    GLISHROOT=$HOME/Data/glish
    PATH+=:$GLISHROOT/linux64/bin
fi

export PATH


function most_useless_use_of_zsh {
   local lines columns colour a b p q i pnew
   ((columns=COLUMNS-1, lines=LINES-1, colour=0))
   for ((b=-1.5; b<=1.5; b+=3.0/lines)) do
       for ((a=-2.0; a<=1; a+=3.0/columns)) do
           for ((p=0.0, q=0.0, i=0; p*p+q*q < 4 && i < 32; i++)) do
               ((pnew=p*p-q*q+a, q=2*p*q+b, p=pnew))
           done
           ((colour=(i/4)%8))
            echo -n "\\e[4${colour}m "
        done
        echo
    done
}

Arch x86_64

Offline

#36 2010-12-25 15:15:29

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: Post your .zshrc

Moved to Workstation User.


ᶘ ᵒᴥᵒᶅ

Offline

#37 2010-12-25 18:59:07

hmo_gsm
Member
From: Germany
Registered: 2010-12-20
Posts: 20

Re: Post your .zshrc

Am using Barts S60_prompt and a few small files that definitely need an update ~

--latest version can now be found via bitbucket

##
# .zshrc
##
autoload -U compinit promptinit zmv url-quote-magic
compinit
promptinit
prompt bart

zle -N self-insert url-quote-magic

setopt always_to_end
setopt autocd
setopt complete_in_word
setopt correctall
setopt extended_glob
setopt globdots
setopt histignorespace
setopt ignoreeof
setopt noclobber

HISTFILE=~/.zsh-history
HISTSIZE=500
SAVEHIST=5000
setopt hist_ignore_all_dups hist_reduce_blanks \
hist_save_no_dups inc_append_history \
extended_history share_history multios

source "${XDG_CONFIG_HOME}/zsh/aliases"
source "${XDG_CONFIG_HOME}/zsh/comp"
source "${XDG_CONFIG_HOME}/zsh/S60_prompt"
##
# ${XDG_CONFIG_HOME}/zsh/aliases
##
alias -s txt=vim
alias -s c=vim
alias -s cpp=vim
alias -s h=vim
alias -s py=vim
alias -s errors=less
alias -s error=less
alias -s log=less
alias -s png=feh
alias -s jpg=feh
alias -s gif=feh
alias -s pdf=zathura

alias -g L='| less'
alias -g G='| egrep --color=auto -n'

alias ..='cd ..'
alias mem="free -m"
alias :q='exit'
alias :q!='exit'

alias clyde='sudo clyde'
alias cp='nocorrect cp'
alias dt='dmesg | tail'
alias ftp='ncftp'
alias mkdir='nocorrect mkdir'
alias mpdvd="mplayer -vf cropdetect -display :0 -really-quiet dvdnav://$1"
alias mv='nocorrect mv'
alias mvtr='sudo mv ${HOME}/dl/*.torrent /home/rtorrent/watch/'
alias ncmpc='ncmpcpp'
alias rt='dtach -a /tmp/rt'
alias sa='screen -r anime'
alias sci='screen -dmS irssi /usr/bin/irssi'
alias si='screen -r irssi'
alias sm='screen -r movies'
##
# ${XDG_CONFIG_HOME}/zsh/comp
##
zstyle ':completion:*' completer _complete _match _approximate
zstyle ':completion:*:match:*' original only
zstyle ':completion:*:approximate:*' max-errors 1 numeric
zstyle ':completion:*:cd:*' menu yes select
zstyle ':completion:*:cd:*' ignore-parents parent pwd
zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
zstyle ':completion:*:warnings' format '%BSorry, no matches for: %d%b'
zstyle ':completion:*:kill:*' menu yes selectG
zstyle ':completion:*:kill:*' force-list always
zstyle ':completion:*:processes' command 'ps -A'
zstyle ':completion:*:manuals' menu yes select
zstyle ':completion::complete:*' use-cache 1

Last edited by hmo_gsm (2011-01-08 15:37:58)


HHNNNNGG | nyahahahaha *meow*

Offline

#38 2011-04-14 07:49:31

yochaigal
Member
From: Boston
Registered: 2011-02-06
Posts: 202

Re: Post your .zshrc

I just installed the grml-zsh-config package, and then added another line to ensure bash-style keyboard commands translate.

here's mine:



# The following lines were added by compinstall
zstyle :compinstall filename '/home/yochai/.zshrc'

autoload -Uz compinit
compinit
# End of lines added by compinstall
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
bindkey -e
eval "$(sed -n 's/^/bindkey /; s/: / /p' /etc/inputrc)"

# End of lines configured by zsh-newuser-install

Offline

#39 2011-04-14 08:08:42

dmz
Member
From: Sweden
Registered: 2008-08-27
Posts: 881
Website

Re: Post your .zshrc

My zsh resource files can be found here:

https://github.com/trapd00r/configs/blob/master/.zshrc
https://github.com/trapd00r/configs/tree/master/zsh

The 'ls' is ls++ ( https://github.com/trapd00r/ls-- )

The LS_COLORS is https://github.com/trapd00r/LS_COLORS

zsh.png


@teh: Regarding your colors in tty thing in your .zshrc; you might like ttycolor ( https://github.com/trapd00r/ttycolor ) for that task. It comes pre-loaded with 35 colorschemes, most of them taken straight from the various screenshot threads, and named after the user;

b52
blue
breeze
c00kiez
CalcAndCoffee
Daisuke2
Digerati
drkwolf
freakcode
grey
jousi
jstandler
leosolaris
librec00kiez
Longbow
matrix
mattikus
mmso2
purple
Rasi
rasta
Reasons
sicpsnake
smurnjiff
square
Square
SuperTrain
Tango
Tangoesque
Taters
Thayer
whordijk
woldrich
xterm

Last edited by dmz (2011-04-14 08:18:25)

Offline

Board footer

Powered by FluxBB