Last active
June 3, 2020 16:12
-
-
Save nfet/bf947bf77fba5cc3d474b6a7e38c28b3 to your computer and use it in GitHub Desktop.
ZShell Stuff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# git | |
autoload -Uz vcs_info | |
precmd_vcs_info() { vcs_info } | |
precmd_functions+=( precmd_vcs_info ) | |
setopt prompt_subst | |
RPROMPT=\$vcs_info_msg_0_ | |
zstyle ':vcs_info:git:*' formats '%F{240}(%b)%r%f' | |
zstyle ':vcs_info:*' enable git | |
source zshrc.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# defines all the functions that os/zshrc.sh can use | |
#_verbose=true | |
_this_script="${(%):-%N}" | |
function _echo_script_name() { | |
if [[ "${_verbose}" == "true" ]]; then | |
echo sourcing $1 | |
fi | |
} | |
function _echo_script() { | |
if [[ "${_verbose}" == "true" ]]; then | |
echo sourcing $1 | |
fi | |
} | |
_echo_script_name "${_this_script}" | |
function include () { | |
[[ -f "$1" ]] && source "$1" | |
} | |
function _get_path() { | |
echo "$( cd "$1" && pwd )" | |
} | |
function _load_scripts() { | |
local dir=$1 | |
local i | |
if [ -d "${dir}" ]; then | |
for i in ${dir}/*.sh; do | |
if [ -r $i ]; then | |
_echo_script $i && source $i | |
fi | |
done | |
fi | |
} | |
function _init() { | |
local SOURCE=$1 | |
local script="$(basename $SOURCE)" | |
local cwd="$( cd "$( dirname "$SOURCE" )" && pwd )" | |
local source="${cwd}/${script}" | |
# echo cwd: $cwd | |
echo sourcing ${source} | |
local pre_dir="$(_get_path "${cwd}/../_pre")" | |
local post_dir="$(_get_path "${cwd}/../_post")" | |
local common_dir="$(_get_path "${cwd}/../common")" | |
local scripts_dir="$(_get_path "${cwd}/scripts")" | |
_load_scripts ${pre_dir} | |
_load_scripts ${common_dir} | |
_load_scripts ${scripts_dir} | |
_load_scripts ${post_dir} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment