Browse code

Moving all zsh config options into a lib/ subdirectory to make way for some upcoming changes to directory structure and configuration options

Robby Russell authored on 23/09/2009 at 14:43:36
Showing 21 changed files
1 1
deleted file mode 100644
... ...
@@ -1,43 +0,0 @@
1
-alias pu='pushd'
2
-alias po='popd'
3
-
4
-alias sc='ruby script/console'
5
-alias sd='ruby script/server --debugger'
6
-alias ss='thin --stats "/thin/stats" start'
7
-
8
-alias mr='mate CHANGELOG app config db lib public script spec test'
9
-alias .='pwd'
10
-alias ...='cd ../..'
11
-
12
-alias _='sudo'
13
-
14
-#alias g='grep -in'
15
-
16
-alias g='git'
17
-alias gst='git status'
18
-alias gl='git pull'
19
-alias gp='git push'
20
-alias gd='git diff | mate'
21
-alias gc='git commit -v'
22
-alias gca='git commit -v -a'
23
-alias gb='git branch'
24
-alias gba='git branch -a'
25
-
26
-alias history='fc -l 1'
27
-
28
-alias ls='ls -F'
29
-alias ll='ls -al'
30
-
31
-alias sgem='sudo gem'
32
-
33
-alias rfind='find . -name *.rb | xargs grep -n'
34
-
35
-alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
36
-
37
-alias et='mate . &'
38
-alias ett='mate app config lib db public spec test Rakefile Capfile Todo &'
39
-alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo &'
40
-alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo &'
41
-
42
-
43
-
44 1
deleted file mode 100644
... ...
@@ -1,4 +0,0 @@
1
-autoload colors; colors;
2
-
3
-unset LSCOLORS
4
-export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'
5 1
deleted file mode 100644
... ...
@@ -1,30 +0,0 @@
1
-setopt noautomenu
2
-setopt COMPLETE_IN_WORD
3
-setopt ALWAYS_TO_END
4
-
5
-unsetopt flowcontrol
6
-
7
-WORDCHARS=''
8
-
9
-autoload -U compinit
10
-compinit
11
-
12
-zmodload -i zsh/complist
13
-
14
-## case-insensitive (all),partial-word and then substring completion
15
-zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
16
-
17
-zstyle ':completion:*' list-colors ''
18
-zstyle ':completion:*' hosts $( sed 's/[, ].*$//' $HOME/.ssh/known_hosts )
19
-
20
-unsetopt MENU_COMPLETE
21
-setopt AUTO_MENU
22
-
23
-bindkey -M menuselect '^o' accept-and-infer-next-history
24
-
25
-zstyle ':completion:*:*:*:*:*' menu yes select
26
-# zstyle ':completion:*:*:*:*:processes' force-list always
27
-
28
-zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
29
-zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w"
30
-zstyle ':completion:*:*:(ssh|scp):*:*' hosts `sed 's/^\([^ ,]*\).*$/\1/' ~/.ssh/known_hosts`
31 1
deleted file mode 100644
... ...
@@ -1,59 +0,0 @@
1
-function title {
2
-  if [[ $TERM == "screen" ]]; then
3
-    # Use these two for GNU Screen:
4
-    print -nR $'\033k'$1$'\033'\\\
5
-
6
-    print -nR $'\033]0;'$2$'\a'
7
-  elif [[ $TERM == "xterm" || $TERM == "rxvt" ]]; then
8
-    # Use this one instead for XTerms:
9
-    print -nR $'\033]0;'$*$'\a'
10
-  fi
11
-}
12
-
13
-function precmd {
14
-  title zsh "$PWD"
15
-}
16
-
17
-function preexec {
18
-  emulate -L zsh
19
-  local -a cmd; cmd=(${(z)1})
20
-  title $cmd[1]:t "$cmd[2,-1]"
21
-}
22
-
23
-function remote_console() {
24
-  /usr/bin/env ssh $1 "( cd $2 && ruby script/console production )"
25
-}
26
-
27
-function zsh_stats() {
28
-  history | awk '{print $2}' | sort | uniq -c | sort -rn | head
29
-}
30
-
31
-function uninstall_oh_my_zsh() {
32
-  /bin/sh $ZSH/tools/uninstall.sh
33
-}
34
-
35
-function upgrade_oh_my_zsh() {
36
-  /bin/sh $ZSH/tools/upgrade.sh
37
-}
38
-
39
-function tab() {
40
-  osascript 2>/dev/null <<EOF
41
-    tell application "System Events"
42
-      tell process "Terminal" to keystroke "t" using command down
43
-    end
44
-    tell application "Terminal"
45
-      activate
46
-      do script with command "cd $PWD; $*" in window 1
47
-    end tell
48
-EOF
49
-}
50
-
51
-function take() {
52
-  mkdir -p $1
53
-  cd $1
54
-}
55
-
56
-function tm() {
57
-  cd $1
58
-  mate $1
59
-}
60 1
deleted file mode 100644
... ...
@@ -1,25 +0,0 @@
1
-# Varables for themeing the git info prompt:
2
-# ZSH_THEME_GIT_PROMPT_PREFIX - Prefix at the very beginning of the prompt, before the branch name
3
-# ZSH_THEME_GIT_PROMPT_SUFFIX - At the very end of the prompt
4
-# ZSH_THEME_GIT_PROMPT_DIRTY  - Text to display if the branch is dirty
5
-# ZSH_THEME_GIT_PROMPT_CLEAN  - Text to display if the branch is clean
6
-
7
-ZSH_THEME_GIT_PROMPT_PREFIX="git:("
8
-ZSH_THEME_GIT_PROMPT_SUFFIX=")"
9
-ZSH_THEME_GIT_PROMPT_DIRTY="*"
10
-ZSH_THEME_GIT_PROMPT_CLEAN=""
11
-
12
-# get the name of the branch we are on
13
-function git_prompt_info() {
14
-  ref=$(git symbolic-ref HEAD 2> /dev/null) || return
15
-  echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
16
-}
17
-
18
-parse_git_dirty () {
19
-  if [[ $(git status  | tail -n1) != "nothing to commit (working directory clean)" ]]; then
20
-    echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
21
-  else
22
-    echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
23
-  fi
24
-}
25
-
26 1
deleted file mode 100644
... ...
@@ -1,6 +0,0 @@
1
-#
2
-# Color grep results
3
-# Examples: http://rubyurl.com/ZXv
4
-#
5
-export GREP_OPTIONS='--color=auto'
6
-export GREP_COLOR='1;32'
7 1
\ No newline at end of file
8 2
deleted file mode 100644
... ...
@@ -1,15 +0,0 @@
1
-# History stuff.
2
-setopt HIST_VERIFY
3
-setopt INC_APPEND_HISTORY
4
-setopt SHARE_HISTORY
5
-setopt EXTENDED_HISTORY
6
-setopt HIST_IGNORE_DUPS
7
-
8
-## Command history configuration
9
-#
10
-HISTFILE=$ZSH/log/.zsh_history
11
-HISTSIZE=2500
12
-SAVEHIST=2500
13
-setopt hist_ignore_dups # ignore duplication command history list
14
-setopt share_history # share command history data
15
-
16 1
deleted file mode 100644
... ...
@@ -1,14 +0,0 @@
1
-# TODO: Explain what some of this does..
2
-autoload -U compinit
3
-compinit
4
-bindkey '\ew' kill-region
5
-bindkey -s '\el' "ls\n"
6
-bindkey -s '\e.' "..\n"
7
-bindkey '^r' history-incremental-search-backward
8
-bindkey "^[[5~" up-line-or-history
9
-bindkey "^[[6~" down-line-or-history
10
-bindkey "^[[H" beginning-of-line
11
-bindkey "^[[1~" beginning-of-line
12
-bindkey "^[[F"  end-of-line
13
-bindkey "^[[4~" end-of-line
14
-bindkey ' ' magic-space    # also do history expansion on space
15 1
\ No newline at end of file
16 2
new file mode 100644
... ...
@@ -0,0 +1,43 @@
0
+alias pu='pushd'
1
+alias po='popd'
2
+
3
+alias sc='ruby script/console'
4
+alias sd='ruby script/server --debugger'
5
+alias ss='thin --stats "/thin/stats" start'
6
+
7
+alias mr='mate CHANGELOG app config db lib public script spec test'
8
+alias .='pwd'
9
+alias ...='cd ../..'
10
+
11
+alias _='sudo'
12
+
13
+#alias g='grep -in'
14
+
15
+alias g='git'
16
+alias gst='git status'
17
+alias gl='git pull'
18
+alias gp='git push'
19
+alias gd='git diff | mate'
20
+alias gc='git commit -v'
21
+alias gca='git commit -v -a'
22
+alias gb='git branch'
23
+alias gba='git branch -a'
24
+
25
+alias history='fc -l 1'
26
+
27
+alias ls='ls -F'
28
+alias ll='ls -al'
29
+
30
+alias sgem='sudo gem'
31
+
32
+alias rfind='find . -name *.rb | xargs grep -n'
33
+
34
+alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
35
+
36
+alias et='mate . &'
37
+alias ett='mate app config lib db public spec test Rakefile Capfile Todo &'
38
+alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo &'
39
+alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo &'
40
+
41
+
42
+
0 43
new file mode 100644
... ...
@@ -0,0 +1,4 @@
0
+autoload colors; colors;
1
+
2
+unset LSCOLORS
3
+export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'
0 4
new file mode 100644
... ...
@@ -0,0 +1,30 @@
0
+setopt noautomenu
1
+setopt COMPLETE_IN_WORD
2
+setopt ALWAYS_TO_END
3
+
4
+unsetopt flowcontrol
5
+
6
+WORDCHARS=''
7
+
8
+autoload -U compinit
9
+compinit
10
+
11
+zmodload -i zsh/complist
12
+
13
+## case-insensitive (all),partial-word and then substring completion
14
+zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
15
+
16
+zstyle ':completion:*' list-colors ''
17
+zstyle ':completion:*' hosts $( sed 's/[, ].*$//' $HOME/.ssh/known_hosts )
18
+
19
+unsetopt MENU_COMPLETE
20
+setopt AUTO_MENU
21
+
22
+bindkey -M menuselect '^o' accept-and-infer-next-history
23
+
24
+zstyle ':completion:*:*:*:*:*' menu yes select
25
+# zstyle ':completion:*:*:*:*:processes' force-list always
26
+
27
+zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
28
+zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w"
29
+zstyle ':completion:*:*:(ssh|scp):*:*' hosts `sed 's/^\([^ ,]*\).*$/\1/' ~/.ssh/known_hosts`
0 30
new file mode 100644
... ...
@@ -0,0 +1,59 @@
0
+function title {
1
+  if [[ $TERM == "screen" ]]; then
2
+    # Use these two for GNU Screen:
3
+    print -nR $'\033k'$1$'\033'\\\
4
+
5
+    print -nR $'\033]0;'$2$'\a'
6
+  elif [[ $TERM == "xterm" || $TERM == "rxvt" ]]; then
7
+    # Use this one instead for XTerms:
8
+    print -nR $'\033]0;'$*$'\a'
9
+  fi
10
+}
11
+
12
+function precmd {
13
+  title zsh "$PWD"
14
+}
15
+
16
+function preexec {
17
+  emulate -L zsh
18
+  local -a cmd; cmd=(${(z)1})
19
+  title $cmd[1]:t "$cmd[2,-1]"
20
+}
21
+
22
+function remote_console() {
23
+  /usr/bin/env ssh $1 "( cd $2 && ruby script/console production )"
24
+}
25
+
26
+function zsh_stats() {
27
+  history | awk '{print $2}' | sort | uniq -c | sort -rn | head
28
+}
29
+
30
+function uninstall_oh_my_zsh() {
31
+  /bin/sh $ZSH/tools/uninstall.sh
32
+}
33
+
34
+function upgrade_oh_my_zsh() {
35
+  /bin/sh $ZSH/tools/upgrade.sh
36
+}
37
+
38
+function tab() {
39
+  osascript 2>/dev/null <<EOF
40
+    tell application "System Events"
41
+      tell process "Terminal" to keystroke "t" using command down
42
+    end
43
+    tell application "Terminal"
44
+      activate
45
+      do script with command "cd $PWD; $*" in window 1
46
+    end tell
47
+EOF
48
+}
49
+
50
+function take() {
51
+  mkdir -p $1
52
+  cd $1
53
+}
54
+
55
+function tm() {
56
+  cd $1
57
+  mate $1
58
+}
0 59
new file mode 100644
... ...
@@ -0,0 +1,25 @@
0
+# Varables for themeing the git info prompt:
1
+# ZSH_THEME_GIT_PROMPT_PREFIX - Prefix at the very beginning of the prompt, before the branch name
2
+# ZSH_THEME_GIT_PROMPT_SUFFIX - At the very end of the prompt
3
+# ZSH_THEME_GIT_PROMPT_DIRTY  - Text to display if the branch is dirty
4
+# ZSH_THEME_GIT_PROMPT_CLEAN  - Text to display if the branch is clean
5
+
6
+ZSH_THEME_GIT_PROMPT_PREFIX="git:("
7
+ZSH_THEME_GIT_PROMPT_SUFFIX=")"
8
+ZSH_THEME_GIT_PROMPT_DIRTY="*"
9
+ZSH_THEME_GIT_PROMPT_CLEAN=""
10
+
11
+# get the name of the branch we are on
12
+function git_prompt_info() {
13
+  ref=$(git symbolic-ref HEAD 2> /dev/null) || return
14
+  echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
15
+}
16
+
17
+parse_git_dirty () {
18
+  if [[ $(git status  | tail -n1) != "nothing to commit (working directory clean)" ]]; then
19
+    echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
20
+  else
21
+    echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
22
+  fi
23
+}
24
+
0 25
new file mode 100644
... ...
@@ -0,0 +1,6 @@
0
+#
1
+# Color grep results
2
+# Examples: http://rubyurl.com/ZXv
3
+#
4
+export GREP_OPTIONS='--color=auto'
5
+export GREP_COLOR='1;32'
0 6
\ No newline at end of file
1 7
new file mode 100644
... ...
@@ -0,0 +1,15 @@
0
+# History stuff.
1
+setopt HIST_VERIFY
2
+setopt INC_APPEND_HISTORY
3
+setopt SHARE_HISTORY
4
+setopt EXTENDED_HISTORY
5
+setopt HIST_IGNORE_DUPS
6
+
7
+## Command history configuration
8
+#
9
+HISTFILE=$ZSH/log/.zsh_history
10
+HISTSIZE=2500
11
+SAVEHIST=2500
12
+setopt hist_ignore_dups # ignore duplication command history list
13
+setopt share_history # share command history data
14
+
0 15
new file mode 100644
... ...
@@ -0,0 +1,14 @@
0
+# TODO: Explain what some of this does..
1
+autoload -U compinit
2
+compinit
3
+bindkey '\ew' kill-region
4
+bindkey -s '\el' "ls\n"
5
+bindkey -s '\e.' "..\n"
6
+bindkey '^r' history-incremental-search-backward
7
+bindkey "^[[5~" up-line-or-history
8
+bindkey "^[[6~" down-line-or-history
9
+bindkey "^[[H" beginning-of-line
10
+bindkey "^[[1~" beginning-of-line
11
+bindkey "^[[F"  end-of-line
12
+bindkey "^[[4~" end-of-line
13
+bindkey ' ' magic-space    # also do history expansion on space
0 14
\ No newline at end of file
1 15
new file mode 100644
... ...
@@ -0,0 +1,32 @@
0
+export PAGER=less
1
+export LC_CTYPE=en_US.UTF-8
2
+
3
+bindkey -e
4
+
5
+# Directory stuff.
6
+setopt AUTO_NAME_DIRS
7
+
8
+# Speed stuff.
9
+
10
+#setopt NO_BEEP
11
+setopt AUTO_CD
12
+setopt MULTIOS
13
+setopt CDABLEVARS
14
+
15
+bindkey -e
16
+
17
+if [[ x$WINDOW != x ]]
18
+then
19
+    SCREEN_NO="%B$WINDOW%b "
20
+else
21
+    SCREEN_NO=""
22
+fi
23
+
24
+PS1="%n@%m:%~%# "
25
+
26
+# Setup the prompt with pretty colors
27
+setopt prompt_subst
28
+
29
+export LSCOLORS="Gxfxcxdxbxegedabagacad"
30
+
31
+source "$ZSH/themes/$ZSH_THEME.zsh-theme"
0 32
new file mode 100644
... ...
@@ -0,0 +1,42 @@
0
+_rake_does_task_list_need_generating () {
1
+  if [ ! -f .rake_tasks~ ]; then return 0;
2
+  else
3
+    accurate=$(stat -f%m .rake_tasks~)
4
+    changed=$(stat -f%m Rakefile)
5
+    return $(expr $accurate '>=' $changed)
6
+  fi
7
+}
8
+
9
+_rake () {
10
+  if [ -f Rakefile ]; then
11
+    if _rake_does_task_list_need_generating; then
12
+      echo "\nGenerating .rake_tasks~..." > /dev/stderr
13
+      rake --silent --tasks | cut -d " " -f 2 > .rake_tasks~
14
+    fi
15
+    compadd `cat .rake_tasks~`
16
+  fi
17
+}
18
+
19
+compctl -K _rake rake
20
+
21
+function _cap_does_task_list_need_generating () {
22
+  if [ ! -f .cap_tasks~ ]; then return 0;
23
+  else
24
+    accurate=$(stat -f%m .cap_tasks~)
25
+    changed=$(stat -f%m config/deploy.rb)
26
+    return $(expr $accurate '>=' $changed)
27
+  fi
28
+}
29
+
30
+function _cap () {
31
+  if [ -f config/deploy.rb ]; then
32
+    if _cap_does_task_list_need_generating; then
33
+      echo "\nGenerating .cap_tasks~..." > /dev/stderr
34
+      cap show_tasks -q | cut -d " " -f 1 | sed -e '/^ *$/D' -e '1,2D'
35
+> .cap_tasks~
36
+    fi
37
+    compadd `cat .cap_tasks~`
38
+  fi
39
+}
40
+
41
+compctl -K _cap cap
... ...
@@ -2,4 +2,4 @@
2 2
 
3 3
 # Load all of the config files in ~/oh-my-zsh that end in .zsh
4 4
 # TIP: Add files you don't want in git to .gitignore
5
-for config_file ($ZSH/*.zsh) source $config_file
5
+for config_file ($ZSH/lib/*.zsh) source $config_file
6 6
deleted file mode 100644
... ...
@@ -1,32 +0,0 @@
1
-export PAGER=less
2
-export LC_CTYPE=en_US.UTF-8
3
-
4
-bindkey -e
5
-
6
-# Directory stuff.
7
-setopt AUTO_NAME_DIRS
8
-
9
-# Speed stuff.
10
-
11
-#setopt NO_BEEP
12
-setopt AUTO_CD
13
-setopt MULTIOS
14
-setopt CDABLEVARS
15
-
16
-bindkey -e
17
-
18
-if [[ x$WINDOW != x ]]
19
-then
20
-    SCREEN_NO="%B$WINDOW%b "
21
-else
22
-    SCREEN_NO=""
23
-fi
24
-
25
-PS1="%n@%m:%~%# "
26
-
27
-# Setup the prompt with pretty colors
28
-setopt prompt_subst
29
-
30
-export LSCOLORS="Gxfxcxdxbxegedabagacad"
31
-
32
-source "$ZSH/themes/$ZSH_THEME.zsh-theme"
33 1
deleted file mode 100644
... ...
@@ -1,42 +0,0 @@
1
-_rake_does_task_list_need_generating () {
2
-  if [ ! -f .rake_tasks~ ]; then return 0;
3
-  else
4
-    accurate=$(stat -f%m .rake_tasks~)
5
-    changed=$(stat -f%m Rakefile)
6
-    return $(expr $accurate '>=' $changed)
7
-  fi
8
-}
9
-
10
-_rake () {
11
-  if [ -f Rakefile ]; then
12
-    if _rake_does_task_list_need_generating; then
13
-      echo "\nGenerating .rake_tasks~..." > /dev/stderr
14
-      rake --silent --tasks | cut -d " " -f 2 > .rake_tasks~
15
-    fi
16
-    compadd `cat .rake_tasks~`
17
-  fi
18
-}
19
-
20
-compctl -K _rake rake
21
-
22
-function _cap_does_task_list_need_generating () {
23
-  if [ ! -f .cap_tasks~ ]; then return 0;
24
-  else
25
-    accurate=$(stat -f%m .cap_tasks~)
26
-    changed=$(stat -f%m config/deploy.rb)
27
-    return $(expr $accurate '>=' $changed)
28
-  fi
29
-}
30
-
31
-function _cap () {
32
-  if [ -f config/deploy.rb ]; then
33
-    if _cap_does_task_list_need_generating; then
34
-      echo "\nGenerating .cap_tasks~..." > /dev/stderr
35
-      cap show_tasks -q | cut -d " " -f 1 | sed -e '/^ *$/D' -e '1,2D'
36
-> .cap_tasks~
37
-    fi
38
-    compadd `cat .cap_tasks~`
39
-  fi
40
-}
41
-
42
-compctl -K _cap cap