Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:derekwyatt/dotfiles

  • Loading branch information...
commit 9c83c19d5e8e9ff788a65dd7e7a4f83e27e2075b 2 parents 3e317c9 + dc05fce
@derekwyatt authored
View
14 zsh_custom/plugins/regex-dirstack/regex-dirstack.plugin.zsh
@@ -14,7 +14,7 @@ function ss
{
local c=1
local collimit=$((${COLUMNS-80}-10))
- dirs -p | tail -n+2 | \
+ dirs -p | tail -n+2 | head -${SS_DISPLAY_LIMIT-1000} | \
while read f
do
echo "$c) "$(limitStringToWidthByMidpoint $f $collimit)
@@ -40,3 +40,15 @@ function csd
cd +$num
return $?
}
+
+function cdb
+{
+ local dir="$1"
+ local old="$PWD"
+ local new="$(echo $old | sed -e s%/$dir/.*$%/$dir%)"
+ if [[ "$old" != "$new" ]]; then
+ cd "$new"
+ else
+ echo "That evaluated to squat." 1>&2
+ fi
+}
View
4 zsh_custom/plugins/vim-interaction/vim-interaction.plugin.zsh
@@ -70,3 +70,7 @@ alias vk="callvim -b':wincmd k'"
alias vj="callvim -b':wincmd j'"
alias vl="callvim -b':wincmd l'"
alias vh="callvim -b':wincmd h'"
+alias vK="callvim -b':sp<cr>:wincmd k'"
+alias vJ="callvim -b':sp<cr>:wincmd j'"
+alias vH="callvim -b':vsp<cr>:wincmd h'"
+alias vL="callvim -b':vsp<cr>:wincmd l'"
View
32 zsh_custom/themes/gnzh.zsh-theme
@@ -6,6 +6,18 @@ autoload -U colors zsh/terminfo # Used in the colour alias below
colors
setopt prompt_subst
+function limitStringToWidthByMidpoint
+{
+ local string="$1"
+ local width=$2
+ if (( ${#string} > $width )); then
+ local splitnum=$((width/2))
+ echo "$(echo $string | cut -c1-$splitnum) ... $(echo $string | cut -c$((${#string}-$splitnum))-)"
+ else
+ echo $string
+ fi
+}
+
# make some aliases for the colours: (coud use normal escap.seq's too)
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
eval PR_$color='%{$fg[${(L)color}]%}'
@@ -17,11 +29,11 @@ eval PR_BOLD="%{$terminfo[bold]%}"
if [[ $UID -ge 1000 ]]; then # normal user
eval PR_USER='${PR_GREEN}%n${PR_NO_COLOR}'
eval PR_USER_OP='${PR_GREEN}%#${PR_NO_COLOR}'
- local PR_PROMPT='$PR_NO_COLOR$PR_NO_COLOR'
+ local PR_PROMPT='$PR_NO_COLOR>$PR_NO_COLOR'
elif [[ $UID -eq 0 ]]; then # root
eval PR_USER='${PR_RED}%n${PR_NO_COLOR}'
eval PR_USER_OP='${PR_RED}%#${PR_NO_COLOR}'
- local PR_PROMPT='$PR_RED$PR_NO_COLOR'
+ local PR_PROMPT='$PR_RED>$PR_NO_COLOR'
fi
if [[ ${MY_SHELL_LEVEL:-0} -gt 1 ]]; then
local PR_PROMPT="$PR_PROMPT [$(($MY_SHELL_LEVEL-1))]"
@@ -36,20 +48,14 @@ fi
local return_code="%(?..%{$PR_RED%}%? ↵%{$PR_NO_COLOR%})"
-local user_host='${PR_USER}${PR_CYAN}@${PR_HOST}'
-local current_dir='%{$PR_BOLD$PR_BLUE%}%~%{$PR_NO_COLOR%}'
-local rvm_ruby=''
-if which rvm-prompt &> /dev/null; then
- rvm_ruby='%{$PR_RED%}‹$(rvm-prompt i v g s)›%{$PR_NO_COLOR%}'
-else
- if which rbenv &> /dev/null; then
- rvm_ruby='%{$PR_RED%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$PR_NO_COLOR%}'
- fi
-fi
local git_branch='$(git_prompt_info)%{$PR_NO_COLOR%}'
+local user_host='${PR_USER}${PR_CYAN}@${PR_HOST}'
+local prompty_stuff_so_far="$(git_prompt_info)$(print -P %n)$(print -P %m)"
+local len_so_far=$((${#prompty_stuff_so_far}+20))
+local current_dir='%{$PR_BOLD$PR_BLUE%}$(limitStringToWidthByMidpoint "$(print -P %~)" $((COLUMNS-$len_so_far)))%{$PR_NO_COLOR%}'
#PROMPT="${user_host} ${current_dir} ${rvm_ruby} ${git_branch}$PR_PROMPT "
-PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch}
+PROMPT="╭─${user_host} ${current_dir} ${git_branch}
╰─$PR_PROMPT "
RPS1="${return_code}"
View
2  zshrc
@@ -22,6 +22,7 @@ else
export MY_SHELL_LEVEL=$(($MY_SHELL_LEVEL+1))
fi
+export SS_DISPLAY_LIMIT=25
export ZSH_CUSTOM=~/.dotfiles/zsh_custom
plugins=(git regex-dirstack vim-interaction)
source $ZSH/oh-my-zsh.sh
@@ -33,6 +34,7 @@ setopt auto_pushd
setopt pushd_silent
setopt pushd_ignore_dups
setopt ignore_eof
+setopt rm_star_silent
unsetopt nomatch
unsetopt correct_all
Please sign in to comment.
Something went wrong with that request. Please try again.