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/bundle"
|
||||||
tap "homebrew/services"
|
tap "homebrew/services"
|
||||||
brew "xz"
|
# brew "xz"
|
||||||
brew "openssl@3"
|
# brew "openssl@3"
|
||||||
brew "readline"
|
# brew "readline"
|
||||||
brew "sqlite"
|
# brew "sqlite"
|
||||||
brew "php"
|
# brew "php"
|
||||||
brew "composer"
|
# brew "composer"
|
||||||
brew "dnsmasq"
|
# brew "dnsmasq"
|
||||||
brew "ffmpeg"
|
# brew "ffmpeg"
|
||||||
brew "git"
|
brew "git"
|
||||||
brew "imagemagick"
|
# brew "imagemagick"
|
||||||
brew "mas"
|
brew "mas"
|
||||||
brew "nginx"
|
# brew "nginx"
|
||||||
brew "nvm"
|
# brew "nvm"
|
||||||
brew "pipx"
|
# brew "pipx"
|
||||||
brew "pkg-config"
|
# brew "pkg-config"
|
||||||
brew "pyenv"
|
# brew "pyenv"
|
||||||
brew "tcl-tk"
|
# brew "tcl-tk"
|
||||||
brew "yt-dlp"
|
brew "yt-dlp"
|
||||||
brew "zlib"
|
# brew "zlib"
|
||||||
cask "1password"
|
cask "1password"
|
||||||
cask "adguard"
|
cask "adguard"
|
||||||
cask "arq"
|
cask "arq"
|
||||||
|
@ -8,9 +8,9 @@
|
|||||||
<data>
|
<data>
|
||||||
YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMS
|
YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMS
|
||||||
AAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVRyb290gAGjCwwTVSRudWxs0w0ODxAREldO
|
AAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVRyb290gAGjCwwTVSRudWxs0w0ODxAREldO
|
||||||
U1doaXRlXE5TQ29sb3JTcGFjZVYkY2xhc3NNMCAwLjg1MDAwMDAyABADgALSFBUWF1ok
|
U1doaXRlXE5TQ29sb3JTcGFjZVYkY2xhc3NCMAAQA4AC0hQVFhdaJGNsYXNzbmFtZVgk
|
||||||
Y2xhc3NuYW1lWCRjbGFzc2VzV05TQ29sb3KiFhhYTlNPYmplY3QIERokKTI3SUxRU1dd
|
Y2xhc3Nlc1dOU0NvbG9yohYYWE5TT2JqZWN0CBEaJCkyN0lMUVNXXWRseYCDhYeMl6Co
|
||||||
ZGx5gI6Qkpeiq7O2AAAAAAAAAQEAAAAAAAAAGQAAAAAAAAAAAAAAAAAAAL8=
|
qwAAAAAAAAEBAAAAAAAAABkAAAAAAAAAAAAAAAAAAAC0
|
||||||
</data>
|
</data>
|
||||||
<key>CursorColor</key>
|
<key>CursorColor</key>
|
||||||
<data>
|
<data>
|
||||||
|
@ -1,19 +1,14 @@
|
|||||||
# macos-setup
|
# macos-setup
|
||||||
A set of bash scripts and files to configure macOS which:
|
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
|
- Speeds up mouse tracking speed beyond available settings
|
||||||
- Installs:
|
- Installs:
|
||||||
- Homebrew (https://brew.sh/)
|
- Homebrew (https://brew.sh/)
|
||||||
- mas-cli (https://github.com/mas-cli/mas)
|
- 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
|
- A list of programs and utilities from a Brewfile
|
||||||
- Reconfigures the Dock with my most used programs
|
- Reconfigures the Dock with my most used programs
|
||||||
- Sets a custom Terminal theme as default
|
- Sets a custom Terminal theme as default
|
||||||
- Adds my custom Z Shell profile
|
- Adds my custom Z Shell profile
|
||||||
|
|
||||||
Tested and working on macOS Ventura.
|
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
|
# Increase mouse speed beyond available options in System Settings
|
||||||
echo "Increase mouse speed"
|
echo "Increase mouse speed"
|
||||||
defaults write -g com.apple.mouse.scaling 9
|
defaults write -g com.apple.mouse.scaling 10
|
||||||
|
|
||||||
# Configure Finder
|
# Configure Finder
|
||||||
echo "Configuring 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"
|
defaults write com.apple.Terminal "Default Window Settings" -string "Custom"
|
||||||
rm ~/Downloads/Custom.terminal
|
rm ~/Downloads/Custom.terminal
|
||||||
|
|
||||||
# Copy ZSH Profile
|
Copy ZSH Profile (disabled while re-doing profile)
|
||||||
rsync zshrc ~/.zshrc
|
rsync zshrc ~/.zshrc
|
||||||
source ~/.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
|
# Prompt user to reboot
|
||||||
echo "Setup complete, please reboot."
|
echo "Setup complete, please reboot."
|
123
zshrc
123
zshrc
@ -1,28 +1,113 @@
|
|||||||
# Composer
|
# Prompt
|
||||||
export PATH="$HOME/.composer/vendor/bin:$PATH"
|
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
|
local output_symbols=''
|
||||||
export PATH="/usr/local/sbin:$PATH"
|
|
||||||
|
|
||||||
# Node.js
|
local git_status_v
|
||||||
|
git_status_v="$(git status --porcelain=v2 --branch --show-stash 2>/dev/null)"
|
||||||
|
|
||||||
## NVM
|
# Parse branch information
|
||||||
export NVM_DIR="$HOME/.nvm"
|
local ahead_count behind_count
|
||||||
|
|
||||||
### Load NVM
|
# AHEAD, BEHIND, DIVERGED
|
||||||
[ -s "$(brew --prefix)/opt/nvm/nvm.sh" ] && \. "$(brew --prefix)/opt/nvm/nvm.sh"
|
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
|
# If the branch is up to date, show the up to date symbol
|
||||||
[ -s "$(brew --prefix)/opt/nvm/etc/bash_completion.d/nvm" ] && \. "$(brew --prefix)/opt/nvm/etc/bash_completion.d/nvm"
|
[[ $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
|
# STAGED
|
||||||
export PYENV_ROOT="$HOME/.pyenv"
|
[[ $(git diff --name-only --cached) ]] && output_symbols+="$staged"
|
||||||
|
|
||||||
### pyenv setup
|
# For the rest of the symbols, we use the v1 format of git status because it's easier to parse.
|
||||||
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
|
local git_status
|
||||||
eval "$(pyenv init -)"
|
|
||||||
|
|
||||||
## pipx
|
symbols="$(git status --porcelain=v1 | cut -c1-2 | sed 's/ //g')"
|
||||||
export PATH="$PATH:/~/.local/bin"
|
|
||||||
|
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