changed the folder structure yet again
This commit is contained in:
parent
b5f657b8a4
commit
5e98d160a1
8 changed files with 4 additions and 450 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,4 +0,0 @@
|
|||
bin/zunit
|
||||
bin/bronze
|
||||
lib/local/_zunit
|
||||
lib/bookmarks
|
6
.gitmodules
vendored
6
.gitmodules
vendored
|
@ -10,12 +10,6 @@
|
|||
[submodule "lib/gitignore"]
|
||||
path = lib/gitignore
|
||||
url = https://github.com/github/gitignore
|
||||
[submodule "lib/zunit"]
|
||||
path = lib/zunit
|
||||
url = https://github.com/zunit-zsh/zunit
|
||||
[submodule "lib/welder"]
|
||||
path = lib/welder
|
||||
url = https://github.com/pch/welder
|
||||
[submodule "lib/basher"]
|
||||
path = lib/basher
|
||||
url = https://github.com/basherpm/basher
|
||||
|
|
17
install
17
install
|
@ -1,15 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
#!/bin/bash
|
||||
cd ${HOME}/dotfiles
|
||||
|
||||
cd ${BASEDIR}
|
||||
echo "Installing Dotfiles - Please Wait!"
|
||||
git submodule update --init --recursive
|
||||
|
||||
echo "Installing Dotbot and Linking Files"
|
||||
${BASEDIR}/lib/dotbot/bin/dotbot -d ${BASEDIR} -c cfg/dotbot/cfg ${@}
|
||||
|
||||
echo "Installing ZUnit"
|
||||
cd ${BASEDIR}/lib/zunit
|
||||
./build.zsh
|
||||
cp -f zunit ${BASEDIR}/bin
|
||||
cp -f zunit.zsh-completion ${BASEDIR}/lib/local/_zunit
|
||||
lib/dotbot/bin/dotbot -d . -c cfg/dotbot/cfg ${@}
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
#compdef jump deletemark showmarks
|
||||
#autoload
|
||||
|
||||
local bookmark_file="$(<"$BOOKMARKS_FILE")"
|
||||
local bookmark_array; bookmark_array=(${(f)bookmark_file});
|
||||
local bookmark_name bookmark_path bookmark_line
|
||||
bookmarks=()
|
||||
for bookmark_line in $bookmark_array; do
|
||||
if [[ "$bookmark_line" == *"|"* ]] ; then
|
||||
bookmark_path="${bookmark_line%%|*}"
|
||||
bookmark_path="${bookmark_path/\$HOME/\~}"
|
||||
bookmark_name="${bookmark_line#*|}"
|
||||
bookmarks+="${bookmark_name}:${bookmark_path}"
|
||||
fi
|
||||
done
|
||||
|
||||
_arguments \
|
||||
'*:: :->subcmds' && return 0
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands 'Bookmarks' bookmarks
|
||||
return
|
||||
fi
|
|
@ -1,312 +0,0 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
# Filthy
|
||||
# by James Dinsdale
|
||||
# https://github.com/molovo/filthy
|
||||
# MIT License
|
||||
|
||||
# Largely based on Pure by Sindre Sorhus <https://github.com/sindresorhus/pure>
|
||||
|
||||
# For my own and others sanity
|
||||
# git:
|
||||
# %b => current branch
|
||||
# %a => current action (rebase/merge)
|
||||
# prompt:
|
||||
# %F => color dict
|
||||
# %f => reset color
|
||||
# %~ => current path
|
||||
# %* => time
|
||||
# %n => username
|
||||
# %m => shortname host
|
||||
# %(?..) => prompt conditional - %(condition.true.false)
|
||||
|
||||
prompt_filthy_nice_exit_code() {
|
||||
local exit_status="${1:-$(print -P %?)}";
|
||||
# nothing to do here
|
||||
[[ ${FILTHY_SHOW_EXIT_CODE:=0} != 1 || -z $exit_status || $exit_status == 0 ]] && return;
|
||||
|
||||
local sig_name;
|
||||
|
||||
# is this a signal name (error code = signal + 128) ?
|
||||
case $exit_status in
|
||||
129) sig_name=HUP ;;
|
||||
130) sig_name=INT ;;
|
||||
131) sig_name=QUIT ;;
|
||||
132) sig_name=ILL ;;
|
||||
134) sig_name=ABRT ;;
|
||||
136) sig_name=FPE ;;
|
||||
137) sig_name=KILL ;;
|
||||
139) sig_name=SEGV ;;
|
||||
141) sig_name=PIPE ;;
|
||||
143) sig_name=TERM ;;
|
||||
esac
|
||||
|
||||
# usual exit codes
|
||||
case $exit_status in
|
||||
-1) sig_name=FATAL ;;
|
||||
1) sig_name=WARN ;; # Miscellaneous errors, such as "divide by zero"
|
||||
2) sig_name=BUILTINMISUSE ;; # misuse of shell builtins (pretty rare)
|
||||
126) sig_name=CCANNOTINVOKE ;; # cannot invoke requested command (ex : source script_with_syntax_error)
|
||||
127) sig_name=CNOTFOUND ;; # command not found (ex : source script_not_existing)
|
||||
esac
|
||||
|
||||
# assuming we are on an x86 system here
|
||||
# this MIGHT get annoying since those are in a range of exit codes
|
||||
# programs sometimes use.... we'll see.
|
||||
case $exit_status in
|
||||
19) sig_name=STOP ;;
|
||||
20) sig_name=TSTP ;;
|
||||
21) sig_name=TTIN ;;
|
||||
22) sig_name=TTOU ;;
|
||||
esac
|
||||
|
||||
echo "$ZSH_PROMPT_EXIT_SIGNAL_PREFIX${exit_status}:${sig_name:-$exit_status}$ZSH_PROMPT_EXIT_SIGNAL_SUFFIX ";
|
||||
}
|
||||
|
||||
# turns seconds into human readable time
|
||||
# 165392 => 1d 21h 56m 32s
|
||||
prompt_filthy_human_time() {
|
||||
local tmp=$(( $1 / 1000 ))
|
||||
local days=$(( tmp / 60 / 60 / 24 ))
|
||||
local hours=$(( tmp / 60 / 60 % 24 ))
|
||||
local minutes=$(( tmp / 60 % 60 ))
|
||||
local seconds=$(( tmp % 60 ))
|
||||
(( $days > 0 )) && print -n "${days}d "
|
||||
(( $hours > 0 )) && print -n "${hours}h "
|
||||
(( $minutes > 0 )) && print -n "${minutes}m "
|
||||
(( $seconds > 5 )) && print -n "${seconds}s"
|
||||
(( $tmp <= 5 )) && print -n "${1}ms"
|
||||
}
|
||||
|
||||
# displays the exec time of the last command if set threshold was exceeded
|
||||
prompt_filthy_cmd_exec_time() {
|
||||
local stop=$((EPOCHREALTIME*1000))
|
||||
local start=${cmd_timestamp:-$stop}
|
||||
integer elapsed=$stop-$start
|
||||
(($elapsed > ${FILTHY_CMD_MAX_EXEC_TIME:=500})) && prompt_filthy_human_time $elapsed
|
||||
}
|
||||
|
||||
prompt_filthy_preexec() {
|
||||
cmd_timestamp=$((EPOCHREALTIME*1000))
|
||||
|
||||
# shows the current dir and executed command in the title when a process is active
|
||||
print -Pn "\e]0;"
|
||||
echo -nE "$PWD:t: $2"
|
||||
print -Pn "\a"
|
||||
}
|
||||
|
||||
# string length ignoring ansi escapes
|
||||
prompt_filthy_string_length() {
|
||||
print ${#${(S%%)1//(\%([KF1]|)\{*\}|\%[Bbkf])}}
|
||||
}
|
||||
|
||||
prompt_filthy_precmd() {
|
||||
local prompt_filthy_preprompt git_root current_path branch repo_status
|
||||
|
||||
# Ensure prompt starts on a new line
|
||||
prompt_filthy_preprompt="\n"
|
||||
|
||||
# Print connection info
|
||||
prompt_filthy_preprompt+="$(prompt_filthy_connection_info)"
|
||||
|
||||
# check if we're in a git repo, and show git info if we are
|
||||
if command git rev-parse --is-inside-work-tree &>/dev/null; then
|
||||
# Print the name of the repository
|
||||
git_root=$(git rev-parse --show-toplevel)
|
||||
prompt_filthy_preprompt+="%B%F{yellow}$(basename ${git_root})%b%f"
|
||||
|
||||
# Print the current_path relative to the git root
|
||||
current_path=$(git rev-parse --show-prefix)
|
||||
prompt_filthy_preprompt+=" %F{blue}${${current_path%/}:-"/"}%f"
|
||||
else
|
||||
# We're not in a repository, so just print the current path
|
||||
prompt_filthy_preprompt+="%F{blue}%~%f"
|
||||
fi
|
||||
|
||||
# Print everything so far in the title
|
||||
# print -Pn '\e]0;${prompt_filthy_preprompt}\a'
|
||||
|
||||
# Echo command exec time
|
||||
prompt_filthy_preprompt+=" %F{yellow}$(prompt_filthy_cmd_exec_time)%f"
|
||||
|
||||
if [[ -f "${ZDOTDIR:-$HOME}/.promptmsg" ]]; then
|
||||
# Echo any stored messages after the pre-prompt
|
||||
prompt_filthy_preprompt+=" $(cat ${ZDOTDIR:-$HOME}/.promptmsg)"
|
||||
fi
|
||||
|
||||
# We've already added any messages to our prompt, so let's reset them
|
||||
cat /dev/null >! "${ZDOTDIR:-$HOME}/.promptmsg"
|
||||
|
||||
print -P $prompt_filthy_preprompt
|
||||
|
||||
# reset value since `preexec` isn't always triggered
|
||||
unset cmd_timestamp
|
||||
}
|
||||
|
||||
prompt_filthy_rprompt() {
|
||||
# check if we're in a git repo, and show git info if we are
|
||||
if command git rev-parse --is-inside-work-tree &>/dev/null; then
|
||||
# Print the repository status
|
||||
branch=$(prompt_filthy_git_branch)
|
||||
repo_status=$(prompt_filthy_git_repo_status)
|
||||
ci_status=$(prompt_filthy_ci_status)
|
||||
fi
|
||||
|
||||
if builtin type zvm >/dev/null 2>&1; then
|
||||
zvm_version=" $(zvm current --quiet)"
|
||||
fi
|
||||
|
||||
print "${branch}${repo_status}${ci_status}%F{yellow}${zvm_version}%f"
|
||||
}
|
||||
|
||||
prompt_filthy_ci_status() {
|
||||
local state git_dir_local state_file
|
||||
|
||||
[[ $FILTHY_SHOW_CI_STATUS -eq 0 ]] && return
|
||||
|
||||
builtin type hub >/dev/null 2>&1 || return
|
||||
|
||||
git_dir_local="$(git rev-parse --git-dir)"
|
||||
state_file="${git_dir_local}/ci-status"
|
||||
|
||||
function _retrieve_ci_status() {
|
||||
# Delay the asynchronous process, otherwise the status file
|
||||
# will be empty when we read it
|
||||
sleep 1
|
||||
|
||||
state=$(hub ci-status 2>&1)
|
||||
cat /dev/null >! "${state_file}" 2>/dev/null
|
||||
case $state in
|
||||
success )
|
||||
print '%F{green}●%f' >> "${state_file}"
|
||||
;;
|
||||
pending )
|
||||
print '%F{yellow}○%f' >> "${state_file}"
|
||||
;;
|
||||
failure )
|
||||
print '%F{red}●%f' >> "${state_file}"
|
||||
;;
|
||||
error )
|
||||
print '%F{red}‼%f' >> "${state_file}"
|
||||
;;
|
||||
'no status' )
|
||||
print '%F{242}○%f' >> "${state_file}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
_retrieve_ci_status >/dev/null 2>&1 &!
|
||||
|
||||
state=$(cat "${state_file}" 2>/dev/null)
|
||||
|
||||
[[ -n $state ]] && print " $state"
|
||||
}
|
||||
|
||||
prompt_filthy_git_repo_status() {
|
||||
# Do a fetch asynchronously
|
||||
git fetch > /dev/null 2>&1 &!
|
||||
|
||||
local clean
|
||||
local rtn=""
|
||||
local count
|
||||
local up
|
||||
local down
|
||||
|
||||
dirty="$(git diff --ignore-submodules=all HEAD 2>/dev/null)"
|
||||
[[ $dirty != "" ]] && rtn+=" %F{242}…%f"
|
||||
|
||||
staged="$(git diff --staged HEAD 2>/dev/null)"
|
||||
[[ $staged != "" ]] && rtn+=" %F{242}*%f"
|
||||
|
||||
# check if there is an upstream configured for this branch
|
||||
# exit if there isn't, as we can't check for remote changes
|
||||
if command git rev-parse --abbrev-ref @'{u}' &>/dev/null; then
|
||||
# if there is, check git left and right arrow_status
|
||||
count="$(command git rev-list --left-right --count HEAD...@'{u}' 2>/dev/null)"
|
||||
|
||||
# Get the push and pull counts
|
||||
up="$count[(w)1]"
|
||||
down="$count[(w)2]"
|
||||
|
||||
# Check if either push or pull is needed
|
||||
[[ $up > 0 || $down > 0 ]] && rtn+=" "
|
||||
|
||||
# Push is needed, show up arrow
|
||||
[[ $up > 0 ]] && rtn+="%F{yellow}⇡%f"
|
||||
|
||||
# Pull is needed, show down arrow
|
||||
[[ $down > 0 ]] && rtn+="%F{yellow}⇣%f"
|
||||
fi
|
||||
|
||||
print $rtn
|
||||
}
|
||||
|
||||
prompt_filthy_git_branch() {
|
||||
# get the current git status
|
||||
local branch git_dir_local rtn
|
||||
|
||||
branch=$(git status --short --branch -uno --ignore-submodules=all | head -1 | awk '{print $2}' 2>/dev/null)
|
||||
git_dir_local=$(git rev-parse --git-dir)
|
||||
|
||||
# remove reference to any remote tracking branch
|
||||
branch=${branch%...*}
|
||||
|
||||
# check if HEAD is detached
|
||||
if [[ -d "${git_dir_local}/rebase-merge" ]]; then
|
||||
branch=$(git status | head -5 | tail -1 | awk '{print $6}')
|
||||
rtn="%F{red}rebasing interactively%f%F{242} → ${branch//([[:space:]]|\')/}%f"
|
||||
elif [[ -d "${git_dir_local}/rebase-apply" ]]; then
|
||||
branch=$(git status | head -2 | tail -1 | awk '{print $6}')
|
||||
rtn="%F{red}rebasing%f%F{242} → ${branch//([[:space:]]|\')/}%f"
|
||||
elif [[ -f "${git_dir_local}/MERGE_HEAD" ]]; then
|
||||
branch=$(git status | head -1 | awk '{print $3}')
|
||||
rtn="%F{red}merging%f%F{242} → ${branch//([[:space:]]|\')/}%f"
|
||||
elif [[ "$branch" = "HEAD" ]]; then
|
||||
commit=$(git status HEAD -uno --ignore-submodules=all | head -1 | awk '{print $4}' 2>/dev/null)
|
||||
|
||||
if [[ "$commit" = "on" ]]; then
|
||||
rtn="%F{yellow}no branch%f"
|
||||
else
|
||||
rtn="%F{242}detached@%f"
|
||||
rtn+="%F{yellow}"
|
||||
rtn+="$commit"
|
||||
rtn+="%f"
|
||||
fi
|
||||
else
|
||||
rtn="%F{242}$branch%f"
|
||||
fi
|
||||
|
||||
print "$rtn"
|
||||
}
|
||||
|
||||
prompt_filthy_connection_info() {
|
||||
# show username@host if logged in through SSH
|
||||
if [[ "x$SSH_CONNECTION" != "x" ]]; then
|
||||
echo '%(!.%B%F{red}%n%f%b.%F{242}%n%f)%F{242}@%m%f '
|
||||
else
|
||||
echo '%(!.%B%F{red}%n%f%b%F{242}@%m%f .)'
|
||||
fi
|
||||
}
|
||||
|
||||
prompt_filthy_setup() {
|
||||
# prevent percentage showing up
|
||||
# if output doesn't end with a newline
|
||||
export PROMPT_EOL_MARK=''
|
||||
|
||||
prompt_opts=(cr subst percent)
|
||||
|
||||
zmodload zsh/datetime
|
||||
autoload -Uz add-zsh-hook
|
||||
# autoload -Uz git-info
|
||||
|
||||
add-zsh-hook precmd prompt_filthy_precmd
|
||||
add-zsh-hook preexec prompt_filthy_preexec
|
||||
|
||||
# prompt turns red if the previous command didn't exit with 0
|
||||
PROMPT='%(?.%F{green}.%F{red}$(prompt_filthy_nice_exit_code))❯%f '
|
||||
|
||||
RPROMPT='$(prompt_filthy_rprompt)'
|
||||
}
|
||||
|
||||
prompt_filthy_setup "$@"
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
+vi-prompt-nerdish-git-hook-enable() {
|
||||
if [ "$(command git rev-parse --is-inside-work-tree 2> /dev/null)" != "true" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
+vi-prompt-nerdish-git-hook-remote-status() {
|
||||
if [ "$1" != "1" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
command git rev-parse --abbrev-ref @'{u}' &>/dev/null || return 0
|
||||
|
||||
local arrow_status=""
|
||||
arrow_status="$(command git rev-list --left-right --count HEAD ...@'{u}' 2>/dev/null)"
|
||||
(( !$? )) || return 0
|
||||
|
||||
arrow_status=(${(ps:\t:)status})
|
||||
|
||||
local arrows left="${arrow_status[0]}" right="${arrow_status[1]}"
|
||||
|
||||
(( ${right:-0} > 0 )) && arrows+="%F{cyan}$(echo -e "${NERDISH_SYMBOL_GIT_STATUS_ARROW_DOWN:-"\uf13a"}")%f"
|
||||
(( ${left:-0} > 0 )) && arrows+="%F{magenta}$(echo -e "${NERDISH_SYMBOL_GIT_STATUS_ARROW_UP:-"\uf139"}")%f"
|
||||
|
||||
if [ -n "${arrows:-}" ]; then
|
||||
hook_com[misc]+="${arrows}"
|
||||
fi
|
||||
}
|
||||
|
||||
prompt_nerdish_precmd() {
|
||||
vcs_info
|
||||
}
|
||||
|
||||
prompt_nerdish_setup() {
|
||||
local _prompt="$(echo -e "${NERDISH_SYMBOL_PROMPT:-"\uf105"}")"
|
||||
local _directory="$(echo -e "${NERDISH_SYMBOL_DIRECTORY:-"\uf0a0"}")"
|
||||
local _branch="$(echo -e "${NERDISH_SYMBOL_GIT_BRANCH:-"\ue725"}")"
|
||||
local _action="$(echo -e "${NERDISH_SYMBOL_GIT_ACTION:-"\uf101"}")"
|
||||
local _staged="$(echo -e "${NERFISH_SYMBOL_GIT_STAGED:-"\uf055"}")"
|
||||
local _unstaged="$(echo -e "${NERDISH_SYMBOL_GIT_UNSTAGED:-"\uf059"}")"
|
||||
|
||||
local _machine=""
|
||||
if [ "$(uname -s)" = "Darwin" ]; then
|
||||
_machine="%F{white}$(echo -e "\uf179")%f"
|
||||
elif [[ "$(uname -s)" =~ "^MSYS2_NT" ]]; then
|
||||
_machine="%F{blue}$(echo -e "\u17a")%f"
|
||||
elif [ "$(uname -s)" = "Linux" ]; then
|
||||
: # TODO
|
||||
fi
|
||||
|
||||
setopt prompt_subst
|
||||
|
||||
autoload -Uz add-zsh-hook
|
||||
autoload -Uz vcs_info
|
||||
|
||||
add-zsh-hook precmd prompt_nerdish_precmd
|
||||
|
||||
zstyle ':vcs_info:*' enable git
|
||||
zstyle ':vcs_info:*' use-simple true
|
||||
zstyle ':vcs_info:*' max-exports 3
|
||||
zstyle ':vcs_info:git:*' check-for-changes true
|
||||
zstyle ':vcs_info:git:*' stagedstr "%F{green}${_staged}%f"
|
||||
zstyle ':vcs_info:git:*' unstagedstr "%F{yellow}${_unstaged}%f"
|
||||
|
||||
zstyle ':vcs_info:git+set-message:*' hooks \
|
||||
prompt-nerdish-git-hook-enable \
|
||||
prompt-nerdish-git-hook-remote-status
|
||||
|
||||
|
||||
zstyle ':vcs_info:git*' formats \
|
||||
"${_branch}%b" \
|
||||
"%c%u %m"
|
||||
zstyle ':vcs_info:git*' actionformats \
|
||||
"${_branche}%b${_action}%a" \
|
||||
"%c%u %m"
|
||||
|
||||
local preline="%F{green}${_directory}%f %F{blue}%~%f"
|
||||
local cmdline="%(?.%F{magenta}.%F{red})${_prompt}%f"
|
||||
|
||||
PROMPT="
|
||||
${preline} \${vcs_info_msg_0_} \${vcs_info_msg_1_}
|
||||
${_machine} ${cmdline}"
|
||||
}
|
||||
|
||||
prompt_nerdish_setup "${@:-}"
|
||||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 7e3a0ddc38a2992e59377d8886aa70e57169e9a3
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 99ef8bc07afed803b461443e0ca7663634c2bb55
|
Loading…
Add table
Reference in a new issue