Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

split monolithic zshrc file into many smaller ones

  • Loading branch information...
commit 0c87fc540737130ac41a054a6551941525e0180d 1 parent 364c443
Suraj N. Kurapati authored
4 .gitmodules
... ... @@ -1,6 +1,6 @@
1 1 [submodule ".zsh-history-substring-search"]
2   - path = .zsh-history-substring-search
  2 + path = .zsh/bundle/zsh-history-substring-search
3 3 url = git://github.com/zsh-users/zsh-history-substring-search.git
4 4 [submodule ".zsh-syntax-highlighting"]
5   - path = .zsh-syntax-highlighting
  5 + path = .zsh/bundle/zsh-syntax-highlighting
6 6 url = git://github.com/zsh-users/zsh-syntax-highlighting.git
0  .zsh-history-substring-search → .zsh/bundle/zsh-history-substring-search
File renamed without changes
0  .zsh-syntax-highlighting → .zsh/bundle/zsh-syntax-highlighting
File renamed without changes
9 .zsh/config.zsh
... ... @@ -0,0 +1,9 @@
  1 +# load bundles
  2 +for dir in ~/.zsh/bundle/*; do
  3 + source $dir/${dir##*/}.zsh
  4 +done
  5 +
  6 +# delegate configuration to files in config/
  7 +for file in ~/.zsh/config/**/*.zsh; do
  8 + source $file
  9 +done
37 .zsh/config/0-defaults.zsh
... ... @@ -0,0 +1,37 @@
  1 +# Lines configured by zsh-newuser-install
  2 +HISTFILE=~/.zsh_history
  3 +HISTSIZE=9999
  4 +SAVEHIST=9999
  5 +setopt appendhistory autocd nomatch notify
  6 +bindkey -e
  7 +# End of lines configured by zsh-newuser-install
  8 +
  9 +# The following lines were added by compinstall
  10 +zstyle :compinstall filename ~/.zshrc
  11 +autoload -Uz compinit
  12 +compinit
  13 +# End of lines added by compinstall
  14 +
  15 +# stuff from default oh-my-zsh configuration
  16 +setopt alwaystoend
  17 +setopt autocd
  18 +setopt autopushd
  19 +setopt cdablevars
  20 +setopt completeinword
  21 +setopt correctall
  22 +setopt extendedglob
  23 +setopt extendedhistory
  24 +setopt noflowcontrol
  25 +setopt histexpiredupsfirst
  26 +setopt histignorealldups
  27 +setopt histignoredups
  28 +setopt histignorespace
  29 +setopt histverify
  30 +setopt incappendhistory
  31 +setopt interactive
  32 +setopt kshglob
  33 +setopt longlistjobs
  34 +setopt monitor
  35 +setopt promptsubst
  36 +setopt pushdignoredups
  37 +setopt sharehistory
8 .zsh/config/1-interaction.zsh
... ... @@ -0,0 +1,8 @@
  1 +# bind special keys according to readline configuration
  2 +eval "$(sed -n 's/^/bindkey /; s/: / /p' /etc/inputrc)"
  3 +
  4 +# do not erase entire line when Control-U is pressed
  5 +bindkey '^U' backward-kill-line
  6 +
  7 +# keep command history unique to fit more items in it!
  8 +setopt histignorealldups
4 .zsh/config/alias.zsh
... ... @@ -0,0 +1,4 @@
  1 +source ~/.alias
  2 +setopt nocompletealiases # treat `gco` like `git checkout`
  3 +compdef _git tig=git-checkout # treat `tig` like `git checkout`
  4 +compdef hub=git # treat `hub` like `git`
4 .zsh/config/bundle/zsh-history-substring-search.zsh
... ... @@ -0,0 +1,4 @@
  1 +if test $TERM != linux; then
  2 + HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='fg=yellow,standout'
  3 + HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='fg=red,standout'
  4 +fi
2  .zsh/config/bundle/zsh-syntax-highlighting.zsh
... ... @@ -0,0 +1,2 @@
  1 +ZSH_HIGHLIGHT_STYLES[single-hyphen-option]='bold'
  2 +ZSH_HIGHLIGHT_STYLES[double-hyphen-option]='bold'
2  .zsh/config/nvm.zsh
... ... @@ -0,0 +1,2 @@
  1 +# Node Version Manager
  2 +source ~/.nvm/nvm.sh
3  .zsh/config/precmd.zsh
... ... @@ -0,0 +1,3 @@
  1 +# show current command, directory, and user in terminal title
  2 +precmd() { print -Pn "\e]2;$0 (%~) %n@%m\a" }
  3 +preexec() { print -Pn "\e]2;$1 (%~) %n@%m\a" }
64 .zsh/config/prompt.zsh
... ... @@ -0,0 +1,64 @@
  1 +# my "sunaku" prompt from oh-my-zsh (see http://ompldr.org/vOHcwZg)
  2 +PROMPT='%(?..%B%F{red}exit %?%f%b
  3 +)'\
  4 +'$(vcs_info && echo $vcs_info_msg_0_)'\
  5 +"%F{$(test $UID -eq 0 && echo red || echo green)}%~%f"\
  6 +'%(!.#.>) '
  7 +RPROMPT='%F{cyan}%@%f'
  8 +
  9 +# VCS integration for ZSH command prompt
  10 +autoload -Uz vcs_info
  11 +zstyle ':vcs_info:*' check-for-changes true
  12 +zstyle ':vcs_info:*' stagedstr '%B%F{green}^%f%b'
  13 +zstyle ':vcs_info:*' unstagedstr '%B%F{yellow}*%f%b'
  14 +zstyle ':vcs_info:*' formats '%c%u%b%m '
  15 +zstyle ':vcs_info:*' actionformats '%c%u%b%m %B%s-%a%%b '
  16 +zstyle ':vcs_info:git*+set-message:*' hooks git-untracked git-aheadbehind git-remotebranch
  17 +
  18 +# http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Misc/vcs_info-examples
  19 +
  20 +### git: Show marker (T) if there are untracked files in repository
  21 +# Make sure you have added staged to your 'formats': %c
  22 +function +vi-git-untracked(){
  23 + if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == 'true' ]] && \
  24 + git status --porcelain | grep '??' &> /dev/null ; then
  25 + # This will show the marker if there are any untracked files in repo.
  26 + # If instead you want to show the marker only if there are untracked
  27 + # files in $PWD, use:
  28 + #[[ -n $(git ls-files --others --exclude-standard) ]] ; then
  29 + hook_com[unstaged]+='%B%F{magenta},%f%b'
  30 + fi
  31 +}
  32 +
  33 +### git: Show +N/-N when your local branch is ahead-of or behind remote HEAD.
  34 +# Make sure you have added misc to your 'formats': %m
  35 +function +vi-git-aheadbehind() {
  36 + local ahead behind
  37 + local -a gitstatus
  38 +
  39 + # for git prior to 1.7
  40 + # ahead=$(git rev-list origin/${hook_com[branch]}..HEAD | wc -l)
  41 + ahead=$(git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l)
  42 + (( $ahead )) && gitstatus+=( "%B%F{blue}+${ahead}%f%b" )
  43 +
  44 + # for git prior to 1.7
  45 + # behind=$(git rev-list HEAD..origin/${hook_com[branch]} | wc -l)
  46 + behind=$(git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l)
  47 + (( $behind )) && gitstatus+=( "%B%F{red}-${behind}%f%b" )
  48 +
  49 + hook_com[misc]+=${(j::)gitstatus}
  50 +}
  51 +
  52 +### git: Show remote branch name for remote-tracking branches
  53 +# Make sure you have added staged to your 'formats': %b
  54 +function +vi-git-remotebranch() {
  55 + local remote
  56 +
  57 + # Are we on a remote-tracking branch?
  58 + remote=${$(git rev-parse --verify ${hook_com[branch]}@{upstream} \
  59 + --symbolic-full-name 2>/dev/null)/refs\/remotes\/}
  60 +
  61 + if [[ -n ${remote} && ${remote#*/} != ${hook_com[branch]} ]] ; then
  62 + hook_com[branch]="${hook_com[branch]}(%F{cyan}${remote}%f)"
  63 + fi
  64 +}
4 .zsh/config/rvm.zsh
... ... @@ -0,0 +1,4 @@
  1 +# Ruby Version Manager
  2 +unsetopt auto_name_dirs
  3 +source ~/.rvm/scripts/rvm
  4 +cd $PWD # trigger .rvmrc loading
2  .zsh/config/z-fortune.zsh
... ... @@ -0,0 +1,2 @@
  1 +# fortune cookie ;-)
  2 +fortune -s | cowsay
163 .zshrc
... ... @@ -1,163 +0,0 @@
1   -#-----------------------------------------------------------------------------
2   -# defaults
3   -#-----------------------------------------------------------------------------
4   -
5   -# Lines configured by zsh-newuser-install
6   -HISTFILE=~/.zsh_history
7   -HISTSIZE=9999
8   -SAVEHIST=9999
9   -setopt appendhistory autocd nomatch notify
10   -bindkey -e
11   -# End of lines configured by zsh-newuser-install
12   -
13   -# The following lines were added by compinstall
14   -zstyle :compinstall filename ~/.zshrc
15   -autoload -Uz compinit
16   -compinit
17   -# End of lines added by compinstall
18   -
19   -# stuff from default oh-my-zsh configuration
20   -setopt alwaystoend
21   -setopt autocd
22   -setopt autopushd
23   -setopt cdablevars
24   -setopt completeinword
25   -setopt correctall
26   -setopt extendedglob
27   -setopt extendedhistory
28   -setopt noflowcontrol
29   -setopt histexpiredupsfirst
30   -setopt histignorealldups
31   -setopt histignoredups
32   -setopt histignorespace
33   -setopt histverify
34   -setopt incappendhistory
35   -setopt interactive
36   -setopt kshglob
37   -setopt longlistjobs
38   -setopt monitor
39   -setopt promptsubst
40   -setopt pushdignoredups
41   -setopt sharehistory
42   -
43   -#-----------------------------------------------------------------------------
44   -# appearance
45   -#-----------------------------------------------------------------------------
46   -
47   -# show current command, directory, and user in terminal title
48   -precmd() { print -Pn "\e]2;$0 (%~) %n@%m\a" }
49   -preexec() { print -Pn "\e]2;$1 (%~) %n@%m\a" }
50   -
51   -# my "sunaku" prompt from oh-my-zsh (see http://ompldr.org/vOHcwZg)
52   -PROMPT='%(?..%B%F{red}exit %?%f%b
53   -)'\
54   -'$(vcs_info && echo $vcs_info_msg_0_)'\
55   -"%F{$(test $UID -eq 0 && echo red || echo green)}%~%f"\
56   -'%(!.#.>) '
57   -RPROMPT='%F{cyan}%@%f'
58   -
59   -# VCS integration for ZSH command prompt
60   -autoload -Uz vcs_info
61   -zstyle ':vcs_info:*' check-for-changes true
62   -zstyle ':vcs_info:*' stagedstr '%B%F{green}^%f%b'
63   -zstyle ':vcs_info:*' unstagedstr '%B%F{yellow}*%f%b'
64   -zstyle ':vcs_info:*' formats '%c%u%b%m '
65   -zstyle ':vcs_info:*' actionformats '%c%u%b%m %B%s-%a%%b '
66   -zstyle ':vcs_info:git*+set-message:*' hooks git-untracked git-aheadbehind git-remotebranch
67   -
68   -# http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Misc/vcs_info-examples
69   -
70   -### git: Show marker (T) if there are untracked files in repository
71   -# Make sure you have added staged to your 'formats': %c
72   -function +vi-git-untracked(){
73   - if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == 'true' ]] && \
74   - git status --porcelain | grep '??' &> /dev/null ; then
75   - # This will show the marker if there are any untracked files in repo.
76   - # If instead you want to show the marker only if there are untracked
77   - # files in $PWD, use:
78   - #[[ -n $(git ls-files --others --exclude-standard) ]] ; then
79   - hook_com[unstaged]+='%B%F{magenta},%f%b'
80   - fi
81   -}
82   -
83   -### git: Show +N/-N when your local branch is ahead-of or behind remote HEAD.
84   -# Make sure you have added misc to your 'formats': %m
85   -function +vi-git-aheadbehind() {
86   - local ahead behind
87   - local -a gitstatus
88   -
89   - # for git prior to 1.7
90   - # ahead=$(git rev-list origin/${hook_com[branch]}..HEAD | wc -l)
91   - ahead=$(git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l)
92   - (( $ahead )) && gitstatus+=( "%B%F{blue}+${ahead}%f%b" )
93   -
94   - # for git prior to 1.7
95   - # behind=$(git rev-list HEAD..origin/${hook_com[branch]} | wc -l)
96   - behind=$(git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l)
97   - (( $behind )) && gitstatus+=( "%B%F{red}-${behind}%f%b" )
98   -
99   - hook_com[misc]+=${(j::)gitstatus}
100   -}
101   -
102   -### git: Show remote branch name for remote-tracking branches
103   -# Make sure you have added staged to your 'formats': %b
104   -function +vi-git-remotebranch() {
105   - local remote
106   -
107   - # Are we on a remote-tracking branch?
108   - remote=${$(git rev-parse --verify ${hook_com[branch]}@{upstream} \
109   - --symbolic-full-name 2>/dev/null)/refs\/remotes\/}
110   -
111   - if [[ -n ${remote} && ${remote#*/} != ${hook_com[branch]} ]] ; then
112   - hook_com[branch]="${hook_com[branch]}(%F{cyan}${remote}%f)"
113   - fi
114   -}
115   -
116   -#-----------------------------------------------------------------------------
117   -# interaction
118   -#-----------------------------------------------------------------------------
119   -
120   -# bind special keys according to readline configuration
121   -eval "$(sed -n 's/^/bindkey /; s/: / /p' /etc/inputrc)"
122   -
123   -# do not erase entire line when Control-U is pressed
124   -bindkey '^U' backward-kill-line
125   -
126   -# keep command history unique to fit more items in it!
127   -setopt histignorealldups
128   -
129   -source ~/.alias
130   -setopt nocompletealiases # treat `gco` like `git checkout`
131   -compdef _git tig=git-checkout # treat `tig` like `git checkout`
132   -compdef hub=git # treat `hub` like `git`
133   -
134   -#-----------------------------------------------------------------------------
135   -# plugins
136   -#-----------------------------------------------------------------------------
137   -
138   -# zsh-syntax-highlighting
139   -source ~/.zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
140   -ZSH_HIGHLIGHT_STYLES[single-hyphen-option]='bold'
141   -ZSH_HIGHLIGHT_STYLES[double-hyphen-option]='bold'
142   -
143   -# zsh-history-substring-search
144   -source ~/.zsh-history-substring-search/zsh-history-substring-search.zsh
145   -if test $TERM != linux; then
146   - HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='fg=yellow,standout'
147   - HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='fg=red,standout'
148   -fi
149   -
150   -# Ruby Version Manager
151   -unsetopt auto_name_dirs
152   -source ~/.rvm/scripts/rvm
153   -cd $PWD # trigger .rvmrc loading
154   -
155   -# Node Version Manager
156   -source ~/.nvm/nvm.sh
157   -
158   -#-----------------------------------------------------------------------------
159   -# welcome
160   -#-----------------------------------------------------------------------------
161   -
162   -# fortune cookie ;-)
163   -fortune -s | cowsay
1  .zshrc

0 comments on commit 0c87fc5

Please sign in to comment.
Something went wrong with that request. Please try again.