switching to apple silicon

This commit is contained in:
Jeremie Fraeys 2024-08-24 13:20:41 -04:00
parent 98198d7fd1
commit 4076fbef50
5 changed files with 98 additions and 36 deletions

View file

@ -3,3 +3,4 @@ channels:
auto_activate_base: false
changeps1: false
channel_priority: strict

View file

@ -24,8 +24,15 @@ elseif wezterm.target_triple == "x86_64-apple-darwin" then
config.macos_window_background_blur = 10
config.default_prog = { "/bin/zsh", "-l" }
config.font = wezterm.font_with_fallback({
{ family = "MesloLGS NF", scale = 0.9 },
{ family = "Symbols Nerd Font", scale = 0.9 },
{ family = "MesloLGS Nerd Font", scale = 0.9 },
{ family = "Menlo", scale = 0.9 },
})
elseif wezterm.target_triple == "aarch64-apple-darwin" then
config.macos_window_background_blur = 10
config.default_prog = { "/bin/zsh", "-l" }
config.font = wezterm.font_with_fallback({
{ family = "MesloLGS Nerd Font", scale = 0.9 },
{ family = "Menlo", scale = 0.9 },
})
elseif wezterm.target_triple == "x86_64-unknown-linux-gnu" then
config.default_prog = { "/bin/bash", "-l" }
@ -72,7 +79,7 @@ if config.enable_tab_bar then
config.tab_max_width = 25
config.show_new_tab_button_in_tab_bar = false
end
--
config.switch_to_last_active_tab_when_closing_tab = true
config.window_close_confirmation = "NeverPrompt"
@ -159,12 +166,25 @@ keys = {
{ key = " ", mods = "LEADER", action = act.ActivateTabRelative(1) },
{ key = "x", mods = "LEADER", action = act({ CloseCurrentPane = { confirm = true } }) },
-- {
-- key = "f",
-- mods = "LEADER",
-- action = act.SpawnCommandInNewTab({
-- args = { "sessionizer" },
-- }),
-- },
{
key = "f",
mods = "LEADER",
action = act.SpawnCommandInNewTab({
args = { "sessionizer" },
}),
action = wezterm.action_callback(function(window, pane)
-- Check if the pane is a command-line environment
local title = pane:get_title()
if title:match("^[%a%d%._-]+[%s]*$") then
-- Example condition: check if the title matches common command-line patterns
window:perform_action(wezterm.action.SendString("sessionizer\n"), pane)
end
end),
},
{

View file

@ -1,13 +1,22 @@
# Setup fzf
# ---------
if [[ ! "$PATH" == */usr/local/opt/fzf/bin* ]]; then
PATH="${PATH:+${PATH}:}/usr/local/opt/fzf/bin"
if [[ "$(uname -m)" == "arm64" ]]; then
# ARM-based Mac (Apple Silicon)
FZF_PATH="/opt/homebrew/opt/fzf"
else
# Intel-based Mac
FZF_PATH="/usr/local/opt/fzf"
fi
if [[ ! "$PATH" == *$FZF_PATH/bin* ]]; then
PATH="${PATH:+${PATH}:}$FZF_PATH/bin"
fi
# Auto-completion
# ---------------
[[ $- == *i* ]] && source "/usr/local/opt/fzf/shell/completion.zsh" 2> /dev/null
[[ $- == *i* ]] && source "$FZF_PATH/shell/completion.zsh" 2> /dev/null
# Key bindings
# ------------
source "/usr/local/opt/fzf/shell/key-bindings.zsh"
source "$FZF_PATH/shell/key-bindings.zsh"

View file

@ -4,6 +4,15 @@
# Set default pager
export PAGER="less -i -N -S -R"
# Determine architecture and set brew paths
if [[ "$(uname -m)" == "arm64" ]]; then
# ARM-based Mac (Apple Silicon)
HOMEBREW_PREFIX="/opt/homebrew"
else
# Intel-based Mac
HOMEBREW_PREFIX="/usr/local"
fi
# Ensure PYENV_ROOT is set and its bin directory is in PATH
if [[ -n "$PYENV_ROOT" && ! "$PATH" =~ (^|:)${PYENV_ROOT}/bin(:|$) ]]; then
export PATH="$PYENV_ROOT/bin:$PATH"
@ -20,8 +29,8 @@ fi
# Read fzf theme options if the file exists
if [[ -f "$HOME/.local/bin/scripts/fzf_theme" ]]; then
FZF_OPTIONS=$("$HOME/.local/bin/scripts/fzf_theme")
export FZF_DEFAULT_OPTS="$FZF_OPTIONS"
FZF_OPTIONS=$("$HOME/.local/bin/scripts/fzf_theme")
export FZF_DEFAULT_OPTS="$FZF_OPTIONS"
fi
# Source fzf configuration
@ -36,10 +45,18 @@ if [[ -d "$HOME/.rvm/bin" && ! "$PATH" =~ (^|:)${HOME}/.rvm/bin(:|$) ]]; then
export PATH="$PATH:$HOME/.rvm/bin"
fi
# Add Node to PATH
if command -v node &> /dev/null; then
export PATH="$PATH:$(npm bin)"
fi
# Add Golang to PATH
if [[ -n "$(go env GOPATH)" && ! "$PATH" =~ (^|:)$(go env GOPATH)/bin(:|$) ]]; then
if command -v go &> /dev/null; then
# Set GOPATH and add Go binaries to PATH
export GOPATH="${GOPATH:-$HOME/Documents/projects:$HOME/.go}"
export PATH="$PATH:$(go env GOPATH)/bin"
if [[ ! "$PATH" =~ (^|:)$(go env GOPATH)/bin(:|$) ]]; then
export PATH="$PATH:$(go env GOPATH)/bin"
fi
fi
# Cargo setup

View file

@ -6,16 +6,16 @@
# export ZSH_CUSTOM="$HOME/.oh-my-zsh/custom"
# export UPDATE_ZSH_DAYS=1
# Add macOS specific command-line utilities
if [[ -d /usr/local/opt/coreutils/libexec/gnubin && ! "$PATH" =~ (^|:)/usr/local/opt/coreutils/libexec/gnubin(:|$) ]]; then
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
fi
# Ensure /opt/homebrew is in the PATH if it exists
if [[ -d /opt/homebrew && ! "$PATH" =~ (^|:)/opt/homebrew/(bin|sbin)($|:) ]]; then
export PATH="/opt/homebrew/bin:/opt/homebrew/sbin:$PATH"
fi
# Add macOS specific command-line utilities
if [[ -d /usr/local/opt/coreutils/libexec/gnubin && ! "$PATH" =~ (^|:)/usr/local/opt/coreutils/libexec/gnubin(:|$) ]]; then
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
fi
# Add /usr/local/bin and /usr/local/sbin to PATH if they are not already present
dirs=("/usr/local/bin" "/usr/local/sbin")
for dir in "${dirs[@]}"; do
@ -92,6 +92,12 @@ zinit load ajeetdsouza/zoxide
# Load eza completions if needed
[[ ! "$FPATH" =~ (^|:)${HOME}/.local/bin/eza/completions/zsh(:|$) ]] && export FPATH="$HOME/.local/bin/eza/completions/zsh:$FPATH"
# Initialize pyenv
if command -v pyenv 1>/dev/null 2>&1; then
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
fi
# Initialize direnv
eval "$(direnv hook zsh)"
@ -102,30 +108,42 @@ eval "$(zoxide init --cmd cd zsh)"
eval "$(starship init zsh)"
export STARSHIP_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/starship.toml"
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/usr/local/Caskroom/miniforge/base/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/usr/local/Caskroom/miniforge/base/etc/profile.d/conda.sh" ]; then
. "/usr/local/Caskroom/miniforge/base/etc/profile.d/conda.sh"
else
export PATH="/usr/local/Caskroom/miniforge/base/bin:$PATH"
# Contents within this block are managed by 'conda init'
CONDA_PATHS=("/usr/local/Caskroom/miniforge/base" "/opt/homebrew/Caskroom/miniforge/base")
for CONDA_PATH in "${CONDA_PATHS[@]}"; do
if [ -d "$CONDA_PATH" ]; then
__conda_setup="$('$CONDA_PATH/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "$CONDA_PATH/etc/profile.d/conda.sh" ]; then
. "$CONDA_PATH/etc/profile.d/conda.sh"
else
export PATH="$CONDA_PATH/bin:$PATH"
fi
fi
# Initialize Mamba if available
if [ -f "$CONDA_PATH/etc/profile.d/mamba.sh" ]; then
. "$CONDA_PATH/etc/profile.d/mamba.sh"
fi
break
fi
fi
done
unset __conda_setup
# <<< conda initialize <<<
# Set default editor
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR='vi'
export EDITOR='vim'
else
export EDITOR='nvim'
fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# export ARCHFLAGS="-arch x86_64 -arch arm64"
# Custom aliases
alias python="python3"
@ -135,9 +153,6 @@ if [[ -f ~/.local/bin/scripts/check_aliases ]]; then
. ~/.local/bin/scripts/check_aliases
fi
# Final clean-up of PATH (commented out for speed)
# path_clean
# zprof (commented out for speed)
# zprof