From 19bc81f77b82b70e27ad03aeb41de9a4e507bcce Mon Sep 17 00:00:00 2001 From: Thomas Ulmer Date: Wed, 8 Jul 2026 09:56:36 -0700 Subject: merge profile, make sh generic to allow ksh --- config/bash_aliases | 29 ---------- config/bash_profile | 39 ------------- config/bashrc | 69 ----------------------- config/profile | 159 ++++++++++++++++++++++++++++++++++++++++++++++++++++ setup.sh | 6 +- 5 files changed, 161 insertions(+), 141 deletions(-) delete mode 100644 config/bash_aliases delete mode 100644 config/bash_profile delete mode 100644 config/bashrc create mode 100644 config/profile diff --git a/config/bash_aliases b/config/bash_aliases deleted file mode 100644 index 9da49df..0000000 --- a/config/bash_aliases +++ /dev/null @@ -1,29 +0,0 @@ -#aliases for bash -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" - -alias pd="pushd" -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" -alias ls="ls --color=auto" -alias grep='grep --color=auto' diff --git a/config/bash_profile b/config/bash_profile deleted file mode 100644 index 1613f56..0000000 --- a/config/bash_profile +++ /dev/null @@ -1,39 +0,0 @@ -# This file is sourced by bash for login shells. The following line -# runs your .bashrc and is recommended by the bash info pages. - -# Ensure XDG_RUNTIME_DIR is set -if test -z "$XDG_RUNTIME_DIR"; then - export XDG_RUNTIME_DIR=$(mktemp -d /tmp/$(id -u)-runtime-dir.XXX) -fi - -if [[ -f ~/.bashrc ]] ; then - . ~/.bashrc -fi - -if [ -d ~/.ghcup/bin ]; then - export PATH=~/.ghcup/bin:$PATH -fi - -if [ -d ~/.cabal/bin ]; then - export PATH=~/.cabal/bin:$PATH -fi - -if [ -d ~/.cargo/bin ]; then - export PATH=~/.cargo/bin:$PATH -fi - -if [ -d ~/.mcabal/bin ]; then - export PATH=~/.mcabal/bin:$PATH -fi - -if [ -d ~/.local/musl/bin ]; then - export PATH=~/.local/musl/bin:$PATH -fi - -if [ -d ~/.local/bin ]; then - export PATH=~/.local/bin:$PATH -fi - -if [ -d /usr/local/lib/pkgconfig ]; then - export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH -fi diff --git a/config/bashrc b/config/bashrc deleted file mode 100644 index 8755bbf..0000000 --- a/config/bashrc +++ /dev/null @@ -1,69 +0,0 @@ -# If not running interactively, don't do anything -case $- in - *i*) ;; - *) return;; -esac - -# don't put duplicate lines or lines starting with space in the history. -# See bash(1) for more options -HISTCONTROL=ignoreboth - -# append to the history file, don't overwrite it -shopt -s histappend - -# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) -HISTSIZE=1000 -HISTFILESIZE=2000 - -# check the window size after each command and, if necessary, -# update the values of LINES and COLUMNS. -shopt -s checkwinsize - -# If set, the pattern "**" used in a pathname expansion context will -# match all files and zero or more directories and subdirectories. -shopt -s globstar - -# set a fancy prompt (non-color, unless we know we "want" color) -case "$TERM" in - xterm-color|*-256color) color_prompt=yes;; -esac - -if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then - # We have color support; assume it's compliant with Ecma-48 - # (ISO/IEC-6429). (Lack of such support is extremely rare, and such - # a case would tend to support setf rather than setaf.) - color_prompt=yes -else - color_prompt= -fi - -if [ "$color_prompt" = yes ]; then - PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' -else - PS1='\u@\h:\w\$ ' -fi -unset color_prompt - -# If this is an xterm set the title to user@host:dir -case "$TERM" in - xterm*|rxvt*|st*|alacritty*) - PS1="\[\e]0;\u@\h: \w\a\]$PS1" - ;; - *) - ;; -esac - -[ -n "$EAT_SHELL_INTEGRATION_DIR" ] && \ - source "$EAT_SHELL_INTEGRATION_DIR/bash" - -export ALTERNATE_EDITOR=emacs -export EDITOR="emacsclient -c" -export VISUAL="emacsclient -c" -export MORE="FRX" -export LESS="FRX" -export PAGER=$(which less || which more || echo "cat") -export EXINIT="set ai ic sw=4 ts=4 nofl magic" - -if [ -f ~/.bash_aliases ]; then - . ~/.bash_aliases -fi 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 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 diff --git a/setup.sh b/setup.sh index 6a117d3..82316e8 100755 --- a/setup.sh +++ b/setup.sh @@ -22,9 +22,7 @@ if confirm "Check and install symlinks?"; then mkdir -p ${there}.local/bin ln -s ${here}config/emacs ${there}.emacs.d - ln -s ${here}config/bash_profile ${there}.bash_profile - ln -s ${here}config/bashrc ${there}.bashrc - ln -s ${here}config/bash_aliases ${there}.bash_aliases + ln -s ${here}config/profile ${there}.profile ln -s ${here}config/tcshrc ${there}.tcshrc ln -s ${here}config/xinitrc ${there}.xinitrc ln -s ${here}config/tmux.conf ${there}.tmux.conf @@ -48,4 +46,4 @@ if confirm "Check and install symlinks?"; then ln -s ${here}scripts/misc/battery.sh ${there}.local/bin/tmubattery fi -echo "All set up, remember to source ~/.bash_profile and symlink tmubrowse and tmuterm." +echo "All set up, remember to source ~/.profile and symlink tmubrowse and tmuterm." -- cgit v1.2.3