Skip to content

Commit

Permalink
updating bash profile
Browse files Browse the repository at this point in the history
  • Loading branch information
gregology committed Jan 4, 2024
1 parent d5a3ed0 commit 36d7bb6
Showing 1 changed file with 66 additions and 8 deletions.
74 changes: 66 additions & 8 deletions reference/bash_profile.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,32 @@ Useful aliases and alike from my `.zshrc`

```
export EDITOR="nano"
export HISTSIZE=1000000
export HISTFILESIZE=1000000
## Git
# PATH
alias master='git checkout master'
# Homebrew
export PATH=/opt/homebrew/bin:$PATH
# npm global packages
export PATH="$HOME/.npm-global/bin:$PATH"
# Signing scripts
export PATH="~/src/bin/sign:$PATH"
# Git
alias giti='code .git/info/exclude'
alias gitig='code ~/.gitignore'
autoload -Uz compinit && compinit
alias main='git checkout main || git checkout master'
alias master='main'
alias pull='git pull'
alias push='git push origin HEAD'
alias gitclean='git branch | grep -v "^*"" | xargs git branch -d'
alias fush='git push origin HEAD -f'
alias amend='git commit --amend --no-edit'
parse_git_branch() {
git_status="$(git status 2> /dev/null)"
Expand All @@ -28,7 +43,7 @@ parse_git_branch() {
fi
if [[ ${git_status} =~ ${pattern} ]]; then
branch=${match[1]}
branch_cut=${branch:0:35}
branch_cut=${branch:0:60}
if (( ${#branch} > ${#branch_cut} )); then
echo "(${branch_cut}…${state})"
else
Expand All @@ -37,17 +52,60 @@ parse_git_branch() {
fi
}
# Ruby
setopt PROMPT_SUBST
PROMPT='%{%F{blue}%}%9c%{%F{none}%}$(parse_git_branch)$ '
RPROMPT='%*'
## Mac shortcuts
alias zshrc='code --new-window --add ~/common.code-workspace ~/.zshrc'
alias profile='code --new-window --add ~/common.code-workspace ~/.zshrc'
alias sp='source ~/.zshrc'
alias hist='code --new-window --add ~/common.code-workspace ~/.zsh_history'
## App shortcuts
alias vlc='/Applications/VLC.app/Contents/MacOS/VLC'
# Ruby
alias brake='bundle exec rake'
alias brails='bundle exec rails'
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
# signing scripts
export PATH="$HOME/bin:$PATH"
# Python
eval "$(pyenv init --path)"
export PATH="/opt/homebrew/opt/libpq/bin:$PATH"
# Functions
stopwatch() {
start_time=$(date +%s)
"$@"
end_time=$(date +%s)
execution_time=$((end_time-start_time))
echo "Execution time: $execution_time seconds"
}
generate_alias() {
cd_alias_name="cd${1}"
code_alias_name="co${1}"
pull_alias_name="p${1}"
dir_path="$2"
alias "$cd_alias_name"="cd $dir_path"
alias "$code_alias_name"="code $dir_path"
alias "$pull_alias_name"="(cd $dir_path && git pull)"
}
# Example usage:
generate_alias g ~/src/gregology.github.io
generate_alias e ~/src/esphome
```

My old `.bash_profile` from before MacOS moved from bash to zsh by default.
Expand Down

0 comments on commit 36d7bb6

Please sign in to comment.