From 757b42d7c6486517cb89c63b312f288770bee6a0 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Thu, 20 Feb 2025 03:03:04 +0800 Subject: [PATCH 1/4] feat: add thefuck and homebrew (dependency) to bashrc --- .bashrc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.bashrc b/.bashrc index e4a6de2..c4435c5 100644 --- a/.bashrc +++ b/.bashrc @@ -117,5 +117,11 @@ export PATH="$HOME/nvim/bin:$PATH" # Theming export PS1="\[\e[36m\]$(date +'%H:%M:%S')\[\e[32m\]$USER \[\e[35m\]\w \[\e[31m\]$ " +# Homebrew +eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" + +# thefuck +eval $(thefuck --alias) + # Path setting -export PATH="$HOME/bin:$PATH" \ No newline at end of file +export PATH="$HOME/bin:$PATH" From 3d5a6696b16a189fee5e49403bcda3777d90cf63 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Thu, 20 Feb 2025 03:08:52 +0800 Subject: [PATCH 2/4] refactor: add bash specific scripts --- .bash_logout | 7 +++++++ .bash_profile | 1 + 2 files changed, 8 insertions(+) create mode 100644 .bash_logout create mode 100644 .bash_profile diff --git a/.bash_logout b/.bash_logout new file mode 100644 index 0000000..de4f5f7 --- /dev/null +++ b/.bash_logout @@ -0,0 +1,7 @@ +# ~/.bash_logout: executed by bash(1) when login shell exits. + +# when leaving the console clear the screen to increase privacy + +if [ "$SHLVL" = 1 ]; then + [ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q +fi diff --git a/.bash_profile b/.bash_profile new file mode 100644 index 0000000..86795d7 --- /dev/null +++ b/.bash_profile @@ -0,0 +1 @@ +source ~/.bashrc From b9db3f192e34083666bea13c493a90e555f8d668 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Thu, 20 Feb 2025 03:11:15 +0800 Subject: [PATCH 3/4] feat: add bashcompletions to bashrc --- .bashrc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.bashrc b/.bashrc index c4435c5..30bee2b 100644 --- a/.bashrc +++ b/.bashrc @@ -1,3 +1,4 @@ +eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)0 # Pull the latest changes from the remote (but only once!) if ! [ -v REPO_INITIALISED ]; then git pull origin main --quiet && export REPO_INITIALISED=true @@ -100,9 +101,9 @@ fi # enable programmable completion features (you don't need to enable # this, if it's already enabled in /etc/bash.bashrc and /etc/profile # sources /etc/bash.bashrc). -#if [ -f /etc/bash_completion ] && ! shopt -oq posix; then -# . /etc/bash_completion -#fi +if [ -f /etc/bash_completion ] && ! shopt -oq posix; then + . /etc/bash_completion +fi # Rust/Cargo setup . "$HOME/.cargo/env" From e7674076632c02e38642194cdffadf14af0f4184 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Thu, 20 Feb 2025 04:33:57 +0800 Subject: [PATCH 4/4] fix: amend bashrc to check for homebrew --- .bashrc | 17 ++++++++++------- .gitconfig | 1 + 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.bashrc b/.bashrc index 30bee2b..3dadf77 100644 --- a/.bashrc +++ b/.bashrc @@ -1,4 +1,3 @@ -eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)0 # Pull the latest changes from the remote (but only once!) if ! [ -v REPO_INITIALISED ]; then git pull origin main --quiet && export REPO_INITIALISED=true @@ -118,11 +117,15 @@ export PATH="$HOME/nvim/bin:$PATH" # Theming export PS1="\[\e[36m\]$(date +'%H:%M:%S')\[\e[32m\]$USER \[\e[35m\]\w \[\e[31m\]$ " -# Homebrew -eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" +# Homebrew (Linuxbrew) - Check if it exists first +if [ -f /home/linuxbrew/.linuxbrew/bin/brew ]; then + eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" -# thefuck -eval $(thefuck --alias) + # thefuck + eval $(thefuck --alias) +fi -# Path setting -export PATH="$HOME/bin:$PATH" +# Path Setting - Make sure $HOME/bin exists and only add it once. +if [ -d "$HOME/bin" ] && ! echo "$PATH" | grep -q "$HOME/bin"; then + export PATH="$HOME/bin:$PATH" +fi diff --git a/.gitconfig b/.gitconfig index 0204694..2cd825f 100644 --- a/.gitconfig +++ b/.gitconfig @@ -9,3 +9,4 @@ autoSetupRemote = true [safe] directory = /appdata + directory = /storage/emulated/0/Obsidian Vaults/second-brain