From 76dc1a55f50fbe3b966641110e810c8efc805eb0 Mon Sep 17 00:00:00 2001 From: Sam Nystrom Date: Sun, 4 Feb 2024 10:29:26 -0500 Subject: Switch from yash to busybox ash --- .ashrc | 22 +++++++++++++++++ .profile | 24 ++++++------------- .yashrc | 84 ---------------------------------------------------------------- 3 files changed, 29 insertions(+), 101 deletions(-) create mode 100644 .ashrc delete mode 100644 .yashrc diff --git a/.ashrc b/.ashrc new file mode 100644 index 0000000..e2b926e --- /dev/null +++ b/.ashrc @@ -0,0 +1,22 @@ +# Prompt +PS1='\e[1;36m$(pwd | sed "1s#^$HOME#~#")\e[34m $([ -n "$(jobs)" ] && printf "* ")\e[3$((1+!$?))m$\e[m ' + +export EDITOR=vis +export VISUAL=vis +export PAGER=less +export SHELL=ash +export TERMINAL=foot +export BROWSER=firefox +export GTK_THEME=Catppuccin-Macchiato-Standard-Mauve-Dark +export DBUS_SESSION_BUS_ADDRESS=unix:path="$XDG_RUNTIME_DIR"/bus + +alias ..='cd ..' +alias ...='cd ../..' +alias ....='cd ../../..' +alias cfg='git --git-dir ~/.cfg --work-tree ~' +alias fs='fossil' +alias s6-rclocal='s6-rc -l "$XDG_RUNTIME_DIR"/s6-rc' + +s6less() { + s6-tai64nlocal < ~/.local/state/s6/logs/"$1"/current | less -R +} diff --git a/.profile b/.profile index 033a9ee..41e6817 100644 --- a/.profile +++ b/.profile @@ -1,31 +1,21 @@ # Add PATH entries if they aren't already in PATH # We can't use external commands yet in case PATH is empty -for p in /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin "$HOME"/.local/bin "$HOME"/.cargo/bin "$HOME"/bin; do +for p in /bin /sbin /usr/bin /usr/sbin /var/lib/flatpak/exports/bin /usr/local/bin /usr/local/sbin ~/.local/bin ~/.cargo/bin ~/bin; do case ":$PATH:" in - *:"$p":*) ;; - *) export PATH="$PATH:$p" ;; + *:"$p":*) ;; + *) export PATH="$p:$PATH" ;; esac done # Create a tmpdir for XDG_RUNTIME_DIR if it is not set -if ! [ "$XDG_RUNTIME_DIR" ]; then +if [ -z "$XDG_RUNTIME_DIR" ]; then rundir="/run/user/$(id -u)" if [ -d "$rundir" ]; then export XDG_RUNTIME_DIR="$rundir" else - XDG_RUNTIME_DIR="$(mktemp -d)" - export XDG_RUNTIME_DIR + export XDG_RUNTIME_DIR="$(mktemp -d)" fi fi -# Set environment variables -export EDITOR=vim -export VISUAL=vim -export PAGER=less -export SHELL=yash -export TERMINAL=foot -export BROWSER=firefox -export GTK_THEME=Catppuccin-Macchiato-Standard-Mauve-Dark -export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR"/hissh-agent -export DBUS_SESSION_BUS_ADDRESS=unix:path="$XDG_RUNTIME_DIR"/bus -export XDG_CURRENT_DESKTOP=sway +export ENV=~/.ashrc +. $ENV diff --git a/.yashrc b/.yashrc deleted file mode 100644 index 3f4fe05..0000000 --- a/.yashrc +++ /dev/null @@ -1,84 +0,0 @@ -_ps1_prompt() { - cmd_status=$? - cmd_duration=$((CMD_DURATION / 1000)) - CMD_DURATION=0 - is_git=$(git rev-parse --is-inside-work-tree 2>/dev/null) - - prompt="\n\\foc." - if [ "$is_git" ]; then - prompt="$prompt$(git rev-parse --show-toplevel | awk -F/ '{ print $NF }')" - git_path=$(git rev-parse --show-prefix) - git_path="${git_path%/}" - prompt="$prompt${git_path:+"/$git_path"}" - elif [ "${PWD#"$HOME"}" != "$PWD" ]; then - prompt="$prompt~${PWD#"$HOME"}" - else - prompt="$prompt$PWD" - fi - prompt="$prompt\\fD." - - if [ "$is_git" ]; then - prompt="$prompt on \\fom. $(git branch --show-current)" - - stat= - git rev-parse --verify refs/stash >/dev/null 2>&1 && stat="$stat\$" - status="$(git status --porcelain -b)" - case "$status" in - U[UDA]*|AA*|DD*|[DA]U*) stat="$stat=" ;; - esac - case "$status" in - [MARCDU\ ]D*|D[\ UM]*) stat="$stat✘" ;; - esac - case "$status" in - R[\ MD]*) stat="$stat»" ;; - esac - case "$status" in - [\ MARC]M*) stat="$stat!" ;; - esac - case "$status" in - A[\ MDAU]*|M[\ MD]*|UA*) stat="$stat+" ;; - esac - case "$status" in - '??'*) stat="$stat?" ;; - esac - case "$status" in - '## '*ahead*behind*) stat="$stat⇕" ;; - '## '*ahead*) stat="$stat⇡" ;; - '## '*behind*) stat="$stat⇣" ;; - esac - prompt="$prompt${stat:+"\\for. [$stat]"}" - fi - - if [ "$cmd_duration" -gt 1 ]; then - prompt="$prompt took\\foy." - - secs=$((cmd_duration % 60)) - mins=$((cmd_duration / 60 % 60)) - hours=$((cmd_duration / 3600)) - - [ "$hours" -gt 0 ] && prompt="$prompt ${hours}h" - [ "$mins" -gt 0 ] && prompt="$prompt ${mins}m" - [ "$secs" -gt 0 ] && prompt="$prompt ${secs}s" - fi - prompt="$prompt\n" - - n_jobs="$(jobs 2>/dev/null | wc -l)" - if [ "$n_jobs" -gt 0 ]; then - [ "$n_jobs" -le 1 ] && n_jobs= - prompt="$prompt\\fob.✦ ${n_jobs:+"$n_jobs "}" - fi - case "$cmd_status" in - 0) printf '%s\\fg.❯ \\fD.' "$prompt" ;; - *) printf '%s\\fr.❯ \\fD.' "$prompt" ;; - esac -} - -export PS1='$(_ps1_prompt)' - -export HISTSIZE=100000 -export HISTRMDUP=10 - -set le-predict - -alias cfg='git --git-dir ~/.cfg --work-tree ~' -alias tree='tree -C' -- cgit v1.2.3