update bashrc.arch

This commit is contained in:
juancwu 2025-07-30 17:50:18 -04:00
commit 38766e8a95
No known key found for this signature in database

View file

@ -1,58 +1,3 @@
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# enable color support for ls and grep (even tho i don't use grep ???)
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias grep='grep --color=auto'
fi
export PATH=$PATH:/home/jc/.local/bin
# -------------- Aliases
alias gs="git status"
@ -121,8 +66,6 @@ fcd() {
find "$HOME/.config" -maxdepth 1 -type d
find "$HOME/.config" -maxdepth 1 -type l
find "$HOME/.cache" -maxdepth 1 -type d
find "/mnt/smb" -maxdepth 1 -type d
echo "$HOME/Documents/Obsidian Vault"
find "$HOME/ghq" -mindepth 2 -maxdepth 2 -type d
ls -d -1 "$HOME/"/*/ | grep -v \.git
} | fzf --filter="$1" --select-1 --exit-0 | head -1)
@ -131,8 +74,6 @@ fcd() {
find "$HOME/.config" -maxdepth 1 -type d
find "$HOME/.config" -maxdepth 1 -type l
find "$HOME/.cache" -maxdepth 1 -type d
find "/mnt/smb" -maxdepth 1 -type d
echo "$HOME/Documents/Obsidian Vault"
find "$HOME/ghq" -mindepth 2 -maxdepth 2 -type d
ls -d -1 "$HOME/"/*/ | grep -v \.git
} | fzf)
@ -269,134 +210,9 @@ gcr() {
fi
}
# makes it easier to spin up ngrok with static domain, pass in the port ngrok needs to listen
sngrok() {
ngrok http --domain=hyena-merry-literally.ngrok-free.app $1
}
# Set prompt
if [ "$color_prompt" = yes ]; then
PS1="${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\]\$(parse-git-branch)\[\033[00m\] \$ "
else
PS1="${debian_chroot:+($debian_chroot)}\u@\h:\w\$(parse-git-branch)\$ "
fi
unset color_prompt
# setup terminal stuff
# determine initial terminal color mode
TERM_COLOR_MODE=dark
command -v asadesuka > /dev/null 2>&1
if [ $? -eq 0 ]; then
IS_ASA=$(asadesuka -offset=30)
if [ $IS_ASA == "true" ]; then
TERM_COLOR_MODE=light
fi
else
CURRENT_HOUR=$(date +"%H")
SEVEN_AM=7
SEVEN_PM=19
if [ $CURRENT_HOUR -ge $SEVEN_AM ] && [ $CURRENT_HOUR -lt $SEVEN_PM ]; then
TERM_COLOR_MODE=light
fi
fi
export TERM_COLOR_MODE
# set the terminal color theme
USE_TERM=alacritty
theme_link="$HOME/.config/alacritty/theme.toml"
use_theme="$HOME/ghq/alacritty/alacritty-theme/themes/catppuccin_latte.toml"
if [ $TERM_COLOR_MODE == "dark" ]; then
# if [ $USE_TERM == "kitty" ]; then
# kitten @ set-colors --all "$HOME/.config/kitty/light.conf"
# fi
# if [ $USE_TERM == "alacritty" ]; then
# cp "$HOME/ghq/alacritty/alacritty-theme/themes/catppuccin_latte.toml" "$theme_link"
# fi
use_theme="$HOME/ghq/alacritty/alacritty-theme/themes/catppuccin_mocha.toml"
# else
# if [ $USE_TERM == "kitty" ]; then
# kitten @ set-colors --all "$HOME/.config/kitty/dark.conf"
# fi
# if [ $USE_TERM == "alacritty" ]; then
# cp "$HOME/ghq/alacritty/alacritty-theme/themes/catppuccin_mocha.toml" "$theme_link"
# fi
fi
rm -f "$theme_link"
cp "$use_theme" "$theme_link"
# setup kitty, it will export TERM_COLOR_MODE (can be light or dark)
# source ~/.config/kitty/setup.sh
# function to toggle kitty terminal theme
toggle_theme() {
if [ "$TERM_COLOR_MODE" == "light" ]; then
export TERM_COLOR_MODE=dark
theme="catppuccin_latte"
else
export TERM_COLOR_MODE=light
theme="catppuccin_mocha"
fi
if [ $USE_TERM == "kitty" ]; then
kitten @ set-colors --all "$HOME/.config/kitty/$TERM_COLOR_MODE.conf"
fi
if [ $USE_TERM == "alacritty" ]; then
theme_link="$HOME/.config/alacritty/theme.toml"
if [ -L "$theme_link" ]; then
rm "$theme_link"
fi
ln -s "$HOME/ghq/alacritty/alacritty-theme/themes/$theme.toml" "$theme_link"
fi
}
type -p curl >/dev/null || echo -e "$WARNING curl is not installed"
command -v nvm > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo -e "$WARNING nvm is not installed"
fi
command -v pnpm > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo -e "$WARNING pnpm is not installed"
fi
command -v nvim > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo -e "$ERROR neovim is not installed"
fi
# command -v yarn > /dev/null 2>&1
# if [ $? -ne 0 ]; then
# echo -e "$WARNING yarn is not installed"
# fi
# command -v bun > /dev/null 2>&1
# if [ $? -ne 0 ]; then
# echo -e "$WARNING bun is not installed"
# fi
# command -v notify-send > /dev/null 2>&1
# if [ $? -ne 0 ]; then
# echo -e "$WARNING notify-send is not installed. Will affect the alias: \033[34;49;1malert\033[0m"
# fi
command -v lazygit > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo -e "$WARNING lazygit is not installed"
else
alias lg="lazygit"
fi
command -v rustc > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo -e "$WARNING rust is not installed"
fi
# set bat theme
export BAT_THEME="ansi"
# walk editor
export EDITOR=nvim
bc() {
mac=$(bluetoothctl devices | rg "$1" | awk '{print $2}')
bluetoothctl connect $mac