making bash more similar to zsh configs

This commit is contained in:
Jeremie Fraeys 2024-12-18 20:51:10 -05:00
parent fb78d88272
commit 671dc697c8
3 changed files with 55 additions and 4 deletions

View file

@ -15,6 +15,8 @@ if [ -d "$HOME/.local/bin" ] && [[ ! "$PATH" =~ (^|:)${HOME}/.local/bin(:|$) ]];
export PATH="$HOME/.local/bin:$PATH"
fi
[[ -n ${SSH_CONNECTION} ]] && export EDITOR='vim'
# Set permissions for ~/.local/bin
chmod -R ug+rwx "$HOME/.local/bin/"
@ -31,12 +33,12 @@ fi
[ -f ~/.fzf.bash ] && . ~/.fzf.bash
# Add RVM to PATH
# Add RVM to PATH if not already included
if [[ ! "$PATH" =~ (^|:)${HOME}/.rvm/bin(:|$) ]]; then
export PATH="$PATH:$HOME/.rvm/bin"
fi
# Add Golang to PATH
# Add Golang to PATH if not already included
if [ -n "$(go env GOPATH)" ] && [[ ! "$PATH" =~ (^|:)$(go env GOPATH)/bin(:|$) ]]; then
export GOPATH="$HOME/Documents/projects:$HOME/go"
export PATH="$PATH:$(go env GOPATH)/bin"
@ -62,3 +64,14 @@ fi
unset __conda_setup
# <<< conda initialize <<<
# Check for WSL and adjust configurations
if grep -q Microsoft /proc/version; then
# Ensure WSL compatibility for Conda if using Miniforge
if [ -f "/mnt/c/Users/$USER/AppData/Local/Miniconda3/etc/profile.d/conda.sh" ]; then
. "/mnt/c/Users/$USER/AppData/Local/Miniconda3/etc/profile.d/conda.sh"
fi
else
# Unix-specific configuration (Linux/macOS)
# Add any Unix-specific paths or configurations here
export PATH="/usr/local/bin:$PATH"
fi

View file

@ -3,6 +3,25 @@ if [[ -f /etc/bash_completion ]]; then
. /etc/bash_completion
fi
# Check for WSL and adjust accordingly
if grep -q Microsoft /proc/version; then
# WSL-specific configuration
# Set path to Windows executables for easy access
export PATH="/mnt/c/Windows/System32:$PATH"
export PATH="/mnt/c/Program Files:$PATH"
export PATH="/mnt/c/Windows:$PATH"
# Use Windows Notepad or other executables from WSL
alias notepad="notepad.exe"
alias explorer="explorer.exe"
else
# Unix-specific configuration (Linux or macOS)
# You can add Unix-specific tools and paths here if needed
# For example, add custom Linux paths if they are different from default
export PATH="/usr/local/bin:$PATH"
fi
# Custom aliases
alias python="python3"
alias grep="grep --color=auto"
@ -12,6 +31,7 @@ alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
# Load custom check_aliases if it exists
if [[ -f "$HOME/.local/bin/scripts/check_aliases" ]]; then
. "$HOME/.local/bin/scripts/check_aliases"
fi
@ -33,3 +53,10 @@ fi
if command -v starship &>/dev/null; then
eval "$(starship init bash)"
fi
# Optionally, initialize other tools for Unix and WSL environments
if command -v wslpath &>/dev/null; then
# Adjust paths between WSL and Windows if necessary
export PATH="$(wslpath 'C:\Program Files'):$PATH"
export PATH="/mnt/c/Program Files/neovim/bin:$PATH"
fi

View file

@ -1,9 +1,9 @@
# Setup fzf
# ---------
# Get the path to fzf installed by Nix
# Get the path to fzf installed by Nix or from a general location
FZF_PATH="$(command -v fzf | xargs dirname)"
# Ensure the fzf binary is in the PATH
# Ensure the fzf binary is in the PATH (if not already added)
if [[ ! "$PATH" == *"$FZF_PATH/bin"* ]]; then
PATH="${PATH:+${PATH}:}$FZF_PATH/bin"
fi
@ -19,3 +19,14 @@ fi
if [[ -f "$FZF_PATH/shell/key-bindings.bash" ]]; then
source "$FZF_PATH/shell/key-bindings.bash"
fi
# Check for WSL and ensure compatibility
if grep -q Microsoft /proc/version; then
# WSL-specific path handling (if needed)
if [[ -f "/mnt/c/Program Files/fzf/shell/completion.bash" ]]; then
source "/mnt/c/Program Files/fzf/shell/completion.bash"
fi
if [[ -f "/mnt/c/Program Files/fzf/shell/key-bindings.bash" ]]; then
source "/mnt/c/Program Files/fzf/shell/key-bindings.bash"
fi
fi