Skip to content

Instantly share code, notes, and snippets.

@pythoninthegrass
Last active May 27, 2024 17:32
Show Gist options
  • Save pythoninthegrass/327990bcd3fdea4842a02584ba422682 to your computer and use it in GitHub Desktop.
Save pythoninthegrass/327990bcd3fdea4842a02584ba422682 to your computer and use it in GitHub Desktop.
Fedora Silverblue .bash_aliases
# shellcheck disable=all
# aliases
alias rsync='rsync -arvW --progress --stats --ignore-existing' # archive, recursive, verbose, whole-file
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias c=clear
alias ..='cd ../'
alias ...='cd ../../'
alias protontricks='flatpak run com.github.Matoking.protontricks'
# PATH
export BREW_PREFIX="/home/linuxbrew/.linuxbrew"
export PATH="${BREW_PREFIX}/bin:$HOME/.local/bin:$PATH"
# homebrew
export BREW_PREFIX=$(brew --prefix)
export HOMEBREW_NO_INSTALL_CLEANUP=1
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
eval "$(brew shellenv)"
function code() {
if [ $(uname -s) = "Linux" ]; then
# export ELECTRON_RUN_AS_NODE=0
if [ "$1" = "-r" ]; then
flatpak run com.visualstudio.code "$2";
else
flatpak run com.visualstudio.code;
fi
fi
}
# asdf
# https://asdf-vm.com/guide/getting-started.html
export ASDF_DIR="$HOME/.asdf"
[[ -f "$ASDF_DIR/asdf.sh" ]] && . "$ASDF_DIR/asdf.sh"
# fzf
# https://github.com/junegunn/fzf#using-git
[[ -f ~/.fzf.bash ]] && . ~/.fzf.bash
# lazydocker
# https://github.com/jesseduffield/lazydocker#installation
alias lzd="lazydocker"
# lazygit
# https://github.com/jesseduffield/lazygit?tab=readme-ov-file#installation
lg() {
export LAZYGIT_NEW_DIR_FILE=~/.lazygit/newdir
lazygit "$@"
if [ -f $LAZYGIT_NEW_DIR_FILE ]; then
cd "$(cat $LAZYGIT_NEW_DIR_FILE)"
rm -f $LAZYGIT_NEW_DIR_FILE > /dev/null
fi
}
# recursive git status
git_status() {
export GREEN='\033[0;32m'
export YELLOW='\033[0;33m'
export RED='\033[0;31m'
export BLUE='\033[0;34m'
export NC='\033[0m'
git_dir=$(find . -mindepth 1 -maxdepth 1 -type d ! -name ".git")
for dir in $git_dir; do
cd $dir && printf "${GREEN}${dir}${NC}\n"
branch=$(git branch --show-current)
status=$(git status --porcelain)
[[ -n $branch ]] && printf "${BLUE}Branch${NC}: $branch\n"
[[ -n $status ]] && printf "${YELLOW}$status${NC}\n"
[[ -z $status ]] && printf "${GREEN}Clean${NC}\n" || printf "${RED}Dirty${NC}\n"
cd ..
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment