Skip to content
Newer
Older
100644 159 lines (142 sloc) 4.44 KB
ba28d62 @taters Lets see if it works
authored Nov 11, 2009
1 #------------------------------------------------------------------#
2 # File: .zshrc ZSH resource file #
3 # Version: 0.1.16 #
4 # Author: Øyvind "Mr.Elendig" Heggstad <mrelendig@har-ikkje.net> #
5 #------------------------------------------------------------------#
6
7 #------------------------------
8 # History stuff
9 #------------------------------
10 HISTFILE=~/.histfile
11 HISTSIZE=1000
12 SAVEHIST=1000
13
14 #------------------------------
15 # Variables
16 #------------------------------
17 export EDITOR="vim"
18 export PAGER="vimpager"
19 export PATH="${PATH}:${HOME}/bin"
20
21 #-----------------------------
22 # Dircolors
23 #-----------------------------
24 LS_COLORS='rs=0:di=01;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:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:';
25 export LS_COLORS
26
27 #------------------------------
28 # Keybindings
29 #------------------------------
30 bindkey -v
31 typeset -g -A key
32 #bindkey '\e[3~' delete-char
33 bindkey '\e[1~' beginning-of-line
34 bindkey '\e[4~' end-of-line
35 #bindkey '\e[2~' overwrite-mode
36 bindkey '^?' backward-delete-char
37 bindkey '^[[1~' beginning-of-line
38 bindkey '^[[5~' up-line-or-history
39 bindkey '^[[3~' delete-char
40 bindkey '^[[4~' end-of-line
41 bindkey '^[[6~' down-line-or-history
42 bindkey '^[[A' up-line-or-search
43 bindkey '^[[D' backward-char
44 bindkey '^[[B' down-line-or-search
45 bindkey '^[[C' forward-char
46 # for rxvt
47 bindkey "\e[8~" end-of-line
48 bindkey "\e[7~" beginning-of-line
49 # for gnome-terminal
50 bindkey "\eOH" beginning-of-line
51 bindkey "\eOF" end-of-line
52
53 #------------------------------
54 # Alias stuff
55 #------------------------------
56 alias ls="ls -h --group-directories-first --color=always"
57 alias ll="ls --color -lh"
58 alias mkdir="mkdir -p"
59 alias ..="cd .."
60 alias nrestart="sudo /etc/rc.d/network stop && sudo rm /var/run/dhcpcd.pid && sudo /etc/rc.d/network start && ping google.com"
61 alias torrent="cd ~/torrents && rtorrent"
62 alias config="vim ~/.xmonad/xmonad.hs"
63 alias spm="sudo pacman"
64 alias spmc="sudo pacman-color"
65 extract () {
66 if [ -f $1 ]; then
67 case $1 in
68 *.tar.bz2) tar xjf $1 ;;
69 *.tar.gz) tar xzf $1 ;;
70 *.bz2) bunzip2 $1 ;;
71 *.gz) gzip -d $1 ;;
72 *.rar) unrar e $1 ;;
73 *.tar) tar xf $1 ;;
74 *.tbz2) tar xjf $1 ;;
75 *.tgz) tar xzf $1 ;;
76 *.zip) unzip $1 ;;
77 *.7z) 7z x $1 ;;
78 *) echo "'$1' cannot be extracted via extract()" ;;
79 esac
80 else
81 echo "'1' is not a valid file"
82 fi
83 }
84
85 #------------------------------
86 # Comp stuff
87 #------------------------------
88 zmodload zsh/complist
89 autoload -Uz compinit
90 compinit
91 zstyle :compinstall filename '${HOME}/.zshrc'
92
93 zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
94
95 zstyle ':completion:*:*:kill:*' menu yes select
96 zstyle ':completion:*:kill:*' force-list always
97
98 zstyle ':completion:*:*:killall:*' menu yes select
99 zstyle ':completion:*:killall:*' force-list always
100
101 #------------------------------
102 # Window title
103 #------------------------------
104 case $TERM in
105
106 *xterm*|rxvt|rxvt-unicode|rxvt-256color|(dt|k|E)term)
107 precmd () { print -Pn "\e]0; [%~]\a" }
108 preexec () { print -Pn "\e]0; [%~] ($1)\a" }
109 ;;
110 screen)
111 precmd () {
112 print -Pn "\e]83;title \"$1\"\a"
113 print -Pn "\e]0;$TERM - (%L) [%n@%M]%# [%~]\a"
114 }
115 preexec () {
116 print -Pn "\e]83;title \"$1\"\a"
117 print -Pn "\e]0;$TERM - (%L) [%n@%M]%# [%~] ($1)\a"
118 }
119 ;;
120 esac
121
122 #------------------------------
123 # Prompt
124 #------------------------------
125 setprompt () {
126 # load some modules
127 autoload -U colors zsh/terminfo # Used in the colour alias below
128 colors
129 setopt prompt_subst
130
131 # make some aliases for the colours: (coud use normal escap.seq's too)
132 for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
133 eval PR_$color='%{$fg[${(L)color}]%}'
134 done
135 PR_NO_COLOR="%{$terminfo[sgr0]%}"
136
137 # Check the UID
138 #if [[ $UID -ge 1000 ]]; then # normal user
139 # eval PR_USER='${PR_WHITE}%#${PR_NO_COLOR}'
140 # eval PR_USER_OP='${PR_WHITE}%#${PR_NO_COLOR}'
141 #elif [[ $UID -eq 0 ]]; then # root
142 # eval PR_USER='${PR_RED}%n${PR_NO_COLOR}'
143 # eval PR_USER_OP='${PR_RED}%#${PR_NO_COLOR}'
144 #fi
145
146 # Check if we are on SSH or not --{FIXME}-- always goes to |no SSH|
147 if [[ -z "$SSH_CLIENT" || -z "$SSH2_CLIENT" ]]; then
148 eval PR_HOST='${PR_GREEN}%M${PR_NO_COLOR}' # no SSH
149 else
150 eval PR_HOST='${PR_YELLOW}%M${PR_NO_COLOR}' #SSH
151 fi
152 # set the prompt
153 #PS1=$'${PR_CYAN}[${PR_USER}${PR_CYAN}@${PR_HOST}${PR_CYAN}][${PR_BLUE}%~${PR_CYAN}]${PR_USER_OP}'
154 PS1=$'${PR_WHITE}[${PR_RED}%~${PR_WHITE}] ${PR_USER_OP}'
155 PS2=$'%_>'
156 }
157 setprompt
158
Something went wrong with that request. Please try again.