Updates for 12th September 2024
This commit is contained in:
parent
318838ad70
commit
1244c95726
32
Brewfile
32
Brewfile
@ -1,24 +1,24 @@
|
||||
tap "homebrew/bundle"
|
||||
tap "homebrew/services"
|
||||
brew "xz"
|
||||
brew "openssl@3"
|
||||
brew "readline"
|
||||
brew "sqlite"
|
||||
brew "php"
|
||||
brew "composer"
|
||||
brew "dnsmasq"
|
||||
brew "ffmpeg"
|
||||
# brew "xz"
|
||||
# brew "openssl@3"
|
||||
# brew "readline"
|
||||
# brew "sqlite"
|
||||
# brew "php"
|
||||
# brew "composer"
|
||||
# brew "dnsmasq"
|
||||
# brew "ffmpeg"
|
||||
brew "git"
|
||||
brew "imagemagick"
|
||||
# brew "imagemagick"
|
||||
brew "mas"
|
||||
brew "nginx"
|
||||
brew "nvm"
|
||||
brew "pipx"
|
||||
brew "pkg-config"
|
||||
brew "pyenv"
|
||||
brew "tcl-tk"
|
||||
# brew "nginx"
|
||||
# brew "nvm"
|
||||
# brew "pipx"
|
||||
# brew "pkg-config"
|
||||
# brew "pyenv"
|
||||
# brew "tcl-tk"
|
||||
brew "yt-dlp"
|
||||
brew "zlib"
|
||||
# brew "zlib"
|
||||
cask "1password"
|
||||
cask "adguard"
|
||||
cask "arq"
|
||||
|
@ -8,9 +8,9 @@
|
||||
<data>
|
||||
YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMS
|
||||
AAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVRyb290gAGjCwwTVSRudWxs0w0ODxAREldO
|
||||
U1doaXRlXE5TQ29sb3JTcGFjZVYkY2xhc3NNMCAwLjg1MDAwMDAyABADgALSFBUWF1ok
|
||||
Y2xhc3NuYW1lWCRjbGFzc2VzV05TQ29sb3KiFhhYTlNPYmplY3QIERokKTI3SUxRU1dd
|
||||
ZGx5gI6Qkpeiq7O2AAAAAAAAAQEAAAAAAAAAGQAAAAAAAAAAAAAAAAAAAL8=
|
||||
U1doaXRlXE5TQ29sb3JTcGFjZVYkY2xhc3NCMAAQA4AC0hQVFhdaJGNsYXNzbmFtZVgk
|
||||
Y2xhc3Nlc1dOU0NvbG9yohYYWE5TT2JqZWN0CBEaJCkyN0lMUVNXXWRseYCDhYeMl6Co
|
||||
qwAAAAAAAAEBAAAAAAAAABkAAAAAAAAAAAAAAAAAAAC0
|
||||
</data>
|
||||
<key>CursorColor</key>
|
||||
<data>
|
||||
|
@ -1,19 +1,14 @@
|
||||
# macos-setup
|
||||
A set of bash scripts and files to configure macOS which:
|
||||
|
||||
- Configures most of the options in System Settings to preference
|
||||
- Configures most of the options in System Settings to personal preference
|
||||
- Speeds up mouse tracking speed beyond available settings
|
||||
- Installs:
|
||||
- Homebrew (https://brew.sh/)
|
||||
- mas-cli (https://github.com/mas-cli/mas)
|
||||
- The latest LTS version of Node.js
|
||||
- Python 3.11
|
||||
- Laravel Valet alongside any neccesary libraries (PHP, Composer, etc)
|
||||
- A list of programs and utilities from a Brewfile
|
||||
- Reconfigures the Dock with my most used programs
|
||||
- Sets a custom Terminal theme as default
|
||||
- Adds my custom Z Shell profile
|
||||
|
||||
Tested and working on macOS Ventura.
|
||||
## ToDo
|
||||
- Automatically select the second to most recent version of Python instead of specifiying the version in the Brewfile
|
17
setup.sh
17
setup.sh
@ -28,7 +28,7 @@ defaults write com.apple.dock springboard-columns -int 6;
|
||||
|
||||
# Increase mouse speed beyond available options in System Settings
|
||||
echo "Increase mouse speed"
|
||||
defaults write -g com.apple.mouse.scaling 9
|
||||
defaults write -g com.apple.mouse.scaling 10
|
||||
|
||||
# Configure Finder
|
||||
echo "Configuring Finder"
|
||||
@ -83,22 +83,9 @@ defaults write com.apple.Terminal "Startup Window Settings" -string "Custom"
|
||||
defaults write com.apple.Terminal "Default Window Settings" -string "Custom"
|
||||
rm ~/Downloads/Custom.terminal
|
||||
|
||||
# Copy ZSH Profile
|
||||
Copy ZSH Profile (disabled while re-doing profile)
|
||||
rsync zshrc ~/.zshrc
|
||||
source ~/.zshrc
|
||||
|
||||
# Install LTS version of Node and the second most recent version of Python
|
||||
# ToDo - programmatically set the Python version instead of directly specifying it
|
||||
nvm install --lts
|
||||
pyenv install 3.11
|
||||
pyenv global 3.11
|
||||
|
||||
# Install imagemagic module for PHP
|
||||
pecl install imagick
|
||||
|
||||
# Install Laravel Valet
|
||||
composer global require laravel/valet
|
||||
valet install
|
||||
|
||||
# Prompt user to reboot
|
||||
echo "Setup complete, please reboot."
|
123
zshrc
123
zshrc
@ -1,28 +1,113 @@
|
||||
# Composer
|
||||
export PATH="$HOME/.composer/vendor/bin:$PATH"
|
||||
# Prompt
|
||||
NEWLINE=$'\n'
|
||||
ARROW=$'\UE0B0'
|
||||
setopt prompt_subst
|
||||
function _git_symbols() {
|
||||
# Symbols
|
||||
local ahead='↑'
|
||||
local behind='↓'
|
||||
local diverged='↕'
|
||||
local up_to_date='|'
|
||||
local no_remote=''
|
||||
local staged='+'
|
||||
local untracked='?'
|
||||
local modified='!'
|
||||
local moved='>'
|
||||
local deleted='x'
|
||||
local stashed='$'
|
||||
|
||||
# Homebrew
|
||||
export PATH="/usr/local/sbin:$PATH"
|
||||
local output_symbols=''
|
||||
|
||||
# Node.js
|
||||
local git_status_v
|
||||
git_status_v="$(git status --porcelain=v2 --branch --show-stash 2>/dev/null)"
|
||||
|
||||
## NVM
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
# Parse branch information
|
||||
local ahead_count behind_count
|
||||
|
||||
### Load NVM
|
||||
[ -s "$(brew --prefix)/opt/nvm/nvm.sh" ] && \. "$(brew --prefix)/opt/nvm/nvm.sh"
|
||||
# AHEAD, BEHIND, DIVERGED
|
||||
if echo $git_status_v | grep -q "^# branch.ab " ; then
|
||||
# One line of the git status output looks like this:
|
||||
# # branch.ab +1 -2
|
||||
# In the line below:
|
||||
# - we grep for the line starting with # branch.ab
|
||||
# - we grep for the numbers and output them on separate lines
|
||||
# - we remove the + and - signs
|
||||
# - we put the two numbers into variables, while telling read to use a newline as the delimiter for reading
|
||||
read -d "\n" -r ahead_count behind_count <<< $(echo "$git_status_v" | grep "^# branch.ab" | grep -o -E '[+-][0-9]+' | sed 's/[-+]//')
|
||||
# Show the ahead and behind symbols when relevant
|
||||
[[ $ahead_count != 0 ]] && output_symbols+="$ahead"
|
||||
[[ $behind_count != 0 ]] && output_symbols+="$behind"
|
||||
# Replace the ahead symbol with the diverged symbol when both ahead and behind
|
||||
output_symbols="${output_symbols//$ahead$behind/$diverged}"
|
||||
|
||||
### Load bash completion
|
||||
[ -s "$(brew --prefix)/opt/nvm/etc/bash_completion.d/nvm" ] && \. "$(brew --prefix)/opt/nvm/etc/bash_completion.d/nvm"
|
||||
# If the branch is up to date, show the up to date symbol
|
||||
[[ $ahead_count == 0 && $behind_count == 0 ]] && output_symbols+="$up_to_date"
|
||||
fi
|
||||
|
||||
# Python
|
||||
# STASHED
|
||||
echo $git_status_v | grep -q "^# stash " && output_symbols+="$stashed"
|
||||
|
||||
## pyenv
|
||||
export PYENV_ROOT="$HOME/.pyenv"
|
||||
# STAGED
|
||||
[[ $(git diff --name-only --cached) ]] && output_symbols+="$staged"
|
||||
|
||||
### pyenv setup
|
||||
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
|
||||
eval "$(pyenv init -)"
|
||||
# For the rest of the symbols, we use the v1 format of git status because it's easier to parse.
|
||||
local git_status
|
||||
|
||||
## pipx
|
||||
export PATH="$PATH:/~/.local/bin"
|
||||
symbols="$(git status --porcelain=v1 | cut -c1-2 | sed 's/ //g')"
|
||||
|
||||
while IFS= read -r symbol; do
|
||||
case $symbol in
|
||||
??) output_symbols+="$untracked";;
|
||||
M) output_symbols+="$modified";;
|
||||
R) output_symbols+="$moved";;
|
||||
D) output_symbols+="$deleted";;
|
||||
esac
|
||||
done <<< "$symbols"
|
||||
|
||||
# Remove duplicate symbols
|
||||
output_symbols="$(echo -n "$output_symbols" | tr -s "$untracked$modified$moved$deleted")"
|
||||
|
||||
[[ -n $output_symbols ]] && echo -n " $output_symbols"
|
||||
}
|
||||
|
||||
function _git_info() {
|
||||
local git_info=''
|
||||
local git_branch_name=''
|
||||
|
||||
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
||||
git_branch_name="$(git symbolic-ref --short HEAD 2>/dev/null)"
|
||||
if [[ -n "$git_branch_name" ]]; then
|
||||
git_info+="%K{202}%F{52}${ARROW}%f"
|
||||
git_info+="%F{black}%B "
|
||||
git_info+="ש $git_branch_name"
|
||||
fi
|
||||
git_info+="$(_git_symbols)"
|
||||
git_info+="%b%f"
|
||||
git_info+="%k%F{202}${ARROW}%f"
|
||||
echo "$git_info "
|
||||
else
|
||||
git_info+="%K{black}%F{52}${ARROW}%f%k"
|
||||
echo "$git_info "
|
||||
fi
|
||||
}
|
||||
|
||||
# Set background and foreground for first element
|
||||
PROMPT='%K{214}%F{black}'
|
||||
# Print date and time
|
||||
PROMPT+='${ARROW} %D %T '
|
||||
# Close first element
|
||||
PROMPT+='%f%k'
|
||||
# Set background for second element
|
||||
PROMPT+='%K{52}'
|
||||
# Print next arrow
|
||||
PROMPT+='%F{214}${ARROW}%f'
|
||||
# Print current and parent directory
|
||||
PROMPT+=' %2d '
|
||||
# Close second element
|
||||
PROMPT+='%k'
|
||||
# Git Status
|
||||
PROMPT+='$(_git_info)'
|
||||
# Move to new line
|
||||
PROMPT+='${NEWLINE}'
|
||||
# Start second line
|
||||
PROMPT+=' > '
|
Loading…
Reference in New Issue
Block a user