Skip to content

Commit

Permalink
Merge pull request #2 from ThomasHepworth/feature/update-configs
Browse files Browse the repository at this point in the history
Feature/update configs
  • Loading branch information
ThomasHepworth authored Jan 7, 2025
2 parents b44148d + 0e8690c commit 4700715
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
6 changes: 2 additions & 4 deletions shell-configs/.zshrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
cd $HOME

# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
Expand All @@ -8,7 +6,7 @@ if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]
fi

# Run scripts defined in ~/shell directory
for file in shell/*.sh; do
for file in $HOME/shell/*.sh; do
if [ -f "$file" ]; then
source "$file"
fi
Expand All @@ -34,7 +32,7 @@ source $HOMEBREW_PREFIX/share/powerlevel10k/powerlevel10k.zsh-theme
source $HOMEBREW_PREFIX/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source $HOMEBREW_PREFIX/share/zsh-autosuggestions/zsh-autosuggestions.zsh
source $HOMEBREW_PREFIX/opt/zsh-vi-mode/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh
source .config/plugins/fzf-tab/fzf-tab.plugin.zsh
source $HOME/.config/plugins/fzf-tab/fzf-tab.plugin.zsh

# Keybindings
bindkey '^I' fzf_completion
Expand Down
2 changes: 1 addition & 1 deletion shell-configs/shell/aliases/aliases_apps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ alias dk='docker'
alias dcup='docker compose up'
alias dcdown='docker compose down'
alias docker_clean='docker system prune -a --volumes'
alias docker_clean_images='docker rm $(docker ps -aq)'


# Pip aliases
alias pip="uv pip"
alias pyvenv="python3 -m venv venv"
alias pipreqs="pip3 install -r requirements.txt"
alias sact="source venv/bin/activate"
alias pyenv="pyvenv && act && pipreqs"
3 changes: 3 additions & 0 deletions shell-configs/shell/aliases/aliases_aws.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ alias data="aws sso login --profile data --"

# aws-vault aliases
alias avs="aws-vault exec sandbox-admin"
alias avs8="avs --duration8h"
alias avd="aws-vault exec data"
alias avd8="avd --duration8h"

# Persistent aws login (equivalent to aws-vault), but w/ no subshell
aws_login() {
Expand All @@ -15,3 +17,4 @@ aws_login() {
# Aliases using the function
alias sso-sand='aws_login sandbox-admin'
alias sso-data='aws_login data'
alias sso-dataeng='aws_login dataeng'
1 change: 1 addition & 0 deletions shell-configs/shell/exports.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export HOMEBREW_PREFIX=$(brew --prefix)/

# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
export AWS_CLI_AUTO_PROMPT=on-partial

# Eval shell integrations
eval "$(fzf --zsh)"
Expand Down
18 changes: 18 additions & 0 deletions shell-configs/shell/functions/functions_python.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
sact() {
if [ -n "$1" ]; then
venvs_to_try=("$1")
else
venvs_to_try=("venv" ".venv")
fi

for venv in "${venvs_to_try[@]}"; do
if [ -d "$venv" ]; then
echo "Activating '$venv'..."
source "$venv/bin/activate"
return 0
fi
done

echo "Error: No virtual environment found ('$(IFS=', '; echo "${venvs_to_try[*]}")')."
return 1
}

0 comments on commit 4700715

Please sign in to comment.