summaryrefslogtreecommitdiff
path: root/config/profile
diff options
context:
space:
mode:
authorThomas Ulmer <thomasmulmer02@gmail.com>2026-07-08 09:56:36 -0700
committerThomas Ulmer <thomasmulmer02@gmail.com>2026-07-08 09:56:36 -0700
commit19bc81f77b82b70e27ad03aeb41de9a4e507bcce (patch)
tree26d13367f90efadca2780be445204aa5ae89b203 /config/profile
parent8e8e5241e96dc1bec3d897f514b77553da033529 (diff)
merge profile, make sh generic to allow ksh
Diffstat (limited to 'config/profile')
-rw-r--r--config/profile159
1 files changed, 159 insertions, 0 deletions
diff --git a/config/profile b/config/profile
new file mode 100644
index 0000000..e0df453
--- /dev/null
+++ b/config/profile
@@ -0,0 +1,159 @@
+case $- in
+ *i*) INTERACTIVE=1 ;;
+ *) INTERACTIVE=0 ;;
+esac
+
+if [ -z "$XDG_RUNTIME_DIR" ]; then
+ XDG_RUNTIME_DIR=$(mktemp -d "/tmp/$(id -u)-runtime-dir.XXX")
+ export XDG_RUNTIME_DIR
+fi
+
+########################################################################
+
+prepend_path() {
+ if [ -d "$1" ]; then
+ case ":$PATH:" in
+ *:"$1":*) ;;
+ *) PATH=$1:$PATH ;;
+ esac
+ fi
+}
+
+prepend_path "$HOME/.ghcup/bin"
+prepend_path "$HOME/.cabal/bin"
+prepend_path "$HOME/.cargo/bin"
+prepend_path "$HOME/.mcabal/bin"
+prepend_path "$HOME/.local/musl/bin"
+prepend_path "$HOME/.local/bin"
+
+export PATH
+
+########################################################################
+
+if [ -d /usr/local/lib/pkgconfig ]; then
+ if [ -n "$PKG_CONFIG_PATH" ]; then
+ PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
+ else
+ PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
+ fi
+ export PKG_CONFIG_PATH
+fi
+
+########################################################################
+
+export EDITOR=vi
+export ALTERNATE_EDITOR=vi
+export VISUAL=vi
+
+export MORE=FRX
+export LESS=FRX
+export EXINIT='set ai ic nu sw=4 ts=4 nofl magic'
+
+if command -v less >/dev/null 2>&1; then
+ PAGER=less
+elif command -v more >/dev/null 2>&1; then
+ PAGER=more
+else
+ PAGER=cat
+fi
+export PAGER
+
+########################################################################
+
+HISTCONTROL=ignoreboth
+HISTSIZE=1000
+HISTFILESIZE=2000
+export HISTCONTROL HISTSIZE HISTFILESIZE
+
+########################################################################
+
+if [ "$INTERACTIVE" = 1 ]; then
+ color=no
+ if command -v tput >/dev/null 2>&1 &&
+ tput setaf 1 >/dev/null 2>&1
+ then
+ color=yes
+ fi
+
+ case "$TERM" in
+ xterm-color|*-256color)
+ color=yes
+ ;;
+ esac
+
+ user=$(id -un 2>/dev/null || echo '?')
+ host=$(hostname 2>/dev/null || uname -n)
+
+ if [ "$color" = yes ]; then
+ PS1="$(printf '\033[1;32m')${user}@${host}$(printf '\033[0m'):$(printf '\033[1;34m')"'$PWD'"$(printf '\033[0m')\$ "
+ else
+ PS1="${user}@${host}:\$PWD\$ "
+ fi
+
+ case "$TERM" in
+ xterm*|rxvt*|st*|alacritty*)
+ PS1="$(printf '\033]0;%s@%s: %s\007' "$user" "$host" '$PWD')$PS1"
+ ;;
+ esac
+
+ export PS1
+fi
+
+########################################################################
+
+if [ "$INTERACTIVE" = 1 ]; then
+
+ alias cb='xclip -selection clipboard'
+ alias bctl='bluetoothctl'
+ alias less='less -i'
+
+ alias e='emacs'
+ alias a='emacsclient -n'
+ alias femacs='fbterm -- fbterm-emacs.sh'
+ alias demacs='emacs --daemon'
+
+ alias ta='tmux attach'
+
+ alias gl='git log --graph --all --oneline'
+ alias glt='git log --graph --all --oneline --simplify-by-decoration'
+ alias gs='git status'
+ alias gc='git checkout'
+ alias gb='git branch'
+ alias gd='git diff --patch'
+ alias gds='git diff --patch --cached'
+
+ # Only define if supported.
+ command -v pushd >/dev/null 2>&1 && alias pd=pushd
+ command -v popd >/dev/null 2>&1 && alias ppd=popd
+
+ alias up='cd ..'
+
+ alias cdp='cd "$(git worktree list --porcelain | awk '"'"'$1=="worktree"{print $2; exit}'"'"')"'
+
+ alias ll='ls -la'
+ alias l='lk'
+
+ ls --color=auto >/dev/null 2>&1 && alias ls='ls --color=auto'
+ grep --color=auto "" </dev/null >/dev/null 2>&1 && \
+ alias grep='grep --color=auto'
+
+fi
+
+########################################################################
+
+if [ -n "$BASH_VERSION" ]; then
+ shopt -s histappend checkwinsize globstar
+fi
+
+########################################################################
+
+if [ -n "$EAT_SHELL_INTEGRATION_DIR" ]; then
+ case "$BASH_VERSION" in
+ "")
+ ;;
+ *)
+ [ -f "$EAT_SHELL_INTEGRATION_DIR/bash" ] &&
+ . "$EAT_SHELL_INTEGRATION_DIR/bash"
+ ;;
+ esac
+fi