Created
April 14, 2023 12:45
-
-
Save ShaunSHamilton/afe0f6c79fa10fcb5ea83436f98fa5b0 to your computer and use it in GitHub Desktop.
Oh-My-Bash Config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Enable the subsequent settings only in interactive sessions | |
case $- in | |
*i*) ;; | |
*) return;; | |
esac | |
# Path to your oh-my-bash installation. | |
export OSH='/home/shauh/.oh-my-bash' | |
# Set name of the theme to load. Optionally, if you set this to "random" | |
# it'll load a random theme each time that oh-my-bash is loaded. | |
OSH_THEME="font" | |
# To disable the uses of "sudo" by oh-my-bash, please set "false" to | |
# this variable. The default behavior for the empty value is "true". | |
OMB_USE_SUDO=true | |
# Which completions would you like to load? (completions can be found in ~/.oh-my-bash/completions/*) | |
# Custom completions may be added to ~/.oh-my-bash/custom/completions/ | |
# Example format: completions=(ssh git bundler gem pip pip3) | |
# Add wisely, as too many completions slow down shell startup. | |
completions=( | |
git | |
composer | |
ssh | |
) | |
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-bash/plugins/*) | |
# Custom plugins may be added to ~/.oh-my-bash/custom/plugins/ | |
# Example format: plugins=(rails git textmate ruby lighthouse) | |
# Add wisely, as too many plugins slow down shell startup. | |
plugins=( | |
git | |
bashmarks | |
) | |
source "$OSH"/oh-my-bash.sh | |
export NVM_DIR="$HOME/.nvm" | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | |
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion | |
. "$HOME/.cargo/env" | |
if [ -z $DISPLAY ]; then | |
export DISPLAY="$(tail -1 /etc/resolv.conf | cut -d' ' -f2):0" | |
fi | |
eval "$(github-copilot-cli alias -- "$0")" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! bash oh-my-bash.module | |
# | |
# One line prompt showing the following configurable information | |
# for git: | |
# time (virtual_env) username@hostname pwd git_char|git_branch git_dirty_status|→ | |
# | |
# The → arrow shows the exit status of the last command: | |
# - bold green: 0 exit status | |
# - bold red: non-zero exit status | |
# | |
# Example outside git repo: | |
# 07:45:05 user@host ~ → | |
# | |
# Example inside clean git repo: | |
# 07:45:05 user@host .oh-my-bash ±|master|→ | |
# | |
# Example inside dirty git repo: | |
# 07:45:05 user@host .oh-my-bash ±|master ✗|→ | |
# | |
# Example with virtual environment: | |
# 07:45:05 (venv) user@host ~ → | |
# | |
SCM_NONE_CHAR='' | |
SCM_THEME_PROMPT_DIRTY=" ${_omb_prompt_brown}✗" | |
SCM_THEME_PROMPT_CLEAN="" | |
SCM_THEME_PROMPT_PREFIX="${_omb_prompt_green}|" | |
SCM_THEME_PROMPT_SUFFIX="${_omb_prompt_green}|" | |
SCM_GIT_SHOW_MINIMAL_INFO=true | |
CLOCK_THEME_PROMPT_PREFIX='' | |
CLOCK_THEME_PROMPT_SUFFIX=' ' | |
THEME_SHOW_CLOCK=${THEME_SHOW_CLOCK:-"true"} | |
THEME_CLOCK_COLOR=${THEME_CLOCK_COLOR:-"$_omb_prompt_bold_navy"} | |
THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:-"%H:%M:%S"} | |
OMB_PROMPT_VIRTUALENV_FORMAT='(%s) ' | |
OMB_PROMPT_SHOW_PYTHON_VENV=${OMB_PROMPT_SHOW_PYTHON_VENV:=true} | |
function _omb_theme_PROMPT_COMMAND() { | |
# This needs to be first to save last command return code | |
local RC="$?" | |
local hostname="${_omb_prompt_bold_gray}\u@\h" | |
local python_venv; _omb_prompt_get_python_venv | |
python_venv=$_omb_prompt_white$python_venv | |
# Set return status color | |
if [[ ${RC} == 0 ]]; then | |
ret_status="${_omb_prompt_bold_green}" | |
else | |
ret_status="${_omb_prompt_bold_brown}" | |
fi | |
# Set folder icon to: | |
# - if in a rust project: 🦀 | |
# - if in a js project: JS (in green) | |
local folder_icon="" | |
if [[ -f Cargo.toml ]]; then | |
folder_icon="🦀" | |
elif [[ -f package.json ]]; then | |
folder_icon="${_omb_prompt_bold_green}JS" | |
fi | |
# Append new history lines to history file | |
history -a | |
# Set the terminal title to the last 20 characters of the current working directory | |
local dir=${PWD##*/} | |
if [[ ${#dir} -gt 20 ]]; then | |
dir="...${dir: -20}" | |
fi | |
printf "\033]0;%s%s%s\007" "${dir}" | |
# Set the prompt | |
PS1="$(clock_prompt)$python_venv${hostname} ${_omb_prompt_bold_teal}\W ${folder_icon}${_omb_prompt_bold_yellow}$(scm_prompt_char_info)${ret_status}→ ${_omb_prompt_normal}" | |
} | |
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment