diff --git a/zsh/functions.zsh b/zsh/functions.zsh index c82beec..29772d6 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -16,10 +16,6 @@ viscd() { rm -f -- "$temp_file" } -is_linux() { [[ "$OSTYPE" == linux* ]]; } -is_macos() { [[ "$OSTYPE" == darwin* ]]; } -is_android() { [[ "$OSTYPE" == linux-android ]]; } - command_exists() { command -v "$1" &>/dev/null; } lazy_load() { @@ -33,8 +29,8 @@ lazy_load() { }" } -if ! is_macos; then - if is_android; then +if (( ! _is_macos )); then + if (( _is_android )); then open_cmd='termux-open' elif command_exists xdg-open; then open_cmd='nohup xdg-open &> /dev/null' @@ -45,7 +41,7 @@ if ! is_macos; then unset open_cmd fi -if is_macos; then +if (( _is_macos )); then copy_cmd='pbcopy' paste_cmd='pbpaste' elif command_exists xclip; then copy_cmd='xclip -in -selection clipboard' paste_cmd='xclip -out -selection clipboard' diff --git a/zsh/path.zsh b/zsh/path.zsh index 37ea188..6cc275d 100644 --- a/zsh/path.zsh +++ b/zsh/path.zsh @@ -17,7 +17,7 @@ path_prepend() { done } -if is_macos; then +if (( _is_macos )); then # local Python binaries (for some reason they don't go into ~/.local/bin, but # instead into the garbage ~/Library directory) path_prepend path ~/Library/Python/*/bin(OnN) diff --git a/zsh/zshrc b/zsh/zshrc index b9ec0b2..729b50e 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -33,6 +33,19 @@ autoload -U colors && colors _perf_timer_start "total" +# platform identification {{{ + if [[ "$OSTYPE" == linux* ]]; then + _is_linux=1 + if [[ "$OSTYPE" == linux-android ]]; then + _is_android=1 + fi + fi + + if [[ "$OSTYPE" == darwin* ]]; then + _is_macos=1 + fi +# }}} + for script in functions options path env plugins aliases completion zle prompt colorscheme; do _perf_timer_start "$script.zsh" source "$ZSH_DOTFILES/$script.zsh"