Add a common env for platform/platform os export
This commit is contained in:
parent
fbd5048dca
commit
12018878a4
15
aliases
15
aliases
|
@ -3,8 +3,6 @@
|
||||||
# to remove those with: `sed -i 's/\r//' <file>` or with `dos2unix`.
|
# to remove those with: `sed -i 's/\r//' <file>` or with `dos2unix`.
|
||||||
#
|
#
|
||||||
|
|
||||||
platform=`uname`
|
|
||||||
|
|
||||||
if which tput >/dev/null 2>&1; then
|
if which tput >/dev/null 2>&1; then
|
||||||
ncolors=$(tput colors)
|
ncolors=$(tput colors)
|
||||||
fi
|
fi
|
||||||
|
@ -28,6 +26,8 @@ else
|
||||||
NORMAL=""
|
NORMAL=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
platform=`uname`
|
||||||
|
|
||||||
####################################################################################################
|
####################################################################################################
|
||||||
# Helper Functions
|
# Helper Functions
|
||||||
####################################################################################################
|
####################################################################################################
|
||||||
|
@ -49,9 +49,16 @@ reload() {
|
||||||
fi
|
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
|
# See top 10 bash commands
|
||||||
hist() {
|
hist() {
|
||||||
if [[ "${platform,,}" == *'ming'* ]]; then
|
if [[ '${platform,,}' == *'ming'* ]]; then
|
||||||
hist_file=~/.bash_history
|
hist_file=~/.bash_history
|
||||||
else
|
else
|
||||||
hist_file=~/.history
|
hist_file=~/.history
|
||||||
|
@ -552,7 +559,7 @@ alias tw-4k-shortname-compressed='dl_twitch_vid "2160p" 1 25'
|
||||||
# Git
|
# Git
|
||||||
####################################################################################################
|
####################################################################################################
|
||||||
|
|
||||||
if [[ $platform != 'Darwin' && $platform != 'Linux' ]]; then
|
if [[ '${platform,,}' == *'ming'* ]]; then
|
||||||
# Fix a weird mingw 'not a valid identifierline' error.
|
# Fix a weird mingw 'not a valid identifierline' error.
|
||||||
# Got the fix from https://github.com/Alexpux/MSYS2-packages/issues/735#issuecomment-328938800
|
# Got the fix from https://github.com/Alexpux/MSYS2-packages/issues/735#issuecomment-328938800
|
||||||
alias git="PATH=/usr/bin git"
|
alias git="PATH=/usr/bin git"
|
||||||
|
|
|
@ -3,13 +3,13 @@
|
||||||
# Unbreak broken, non-colored terminal
|
# Unbreak broken, non-colored terminal
|
||||||
export TERM=xterm-256color
|
export TERM=xterm-256color
|
||||||
|
|
||||||
# For Windows setup
|
test -f ~/.common_env && . ~/.common_env
|
||||||
test -f ~/.aliases && . ~/.aliases
|
|
||||||
test -f ~/.aliases.private && . ~/.aliases.private
|
|
||||||
# Common env must come first.
|
|
||||||
test -f ~/.private-dotfiles.common/env && . ~/.private-dotfiles.common/env
|
test -f ~/.private-dotfiles.common/env && . ~/.private-dotfiles.common/env
|
||||||
test -f ~/.private-dotfiles/env && . ~/.private-dotfiles/env
|
test -f ~/.private-dotfiles/env && . ~/.private-dotfiles/env
|
||||||
|
|
||||||
|
test -f ~/.aliases && . ~/.aliases
|
||||||
|
test -f ~/.aliases.private && . ~/.aliases.private
|
||||||
|
|
||||||
if [[ -d "$HOME/bin" ]]; then
|
if [[ -d "$HOME/bin" ]]; then
|
||||||
export PATH=$HOME/bin/:$PATH
|
export PATH=$HOME/bin/:$PATH
|
||||||
fi
|
fi
|
||||||
|
|
15
common_env
Normal file
15
common_env
Normal file
|
@ -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
|
||||||
|
|
9
install
9
install
|
@ -1,8 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
platform=`uname`
|
if [[ $(uname) == 'Darwin' ]]; then
|
||||||
|
|
||||||
if [[ $platform == 'Darwin' ]]; then
|
|
||||||
if ! command -v brew &>/dev/null
|
if ! command -v brew &>/dev/null
|
||||||
then
|
then
|
||||||
# We need to update bash, so we'll start with setting up homebrew.
|
# We need to update bash, so we'll start with setting up homebrew.
|
||||||
|
@ -55,7 +53,7 @@ setup_zsh() {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
setup_dir .dotfiles/zsh .zsh
|
setup_dir .dotfiles/zsh/core .zsh
|
||||||
|
|
||||||
FILES=()
|
FILES=()
|
||||||
FILES+=('zshrc')
|
FILES+=('zshrc')
|
||||||
|
@ -64,7 +62,7 @@ setup_zsh() {
|
||||||
|
|
||||||
for file in "${FILES[@]}"
|
for file in "${FILES[@]}"
|
||||||
do
|
do
|
||||||
setup_file .dotfiles/$file .$file
|
setup_file .dotfiles/zsh/$file .$file
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,6 +82,7 @@ setup_dir .dotfiles/vim .vim
|
||||||
# Setup root files
|
# Setup root files
|
||||||
#########################
|
#########################
|
||||||
FILES=()
|
FILES=()
|
||||||
|
FILES+=('common_env')
|
||||||
FILES+=('aliases')
|
FILES+=('aliases')
|
||||||
FILES+=('gitconfig')
|
FILES+=('gitconfig')
|
||||||
FILES+=('vimrc')
|
FILES+=('vimrc')
|
||||||
|
|
0
zsh/func/prompt_wunjo_setup → zsh/core/func/prompt_wunjo_setup
Executable file → Normal file
0
zsh/func/prompt_wunjo_setup → zsh/core/func/prompt_wunjo_setup
Executable file → Normal file
0
zsh/func/zgitinit → zsh/core/func/zgitinit
Executable file → Normal file
0
zsh/func/zgitinit → zsh/core/func/zgitinit
Executable file → Normal file
|
@ -90,12 +90,13 @@ bindkey -e
|
||||||
source $ZSH/lib/*.zsh
|
source $ZSH/lib/*.zsh
|
||||||
|
|
||||||
# Source my custom files after oh-my-zsh so I can override things.
|
# Source my custom files after oh-my-zsh so I can override things.
|
||||||
test -f $HOME/.aliases && . $HOME/.aliases
|
test -f $HOME/.common_env && . $HOME/.common_env
|
||||||
test -f $HOME/.aliases.private && . $HOME/.aliases.private
|
|
||||||
# Common env must come first.
|
|
||||||
test -f $HOME/.private-dotfiles.common/env && . $HOME/.private-dotfiles.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/.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
|
if [[ -d "$HOME/bin" ]]; then
|
||||||
export PATH=$HOME/bin/:$PATH
|
export PATH=$HOME/bin/:$PATH
|
||||||
fi
|
fi
|
Loading…
Reference in New Issue
Block a user