You are not logged in.

#1 2010-02-10 20:42:09

completist
Member
From: /media/knock_knock
Registered: 2009-02-21
Posts: 62

Post your .zshrc

Wanted to make a thread similiar to the Post your .bashrc, but for users of the zsh shell.  I'm new to the zsh shell but here is mine.

autoload -U compinit promptinit
compinit
promptinit

# This will set the default prompt to the walters theme
prompt walters

Offline

#2 2010-02-10 23:26:40

milomouse
Member
Registered: 2009-03-24
Posts: 940
Website

Re: Post your .zshrc

~/.zshrc -> https://github.com/milomouse/dotfiles/b … ter/.zshrc
~/.config/zsh/: functions, aliases, options, exports, etc -> https://github.com/milomouse/dotfiles/t … config/zsh

Adopted a few functions, everything is pretty much personalized to my needs and may not be useful for everyone.
edit: figured it was better to link to updated configs rather than have a static code post..
Also, there's the "Zsh(rc) Tips thread" found here: http://bbs.archlinux.org/viewtopic.php?id=34062

Last edited by milomouse (2010-12-04 04:50:28)

Offline

#3 2010-02-10 23:49:57

Barrucadu
Member
From: York, England
Registered: 2008-03-30
Posts: 1,158
Website

Re: Post your .zshrc

Mine is split into multiple fairly long files, so I won't post them all here.

.zshrc:

## -*- shell-script -*-
# Additional files - I like splitting things up.
. ~/.config/zsh/profile
. ~/.config/zsh/functions
. ~/.config/zsh/aliases

if [[ ! $(tty) == *pts* ]]; then
    if [[ -z "$DISPLAY" ]] && [[ $(tty) = /dev/tty2 ]] && [[ "`runlevel`" == *5* ]]; then
        # Start X
        while true; do
            if [[ -f /var/run/daemons/hal ]]; then
                echo "Starting X11 at `ddate +\"%{%A, the %e of %B%}, %Y. %N%n    Celebrate %H\"`"
                startx ~/.config/xorg/xinitrc &> /dev/null
                source ~/.config/zsh/profile
            fi
        done
    fi
else
    if [[ $DVTM == "" ]]; then
    # Not in dvtm? Madness!
    dvtm
    exit
    else
        # Welcome message
    clear
    ddate +"It's %{%A, the %e of %B%}, %Y. %N%nCelebrate %H" | cowsay -f bunny.cow -W 50
    echo
    fi
fi

aliases: http://github.com/Barrucadu/home/blob/m … sh/aliases
functions: http://github.com/Barrucadu/home/blob/m … /functions
profile: http://github.com/Barrucadu/home/blob/m … sh/profile

My zsh config files total 664 lines, though the functions file makes up nearly half of that.

Last edited by Barrucadu (2010-02-10 23:59:07)

Offline

#4 2010-02-11 00:21:34

Arm-the-Homeless
Member
Registered: 2008-12-22
Posts: 273

Re: Post your .zshrc

Here's mine...

# Zsh Options
source /etc/profile
export HISTFILE=~/.zsh_history
export SAVEHIST=$HISTSIZE
zstyle ':completion:*' completer _complete _ignored
zstyle :compinstall filename '/home/andy/.zshrc'
bindkey -v
autoload -Uz compinit promptinit colors
setopt correctall
setopt hist_ignore_all_dups
setopt hist_ignore_space
setopt noclobber
setopt autocd
compinit
promptinit
colors
fortune && echo
PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[0m%} @ %{\e[0m%}%{\e[0;36m%}%B%m%{\e[0;34m%}%B]%b%{\e[0m%}-%{\e[0;34m%}%B[%b%{\e[0;34m%}'%B%*%b$'%{\e[0;34m%}%B]%b%{\e[0m%}
%{\e[0;34m%}%B└─[%b%{\e[0m%}%~%{\e[0;34m%}%B]%b%{\e[0;34m%}-%B[%{\e[1;35m%}$%{\e[0;34m%}%B]>%{\e[0m%}%b '

# Stuff
eval `dircolors -b`
export BROWSER='firefox'
export MOZ_DISABLE_PANGO='1'
export PAGER='less'
export GREP_COLOR="1;33"
alias -g grep='grep --color=auto'
alias -g ls='ls --color'
alias -g su="su -"
alias -g pacman='pacman-color'
alias -g yaourt='packer'
export LESS_TERMCAP_mb=$'\e[1;31m'
export LESS_TERMCAP_md=$'\e[1;31m'
export LESS_TERMCAP_me=$'\e[0m'
export LESS_TERMCAP_se=$'\e[0m'
export LESS_TERMCAP_so=$'\e[1;44;33m'
export LESS_TERMCAP_ue=$'\e[0m'
export LESS_TERMCAP_us=$'\e[1;32m'

# DevkitPro Stuff
export DEVKITPRO=/home/andy/devkitPro
export DEVKITPPC=$DEVKITPRO/devkitPPC
export DEVKITARM=$DEVKITPRO/devkitARM
export WIIDEV=$DEVKITPRO/wiidev
export PATH=$PATH:$DEVKITPPC/bin:$DEVKITARM/bin:$WIIDEV/bin

Improvements welcome. tongue

Offline

#5 2010-02-11 05:33:22

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

Re: Post your .zshrc

┌─[ramon@Laptop][~]
└─╼ cat .zshrc
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
bindkey -e
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/home/ramon/.zshrc'

autoload -Uz compinit
compinit
# End of lines added by compinstall

PROMPT=$'%{\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%} '


# 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
# for rxvt
bindkey "\e[8~" end-of-line
bindkey "\e[7~" beginning-of-line
# completion in the middle of a line
bindkey '^i' expand-or-complete-prefix

extract () {
        if [ -f $1 ] ; then
           case $1 in
                *.tar.bz2) tar xvjf $1 ;;
                *.tar.gz) tar xvzf $1 ;;
                *.bz2) bunzip2 $1 ;;
                *.rar) rar x $1 ;;
                *.gz) gunzip $1 ;;
                *.tar) tar xvf $1 ;;
                *.tbz2) tar xvjf $1 ;;
                *.tgz) tar xvzf $1 ;;
                *.zip) unzip $1 ;;
                *.Z) uncompress $1 ;;
                *.7z) 7z x $1 ;;
                *) echo "don't know how to extract '$1′…" ;;
            esac
        else
                echo "'$1′ is not a valid file!"
        fi
}

# Pac-Man
#alias yogur="yaourt"
alias yS="yaourt -S"
alias ySs="yaourt -Ss"
alias ySyu="yaourt -Syu"
alias yRsn="yaourt -Rsn"
alias yQi="yaourt -Qi"
alias S="sudo pacman -S" 
alias Ss="sudo pacman -Ss" 
alias Syu="sudo pacman -Syu"
alias Rsn="sudo pacman -Rsn"
alias Qi="sudo pacman -Qi"

# @Music
alias 1.1="ncmpcpp"
alias 1.2="mpdas"
alias 1.3="alsamixer"
alias 1.4="alsamixer -D equal"

# @Term
alias v="vim"
alias m="nohup medit &"
alias ut="nohup urbanterror &"
 
# random
alias ka="killall"
alias h="sudo halt"
alias r="sudo reboot"
alias apagate="xset dpms force off"
alias 60="sudo shutdown -h +60"
alias 120="sudo shutdown -h +120"
alias ac="acpi"
alias iw="iwconfig"
alias ifc="ifconfig"
alias wifi="sudo wifi-select wlan0"

alias go="startx"
alias :q="exit"
alias ..="cd .."
alias ~="cd ~"
alias home="cd ~ && clear"
alias lsa="ls -a --color=auto -F --group-directories-first"
alias clr="clear"
alias whe="whereis"
alias wha="whatis"
alias scrot="scrot -c -d 5"

arst

Offline

#6 2010-02-11 15:52:49

JohannesSM64
Member
From: Norway
Registered: 2009-10-11
Posts: 623
Website

Re: Post your .zshrc

The "linux colors" part is commented because it causes color problems if I start X then go back to the tty.. don't know why.
EDIT: Thanks to vim, html-ified, for nicer viewing big_smile http://sm64.org/johannes/.zshrc.html

Last edited by JohannesSM64 (2010-02-11 16:05:18)

Offline

#7 2010-02-11 20:48:27

kaptenen
Member
Registered: 2009-12-06
Posts: 287
Website

Re: Post your .zshrc

source ~/.zsh/history
source ~/.zsh/alias
source ~/.zsh/exports
source ~/.zsh/bindkeys
source ~/.zsh/completion
source ~/.zsh/functions
source ~/.zsh/setopt

Offline

#8 2010-02-17 12:54:27

Peanut
Member
From: Norway
Registered: 2009-05-24
Posts: 99

Re: Post your .zshrc

The main reason I switched to zsh is the availability of suffix aliases. The ability to "execute" all filetypes without manually invoking commands has transformed my terminal into the ultimate, hassle-free filemanager for most day-to-day operations. In addition, URL's can be automatically opened in firefox by making suffix aliases for .com, .net, etc tongue

I realize that I'm probably preaching to the choir right now, but as a recent convert I'm still impressed by this sort of thing wink

HISTFILE=~/.history
setopt autocd extendedglob complete_in_word hist_ignore_dups numeric_glob_sort
unsetopt beep
bindkey -e
zstyle :compinstall filename '/home/jabirali/.zshrc'
autoload -Uz compinit
compinit


# Aliases
alias ls="ls --color=auto"
alias ll="ls -l"
alias la="ls -al"
alias grep="grep --color=auto"
alias rm="rm -i"
alias mv="mv -i"

alias psgr="ps -ef|grep"
alias battery="acpitool -B"
alias timeplan="feh -F ~/Skole/timeplan.png" # This displays a full-screen version of my schedule
alias spotify="wine 'C:\Program Files\spotify.exe'"
alias chemsketch="cd ~/.wine/drive_c/windows/temp/ACDFREE12; wine CHEMSK.EXE"
alias youtube="minitube"
alias xkcd="xkcdviewer"
alias texrun="~/Utvikling/Tex/run.sh" # This script compiles and views tex-documents in the current folder
alias texmake="~/Utvikling/Tex/make.sh && rap" # This script autogenerates tex-templates for my lab reports, puts it in a folder corresponding to the current week, and then runs the command below
alias rap="cd ~/Skole/KJ1020/Rapporter" # Changes directory to the parent folder of all the lab reports

alias -g L='|less' 
alias -g S='&> /dev/null &'



# Applications
export EDITOR="vim"
export PAGER="less"
export BROWSER="firefox --new-tab"
export MOVPLAY="mplayer"
export PICVIEW="feh"
export SNDPLAY="play"

# File Extensions
for ext in html org php com net no;    do alias -s $ext=$BROWSER; done
for ext in txt tex py PKGBUID;        do alias -s $ext=$EDITOR; done
for ext in png jpg gif;            do alias -s $ext=$PICVIEW; done
for ext in mpg wmv avi mkv;        do alias -s $ext=$MOVPLAY; done
for ext in wav mp3 ogg;            do alias -s $ext=$SNDPLAY; done

for ext in sxw doc rtf odt;        do alias -s $ext=abiword; done
for ext in xls ods odf;            do alias -s $ext=soffice; done
for ext in djvu ps;            do alias -s $ext=evince; done

alias -s pdf="apvlv"
alias -s gz="tar -zxvf"
alias -s bz2="tar -jxvf"
alias -s rar="unrar x"
alias -s zip="unzip"
alias -s exe="wine"
alias -s msi="winei msiexec /i"

# Prompt Colors 
   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'
   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'
   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'


# Prompt
PS1="$fg_lgreen┌─[$fg_lred`acpi -b|sed 's/, /\n/g'|grep %`'%%$fg_lgreen]─[$fg_lblue%/$fg_lgreen]
└─> %{$fg_lgray%}"

Last edited by Peanut (2010-02-17 14:02:33)

Offline

#9 2010-02-17 13:36:34

rson451
Member
From: Annapolis, MD USA
Registered: 2007-04-15
Posts: 1,233
Website

Re: Post your .zshrc

Nothing too fancy for me: http://rsontech.net/dotfiles/.zshrc


archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson

Offline

#10 2010-04-11 21:54:41

voidzero
Member
Registered: 2007-06-21
Posts: 109

Re: Post your .zshrc

Cool, a zsh thread. lol


I'd like to share my theme. Ok... I admit that I stole the zsh theme from gentoo. It's simple and nice enough for me. I use various different boxes and use different colors for each one, this helps me to remember on which box I currently am, which is convenient because it prevents me from halting the wrong box, for example! And this is further improved by adding:

alias halt='echo sure? type sure-halt'; and
alias sure-halt='/sbin/halt'
alias reboot='echo sure? type sure-reboot'; and
alias sure-reboot='/sbin/reboot'

One can never be too safe, right?

Here's the theme I use.

# gentoo prompt theme
autoload colors; colors

# Colors are determined by hostname -s
host=`hostname`
prompt_gentoo_help () {
  cat <<'EOF'
This prompt is color-scheme-able.  You can invoke it thus:

  prompt zshprompt [<promptcolor> [<usercolor> [<rootcolor>]]]

EOF
}

prompt_gentoo_setup () {
    autoload colors;colors
    case "$host" in
        box1)
        prompt_gentoo_user=${2:-'green'}
        prompt_gentoo_root=${3:-'green'}
        prompt_gentoo_prompt=${1:-'red'}
        ;;
        box2)
        prompt_gentoo_user=${2:-'green'}
        prompt_gentoo_root=${3:-'red'}
        prompt_gentoo_prompt=${1:-'yellow'}
        ;;
        *)
        prompt_gentoo_user=${2:-'yellow'}
        prompt_gentoo_root=${3:-'red'}
        prompt_gentoo_prompt=${1:-'white'}
        ;;
    esac

    if [ "$USER" = 'root' ]
    then
      base_prompt="%{$fg_bold[$prompt_gentoo_root]%}%m%{$reset_color%} "
    else
      base_prompt="%{$fg_bold[$prompt_gentoo_user]%}%n@%m%{$reset_color%} "
    fi
    post_prompt="%{$reset_color%}"

    local color="%{*}"
    base_prompt_no_color="${(S)base_prompt//${~color}/}"
    post_prompt_no_color="${(S)post_prompt//${~color}/}"

    setopt noxtrace localoptions
    local base_prompt_expanded_no_color base_prompt_etc
    local prompt_length space_left

    base_prompt_expanded_no_color=$(print -P "$base_prompt_no_color")
    base_prompt_etc=$(print -P "$base_prompt%(4~|...|)%3~")
    prompt_length=${#base_prompt_etc}
    path_prompt="%{$fg_bold[$prompt_gentoo_prompt]%}%1~"
    PS1="$base_prompt$path_prompt %# $post_prompt"
    PS2="$base_prompt$path_prompt %_> $post_prompt"
    PS3="$base_prompt$path_prompt ?# $post_prompt"

    precmd  () { }
    preexec () { }
}

prompt_gentoo_setup "$@"

I have saved this as /etc/zsh/zshprompt which is sourced from /etc/zsh/zshrc.

Last edited by voidzero (2010-04-11 21:56:45)

Offline

#11 2010-04-11 22:27:38

FallenWizard
Member
From: Vienna/ Austria
Registered: 2007-12-10
Posts: 99

Re: Post your .zshrc

Nothing special.  Some things are stolen, some other things are not smile

#---------#
# History |
#---------#
HISTFILE=~/.zsh_history
HISTSIZE=1000
SAVEHIST=1000

#----------#
#Variables #
#----------#
export EDITOR="vim"
export PAGER="vimpager"
export PATH="${PATH}:${HOME}/bin"
export GTK2_RC_FILES=~/.gtkrc-2.0
export MOZ_DISABLE_PANGO=1
export BROWSER="chromium"
export WINEDEBUG="fixme-all"


#-------------#
# Keybindings #
#-------------#

bindkey -v
typeset -g -A key
bindkey '\e[1~' beginning-of-line
bindkey '\e[4~' end-of-line
bindkey '^?' backward-delete-char
bindkey '^[[1~' beginning-of-line
bindkey '^[[5~' up-line-or-history
bindkey '^[[3~' delete-char
bindkey '^[[4~' end-of-line
bindkey '^[[6~' down-line-or-history
bindkey '^[[A' up-line-or-search
bindkey '^[[D' backward-char
bindkey '^[[B' down-line-or-search
bindkey '^[[C' forward-char 
# for rxvt
bindkey "\e[8~" end-of-line
bindkey "\e[7~" beginning-of-line

#---------#
# Aliases #
#---------#

alias ls="ls --color -F"
alias ll="ls --color -lh"
#------#
# Comp #
#------#

zmodload zsh/complist 
autoload -Uz compinit
compinit

zstyle :compinstall filename '${HOME}/.zshrc'
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
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:*' menu select

#-----------------#
# Window titles #
#-----------------#

case $TERM in
    *xterm*|rxvt|rxvt-unicode|rxvt-256color|(dt|k|E)term)
        precmd () { print -Pn "\e]0;$TERM - [%n@%M]%# [%~]\a" } 
        preexec () { print -Pn "\e]0;$TERM - [%n@%M]%# [%~] ($1)\a" }
    ;;
    screen)
        precmd () { 
            print -Pn "\e]83;title \"$1\"\a" 
            print -Pn "\e]0;$TERM - [%n@%M]%# [%~]\a" 
        }
        preexec () { 
            print -Pn "\e]83;title \"$1\"\a" 
            print -Pn "\e]0;$TERM - [%n@%M]%# [%~] ($1)\a" 
        }
    ;; 
esac

#-----------#
# Functions #
#-----------#

sprunge() {
    cat $1 | curl -F 'sprunge=<-' http://sprunge.us
}

ripstream() { 
    streamripper $1 -k 1 -s -t -d /home/fallenwizard/music/streams/$2 --xs_padding=2000:500
}

fehgallery() {
    feh -g 640x480 -d -S filename $1
} 

autoload -U promptinit
promptinit
prompt adam1 black

Last edited by FallenWizard (2010-04-11 22:28:53)

Offline

#12 2010-04-11 23:43:18

Spacenick
Member
From: Germany
Registered: 2010-04-02
Posts: 168

Re: Post your .zshrc

I'm using the one from grml.org see http://grml.org/zsh/#grmlzshconfig

Offline

#13 2010-04-13 11:14:58

JohannesSM64
Member
From: Norway
Registered: 2009-10-11
Posts: 623
Website

Re: Post your .zshrc

Offline

#14 2010-04-13 13:32:59

bruce
Member
Registered: 2008-11-27
Posts: 57

Re: Post your .zshrc

http://paste.pocoo.org/show/201356/

Nothing too fancy there, mostly just took one from around the internets and modified it a little smile

Offline

#15 2010-05-07 01:49:22

gtfernandezm
Member
From: Eliot, ME
Registered: 2010-04-06
Posts: 38

Re: Post your .zshrc

Mine is pretty simple. I am big on aliases, and I haven't really learned how to fully utilize zsh's features yet.

#                                             ~/.zshrc - Zsh Shell Configuration

# === INIT OPTIONS ===================================================
autoload -U compinit promptinit
compinit
promptinit

# === KEYBINDINGS ====================================================
zle-keymap-select () {
if [ $KEYMAP = vicmd ]; then
echo -ne "\033]12;Red\007"
else
echo -ne "\033]12;Grey\007"
fi
}
zle -N zle-keymap-select
zle-line-init () {
zle -K viins
echo -ne "\033]12;Grey\007"
}
zle -N zle-line-init
bindkey -v
 
# === PROMPT THEME ===================================================
prompt walters

# === VARIABLES =====================================================
export EDITOR="vim"
export BROWSER="uzbl-tabbed"
export MOVPLAY="mplayer"
zstyle ':completion:*' menu select

# === ALIASES ========================================================

# === FILE FORMAT ASSOCIATIONS ===
alias -s png=feh
alias -s jpg=feh
alias -s gif=feg
alias -s pdf=zathura

 === SYSTEM ALIASES ===
alias sleep='sudo pm-suspend'
alias mirrorupdate='sudo reflector -l 8 -r -o /etc/pacman.d/mirrorlist'
alias repoupdate='yaourt -Syy'
alias systemupdate='yaourt -Syu'
alias ls='ls --color=auto'
alias edit='sudo vim'
alias restart='sudo reboot'
alias GRN='sudo iwconfig wlan0 essid "GRN"'
alias linksys='sudo iwconfig wlan0 essid "linksys"'
alias wifitest='ping www.google.com'
alias uzbl='uzbl-tabbed' for ext in html org php com net css;             do alias -s $ext=$BROWSER; done
for ext in txt tex py js sh bash PKBUID rc;      do alias -s $ext=$EDITOR; done
for ext in mpg wmv avi mkv;                      do alias -s $ext=$MOVPLAY; done

#  === CONFIG AlIASES ===
alias configuzbl='sudo vim ~/.config/uzbl/config'
alias configmusca='sudo vim ~/.musca_start'
alias configvim='sudo vim ~/.vimrc'
alias configzsh='sudo vim ~/.zshrc'
alias configurxvt='sudo vim ~/.Xdefaults'
alias configconky='sudo vim ~/.conkyrc'

Offline

#16 2010-05-07 10:03:57

lymphatik
Member
From: Somewhere else
Registered: 2009-03-07
Posts: 119

Re: Post your .zshrc

gtfernandezm: Do you mind if I ask you why you sudo something that is in your home directory ?

And instead of using a loop for alias -s just do something like this, it's easier to read.

alias -s {mpg,mpeg,avi,ogm,wmv,m4v,mp4,mov,mkv}='mplayer'

Offline

#17 2010-05-07 12:07:52

gtfernandezm
Member
From: Eliot, ME
Registered: 2010-04-06
Posts: 38

Re: Post your .zshrc

I use sudo on those config files because I had to use sudo anytime I vim'd anything in my Documents directory on another partition and sort of got in the habit of always writing sudo vim, never just vim. It doesn't really  need to be there, since I know better now, but I haven't fixed it.

Thanks for the advice on the alias -s, that is much simpler.

Offline

#18 2010-05-16 21:11:53

lymphatik
Member
From: Somewhere else
Registered: 2009-03-07
Posts: 119

Re: Post your .zshrc

I am  unable to do completion without my cursor ending at the end of the completion. Because it should stay where I started the completion by either using noalwaystoend or completeinword.

ALWAYS_TO_END
    If a completion is performed with the cursor within a word, and a full completion is inserted, the cursor is moved to the end of the word. That is, the cursor is moved to the end of the word if either a single match is inserted or menu completion is performed.
COMPLETE_IN_WORD
    If unset, the cursor is set to the end of the word if completion is started. Otherwise it stays there and completion is done from both ends.

from http://zsh.sourceforge.net/Doc/Release/zsh_15.html

Offline

#19 2010-05-17 11:42:12

JohannesSM64
Member
From: Norway
Registered: 2009-10-11
Posts: 623
Website

Re: Post your .zshrc

Many improvements and more commenting: http://omploader.org/vNGNoNx
Edit: hm, seems there's a bug with vim's :TOhtml, some lines were missing. Got it to work now.
Edit: Ok, it's still buggy, I'll just link to my github: http://github.com/JohannesSM64/Configs/ … ster/zshrc

Last edited by JohannesSM64 (2010-05-17 12:08:16)

Offline

#20 2010-05-23 23:19:25

GalacticArachnid
Member
Registered: 2009-01-02
Posts: 155
Website

Re: Post your .zshrc

Well, after reading this I promptly installed zsh. Time for test ride! big_smile

Offline

#21 2010-05-24 12:33:19

demian
Member
From: Frankfurt, Germany
Registered: 2009-05-06
Posts: 709

Re: Post your .zshrc

I've posted mine already in the other thread but there's been quite a few changes so here's the updated file:
http://github.com/mikar/config/blob/master/.zshrc


no place like /home
github

Offline

#22 2010-06-14 02:23:09

Peanut
Member
From: Norway
Registered: 2009-05-24
Posts: 99

Re: Post your .zshrc

It's grown a bit since my last post tongue

# ~/.zshrc

################################
#
#    General settings
#
################################

HISTFILE=~/.history
HISTSIZE=4096
SAVEHIST=$HISTSIZE

unsetopt beep
setopt extendedglob
setopt complete_in_word
setopt hist_ignore_dups        # Don't save duplicate entries in history
setopt share_history        # Share history between shells
setopt append_history        # Don't _overwrite_ history
setopt noclobber        # Require '>!' to overwrite existing files
setopt multios            # Enable piping to multiple outputs
setopt hist_verify        # Allow correction of !-expressions before running them
setopt interactivecomments    # Enable comments in interactive mode
setopt rm_star_wait        # Wait 10 seconds before executing "rm *"
setopt numeric_glob_sort    # Consider the values of numbers when sorting
setopt correct            # Spelling correction
setopt autocd            # Automatically change directory
setopt autopushd        # Use "pushd" instead of "cd", enabling use of "popd"
setopt pushdsilent        # Make "popd" be less verbose (like cd)
setopt pushdignoredups      # Don't record the same directory as multiple entries

DIRSTACKSIZE=10             # Limit the number of directories to keep in history


################################
#
#    Autocompletion
#
################################

autoload -Uz compinit && compinit
zmodload zsh/complist

zstyle ':completion:*' completer _complete _list _oldlist _expand _ignored _match _correct _approximate _prefix
zstyle ':completion:*' menu select=long-list select=3        # Enable menu completion if 3 or more alternatives
zstyle ':completion:*' list-colors $(dircolors)            # Use colors in the menu selection
zstyle ':completion:*' glob 'yes'                # Expand globs when tab-completing
zstyle ':completion:*:functions' ignored-patterns '_*'        # Ignore completion functions for unavailable commands
zstyle ':completion:*' accept-exact '*(N)'            # Speed up path completion, by avoiding partial globs

zstyle ':completion:*:complete:-command-::commands' ignored-patterns '*\~' # Don't complete backup files as executables
zstyle ':completion:*' ignore-parents parent pwd        # Don't let ../<tab> match $PWD
zstyle ':completion::*:(rm|vi):*' ignore-line true        # Don't match the same filenames multiple times

setopt noautolist        # Disable completion list (skip right to completion menu)


################################
#
#    Keybindings
#
################################

function insert_sudo { zle beginning-of-line; zle -U "sudo " }
autoload -U forward-word-match backward-word-match

zle -N forward-word-match
zle -N backward-word-match
zle -N insert-sudo insert_sudo

bindkey -v
bindkey "^[[3~" delete-char         # Del
bindkey "^[[5~" backward-word-match    # PgUp
bindkey "^[[6~" forward-word-match     # PgDown
bindkey "^[[5^" beginning-of-line    # Ctrl-PgUp
bindkey "^[[6^" end-of-line        # Ctrl-PgDown
bindkey "" beginning-of-line        # Ctrl-a
bindkey "" end-of-line        # Ctrl-e
bindkey "" insert-sudo        # Ctrl-Shift_R



################################
#
#    Directories
#
################################

alias -g ...='../..'
alias -g ....='../../..'
alias -g .....='../../../..'
alias -g ......='../../../../..'
alias -g ,,="~-"
alias -g ,,,="$(dirs | cut -d' ' -f3)"
alias -g ,,,,="$(dirs | cut -d' ' -f4)"
alias -g ,,,,,="$(dirs | cut -d' ' -f5)"
alias -g ,,,,,,="$(dirs | cut -d' ' -f6)"

export a="$HOME/Dokumenter/Artikler"
export b="$HOME/Dokumenter/Bøker"
export c="$HOME/Bilder/Kamera"
export d="$HOME/Downloads"
export f="$HOME/Film"
export m="$HOME/Musikk"
export p="$HOME/Utvikling/Python"
export s="$HOME/Skole"
export win="$HOME/.wine/drive_c/Program Files"
export sel="$HOME/Utvikling/Python/selectutils"



########################################
#
#    Modules and related settings
#
########################################

# File management
zmodload zsh/mapfile
autoload -U zmv
alias zcp="zmv -C"
alias zln="zmv -L"


# Mathematics
zmodload zsh/mathfunc
pi="3.14159265359"
e="2.71828182846"
u="1.660538782e-27"
me="9.10938215e-31"
mp="1.672621637e-27"
mn="1.674927211e-27"


# Colors and escape codes
autoload -U colors; colors
alias ls="ls --color=auto"
alias grep="grep --color=auto"
reset=$'\e[0m'


# Misc modules/functions
zmodload zsh/zselect
zmodload zsh/regex
zmodload zsh/zutil
autoload -U zargs


################################
#
#    Aliases
#
################################

# Global aliases
alias -g X='| xargs'
alias -g §='| vipe |'
alias -g §X='| vipe | xargs'
alias -g Å="&>/dev/null &!"


# Administrative tasks
alias Q="confirm 'SHUT DOWN' sudo /sbin/poweroff"
alias W="confirm 'REBOOT' sudo /sbin/reboot"
alias E="confirm 'SUSPEND' sudo /usr/bin/acpitool -s"
alias N="confirm 'RESTART NETWORK' sudo /etc/rc.d/wicd restart"
alias B="acpi -b"

alias U="packer -Syu"
alias S="packer -Ss"
alias I="packer -S"
alias P="sudo pacman -Rcs"
alias C="sudo pacman -Rcs $(pacman -Qdtq|xargs echo); sudo pacman -Sc"


# Application Launchers
alias rm="rm -i"
alias mv="mv -i"
alias ll="ls -l"
alias la="ls -lah"
alias vim="vim -p"
alias svim="sudo vim -p"

alias doc2pdf="wvPDF"
alias doc2html="wvHtml"
alias fbmplayer="setterm -cursor off; mplayer -x 1280 -y 720 -idx -fs -zoom -msglevel all=-1 -ao alsa -vo fbdev2 -double -af volnorm -nolirc"
alias xmplayer="mplayer -vo xv -ao alsa -idx -fs -af volnorm -nolirc"
alias amplayer="mplayer -ao alsa -af volnorm -nolirc -vo null -msglevel all=0:demux=4:statusline=9"

alias spotify="wine ~/.wine/drive_c/Program\ Files/spotify.exe &>/dev/null &!"
alias aom="cd /home/jabirali/.wine/drive_c/Program\ Files/Age\ of\ Mythology/ && wine aomx-c.exe"


# Other convenient aliases
alias zu="source ~/.zshrc"
alias ze="vim ~/.zshrc"
alias clean="sed -e '/^#/d' -e '/^$/d'"
alias org="sort -n | uniq"
alias psg="ps -ef | grep"

alias todo="vim ~/Dokumenter/TODO.otl"
alias plan="feh ~/Skole/timeplan.png"
alias ntnu="ssh caracal.stud.ntnu.no"



########################################
#
#    Functions
#
########################################

function confirm {
    print "$fg[white]Do you really wish to $fg[red]$argv[1]$fg[white]? (y/n)$reset"
    if ( zselect -t 500 -r 0 && read yesno && [ y = "$yesno" ] ); then
        exec $argv[2,-1]
    else
        print "$fg[white]Action aborted.$reset"
    fi    
}

function netspeed {
    print "${fg_bold[green]}Down:${fg_no_bold[white]}\
        $(( $(ifdata -bips wlan0)/1024 + $(ifdata -bips eth0)/1024 )) KB/s"
    print "${fg_bold[red]}Up:${fg_no_bold[white]}\
        $(( $(ifdata -bops wlan0)/1024 + $(ifdata -bips eth0)/1024 )) KB/s\e[0m"
}

function pathfind { (ls -1 $(echo ${PATH//:/ }) | grep "$1" | xargs -L1 whatis | grep -v 'nothing appropriate') 2>/dev/null | less }
function wiki { dig +short txt $1.wp.dg.cx; }
function docview { wvHtml "$1" - | w3m -T text/html }



########################################
#
#    Prompt and Hook Functions
#
########################################

PROMPT="%f%b
┌─[%F{yellow}%t%f]─[%F{blue}%/%f]
└─> %F{yellow}"

function preexec { echo -ne "\e[0m" }        # Reset colors/boldness
function chpwd { print -Pn "\e]0; %~\a" }    # Set terminal title to %~
#function precmd {}

# Periodically set RPROMPT to the current battery status (if less than 4 Ah left)
PERIOD="300"
function periodic {
    local battery_capacity="$(sed -e '/remaining capacity.*/s/[[a-z :]*\([[:digit:]]*\) mAh/\1/p' -e d /proc/acpi/battery/BAT0/state)"
    local battery_time="%F{red}$(acpi -b|sed -e 's/.*%, \([0-9:]*.*\)/\1/' -e 's/\(.*\):[0-9][0-9] until charged/+ \1/' -e 's/\(.*\):[0-9][0-9] remaining/- \1/')%f"
    if [ "$battery_capacity" -lt "4000" ]; then
        RPROMPT="%b%F{red}$battery_time%F{yellow}"
    else
        unset RPROMPT
    fi
}



########################################
#
#    Default Applications
#    and File Extensions
#
########################################

# Autocreate suffix aliases based on ~/.mailcap
autoload -U zsh-mime-setup; zsh-mime-setup

# Define default applications
export EDITOR="vim -p"
export VISUAL="$EDITOR"
export PAGER="less -i"
export BROWSER="chromium"

# Manually create suffix aliases
alias -s {html,php,org,com,net,no}="$BROWSER"
alias -s {txt,tex,otl}="$EDITOR"
alias -s {png,jpg,gif,raw,JPG,RAW}="feh -FZ --hide-pointer"
alias -s {mpg,wmv,avi,mkv,mp4,flv}="xmplayer"
alias -s {wav,mp3,ogg,flac}="amplayer"
alias -s {doc,xls,rtf,ods,odf,odt,sxw}="soffice"
alias -s {dvi,djvu,ps}="evince"
alias -s pdf="zathura"
alias -s {gz,tgz,bz2,tbz2,xz,txz,tar,rar,zip,7z,arj}="aunpack"
alias -s exe="wine"
alias -s msi="wine msiexec /i"



################################
#    
#    Miscellaneous
# 
################################

# Environment variables
export OOO_FORCE_DESKTOP="gnome"

# Local settings
if [ -e ~/.zshrc.local ]; then 
    source ~/.zshrc.local;
fi

Offline

#23 2010-06-14 02:53:54

Themaister
Member
From: Trondheim, Norway
Registered: 2008-07-21
Posts: 652
Website

Re: Post your .zshrc

if [[ -f `which cowsay` && -f `which fortune` ]]; then 
    fortune | cowsay 
    echo ""
    echo "=================================="
    echo ""
fi


autoload -Uz compinit
compinit
zstyle ':completion::complete:*' use-cache 1
zstyle ':completion:*' special-dirs true

autoload colors
colors

PS1="%{$fg[cyan]%}i7 : [%1~]$%{$reset_color%} "

if [[ -f /CHROOT ]]; then
PS1="$PS1::CHROOT:: "
fi

RPS1="%{$fg[cyan]%}%T%{$reset_color%}"
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=2500
SAVEHIST=2500
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall

#autoload -U promptinit
#promptinit

# End of lines added by compinstall
#
alias go="startx"
alias ls="ls --color"
alias p="sudo pacman-color"
alias p32="sudo pacman --root /opt/arch32 --cachedir /opt/arch32/var/cache/pacman/pkg --config /opt/arch32/pacman.conf"
alias aur="sudo clyde --aur"
alias y="sudo clyde"
alias a="absent"
alias ..="cd .."
alias vi="vim"
alias 32bit="sudo chroot /opt/arch32"
alias sd="sudo shutdown -h"
alias serv="ssh -p 666 -i ~/.ssh/id_rsa server"
alias gcc='gcc -Wall -Wextra'
export EDITOR=vim
export BROWSER=open
export PATH="$PATH:/home/maister/bin:/usr/local/bin:/usr/local/cuda/bin"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64"
export ROAR_OPTIONS='workaround:use-execed'

bindkey -e
bindkey '^[[1;5D' backward-word
bindkey '^[[1;5C' forward-word


dir2mp3(){
    for file in $1/*
    do
            flac2mp3 $file &
    done
    
}

precmd()
{
    [[ $TERM == (xterm*|rxvt*) ]] && print -Pn "\e]0;%n@%M\a"
    rehash
}

preexec()
{
#    print -Pn "\e]0;%n@%M [:: $1 ::] \a"
}

wiki()
{
for arg in $*
do
   SEARCH=$(sed 's| |%20|g' <<< $arg)
   open http://en.wikipedia.org/wiki/$SEARCH
done
}

bindkey '^[[3~'   delete-char

Quite slim :v

Offline

#24 2010-06-14 13:35:59

Octoploid
Member
From: Berlin, Germany
Registered: 2009-10-13
Posts: 64

Re: Post your .zshrc

Here is mine (stolen from various sources):

autoload colors zsh/terminfo
    if [[ "$terminfo[colors]" -ge 8 ]]; then
      colors
    fi

# auto completion
autoload -U compinit
compinit

# prompt
autoload -U promptinit
promptinit
#prompt gentoo

# exports
header() { 
 print -nP "\e]2;$*\a" 
}

chpwd() {
 header "%~"
}

# SCREENDIR will screw screen up
unset SCREENDIR
#export TERM="xterm-color"
export EDITOR="vim"
#export PAGER='col -b|/usr/local/share/vim/vim63/macros/less.sh'
export PAGER="less"
export NNTPSERVER='news.gmane.org'

# Make sure no cores can be dumped while zsh is in charge. I don't know if
# this limit thing uses ulimit or what, but it seems to work..
limit coredumpsize 0

compctl -g '*(-/)' + -g '.*(-/)' -v cd pushd rmdir
compctl -k hosts -x 'p[2,-1]' -l '' -- rsh ssh

# completion for "man" by Gossamer <gossamer@tertius.net.au> 980827
# This is damn funky. I'm going to do something similar for pinfo,
# hopefully.
compctl -f -x 'S[1][2][3][4][5][6][7][8][9]' -k '(1 2 3 4 5 6 7 8 9)' \
  - 'R[[1-9nlo]|[1-9](|[a-z]),^*]' -K 'match-man' \
  - 's[-M],c[-1,-M]' -g '*(-/)' \
  - 's[-P],c[-1,-P]' -c \
  - 's[-S],s[-1,-S]' -k '( )' \
  - 's[-]' -k '(a d f h k t M P)' \
  - 'p[1,-1]' -c + -K 'match-man' \
  -- man

compctl -b bindkey
compctl -v export
compctl -o setopt
compctl -v unset
compctl -o unsetopt
compctl -v vared
compctl -c which
compctl -c sudo

# History things
HISTFILE=$HOME/.zshist
SAVEHIST=5000
HISTSIZE=5000

# Key bindings, useful.
bindkey -v
bindkey "\e[3~" delete-char
bindkey "\e[2~" yank        #insert
bindkey "\e[1~" beginning-of-line
bindkey "\e[4~" end-of-line
bindkey "\e[5~" history-search-backward
bindkey "\e[6~" history-search-forward
bindkey "^R"  history-incremental-search-backward
bindkey "^[[Z" reverse-menu-complete
bindkey " " magic-space
bindkey '^[[A' history-beginning-search-backward # "Up"
bindkey '^[[B' history-beginning-search-forward  # "Down"
bindkey "^Z" "menu-complete"
bindkey -s '^[[5~' 'cd -^Z' # "PageUp"

# Aliases
alias mv='nocorrect mv'       # no spelling correction on mv
alias cp='nocorrect cp'       # no spelling correction on cp
alias mkdir='nocorrect mkdir' # no spelling correction on mkdir
alias m="mutt -y"
alias ls="ls"
alias l="ls -la -G"
alias l.='ls -d .[a-zA-Z]*'
alias ll="ls -l"
alias lsd="find . -maxdepth 1 -type d|column"
alias d="find . -maxdepth 1 -type d|column"
alias xdvi='xdvi -keep'
alias gvim='gvim -geometry +350+0'
alias mc=". /usr/lib/mc/mc-wrapper.sh"
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
alias djview='djview -geometry 1000x1020+350+0'
alias top='top -S'
alias pstree='pstree -a'
alias tin="tin -q -a -r -g news.gmane.org"
alias y='yaourt --lightbg'


# Select Prompt
zstyle ':completion:*' menu select=1

# Expansion options
zstyle ':completion:::::' completer _complete _approximate
zstyle -e ':completion:*:approximate:*' max-errors 'reply=( $(( ($#PREFIX+$#SUFFIX)/3 )) )'
zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b'
#zstyle ':completion::prefix-1:*' completer _complete
#zstyle ':completion:incremental:*' completer _complete _correct
#zstyle ':completion:predict:*' completer _complete

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

# Expand partial paths
zstyle ':completion:*' expand 'yes'
zstyle ':completion:*' squeeze-slashes 'yes'

# Include non-hidden directories in globbed file completions
# for certain commands

zstyle ':completion::complete:*' '\'

# Use menuselection for pid completion
zstyle ':completion:*:*:kill:*' menu yes select
zstyle ':completion:*:kill:*' force-list always

#  tag-order 'globbed-files directories' all-files 
zstyle ':completion::complete:*:tar:directories' file-patterns '*~.*(-/)'

# Don't complete backup files as executables
zstyle ':completion:*:complete:-command-::commands' ignored-patterns '*\~'

# Separate matches into groups
zstyle ':completion:*:matches' group 'yes'

# With commands like rm, it's annoying if you keep getting offered the same
# file multiple times. This fixes it. Also good for cp, et cetera..
zstyle ':completion:*:rm:*' ignore-line yes
zstyle ':completion:*:cp:*' ignore-line yes

# Describe each match group.
zstyle ':completion:*:descriptions' format "%B---- %d%b"

# Messages/warnings format
zstyle ':completion:*:messages' format '%B%U---- %d%u%b' 
zstyle ':completion:*:warnings' format '%B%U---- no match for: %d%u%b'
 
# Describe options in full
zstyle ':completion:*:options' description 'yes'
zstyle ':completion:*:options' auto-description '%d'

# Simulate spider's old abbrev-expand 3.0.5 patch 
zstyle ':completion:*:history-words' stop verbose
zstyle ':completion:*:history-words' remove-all-dups yes
zstyle ':completion:*:history-words' list false

# Follow GNU LS_COLORS
zmodload -i zsh/complist
zstyle ':completion:*:default' list-colors "${(s.:.)LS_COLORS}"
zstyle ':completion:*:*:kill:*' list-colors '=%*=01;31'

# Subdivide man pages into sections 
zstyle ':completion:*:manuals' separate-sections true

zstyle ':completion:*' group-name ''

# zsh Options
setopt                       \
     NO_all_export           \
        always_last_prompt   \
        always_to_end        \
        append_history       \
         auto_cd              \
        auto_list            \
        auto_menu            \
         auto_name_dirs       \
        auto_param_keys      \
        auto_param_slash     \
        auto_pushd           \
        auto_remove_slash    \
     NO_auto_resume          \
        bad_pattern          \
        bang_hist            \
     NO_beep                 \
        brace_ccl            \
        correct_all          \
     NO_bsd_echo             \
        cdable_vars          \
     NO_chase_links          \
         clobber              \
        complete_aliases     \
        complete_in_word     \
         correct                 \
     NO_correct_all          \
        csh_junkie_history   \
     NO_csh_junkie_loops     \
     NO_csh_junkie_quotes    \
     NO_csh_null_glob        \
        equals               \
        extended_glob        \
        extended_history     \
        function_argzero     \
        glob                 \
     NO_glob_assign          \
        glob_complete        \
     NO_glob_dots            \
        glob_subst           \
     NO_hash_cmds            \
     NO_hash_dirs            \
        hash_list_all        \
        hist_allow_clobber   \
        hist_beep            \
    HIST_REDUCE_BLANKS   \
    hist_expire_dups_first \
    hist_find_no_dups    \
        hist_ignore_all_dups \
        hist_ignore_space    \
     NO_hist_no_store        \
        hist_verify          \
     NO_hup                  \
     NO_ignore_braces        \
     NO_ignore_eof           \
        interactive_comments \
    inc_append_history   \
     NO_list_ambiguous       \
     NO_list_beep            \
        list_types           \
        long_list_jobs       \
        magic_equal_subst    \
     NO_mail_warning         \
     NO_mark_dirs            \
         menu_complete        \
        multios              \
        nomatch              \
        notify               \
     NO_null_glob            \
        numeric_glob_sort    \
     NO_overstrike           \
        path_dirs            \
        posix_builtins       \
     NO_print_exit_value     \
     NO_prompt_cr            \
        prompt_subst         \
        pushd_ignore_dups    \
     NO_pushd_minus          \
        pushd_silent         \
        pushd_to_home        \
        rc_expand_param      \
     NO_rc_quotes            \
     NO_rm_star_silent       \
     NO_sh_file_expansion    \
        sh_option_letters    \
        short_loops          \
     NO_sh_word_split        \
     NO_single_line_zle      \
     NO_sun_keyboard_hack    \
        transient_rprompt    \
        unset                \
     NO_verbose              \
        zle


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 

if [[ $TERM = "screen-bce" ]]; then 
    export TERM="screen"
fi

export GOARCH=amd64
export GOOS=linux
export GOROOT=/var/go
source /etc/profile
prompt gentoo

Offline

#25 2010-08-05 13:40:24

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

Re: Post your .zshrc

Here is mine (not surprisingly, lots stolen from elsewhere...), fairly minimal too.
If anyone knows how, I'd like the bash functionality when you say yes to "there are a crapload of these, do you want to see them all?" and you press space to go the next page. zsh just goes right to end, making my trawling manual.

###############################################################################
HISTFILE=~/.zsh_history
HISTSIZE=1000
SAVEHIST=1000
setopt appendhistory notify correctall

autoload -U compinit promptinit
compinit # tab-completion
promptinit # advanced prompt support

zstyle :compinstall filename '$HOME/.zshrc'
zstyle ':completion:*' menu select
###############################################################################


## Key bindings
bindkey -e
bindkey ^f history-beginning-search-backward
bindkey '^[OH' beginning-of-line # home key like bash
bindkey '^[OF' end-of-line # end key like bash
bindkey '^[[3~' delete-char


## Terminal title bar
precmd () { print -Pn "\e]2;%n@%M | %~\a" }


## Prompts
if [[ `whoami` == "root" ]]; then
    PROMPT=$'%{\e[1;31m%}%n%{\e[0m%}'
    PROMPT+=$'@%{\e[1;32m%}%m%{\e[0m%}'
    PROMPT+=$':%{\e[0;34m%}%~%{\e[0m%}# '
else
    PROMPT=$'%{\e[1;34m%}%n%{\e[0m%}'
    if [[ $SSH_CONNECTION != "" ]]; then
        PROMPT+=$'@%{\e[1;32m%}%m%{\e[0m%}'
    fi
    PROMPT+=$':%{\e[0;34m%}%~%{\e[0m%}$ '
fi

export PROMPT
export PS2=$'%{\e[0;34m%}>%{\e[0m%} '

DAYSLEFT=$(( (( (( $(date +%s -d $(date +%F -d "September 24")) - $(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 is due in $DAYSLEFT days!"
fi


## Editor
export EDITOR="vim"


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


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

# optional ones
ARE_WE_LOCAL=1
if [[ $ARE_WE_LOCAL == 1 ]]
then
    # MIRIAD
    . /usr/local/miriad/MIRRC.sh
    PATH=$PATH:$MIRBIN
    
    # livedata / gridzilla
    . $HOME/Data/livedata/init.sh
    GLISHROOT=$HOME/Data/glish
    PATH=$PATH:$GLISHROOT/linux64/bin
    
    # CASA
    PATH=$PATH:$HOME/Data/casapy-30.1.11097-001-64b
    
    # Code Sourcery
    PATH=$PATH:/opt/CodeSourcery/Sourcery_G++_Lite/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

Board footer

Powered by FluxBB