diff --git a/aliases b/aliases index bd3e070..348fab9 100644 --- a/aliases +++ b/aliases @@ -3,8 +3,6 @@ # to remove those with: `sed -i 's/\r//' ` or with `dos2unix`. # -platform=`uname` - if which tput >/dev/null 2>&1; then ncolors=$(tput colors) fi @@ -28,6 +26,8 @@ else NORMAL="" fi +platform=`uname` + #################################################################################################### # Helper Functions #################################################################################################### @@ -49,9 +49,16 @@ reload() { fi } +update-shell() { + if [[ '${platform,,}' == *'ming'* ]]; then + pacman -Syu + printf "\n${BOLD}${YELLOW}Close this shell, open a new one, and then run 'pacman -Su'${NORMAL}\n" + fi +} + # See top 10 bash commands hist() { - if [[ "${platform,,}" == *'ming'* ]]; then + if [[ '${platform,,}' == *'ming'* ]]; then hist_file=~/.bash_history else hist_file=~/.history @@ -552,7 +559,7 @@ alias tw-4k-shortname-compressed='dl_twitch_vid "2160p" 1 25' # Git #################################################################################################### -if [[ $platform != 'Darwin' && $platform != 'Linux' ]]; then +if [[ '${platform,,}' == *'ming'* ]]; then # Fix a weird mingw 'not a valid identifierline' error. # Got the fix from https://github.com/Alexpux/MSYS2-packages/issues/735#issuecomment-328938800 alias git="PATH=/usr/bin git" diff --git a/bash/bashrc b/bash/bashrc index 912fb8b..85a544e 100644 --- a/bash/bashrc +++ b/bash/bashrc @@ -3,13 +3,13 @@ # Unbreak broken, non-colored terminal export TERM=xterm-256color -# For Windows setup -test -f ~/.aliases && . ~/.aliases -test -f ~/.aliases.private && . ~/.aliases.private -# Common env must come first. +test -f ~/.common_env && . ~/.common_env test -f ~/.private-dotfiles.common/env && . ~/.private-dotfiles.common/env test -f ~/.private-dotfiles/env && . ~/.private-dotfiles/env +test -f ~/.aliases && . ~/.aliases +test -f ~/.aliases.private && . ~/.aliases.private + if [[ -d "$HOME/bin" ]]; then export PATH=$HOME/bin/:$PATH fi diff --git a/common_env b/common_env new file mode 100644 index 0000000..1e42a98 --- /dev/null +++ b/common_env @@ -0,0 +1,15 @@ +# Common env for all shells. + +uname_s="$(uname -s)" +case "${uname_s}" in + Linux*) platform="LINUX" platform_os="LINUX";; + Darwin*) platform="MACOS" platform_os="MACOS";; + CYGWIN*) platform="CYGWIN" platform_os="WINDOWS";; + MINGW*) platform="MINGW" platform_os="WINDOWS";; + MSYS*) platform="MINGW" platform_os="WINDOWS";; + *) platform="UNKNOWN:${uname_s} platform_os="UNKNOWN_OS"" +esac + +export PLATFORM=$platform +export PLATFORM_OS=$platform_os + diff --git a/install b/install index 5e03a2c..baf2f15 100755 --- a/install +++ b/install @@ -1,8 +1,6 @@ #!/usr/bin/env bash -platform=`uname` - -if [[ $platform == 'Darwin' ]]; then +if [[ $(uname) == 'Darwin' ]]; then if ! command -v brew &>/dev/null then # We need to update bash, so we'll start with setting up homebrew. @@ -55,7 +53,7 @@ setup_zsh() { fi fi - setup_dir .dotfiles/zsh .zsh + setup_dir .dotfiles/zsh/core .zsh FILES=() FILES+=('zshrc') @@ -64,7 +62,7 @@ setup_zsh() { for file in "${FILES[@]}" do - setup_file .dotfiles/$file .$file + setup_file .dotfiles/zsh/$file .$file done } @@ -84,6 +82,7 @@ setup_dir .dotfiles/vim .vim # Setup root files ######################### FILES=() +FILES+=('common_env') FILES+=('aliases') FILES+=('gitconfig') FILES+=('vimrc') diff --git a/zsh/func/prompt_grb_setup b/zsh/core/func/prompt_grb_setup similarity index 100% rename from zsh/func/prompt_grb_setup rename to zsh/core/func/prompt_grb_setup diff --git a/zsh/func/prompt_wunjo_setup b/zsh/core/func/prompt_wunjo_setup old mode 100755 new mode 100644 similarity index 100% rename from zsh/func/prompt_wunjo_setup rename to zsh/core/func/prompt_wunjo_setup diff --git a/zsh/func/zgitinit b/zsh/core/func/zgitinit old mode 100755 new mode 100644 similarity index 100% rename from zsh/func/zgitinit rename to zsh/core/func/zgitinit diff --git a/zsh/lib/completion.zsh b/zsh/core/lib/completion.zsh similarity index 100% rename from zsh/lib/completion.zsh rename to zsh/core/lib/completion.zsh diff --git a/zsh/lib/history.zsh b/zsh/core/lib/history.zsh similarity index 100% rename from zsh/lib/history.zsh rename to zsh/core/lib/history.zsh diff --git a/zsh/plugins/safe-paste/safe-paste.plugin.zsh b/zsh/core/plugins/safe-paste/safe-paste.plugin.zsh similarity index 100% rename from zsh/plugins/safe-paste/safe-paste.plugin.zsh rename to zsh/core/plugins/safe-paste/safe-paste.plugin.zsh diff --git a/zlogin b/zsh/zlogin similarity index 100% rename from zlogin rename to zsh/zlogin diff --git a/zshenv b/zsh/zshenv similarity index 100% rename from zshenv rename to zsh/zshenv diff --git a/zshrc b/zsh/zshrc similarity index 98% rename from zshrc rename to zsh/zshrc index 01126a2..3dd1587 100644 --- a/zshrc +++ b/zsh/zshrc @@ -90,12 +90,13 @@ bindkey -e source $ZSH/lib/*.zsh # Source my custom files after oh-my-zsh so I can override things. -test -f $HOME/.aliases && . $HOME/.aliases -test -f $HOME/.aliases.private && . $HOME/.aliases.private -# Common env must come first. +test -f $HOME/.common_env && . $HOME/.common_env test -f $HOME/.private-dotfiles.common/env && . $HOME/.private-dotfiles.common/env test -f $HOME/.private-dotfiles/env && . $HOME/.private-dotfiles/env +test -f $HOME/.aliases && . $HOME/.aliases +test -f $HOME/.aliases.private && . $HOME/.aliases.private + if [[ -d "$HOME/bin" ]]; then export PATH=$HOME/bin/:$PATH fi