76 lines
1.6 KiB
Bash
76 lines
1.6 KiB
Bash
# If not running interactively, don't do anything
|
|
case $- in
|
|
*i*) ;;
|
|
*) return ;;
|
|
esac
|
|
|
|
# Set default user
|
|
DEFAULT_USER="$USER"
|
|
|
|
# Editor
|
|
export EDITOR='nvim'
|
|
|
|
# Environment variables
|
|
export GOPATH="$HOME/go"
|
|
export PATH="$PATH:$GOPATH/bin:/usr/local/go/bin"
|
|
|
|
# Local bin
|
|
export PATH="$PATH:$HOME/.local/bin"
|
|
|
|
# Node.js and NVM configuration
|
|
export NVM_DIR="$HOME/.nvm"
|
|
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
|
|
[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion"
|
|
|
|
# Rust/Cargo
|
|
[ -f "$HOME/.cargo/env" ] && source "$HOME/.cargo/env"
|
|
|
|
# SSH agent
|
|
if [ -z "$SSH_AGENT_PID" ]; then
|
|
eval "$(ssh-agent -s)"
|
|
ssh-add -A 2>/dev/null
|
|
fi
|
|
|
|
# FZF (if installed)
|
|
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
|
|
|
|
# Oh My Posh prompt
|
|
eval "$(oh-my-posh init bash --config ~/.config/oh-my-posh/theme.omp.json)"
|
|
|
|
# Bash completion for Git
|
|
if [ -f /usr/share/bash-completion/completions/git ]; then
|
|
source /usr/share/bash-completion/completions/git
|
|
fi
|
|
|
|
# Custom aliases
|
|
if [ -f "$HOME/dotfiles/aliases.bash" ]; then
|
|
source "$HOME/dotfiles/aliases.bash"
|
|
fi
|
|
|
|
# Key timeout
|
|
export KEYTIMEOUT=1
|
|
|
|
# C++ include path
|
|
export CPLUS_INCLUDE_PATH=/usr/local/include
|
|
|
|
work() {
|
|
set +e
|
|
|
|
local proj="$HOME/Drives/500GB/PycharmProjects/time_logix"
|
|
cd "$proj" || { echo "No such dir: $proj" >&2; return 1; }
|
|
|
|
[ -d venv ] || python3 -m venv venv || { echo "venv create failed" >&2; return 1; }
|
|
|
|
. venv/bin/activate
|
|
trap 'deactivate 2>/dev/null || true' RETURN
|
|
|
|
python main.py
|
|
local code=$?
|
|
|
|
cd ~ || true
|
|
|
|
if [ $code -ne 0 ]; then
|
|
echo "main.py exited with code $code"
|
|
fi
|
|
}
|