122 lines
2.8 KiB
Plaintext
122 lines
2.8 KiB
Plaintext
# (mk)shrc
|
||
|
||
if [ -f /etc/shrc ]; then
|
||
. /etc/shrc
|
||
fi
|
||
|
||
export EDITOR=vim
|
||
|
||
# Force 256color term for screen
|
||
if [ "$TERM" = "screen" ] ; then
|
||
TERM="screen-256color"
|
||
export TERM
|
||
fi
|
||
|
||
export LANG=
|
||
export LC_ALL=en_US.UTF-8
|
||
|
||
## Ripped from a custom /etc/shrc, not very useful here
|
||
UID="$(id -u)"
|
||
if [ "$UID" -eq "0" ] ; then
|
||
PROMPT="#"
|
||
USER_COLOR='[31m'
|
||
else
|
||
PROMPT="$"
|
||
USER_COLOR='[96m'
|
||
fi
|
||
|
||
get_ps1() {
|
||
rv=$?
|
||
if [ "$rv" -ne "0" -a "$rv" -ne "130" ] ; then
|
||
print -n "$rv | "
|
||
fi
|
||
if [ -n "$SSH_TTY" ] ; then
|
||
print -n "[33m[SSH] "
|
||
fi
|
||
print -n "${USER_COLOR}${HOST%%.*}:[39m";
|
||
if [[ "${PWD#$HOME}" != "$PWD" ]] ; then
|
||
print -n "~${PWD#$HOME}"
|
||
else
|
||
print -n "$PWD"
|
||
fi
|
||
print -n "${USER_COLOR} ${PROMPT}[0m "
|
||
}
|
||
|
||
case "$-" in *i*)
|
||
# interactive mode settings go here
|
||
if /bin/test -z "${HOST}"; then
|
||
HOST="$(hostname)"
|
||
fi
|
||
PS1='$(get_ps1)'
|
||
set -o emacs
|
||
# This file is used by shells that might not support
|
||
# set -o tabcomplete, so check before trying to use it.
|
||
( set -o tabcomplete 2>/dev/null ) && set -o tabcomplete
|
||
|
||
alias gpg='gpg2'
|
||
alias ctop='xclip -selection clipboard -out | xclip -selection primary -in'
|
||
alias ptoc='xclip -selection primary -out | xclip -selection primary -in'
|
||
alias mutt='neomutt'
|
||
alias define='dict'
|
||
# Hack to bubble up profile, see bin/tmux-shim
|
||
alias tmux="$HOME/bin/tmux-shim"
|
||
|
||
if [ "${KSH_VERSION:-notksh}" != "notksh" ] ; then
|
||
[[ "${KSH_VERSION}" == *"MIRBSD KSH"* ]] && bind '^L=clear-screen'
|
||
else
|
||
hn="$(hostname)"
|
||
PS1='${hn}:${PWD} \$ '
|
||
fi
|
||
|
||
calc()
|
||
{
|
||
echo "$@" | bc
|
||
}
|
||
|
||
nconv()
|
||
{
|
||
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then
|
||
echo "usage: nconv [from-base] [to-base] [num]" >&2
|
||
return 1
|
||
fi
|
||
|
||
echo "obase=$2; ibase=$1; $3" | bc
|
||
}
|
||
;;
|
||
esac
|
||
|
||
if [ -f "$HOME/.cargo/env" ] ; then
|
||
. $HOME/.cargo/env
|
||
fi
|
||
|
||
# Python packages go here
|
||
if [ -d "$HOME/.local/bin" ] ; then
|
||
PATH="$HOME/.local/bin:$PATH"
|
||
fi
|
||
|
||
# Homebrew (macOS)
|
||
if [ -d "/opt/homebrew" ] ; then
|
||
PATH="/opt/homebrew/bin:/opt/homebrew/sbin:/sbin:/usr/sbin:$PATH"
|
||
HOMEBREW_CASK_OPTS="--appdir=~/Applications"
|
||
export HOMEBREW_CASK_OPTS
|
||
# x86 brew hack
|
||
if [ -d "$HOME/.x86_64/homebrew" ] ; then
|
||
brew86() {
|
||
PATH="$HOME/.x86_64/homebrew/bin:$PATH" arch -x86_64 $HOME/.x86_64/homebrew/bin/brew "$@"
|
||
}
|
||
fi
|
||
fi
|
||
|
||
# Flutter
|
||
if [ -d "$HOME/.opt/flutter" ] ; then
|
||
PATH="$HOME/.opt/flutter/bin:$PATH"
|
||
fi
|
||
|
||
# Android SDK (for VMs)
|
||
if [ -d "$HOME/Library/Android/sdk" ] ; then
|
||
export ANDROID_SDK_ROOT=$HOME/Library/Android/sdk
|
||
PATH="$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$ANDROID_SDK_ROOT/emulator:$ANDROID_SDK_ROOT/platform-tools:$PATH"
|
||
fi
|
||
|
||
export PATH
|