From b53471edbde90e63f06c23eb82eb36051ada692c Mon Sep 17 00:00:00 2001 From: Andrea Rogers Date: Sat, 6 Jan 2024 04:02:23 -0600 Subject: [PATCH] bashrc: Terminal.app improvements, aliases broken out On the Mac terminal sessions don't seem to retain the same environment as the one that parses their .bashrc files. So, to overcome that, all aliases and PATH/variable changes are done in .profile (or files sourced by .profile). There aren't any .profiles checked in yet, but stay tuned ;-) --- .aliases/python.bash | 4 ++++ .bashrc | 9 +++------ .bashrc.mac | 12 +++++++++++- 3 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 .aliases/python.bash diff --git a/.aliases/python.bash b/.aliases/python.bash new file mode 100644 index 0000000..68ce71f --- /dev/null +++ b/.aliases/python.bash @@ -0,0 +1,4 @@ +# Python +alias mk-venv='python -m venv .venv' +alias do-venv='. .venv/bin/activate' +alias rm-venv='rm -rf .venv' diff --git a/.bashrc b/.bashrc index 0e4aab6..734ffdb 100644 --- a/.bashrc +++ b/.bashrc @@ -1,6 +1,8 @@ +#!/usr/bin/env bash + command -v port >/dev/null && command -v uname >/dev/null && - [ $(uname) == 'Darwin' ] && . .bashrc.mac + [ $(uname) == 'Darwin' ] && . /opt/local/etc/bashrc.mac simplefind() { find . -iname '*'"$@"'*'; } simpleplay() { @@ -8,8 +10,3 @@ simpleplay() { | xargs -0 mpv --no-audio-display \ ; } - -# Python -alias mk-venv='python -m venv .venv' -alias do-venv='. .venv/bin/activate' -alias rm-venv='rm -rf .venv' diff --git a/.bashrc.mac b/.bashrc.mac index 50d5773..b8209ee 100644 --- a/.bashrc.mac +++ b/.bashrc.mac @@ -1,4 +1,14 @@ -alias ls='ls -G' +#!/usr/bin/env bash + +# System-wide .bashrc file for interactive bash(1) shells. +if [ -z "$PS1" ]; then + return +fi + +# Make bash check its window size after a process completes +shopt -s checkwinsize + +[ -r "/etc/bashrc_$TERM_PROGRAM" ] && . "/etc/bashrc_$TERM_PROGRAM" blsc() { alias ls='ls -G'; } unuu-me() { PATH="$(sed 's/\/opt\/local\/libexec\/uutils://' <<<$PATH)"; blsc; }