99 lines
2.6 KiB
Bash
99 lines
2.6 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# Copyright (C) Harsh Shandilya <me@msfjarvis.dev>
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" && pwd)/scripts"
|
|
|
|
# SDKMAN!
|
|
export SDKMAN_DIR="${HOME}/.sdkman"
|
|
# shellcheck disable=SC1091
|
|
[[ -s "${SDKMAN_DIR}/bin/sdkman-init.sh" ]] && source "${SDKMAN_DIR}/bin/sdkman-init.sh"
|
|
|
|
# Local bin directory
|
|
[ -d "${HOME}/bin" ] && export PATH="${HOME}/bin:${PATH}"
|
|
|
|
# Sexy colors in `ls`
|
|
if type vivid &> /dev/null; then
|
|
LS_COLORS="$(vivid generate snazzy)"
|
|
export LS_COLORS
|
|
fi
|
|
|
|
# Bash completion
|
|
for DIR in "${HOME}"/bash_completion.d "${HOME}"/.nix-profile/share/bash-completion/completions; do
|
|
# shellcheck disable=SC1090
|
|
if [ -d "${DIR}" ]; then
|
|
for COMPLETION in "${DIR}"/*; do
|
|
# shellcheck disable=SC1090
|
|
[[ -r $COMPLETION ]] && source "$COMPLETION"
|
|
done
|
|
fi
|
|
done
|
|
|
|
# Enable pass user extensions
|
|
if type pass &> /dev/null; then
|
|
export PASSWORD_STORE_ENABLE_EXTENSIONS=true
|
|
fi
|
|
|
|
# Shell PS1
|
|
# shellcheck disable=SC2154
|
|
export PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]: \[\033[01;34m\]\W\[\033[00m\]$(__git_ps1 " (%s)") \$ '
|
|
|
|
# Android, but macOS
|
|
if [ -d "${HOME}"/Library/Android/sdk/ ]; then
|
|
export ANDROID_HOME="${HOME}"/Library/Android/sdk
|
|
export PATH="${ANDROID_HOME}/platform-tools:${PATH}"
|
|
if [ -d "${ANDROID_HOME}"/build-tools ]; then
|
|
BUILD_TOOLS_DIR="$(fd -td --maxdepth 1 . "${ANDROID_HOME}"/build-tools | sort -nr | head -n1)"
|
|
export PATH="${BUILD_TOOLS_DIR}:${PATH}"
|
|
fi
|
|
if [ -d "${ANDROID_HOME}"/cmdline-tools/latest ]; then
|
|
export PATH="${ANDROID_HOME}/cmdline-tools/latest/bin:${PATH}"
|
|
fi
|
|
fi
|
|
|
|
# Nano love, or is it?
|
|
if type micro &> /dev/null; then
|
|
export EDITOR=micro
|
|
export MICRO_TRUECOLOR=1
|
|
fi
|
|
|
|
# Setup zoxide
|
|
if type zoxide &> /dev/null; then
|
|
alias cd=z
|
|
fi
|
|
|
|
if [ -d /opt/homebrew/bin ]; then
|
|
export PATH="/opt/homebrew/opt/ruby/bin:/opt/homebrew/bin:${PATH}"
|
|
fi
|
|
|
|
if [ -d ~/go/bin ]; then
|
|
export PATH="${HOME}/go/bin:${PATH}"
|
|
fi
|
|
|
|
# shellcheck source=bash_completions.bash
|
|
source "${SCRIPT_DIR}"/bash_completions.bash
|
|
# shellcheck source=aliases
|
|
source "${SCRIPT_DIR}"/aliases
|
|
# shellcheck source=apps
|
|
source "${SCRIPT_DIR}"/apps
|
|
# shellcheck source=common
|
|
source "${SCRIPT_DIR}"/common
|
|
# shellcheck source=devtools
|
|
source "${SCRIPT_DIR}"/devtools
|
|
# shellcheck source=files
|
|
source "${SCRIPT_DIR}"/files
|
|
# shellcheck source=gitshit
|
|
source "${SCRIPT_DIR}"/gitshit
|
|
# shellcheck source=nix
|
|
source "${SCRIPT_DIR}"/nix
|
|
# shellcheck source=system
|
|
source "${SCRIPT_DIR}"/system
|
|
# shellcheck source=system_darwin
|
|
source "${SCRIPT_DIR}"/system_darwin
|
|
|
|
function reload() {
|
|
# shellcheck disable=SC1090
|
|
source ~/.bashrc
|
|
}
|