github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

rson / dotfiles

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 3
    • 1
  • Source
  • Commits
  • Network (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Switch Branches (1)
    • master ✓
  • Switch Tags (0)
  • Branch List
Sending Request…

Configs for all my machines — Read more

  Cancel

http://rsontech.net/

  Cancel
  • HTTP
  • Git Read-Only

This URL has Read+Write access

Fix guifont 
rson (author)
Wed Jul 28 07:05:41 -0700 2010
commit  73f9b0da695265ef24e4
tree    e88c041b526bc3dfd4a3
parent  df66961ac7d93238163c
dotfiles / zshrc zshrc
Txt 100644 190 lines (163 sloc) 4.222 kb
  • edit
  • raw
  • blame
  • history
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# .zshrc - zsh configuration file
#
# Randy Morris (rson451@gmail.com)
#
# CREATED: a long time ago
# MODIFIED: 2010-07-27 15:06
#
# Note: This file closely ties in with my screenrc for the screen title stuff.
# See http://rsontech.net/dotfiles/screenrc
#

# simple settings {{{
HISTFILE=~/.zsh_history
HISTSIZE=1000
SAVEHIST=1000
bindkey -v
autoload -U compinit && compinit
autoload -U colors && colors
setopt nobeep nohistbeep nolistbeep

#}}}

# environ vars {{{
export PATH=$PATH:~/bin
export BC_ENV_ARGS=~/.bcrc
export EDITOR=/usr/bin/vim
#}}}

# aliases {{{
alias ls='ls --color=auto'
alias tree='tree -L 1 -C'
alias :q='exit'
alias sudo='command sudo '
alias shop='shop --pad 12'
alias gmutt='mutt -F $HOME/.muttrc.personal'
alias gitt='git ls-files -toc'
alias .f='cd ~/.config/dotfiles/'
alias pyc='find . -name "*.pyc" -delete'
alias tmux='tmux -2'

$(which pacman-color &> /dev/null ) && alias pacman='pacman-color'
#}}}

# functions {{{

atop(){ #{{{
    SHOW=10
    DELAY=3;

    if [ $1 ]; then
        SHOW=$1
        if [ $2 ]; then
            DELAY=$2
        fi
    fi
    watch -n $DELAY "free; echo; uptime; echo; ps aux --sort=-%cpu | head -n $(($SHOW+1)); echo; who"
}
#}}}

todo(){ #{{{
  if [ -z $1 ]; then
    awk '{ i += 1; print i": "$0 }' $HOME/.todo
    return
  fi

  case $1 in
    "add")
      echo $2 >> $HOME/.todo
    ;;
    "del")
      todo=$(< $HOME/.todo | sed "$2"'d')
      echo $todo > $HOME/.todo
    ;;
    "search")
      grep -ni --color=never $2 $HOME/.todo | sed -e 's/:/: /'
    ;;
  esac
}
#}}}

set-title(){ #{{{
    builtin echo -ne "\ek$*\e\\"
}
#}}}

set-hardstatus(){ #{{{
    if [[ $* == "zsh" ]]; then
        printf '\e_%s\e\' $VIMODE
    else
        printf '\e_\e\'
    fi
}
#}}}

preexec(){ #{{{
    #if [[ -n $STY ]]; then
    if [[ $TERM =~ "screen" ]]; then
        TITLE=${$(echo $3 | sed -r 's/^command sudo ([^ ]*) .*/\1/;tx;s/^([^ ]*) +.*/\1/;s/^([^ ]*)$/\1/;:x;q')/#*\/}
        set-title $TITLE
        set-hardstatus $TITLE
    fi
}
#}}}

precmd(){ #{{{
    set-prompt
    #if [[ -n $STY ]]; then
    if [[ $TERM =~ "screen" ]]; then
        TITLE=${0/#*\/}
        set-title $TITLE
        set-hardstatus $TITLE
    fi
}
#}}}

chpwd(){ #{{{
    set-prompt

    if [ -d ".git" ]; then
        git status
    fi
    ls
}
#}}}

set-mode(){ #{{{
    VIMODE='--'$1'--'
    set-hardstatus $TITLE
}
#}}}

set-prompt(){ #{{{
    if [[ $HOST == 'banks' ]]; then
        PS1="%{$fg_no_bold[white]%}%~ %(?.%{$fg_no_bold[green]%}>%{$fg_bold[green]%}>%{$fg_bold[yellow]%}>.%{$fg_no_bold[magenta]%}>%{$fg_bold[red]%}>%{$fg_bold[magenta]%}>)%{$reset_color%} "
        RPROMPT="%(?.%{$fg_bold[yellow]%}<%{$fg_bold[green]%}<%{$fg_no_bold[green]%}<.%{$fg_bold[magenta]%}<%{$fg_bold[red]%}<%{$fg_no_bold[magenta]%}<) %{$fg_no_bold[white]%}%n@%m%{$reset_color%}"
    else
        PS1="%{$fg_no_bold[white]%}%~ %(?.%{$fg_no_bold[cyan]%}>%{$fg_no_bold[blue]%}>%{$fg_bold[cyan]%}>.%{$fg_no_bold[magenta]%}>%{$fg_bold[red]%}>%{$fg_bold[magenta]%}>)%{$reset_color%} "
        RPROMPT="%(?.%{$fg_bold[cyan]%}<%{$fg_no_bold[blue]%}<%{$fg_no_bold[cyan]%}<.%{$fg_bold[magenta]%}<%{$fg_bold[red]%}<%{$fg_no_bold[magenta]%}<) %{$fg_no_bold[white]%}%n@%m%{$reset_color%}"
    fi
}
#}}}

zle-keymap-select(){ #{{{
    if [[ $KEYMAP == vicmd ]]; then
        set-mode NORMAL
    else
        set-mode INSERT
    fi
}
#}}}

#}}}

# make special keys work as expected {{{
bindkey "\e[1~" beginning-of-line
bindkey "\e[2~" quoted-insert
bindkey "\e[3~" delete-char
bindkey "\e[4~" end-of-line
bindkey "\e[5~" beginning-of-history
bindkey "\e[6~" end-of-history
bindkey "\e[7~" beginning-of-line
bindkey "\e[8~" end-of-line
bindkey "\e[H" beginning-of-line
bindkey "\e[F" end-of-line
bindkey "\eOH" beginning-of-line
bindkey "\eOF" end-of-line
bindkey "\eOd" backward-word
bindkey "\eOc" forward-word
bindkey "\e[A" history-search-backward
bindkey "\e[B" history-search-forward
#}}}

# convenience keys {{{
bindkey -s "^\\" " | less\n"
bindkey "^J" push-line
bindkey '^R' history-incremental-search-backward
#}}}

set-mode INSERT
set-prompt

zle -N zle-keymap-select

# launch X if logged into TTY1
if [[ $TTY == /dev/tty1 ]]; then
    exec /usr/bin/xinit
fi

# vim:foldlevel=0

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server
  • English
  • Català
  • Čeština
  • Deutsch
  • Español
  • Français
  • Hrvatski
  • Indonesia
  • Italiano
  • 日本語
  • Nederlands
  • Norsk
  • Polski
  • Português (BR)
  • Српски
  • Svenska
  • 中文