mirror of
https://github.com/acedanger/shell.git
synced 2025-12-06 03:20:12 -08:00
172 lines
5.9 KiB
Bash
172 lines
5.9 KiB
Bash
# If you come from bash you might have to change your $PATH.
|
|
# export PATH=$HOME/bin:/usr/local/bin:$PATH
|
|
export PATH=$PATH:$HOME/.local/bin
|
|
|
|
# Path to your oh-my-zsh installation.
|
|
export ZSH="/home/acedanger/.oh-my-zsh"
|
|
|
|
# Set name of the theme to load --- if set to "random", it will
|
|
# load a random theme each time oh-my-zsh is loaded, in which case,
|
|
# to know which specific one was loaded, run: echo $RANDOM_THEME
|
|
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
|
|
ZSH_THEME="agnoster"
|
|
|
|
# Uncomment the following line to use hyphen-insensitive completion.
|
|
# Case-sensitive completion must be off. _ and - will be interchangeable.
|
|
HYPHEN_INSENSITIVE="true"
|
|
|
|
# Uncomment the following line to disable bi-weekly auto-update checks.
|
|
# DISABLE_AUTO_UPDATE="true"
|
|
|
|
# Uncomment the following line to automatically update without prompting.
|
|
# DISABLE_UPDATE_PROMPT="true"
|
|
|
|
# Uncomment the following line if pasting URLs and other text is messed up.
|
|
# DISABLE_MAGIC_FUNCTIONS="true"
|
|
|
|
# Uncomment the following line to disable colors in ls.
|
|
# DISABLE_LS_COLORS="true"
|
|
|
|
# Uncomment the following line to disable auto-setting terminal title.
|
|
# DISABLE_AUTO_TITLE="true"
|
|
|
|
# Uncomment the following line to enable command auto-correction.
|
|
# ENABLE_CORRECTION="true"
|
|
|
|
# Uncomment the following line to display red dots whilst waiting for completion.
|
|
# Caution: this setting can cause issues with multiline prompts (zsh 5.7.1 and newer seem to work)
|
|
# See https://github.com/ohmyzsh/ohmyzsh/issues/5765
|
|
# COMPLETION_WAITING_DOTS="true"
|
|
|
|
# Uncomment the following line if you want to disable marking untracked files
|
|
# under VCS as dirty. This makes repository status check for large repositories
|
|
# much, much faster.
|
|
# DISABLE_UNTRACKED_FILES_DIRTY="true"
|
|
|
|
# Standard plugins can be found in $ZSH/plugins/
|
|
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
|
|
# Add wisely, as too many plugins slow down shell startup.
|
|
plugins=(git zsh-autosuggestions zsh-syntax-highlighting docker docker-compose zsh-you-should-use z ssh)
|
|
|
|
export ZSH_COMPDUMP=$ZSH/cache/.zcompdump-$HOST
|
|
source $ZSH/oh-my-zsh.sh
|
|
|
|
# Initialize zoxide
|
|
eval "$(zoxide init zsh)"
|
|
|
|
# User configuration
|
|
# export MANPATH="/usr/local/man:$MANPATH"
|
|
|
|
# You may need to manually set your language environment
|
|
# export LANG=en_US.UTF-8
|
|
|
|
# Preferred editor for local and remote sessions
|
|
# if [[ -n $SSH_CONNECTION ]]; then
|
|
# export EDITOR='vim'
|
|
# else
|
|
# export EDITOR='mvim'
|
|
# fi
|
|
|
|
# Compilation flags
|
|
# export ARCHFLAGS="-arch x86_64"
|
|
|
|
# Set personal aliases, overriding those provided by oh-my-zsh libs,
|
|
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
|
|
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
|
|
# For a full list of active aliases, run `alias`.
|
|
|
|
# Load custom aliases
|
|
# Define ZSH_CUSTOM if not already defined
|
|
if [ -z "$ZSH_CUSTOM" ]; then
|
|
ZSH_CUSTOM="$HOME/.oh-my-zsh/custom"
|
|
fi
|
|
|
|
if [ -f "$ZSH_CUSTOM/aliases.zsh" ]; then
|
|
source "$ZSH_CUSTOM/aliases.zsh"
|
|
elif [ -f "$HOME/.oh-my-zsh/custom/aliases.zsh" ]; then
|
|
source "$HOME/.oh-my-zsh/custom/aliases.zsh"
|
|
fi
|
|
|
|
# set directory to home
|
|
cd ~
|
|
|
|
if [ -x /usr/games/cowsay -a -x /usr/games/fortune -a -x /usr/games/lolcat ]; then
|
|
fortune -s | cowsay | lolcat
|
|
fi
|
|
|
|
# NVM configuration
|
|
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
|
|
|
|
# Automatically use node version specified in .nvmrc if present
|
|
autoload -U add-zsh-hook
|
|
load-nvmrc() {
|
|
local nvmrc_path="$(nvm_find_nvmrc)"
|
|
if [ -n "$nvmrc_path" ]; then
|
|
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
|
|
if [ "$nvmrc_node_version" = "N/A" ]; then
|
|
nvm install
|
|
elif [ "$nvmrc_node_version" != "$(nvm version)" ]; then
|
|
nvm use
|
|
fi
|
|
elif [ -n "$(PWD=$OLDPWD nvm_find_nvmrc)" ] && [ "$(nvm version)" != "$(nvm version default)" ]; then
|
|
nvm use default
|
|
fi
|
|
}
|
|
add-zsh-hook chpwd load-nvmrc
|
|
load-nvmrc
|
|
|
|
[[ -s /home/acedanger/.autojump/etc/profile.d/autojump.sh ]] && source /home/acedanger/.autojump/etc/profile.d/autojump.sh
|
|
|
|
# Enable bash completion compatibility in zsh
|
|
autoload -U +X bashcompinit && bashcompinit
|
|
autoload -U compinit && compinit -u
|
|
|
|
# Load custom backup scripts completion
|
|
if [ -f "$HOME/shell/completions/backup-scripts-completion.bash" ]; then
|
|
source "$HOME/shell/completions/backup-scripts-completion.bash"
|
|
fi
|
|
|
|
# Go environment variables (required for Fabric and other Go tools)
|
|
# GOROOT is auto-detected by Go when installed via package manager
|
|
export GOPATH=$HOME/go
|
|
export PATH=$GOPATH/bin:$PATH
|
|
|
|
# Fabric AI - Pattern aliases and helper functions
|
|
if command -v fabric &> /dev/null; then
|
|
# Loop through all directories in the ~/.config/fabric/patterns directory to create aliases
|
|
if [ -d "$HOME/.config/fabric/patterns" ]; then
|
|
for pattern_dir in $HOME/.config/fabric/patterns/*/; do
|
|
if [ -d "$pattern_dir" ]; then
|
|
# Get the base name of the directory (i.e., remove the directory path)
|
|
pattern_name=$(basename "$pattern_dir")
|
|
|
|
# Create an alias in the form: alias pattern_name="fabric --pattern pattern_name"
|
|
alias_command="alias $pattern_name='fabric --pattern $pattern_name'"
|
|
|
|
# Evaluate the alias command to add it to the current shell
|
|
eval "$alias_command"
|
|
fi
|
|
done
|
|
fi
|
|
|
|
# YouTube transcript helper function
|
|
yt() {
|
|
if [ "$#" -eq 0 ] || [ "$#" -gt 2 ]; then
|
|
echo "Usage: yt [-t | --timestamps] youtube-link"
|
|
echo "Use the '-t' flag to get the transcript with timestamps."
|
|
return 1
|
|
fi
|
|
|
|
transcript_flag="--transcript"
|
|
if [ "$1" = "-t" ] || [ "$1" = "--timestamps" ]; then
|
|
transcript_flag="--transcript-with-timestamps"
|
|
shift
|
|
fi
|
|
|
|
local video_link="$1"
|
|
fabric -y "$video_link" $transcript_flag
|
|
}
|
|
fi
|