more changes
This commit is contained in:
parent
94d90d9a3a
commit
6ae3048c28
19 changed files with 880 additions and 559 deletions
|
|
@ -9,6 +9,7 @@ after-login-command = []
|
||||||
# You can use it to add commands that run after AeroSpace startup.
|
# You can use it to add commands that run after AeroSpace startup.
|
||||||
# 'after-startup-command' is run after 'after-login-command'
|
# 'after-startup-command' is run after 'after-login-command'
|
||||||
# Available commands : https://nikitabobko.github.io/AeroSpace/commands
|
# Available commands : https://nikitabobko.github.io/AeroSpace/commands
|
||||||
|
# after-startup-command = ['exec-and-forget sketchybar']
|
||||||
after-startup-command = []
|
after-startup-command = []
|
||||||
|
|
||||||
# Start AeroSpace at login
|
# Start AeroSpace at login
|
||||||
|
|
@ -36,7 +37,7 @@ default-root-container-orientation = 'auto'
|
||||||
# See https://nikitabobko.github.io/AeroSpace/guide#on-focus-changed-callbacks
|
# See https://nikitabobko.github.io/AeroSpace/guide#on-focus-changed-callbacks
|
||||||
# See https://nikitabobko.github.io/AeroSpace/commands#move-mouse
|
# See https://nikitabobko.github.io/AeroSpace/commands#move-mouse
|
||||||
# Fallback value (if you omit the key): on-focused-monitor-changed = []
|
# Fallback value (if you omit the key): on-focused-monitor-changed = []
|
||||||
on-focused-monitor-changed = ['move-mouse monitor-lazy-center']
|
# on-focused-monitor-changed = ['move-mouse monitor-lazy-center']
|
||||||
# on-focus-changed = ['move-mouse window-lazy-center']
|
# on-focus-changed = ['move-mouse window-lazy-center']
|
||||||
|
|
||||||
# You can effectively turn off macOS "Hide application" (cmd-h) feature by toggling this flag
|
# You can effectively turn off macOS "Hide application" (cmd-h) feature by toggling this flag
|
||||||
|
|
@ -47,6 +48,13 @@ automatically-unhide-macos-hidden-apps = false
|
||||||
# Disable window opening animation
|
# Disable window opening animation
|
||||||
# disable-window-opening-animation = true
|
# disable-window-opening-animation = true
|
||||||
|
|
||||||
|
# Notify Sketchybar about workspace change
|
||||||
|
# exec-on-workspace-change = [
|
||||||
|
# '/bin/bash',
|
||||||
|
# '-c',
|
||||||
|
# 'sketchybar --trigger aerospace_workspace_change FOCUSED_WORKSPACE=$AEROSPACE_FOCUSED_WORKSPACE',
|
||||||
|
# ]
|
||||||
|
|
||||||
# Possible values: (qwerty|dvorak)
|
# Possible values: (qwerty|dvorak)
|
||||||
# See https://nikitabobko.github.io/AeroSpace/guide#key-mapping
|
# See https://nikitabobko.github.io/AeroSpace/guide#key-mapping
|
||||||
[key-mapping]
|
[key-mapping]
|
||||||
|
|
@ -60,12 +68,12 @@ preset = 'qwerty'
|
||||||
# Monitor pattern is the same as for 'workspace-to-monitor-force-assignment'.
|
# Monitor pattern is the same as for 'workspace-to-monitor-force-assignment'.
|
||||||
# See: https://nikitabobko.github.io/AeroSpace/guide#assign-workspaces-to-monitors
|
# See: https://nikitabobko.github.io/AeroSpace/guide#assign-workspaces-to-monitors
|
||||||
[gaps]
|
[gaps]
|
||||||
|
outer.left = 3
|
||||||
|
outer.right = 3
|
||||||
|
outer.top = 3
|
||||||
|
outer.bottom = 5
|
||||||
inner.horizontal = 3
|
inner.horizontal = 3
|
||||||
inner.vertical = 3
|
inner.vertical = 3
|
||||||
outer.left = 5
|
|
||||||
outer.bottom = 5
|
|
||||||
outer.top = 5
|
|
||||||
outer.right = 5
|
|
||||||
|
|
||||||
# 'main' binding mode declaration
|
# 'main' binding mode declaration
|
||||||
# See: https://nikitabobko.github.io/AeroSpace/guide#binding-modes
|
# See: https://nikitabobko.github.io/AeroSpace/guide#binding-modes
|
||||||
|
|
@ -119,8 +127,10 @@ alt-shift-k = 'move up'
|
||||||
alt-shift-l = 'move right'
|
alt-shift-l = 'move right'
|
||||||
|
|
||||||
# See: https://nikitabobko.github.io/AeroSpace/commands#resize
|
# See: https://nikitabobko.github.io/AeroSpace/commands#resize
|
||||||
# alt-shift-minus = 'resize smart -50'
|
alt-shift-minus = 'resize smart -50'
|
||||||
# alt-shift-equal = 'resize smart +50'
|
alt-shift-equal = 'resize smart +50'
|
||||||
|
|
||||||
|
alt-shift-r = 'resize
|
||||||
|
|
||||||
# See: https://nikitabobko.github.io/AeroSpace/commands#workspace
|
# See: https://nikitabobko.github.io/AeroSpace/commands#workspace
|
||||||
alt-1 = 'workspace 1'
|
alt-1 = 'workspace 1'
|
||||||
|
|
@ -143,6 +153,15 @@ alt-z = 'workspace Z'
|
||||||
alt-shift-1 = 'move-node-to-workspace 1'
|
alt-shift-1 = 'move-node-to-workspace 1'
|
||||||
alt-shift-2 = 'move-node-to-workspace 2'
|
alt-shift-2 = 'move-node-to-workspace 2'
|
||||||
alt-shift-3 = 'move-node-to-workspace 3'
|
alt-shift-3 = 'move-node-to-workspace 3'
|
||||||
|
alt-shift-c = 'move-node-to-workspace C'
|
||||||
|
alt-shift-e = 'move-node-to-workspace E'
|
||||||
|
alt-shift-g = 'move-node-to-workspace G'
|
||||||
|
alt-shift-n = 'move-node-to-workspace N'
|
||||||
|
alt-shift-m = 'move-node-to-workspace M'
|
||||||
|
alt-shift-o = 'move-node-to-workspace O'
|
||||||
|
alt-shift-s = 'move-node-to-workspace S'
|
||||||
|
alt-shift-t = 'move-node-to-workspace T'
|
||||||
|
alt-shift-v = 'move-node-to-workspace V'
|
||||||
alt-shift-x = 'move-node-to-workspace X'
|
alt-shift-x = 'move-node-to-workspace X'
|
||||||
alt-shift-y = 'move-node-to-workspace Y'
|
alt-shift-y = 'move-node-to-workspace Y'
|
||||||
alt-shift-z = 'move-node-to-workspace Z'
|
alt-shift-z = 'move-node-to-workspace Z'
|
||||||
|
|
@ -154,7 +173,9 @@ alt-shift-tab = 'move-workspace-to-monitor --wrap-around next'
|
||||||
|
|
||||||
# See: https://nikitabobko.github.io/AeroSpace/commands#mode
|
# See: https://nikitabobko.github.io/AeroSpace/commands#mode
|
||||||
alt-shift-semicolon = 'mode service'
|
alt-shift-semicolon = 'mode service'
|
||||||
alt-shift-r = 'mode resize'
|
alt-shift-r = 'mode resize'
|
||||||
|
|
||||||
|
alt-f = 'fullscreen'
|
||||||
# 'service' binding mode declaration.
|
# 'service' binding mode declaration.
|
||||||
# See: https://nikitabobko.github.io/AeroSpace/guide#binding-modes
|
# See: https://nikitabobko.github.io/AeroSpace/guide#binding-modes
|
||||||
[mode.service.binding]
|
[mode.service.binding]
|
||||||
|
|
@ -185,6 +206,8 @@ alt-shift-l = ['join-with right', 'mode main']
|
||||||
|
|
||||||
[workspace-to-monitor-force-assignment]
|
[workspace-to-monitor-force-assignment]
|
||||||
1 = 'main'
|
1 = 'main'
|
||||||
|
2 = 'main'
|
||||||
|
3 = 'main'
|
||||||
X = ['secondary', 'dell']
|
X = ['secondary', 'dell']
|
||||||
Y = ['secondary', 'dell']
|
Y = ['secondary', 'dell']
|
||||||
Z = ['secondary', 'dell']
|
Z = ['secondary', 'dell']
|
||||||
|
|
@ -194,17 +217,13 @@ if.app-id = 'com.apple.iCal'
|
||||||
run = "move-node-to-workspace C"
|
run = "move-node-to-workspace C"
|
||||||
|
|
||||||
[[on-window-detected]]
|
[[on-window-detected]]
|
||||||
if.app-id = 'org.mozilla.firefox'
|
if.app-id = 'com.apple.finder'
|
||||||
|
run = "move-node-to-workspace E"
|
||||||
|
|
||||||
|
[[on-window-detected]]
|
||||||
|
if.app-id = 'app.zen-browser.zen'
|
||||||
run = "move-node-to-workspace G"
|
run = "move-node-to-workspace G"
|
||||||
|
|
||||||
[[on-window-detected]]
|
|
||||||
if.app-id = 'com.github.wez.wezterm'
|
|
||||||
run = "move-node-to-workspace T"
|
|
||||||
|
|
||||||
[[on-window-detected]]
|
|
||||||
if.app-id = 'com.spotify.client'
|
|
||||||
run = "move-node-to-workspace S"
|
|
||||||
|
|
||||||
[[on-window-detected]]
|
[[on-window-detected]]
|
||||||
if.app-id = 'com.apple.MobileSMS'
|
if.app-id = 'com.apple.MobileSMS'
|
||||||
run = "move-node-to-workspace N"
|
run = "move-node-to-workspace N"
|
||||||
|
|
@ -217,15 +236,18 @@ run = "move-node-to-workspace M"
|
||||||
if.app-id = 'md.obsidian'
|
if.app-id = 'md.obsidian'
|
||||||
run = "move-node-to-workspace O"
|
run = "move-node-to-workspace O"
|
||||||
|
|
||||||
|
[[on-window-detected]]
|
||||||
|
if.app-id = 'com.spotify.client'
|
||||||
|
run = "move-node-to-workspace S"
|
||||||
|
|
||||||
|
[[on-window-detected]]
|
||||||
|
if.app-id = 'com.github.wez.wezterm'
|
||||||
|
run = "move-node-to-workspace T"
|
||||||
|
|
||||||
[[on-window-detected]]
|
[[on-window-detected]]
|
||||||
if.app-id = 'com.vscodium'
|
if.app-id = 'com.vscodium'
|
||||||
run = "move-node-to-workspace V"
|
run = "move-node-to-workspace V"
|
||||||
|
|
||||||
[[on-window-detected]]
|
[[on-window-detected]]
|
||||||
if.app-id = 'com.apple.finder'
|
if.app-id = 'com.apple.Safari'
|
||||||
run = "move-node-to-workspace E"
|
run = "move-node-to-workspace X"
|
||||||
|
|
||||||
# after-startup-command = [
|
|
||||||
# 'exec-and-forget borders active_color=0xffe1e3e4 inactive_color=0xff494d64 width=5.0'
|
|
||||||
# ]
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,77 +1,70 @@
|
||||||
# Ensure XDG_CONFIG_HOME is set
|
#!/usr/bin/env bash
|
||||||
: "${XDG_CONFIG_HOME:=$HOME/.config}"
|
|
||||||
|
|
||||||
# Set default pager
|
# ------------- Environment Setup -------------
|
||||||
|
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||||
|
export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
|
||||||
|
export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
|
||||||
|
|
||||||
|
# Default tools
|
||||||
export PAGER="less -i -N -S -R"
|
export PAGER="less -i -N -S -R"
|
||||||
|
export EDITOR="nvim"
|
||||||
|
export BROWSER="firefox"
|
||||||
|
|
||||||
# Ensure PYENV_ROOT is set and its bin directory is in PATH
|
# ------------- Platform-Specific Setup -------------
|
||||||
if [ -n "$PYENV_ROOT" ] && [[ ! "$PATH" =~ (^|:)${PYENV_ROOT}/bin(:|$) ]]; then
|
OS_TYPE="$(uname -s)"
|
||||||
export PATH="$PYENV_ROOT/bin:$PATH"
|
|
||||||
fi
|
|
||||||
eval "$(pyenv init -)"
|
|
||||||
|
|
||||||
# Add ~/.local/bin to PATH if it exists
|
# Default package manager setup (only for Debian-based systems)
|
||||||
if [ -d "$HOME/.local/bin" ] && [[ ! "$PATH" =~ (^|:)${HOME}/.local/bin(:|$) ]]; then
|
if [[ "$OS_TYPE" == "Linux" ]]; then
|
||||||
export PATH="$HOME/.local/bin:$PATH"
|
# Debian/Ubuntu-based systems (and derivatives like WSL Ubuntu)
|
||||||
|
if command -v apt &>/dev/null; then
|
||||||
|
PACKAGE_MANAGER="apt"
|
||||||
|
export PACKAGE_MANAGER
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ -n ${SSH_CONNECTION} ]] && export EDITOR='vim'
|
# ------------- Helper Functions -------------
|
||||||
|
safe_path_add() {
|
||||||
|
[[ -d "$1" && ":$PATH:" != *":$1:"* ]] && export PATH="$1:$PATH"
|
||||||
|
}
|
||||||
|
|
||||||
# Set permissions for ~/.local/bin
|
# ------------- PATH Setup -------------
|
||||||
chmod -R ug+rwx "$HOME/.local/bin/"
|
safe_path_add "$HOME/.local/bin/scripts"
|
||||||
|
|
||||||
# Read fzf theme options if the file exists
|
# Python Paths
|
||||||
if [ -f "$HOME/.local/bin/scripts/fzf_theme" ]; then
|
[[ -n "$PYENV_ROOT" ]] && safe_path_add "$PYENV_ROOT/bin"
|
||||||
FZF_OPTIONS=$("$HOME/.local/bin/scripts/fzf_theme")
|
|
||||||
export FZF_DEFAULT_OPTS="$FZF_OPTIONS"
|
# Go Paths
|
||||||
|
if command -v go &>/dev/null; then
|
||||||
|
export GOPATH="${GOPATH:-$HOME/.go}"
|
||||||
|
safe_path_add "$GOPATH/bin"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Source fzf configuration
|
# Rust
|
||||||
if command -v fzf >/dev/null 2>&1; then
|
export PATH="$HOME/.cargo/bin:$PATH"
|
||||||
eval "$(fzf --bash)"
|
|
||||||
|
# NVM Setup
|
||||||
|
if [[ -d "$HOME/.nvm" ]]; then
|
||||||
|
export NVM_DIR="$HOME/.nvm"
|
||||||
|
[[ -s "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh"
|
||||||
|
[[ -s "$NVM_DIR/bash_completion" ]] && source "$NVM_DIR/bash_completion"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -f ~/.fzf.bash ] && . ~/.fzf.bash
|
# ------------- FZF and Nix Setup -------------
|
||||||
|
# Determine FZF installation path
|
||||||
# Add RVM to PATH if not already included
|
if command -v fzf &>/dev/null; then
|
||||||
if [[ ! "$PATH" =~ (^|:)${HOME}/.rvm/bin(:|$) ]]; then
|
if [[ "$(command -v fzf)" == "/run/current-system/sw/bin/fzf" ]]; then
|
||||||
export PATH="$PATH:$HOME/.rvm/bin"
|
FZF_PATH="/run/current-system/sw"
|
||||||
|
else
|
||||||
|
FZF_PATH=""
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add Golang to PATH if not already included
|
# Add FZF to PATH if not already there
|
||||||
if [ -n "$(go env GOPATH)" ] && [[ ! "$PATH" =~ (^|:)$(go env GOPATH)/bin(:|$) ]]; then
|
if [[ -n "$FZF_PATH" && ! "$PATH" =~ (^|:)"$FZF_PATH"(:|$) ]]; then
|
||||||
export GOPATH="$HOME/Documents/projects:$HOME/go"
|
export PATH="$FZF_PATH:$PATH"
|
||||||
export PATH="$PATH:$(go env GOPATH)/bin"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Cargo setup
|
# Ensure Nix user profile is in PATH (for NixOS users)
|
||||||
if [ -d "$HOME/.cargo/bin" ] && [[ ! "$PATH" =~ (^|:)${HOME}/.cargo/bin(:|$) ]]; then
|
if [[ -d "$HOME/.nix-profile/bin" && ! "$PATH" =~ (^|:)"$HOME/.nix-profile/bin"(:|$) ]]; then
|
||||||
export PATH="$HOME/.cargo/bin:$PATH"
|
export PATH="$HOME/.nix-profile/bin:$PATH"
|
||||||
fi
|
|
||||||
|
|
||||||
# >>> conda initialize >>>
|
|
||||||
# !! Contents within this block are managed by 'conda init' !!
|
|
||||||
__conda_setup="$('/usr/local/Caskroom/miniforge/base/bin/conda' 'shell.bash' '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"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
unset __conda_setup
|
|
||||||
# <<< conda initialize <<<
|
|
||||||
|
|
||||||
# Check for WSL and adjust configurations
|
|
||||||
if grep -q Microsoft /proc/version; then
|
|
||||||
# Ensure WSL compatibility for Conda if using Miniforge
|
|
||||||
if [ -f "/mnt/c/Users/$USER/AppData/Local/Miniconda3/etc/profile.d/conda.sh" ]; then
|
|
||||||
. "/mnt/c/Users/$USER/AppData/Local/Miniconda3/etc/profile.d/conda.sh"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# Unix-specific configuration (Linux/macOS)
|
|
||||||
# Add any Unix-specific paths or configurations here
|
|
||||||
export PATH="/usr/local/bin:$PATH"
|
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
184
bash/.bashrc
184
bash/.bashrc
|
|
@ -1,62 +1,148 @@
|
||||||
# Load bash completion
|
#!/usr/bin/env bash
|
||||||
if [[ -f /etc/bash_completion ]]; then
|
|
||||||
. /etc/bash_completion
|
# ================ Basic Settings ================
|
||||||
|
# Disable auto title (not applicable to Bash directly, but can be handled through prompts)
|
||||||
|
DISABLE_AUTO_TITLE="true"
|
||||||
|
|
||||||
|
# Miscellaneous settings (uncomment as needed)
|
||||||
|
# DISABLE_LS_COLORS="true"
|
||||||
|
# ENABLE_CORRECTION="true"
|
||||||
|
# COMPLETION_WAITING_DOTS="true"
|
||||||
|
|
||||||
|
# ================ Path Optimizations ================
|
||||||
|
# Ensure no duplicates in PATH
|
||||||
|
typeset -U PATH
|
||||||
|
|
||||||
|
# ================ Bash Completion Settings ================
|
||||||
|
# Enable Bash completions (assuming Bash-completion is installed)
|
||||||
|
if command -v "$PACKAGE_MANAGER" &>/dev/null; then
|
||||||
|
# Install bash-completion if not already installed
|
||||||
|
if ! command -v bash-completion &>/dev/null; then
|
||||||
|
echo "Installing bash-completion..."
|
||||||
|
"$PACKAGE_MANAGER" install bash-completion
|
||||||
|
fi
|
||||||
|
# Source bash-completion if installed
|
||||||
|
if [ -f "/usr/local/etc/bash_completion" ]; then
|
||||||
|
. "/usr/local/etc/bash_completion"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for WSL and adjust accordingly
|
# ================ Plugin Manager (Bash-it) ================
|
||||||
if grep -q Microsoft /proc/version; then
|
# Setup and initialize Bash-it, a Bash plugin manager
|
||||||
# WSL-specific configuration
|
if [ -z "$BASH_IT" ]; then
|
||||||
|
export BASH_IT="$HOME/.bash_it"
|
||||||
# Set path to Windows executables for easy access
|
|
||||||
export PATH="/mnt/c/Windows/System32:$PATH"
|
|
||||||
export PATH="/mnt/c/Program Files:$PATH"
|
|
||||||
export PATH="/mnt/c/Windows:$PATH"
|
|
||||||
|
|
||||||
# Use Windows Notepad or other executables from WSL
|
|
||||||
alias notepad="notepad.exe"
|
|
||||||
alias explorer="explorer.exe"
|
|
||||||
else
|
|
||||||
# Unix-specific configuration (Linux or macOS)
|
|
||||||
# You can add Unix-specific tools and paths here if needed
|
|
||||||
# For example, add custom Linux paths if they are different from default
|
|
||||||
export PATH="/usr/local/bin:$PATH"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Custom aliases
|
# Install Bash-it if it's not already installed
|
||||||
alias python="python3"
|
if [ ! -d "$BASH_IT" ]; then
|
||||||
|
git clone --depth=1 https://github.com/Bash-it/bash-it.git "$BASH_IT"
|
||||||
|
"$BASH_IT/install.sh"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Source the Bash-it script to enable plugin management
|
||||||
|
. "$BASH_IT/bash_it.sh"
|
||||||
|
|
||||||
|
# ================ Bash-it Plugin Configuration ================
|
||||||
|
# Enable essential plugins using Bash-it (it will handle checks internally)
|
||||||
|
bash-it enable plugin git
|
||||||
|
bash-it enable plugin history
|
||||||
|
bash-it enable plugin fasd
|
||||||
|
bash-it enable plugin autojump
|
||||||
|
|
||||||
|
# Enable themes
|
||||||
|
bash-it enable theme bobby
|
||||||
|
|
||||||
|
# ================ Docker Completions ================
|
||||||
|
# Check for Docker completion file and source it if exists
|
||||||
|
if [ -f "$HOME/.docker-completion.bash" ]; then
|
||||||
|
. "$HOME/.docker-completion.bash"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ================ zoxide Plugin ================
|
||||||
|
# Install zoxide (navigation tool for frequently used directories)
|
||||||
|
if ! command -v zoxide &>/dev/null; then
|
||||||
|
echo "zoxide is not installed. Installing..."
|
||||||
|
if ! command -v "$PACKAGE_MANAGER" &>/dev/null; then
|
||||||
|
echo "Package manager is not available!"
|
||||||
|
else
|
||||||
|
"$PACKAGE_MANAGER" install zoxide
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Initialize zoxide
|
||||||
|
eval "$(zoxide init bash)"
|
||||||
|
|
||||||
|
# ================ fzf Plugin ================
|
||||||
|
# Install fzf, a command-line fuzzy finder
|
||||||
|
if ! command -v fzf &>/dev/null; then
|
||||||
|
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
|
||||||
|
~/.fzf/install --no-key-bindings --no-completion --no-update-rc
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Load fzf shell integration if available
|
||||||
|
if [ -f "$HOME/.fzf.bash" ]; then
|
||||||
|
. "$HOME/.fzf.bash"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ================ eza Installation ================
|
||||||
|
# Install eza (enhanced 'ls' command)
|
||||||
|
if ! command -v eza &>/dev/null; then
|
||||||
|
echo "eza is not installed. Installing..."
|
||||||
|
if ! command -v "$PACKAGE_MANAGER" &>/dev/null; then
|
||||||
|
echo "Package manager is not available!"
|
||||||
|
else
|
||||||
|
"$PACKAGE_MANAGER" install eza
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ================ Additional Programs Initialization ================
|
||||||
|
# Initialize direnv (uncomment if needed)
|
||||||
|
# eval "$(direnv hook bash)"
|
||||||
|
|
||||||
|
# Initialize Starship prompt
|
||||||
|
if ! command -v starship &>/dev/null; then
|
||||||
|
curl -fsSL https://starship.rs/install.sh | bash
|
||||||
|
fi
|
||||||
|
eval "$(starship init bash)"
|
||||||
|
export STARSHIP_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/starship.toml"
|
||||||
|
|
||||||
|
# ================ Conda Initialization ================
|
||||||
|
# Initialize Conda (uncomment if you use Conda)
|
||||||
|
# eval "$(conda init bash)"
|
||||||
|
|
||||||
|
# ================ Pyenv Setup ================
|
||||||
|
# Initialize Pyenv if installed
|
||||||
|
if command -v pyenv &>/dev/null; then
|
||||||
|
export PYENV_ROOT="$HOME/.pyenv"
|
||||||
|
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
|
||||||
|
eval "$(pyenv init --path)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ================ Custom Aliases ================
|
||||||
|
# Define commonly used aliases
|
||||||
alias grep="grep --color=auto"
|
alias grep="grep --color=auto"
|
||||||
|
|
||||||
alias ..="cd .."
|
alias ..="cd .."
|
||||||
alias ...="cd ../.."
|
alias ...="cd ../.."
|
||||||
alias ....="cd ../../.."
|
alias ....="cd ../../.."
|
||||||
alias .....="cd ../../../.."
|
alias .....="cd ../../../.."
|
||||||
|
alias v='nvim'
|
||||||
|
|
||||||
# Load custom check_aliases if it exists
|
# Use eza for enhanced 'ls' command
|
||||||
if [[ -f "$HOME/.local/bin/scripts/check_aliases" ]]; then
|
alias ls='eza'
|
||||||
. "$HOME/.local/bin/scripts/check_aliases"
|
alias ll='eza -lh --group-directories-first'
|
||||||
|
alias la='eza -a'
|
||||||
|
alias lla='eza -la --group-directories-first'
|
||||||
|
alias l='eza --classify'
|
||||||
|
|
||||||
|
# Source additional alias checks if available
|
||||||
|
if [[ -f ~/.local/bin/scripts/check_aliases ]]; then
|
||||||
|
. ~/.local/bin/scripts/check_aliases.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set the default editor
|
# ================ Conditional Settings ================
|
||||||
export EDITOR='nvim'
|
# Set the editor to vim if using SSH
|
||||||
|
[[ -n ${SSH_CONNECTION} ]] && export EDITOR='vim'
|
||||||
|
|
||||||
# Add eza completions to BASH_COMPLETION if not already included
|
# ================ Profiling (Optional) ================
|
||||||
if [[ ! "$BASH_COMPLETION" =~ (^|:)${HOME}/.local/bin/eza/completions/bash(:|$) ]]; then
|
# Uncomment to enable profiling (useful for debugging)
|
||||||
export BASH_COMPLETION="$HOME/.local/bin/eza/completions/bash:$BASH_COMPLETION"
|
# bash-profiler # Comment out if profiling is not needed
|
||||||
fi
|
|
||||||
|
|
||||||
# Initialize zoxide
|
|
||||||
if command -v zoxide &>/dev/null; then
|
|
||||||
eval "$(zoxide init bash)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Initialize Starship
|
|
||||||
if command -v starship &>/dev/null; then
|
|
||||||
eval "$(starship init bash)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Optionally, initialize other tools for Unix and WSL environments
|
|
||||||
if command -v wslpath &>/dev/null; then
|
|
||||||
# Adjust paths between WSL and Windows if necessary
|
|
||||||
export PATH="$(wslpath 'C:\Program Files'):$PATH"
|
|
||||||
export PATH="/mnt/c/Program Files/neovim/bin:$PATH"
|
|
||||||
fi
|
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,40 @@
|
||||||
# Setup fzf
|
#!/usr/bin/env bash
|
||||||
# ---------
|
|
||||||
# Get the path to fzf installed by Nix or from a general location
|
|
||||||
FZF_PATH="$(command -v fzf | xargs dirname)"
|
|
||||||
|
|
||||||
# Ensure the fzf binary is in the PATH (if not already added)
|
# Indicate the shell explicitly
|
||||||
if [[ ! "$PATH" == *"$FZF_PATH/bin"* ]]; then
|
export FZF_SHELL="bash"
|
||||||
PATH="${PATH:+${PATH}:}$FZF_PATH/bin"
|
|
||||||
|
# Detect OS and environment
|
||||||
|
IS_WSL=false
|
||||||
|
|
||||||
|
if [[ -f /proc/sys/kernel/osrelease ]] && grep -qi "microsoft" /proc/sys/kernel/osrelease; then
|
||||||
|
IS_WSL=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Auto-completion
|
# Determine fzf path if installed
|
||||||
# ---------------
|
if command -v fzf >/dev/null; then
|
||||||
if [[ -f "$FZF_PATH/shell/completion.bash" ]]; then
|
export FZF_PATH="$(dirname "$(command -v fzf)")"
|
||||||
source "$FZF_PATH/shell/completion.bash"
|
else
|
||||||
|
export FZF_PATH=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Key bindings
|
# Source fzf key bindings and completions based on environment
|
||||||
# ------------
|
if command -v fzf >/dev/null; then
|
||||||
if [[ -f "$FZF_PATH/shell/key-bindings.bash" ]]; then
|
# Linux or macOS typical install
|
||||||
source "$FZF_PATH/shell/key-bindings.bash"
|
[ -f "$FZF_PATH/key-bindings.bash" ] && source "$FZF_PATH/key-bindings.bash"
|
||||||
|
[ -f "$FZF_PATH/completion.bash" ] && source "$FZF_PATH/completion.bash"
|
||||||
|
elif $IS_WSL; then
|
||||||
|
# Windows install accessed via WSL
|
||||||
|
WIN_FZF_DIR="/mnt/c/Program Files/fzf/shell"
|
||||||
|
[ -f "$WIN_FZF_DIR/key-bindings.bash" ] && source "$WIN_FZF_DIR/key-bindings.bash"
|
||||||
|
[ -f "$WIN_FZF_DIR/completion.bash" ] && source "$WIN_FZF_DIR/completion.bash"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for WSL and ensure compatibility
|
# Load fzf theme if available
|
||||||
if grep -q Microsoft /proc/version; then
|
FZF_THEME_SCRIPT="$HOME/.local/bin/scripts/fzf_theme.sh"
|
||||||
# WSL-specific path handling (if needed)
|
if [[ -f "$FZF_THEME_SCRIPT" ]]; then
|
||||||
if [[ -f "/mnt/c/Program Files/fzf/shell/completion.bash" ]]; then
|
# Use custom theme script if it exists
|
||||||
source "/mnt/c/Program Files/fzf/shell/completion.bash"
|
export FZF_DEFAULT_OPTS="$($FZF_THEME_SCRIPT) --height 40% --layout=reverse --border"
|
||||||
fi
|
else
|
||||||
if [[ -f "/mnt/c/Program Files/fzf/shell/key-bindings.bash" ]]; then
|
# Fallback to default options
|
||||||
source "/mnt/c/Program Files/fzf/shell/key-bindings.bash"
|
export FZF_DEFAULT_OPTS="--height 40% --layout=reverse --border"
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -4,3 +4,4 @@ auto_activate_base: false
|
||||||
changeps1: false
|
changeps1: false
|
||||||
|
|
||||||
channel_priority: strict
|
channel_priority: strict
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,30 @@
|
||||||
name = Jeremie Fraeys
|
name = Jeremie Fraeys
|
||||||
email = jfaeys@gmail.com
|
email = jfaeys@gmail.com
|
||||||
[credential]
|
[credential]
|
||||||
helper = store
|
|
||||||
[credentials]
|
|
||||||
helper = osxkeychain
|
helper = osxkeychain
|
||||||
[init]
|
[init]
|
||||||
defaultBranch = main
|
defaultBranch = main
|
||||||
|
[core]
|
||||||
|
compression = 9
|
||||||
|
whitespace = error
|
||||||
|
pager = delta
|
||||||
|
side-by-side = true
|
||||||
|
line-numbers = true
|
||||||
|
preload = true
|
||||||
|
[interactive]
|
||||||
|
diffFilter = delta --color-only
|
||||||
|
[delta]
|
||||||
|
navigate = true
|
||||||
|
[merge]
|
||||||
|
conflictStyle = zdiff3
|
||||||
|
[status]
|
||||||
|
branch = true
|
||||||
|
showStash = true
|
||||||
|
showUntrackedFiles = all
|
||||||
|
|
||||||
|
[url "git@github.com:"]
|
||||||
|
insteadOf = "gh:"
|
||||||
|
|
||||||
|
[url "git@github.com:jfraeys/"]
|
||||||
|
insteadOf = "cj:"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,27 +28,22 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
# System packages
|
# System packages
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
neovim wezterm git ripgrep fd pyenv mos docker docker-compose gh rustup
|
neovim wezterm git ripgrep fd pyenv mos docker docker-compose gh rustup
|
||||||
sd sphinx starship stow tree zoxide spotify direnv unibilium uv raycast skim
|
sd sphinx starship stow tree zoxide spotify unibilium uv raycast skim
|
||||||
eza fzf zsh gettext python3 ruff lua luarocks bat go openssl topgrade vault
|
eza fzf zsh gettext python3 lua luarocks bat go openssl topgrade vault
|
||||||
yamllint
|
yamllint jq yq lazydocker delta bottom luarocks zig pkg-config cmake cairo
|
||||||
|
k3d kubectl kubectx golangci-lint ollama duckdb
|
||||||
(zathura.overrideAttrs (finalAttrs: previousAttrs: {
|
];
|
||||||
pname = previousAttrs.pname + "-with-synctex";
|
|
||||||
nativeBuildInputs = previousAttrs.nativeBuildInputs or [] ++ [ pkgs.pkg-config ];
|
|
||||||
enableSynctex = true;
|
|
||||||
zathuraPlugins = [ "zathura-pdf-poppler" ];
|
|
||||||
}))
|
|
||||||
];
|
|
||||||
|
|
||||||
# Fonts
|
# Fonts
|
||||||
fonts.packages = with pkgs; [ nerd-fonts.meslo-lg ];
|
fonts.packages = with pkgs; [ nerd-fonts.meslo-lg nerd-fonts.fira-code ];
|
||||||
|
|
||||||
# Homebrew setup
|
# Homebrew setup
|
||||||
homebrew = {
|
homebrew = {
|
||||||
enable = true;
|
enable = true;
|
||||||
brews = [ "mas" "shpotify" "zathura-pdf-poppler" "girara" ];
|
brews = [ "mas" "shpotify" "colima" "ruff" "zathura" "zathura-pdf-poppler" ];
|
||||||
|
# brews = [ "mas" "shpotify" "colima" "ruff" ];
|
||||||
casks = [
|
casks = [
|
||||||
{ name = "zotero"; greedy = true; }
|
{ name = "zotero"; greedy = true; }
|
||||||
{ name = "microsoft-teams"; greedy = true; }
|
{ name = "microsoft-teams"; greedy = true; }
|
||||||
|
|
@ -61,10 +56,17 @@
|
||||||
{ name = "google-drive"; greedy = true; }
|
{ name = "google-drive"; greedy = true; }
|
||||||
{ name = "vscodium"; greedy = true; }
|
{ name = "vscodium"; greedy = true; }
|
||||||
{ name = "mactex-no-gui"; greedy = true; }
|
{ name = "mactex-no-gui"; greedy = true; }
|
||||||
{ name = "notion"; greedy = true;}
|
{ name = "notion"; greedy = true; }
|
||||||
{ name = "obsidian"; greedy = true;}
|
{ name = "obsidian"; greedy = true; }
|
||||||
|
{ name = "display-pilot"; greedy = true; }
|
||||||
|
{ name = "zen-browser"; greedy = true; }
|
||||||
];
|
];
|
||||||
masApps = { "notability" = 360593530; };
|
masApps = {
|
||||||
|
"notability" = 360593530;
|
||||||
|
"keynote" = 409183694;
|
||||||
|
"pages" = 409201541;
|
||||||
|
"numbers" = 409203825;
|
||||||
|
};
|
||||||
taps = [ "nikitabobko/tap" "zegervdv/zathura" ];
|
taps = [ "nikitabobko/tap" "zegervdv/zathura" ];
|
||||||
onActivation = {
|
onActivation = {
|
||||||
cleanup = "zap";
|
cleanup = "zap";
|
||||||
|
|
@ -112,7 +114,8 @@
|
||||||
"/System/Applications/Calendar.app"
|
"/System/Applications/Calendar.app"
|
||||||
"/System/Applications/FaceTime.app"
|
"/System/Applications/FaceTime.app"
|
||||||
"/System/Applications/System Settings.app"
|
"/System/Applications/System Settings.app"
|
||||||
"/Applications/Firefox.app"
|
# "/Applications/Firefox.app"
|
||||||
|
"/Applications/Zen.app/"
|
||||||
];
|
];
|
||||||
persistent-others = [
|
persistent-others = [
|
||||||
"/Users/jfraeys/Downloads"
|
"/Users/jfraeys/Downloads"
|
||||||
|
|
@ -151,8 +154,8 @@
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Enable Nix daemon and Touch ID
|
# Enable Nix daemon and Touch ID
|
||||||
services.nix-daemon.enable = true;
|
# services.nix-daemon.enable = true;
|
||||||
security.pam.enableSudoTouchIdAuth = true;
|
security.pam.services.sudo_local.touchIdAuth = true;
|
||||||
|
|
||||||
# Home Manager integration
|
# Home Manager integration
|
||||||
home-manager = {
|
home-manager = {
|
||||||
|
|
@ -162,18 +165,24 @@
|
||||||
backupFileExtension = "backup";
|
backupFileExtension = "backup";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nixpkgs.hostPlatform = "aarch64-darwin";
|
||||||
|
|
||||||
# Nix configuration
|
# Nix configuration
|
||||||
nix = {
|
nix = {
|
||||||
configureBuildUsers = true;
|
# configureBuildUsers = true;
|
||||||
useDaemon = true;
|
# useDaemon = true;
|
||||||
settings.experimental-features = [ "nix-command" "flakes" ];
|
settings.experimental-features = [ "nix-command" "flakes" ];
|
||||||
|
extraOptions = ''
|
||||||
|
extra-platforms = x86_64-darwin aarch64-darwin
|
||||||
|
'';
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
darwinConfigurations = {
|
darwinConfigurations = {
|
||||||
"${hostname}" = nix-darwin.lib.darwinSystem {
|
"${hostname}" = nix-darwin.lib.darwinSystem {
|
||||||
system = "aarch64-darwin";
|
# system = "aarch64-darwin";
|
||||||
modules = [
|
modules = [
|
||||||
configuration
|
configuration
|
||||||
nix-homebrew.darwinModules.nix-homebrew
|
nix-homebrew.darwinModules.nix-homebrew
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit a357fc959ed9abcfd3c66cc9796282d229f03871
|
Subproject commit 9759205e22863960be91cfe626e3141a240df198
|
||||||
148
setup.sh
148
setup.sh
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
# Check for Git
|
# Check for Git
|
||||||
if ! command -v git &>/dev/null; then
|
if ! command -v git &>/dev/null; then
|
||||||
echo "Git is not installed. Aborting." >&2
|
echo "Git is not installed. Aborting." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Make sure we have pulled in and updated any submodules
|
# Make sure we have pulled in and updated any submodules
|
||||||
|
|
@ -12,87 +12,84 @@ git submodule update
|
||||||
|
|
||||||
# What directories should be installable by all users including the root user
|
# What directories should be installable by all users including the root user
|
||||||
base=(
|
base=(
|
||||||
vim
|
vim
|
||||||
nvim
|
nvim
|
||||||
# tmux
|
# tmux
|
||||||
git
|
git
|
||||||
wezterm
|
wezterm
|
||||||
nix-darwin
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Folders that should, or only need to be installed for a local user on macOS
|
# Folders that should, or only need to be installed for a local user on macOS
|
||||||
useronly_macos=(
|
useronly_macos=(
|
||||||
zsh
|
zsh
|
||||||
# yabai
|
aerospace
|
||||||
# skhd
|
# sketchybar
|
||||||
aerospace
|
|
||||||
# oh-my-zsh
|
|
||||||
)
|
)
|
||||||
|
|
||||||
#Folders that should, or only need to be installed for a local user on Linux
|
#Folders that should, or only need to be installed for a local user on Linux
|
||||||
useronly_linux=(
|
useronly_linux=(
|
||||||
bash
|
bash
|
||||||
i3
|
i3
|
||||||
)
|
)
|
||||||
|
|
||||||
# Folders that should, or only need to be installed for a local user
|
# Folders that should, or only need to be installed for a local user
|
||||||
useronly=(
|
useronly=(
|
||||||
zoxide
|
zoxide
|
||||||
conda
|
conda
|
||||||
dask
|
dask
|
||||||
gh
|
direnv
|
||||||
jupyter
|
gh
|
||||||
parallel
|
jupyter
|
||||||
tox
|
parallel
|
||||||
firefox
|
tox
|
||||||
# direnv
|
firefox
|
||||||
starship
|
starship
|
||||||
# p10k
|
zathura
|
||||||
)
|
)
|
||||||
|
|
||||||
# Files to ignore during stow
|
# Files to ignore during stow
|
||||||
ignore_files=(
|
ignore_files=(
|
||||||
".DS_Store"
|
".DS_Store"
|
||||||
"__setup"
|
"__setup"
|
||||||
"bin"
|
"bin"
|
||||||
".git"
|
".git"
|
||||||
".gitignore"
|
".gitignore"
|
||||||
"setup.sh"
|
"setup.sh"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Function to run the stow command for the passed-in directory ($2) in location $1
|
# Function to run the stow command for the passed-in directory ($2) in location $1
|
||||||
stowit() {
|
stowit() {
|
||||||
usr=$1
|
usr=$1
|
||||||
app=$2
|
app=$2
|
||||||
# -v verbose
|
# -v verbose
|
||||||
# -R recursive
|
# -R recursive
|
||||||
# -t target
|
# -t target
|
||||||
# --ignore files to ignore
|
# --ignore files to ignore
|
||||||
stow -v -R -t "${usr}" --ignore "$(
|
stow -v -R -t "${usr}" --ignore "$(
|
||||||
IFS="|"
|
IFS="|"
|
||||||
echo "${ignore_files[*]}"
|
echo "${ignore_files[*]}"
|
||||||
)" "${app}"
|
)" "${app}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to check if the OS is macOS
|
# Function to check if the OS is macOS
|
||||||
get_os() {
|
get_os() {
|
||||||
case "$(uname)" in
|
case "$(uname)" in
|
||||||
Darwin) echo "macos" ;;
|
Darwin) echo "macos" ;;
|
||||||
Linux) echo "linux" ;;
|
Linux) echo "linux" ;;
|
||||||
*) echo "unknown" ;;
|
*) echo "unknown" ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to automate firefox profile updater with expect
|
# Function to automate firefox profile updater with expect
|
||||||
expect_yes() {
|
expect_yes() {
|
||||||
profile_dir=$(find ~/Library/Application\ Support/Firefox/Profiles -type d -name '*.default-release' -print -quit)
|
profile_dir=$(find ~/Library/Application\ Support/Firefox/Profiles -type d -name '*.default-release' -print -quit)
|
||||||
|
|
||||||
if [ -z "$profile_dir" ]; then
|
if [ -z "$profile_dir" ]; then
|
||||||
echo "Error: Firefox profile directory not found."
|
echo "Error: Firefox profile directory not found."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
expect -c "
|
expect -c "
|
||||||
set timeout 1
|
set timeout 1
|
||||||
log_user 0
|
log_user 0
|
||||||
spawn bash -c \"cd '$profile_dir' && $1\" > /dev/null 2>&1
|
spawn bash -c \"cd '$profile_dir' && $1\" > /dev/null 2>&1
|
||||||
|
|
@ -111,39 +108,36 @@ echo "Stowing apps for user: ${USER}"
|
||||||
|
|
||||||
# Setup apps available to local users and root
|
# Setup apps available to local users and root
|
||||||
for app in "${base[@]}"; do
|
for app in "${base[@]}"; do
|
||||||
stowit "${HOME}" "${app}"
|
stowit "${HOME}" "${app}"
|
||||||
done
|
done
|
||||||
|
|
||||||
current_os=$(get_os)
|
current_os=$(get_os)
|
||||||
case "${current_os}" in
|
case "${current_os}" in
|
||||||
"macos")
|
"macos")
|
||||||
for app in "${useronly_macos[@]}"; do
|
for app in "${useronly_macos[@]}"; do
|
||||||
if [ "$(id -u)" -ne 0 ]; then
|
if [ "$(id -u)" -ne 0 ]; then
|
||||||
stowit "${HOME}" "${app}"
|
stowit "${HOME}" "${app}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
"linux")
|
"linux")
|
||||||
for app in "${useronly_linux[@]}"; do
|
for app in "${useronly_linux[@]}"; do
|
||||||
if [ "$(id -u)" -ne 0 ]; then
|
if [ "$(id -u)" -ne 0 ]; then
|
||||||
stowit "${HOME}" "${app}"
|
stowit "${HOME}" "${app}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
"unknown")
|
"unknown")
|
||||||
echo "Unknown OS."
|
echo "Unknown OS."
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Setup useronly folders
|
# Setup useronly folders
|
||||||
for app in "${useronly[@]}"; do
|
for app in "${useronly[@]}"; do
|
||||||
if [ "$(id -u)" -ne 0 ]; then
|
if [ "$(id -u)" -ne 0 ]; then
|
||||||
stowit "${HOME}" "${app}"
|
stowit "${HOME}" "${app}"
|
||||||
if [[ "${app}" = "firefox" ]]; then
|
if [[ "${app}" = "firefox" ]]; then
|
||||||
expect_yes "./updater.sh"
|
expect_yes "./updater.sh"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "##### ALL DONE"
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,9 @@ command_timeout = 5000
|
||||||
|
|
||||||
# Customize your prompt to ensure everything is on a single line
|
# Customize your prompt to ensure everything is on a single line
|
||||||
format = """\
|
format = """\
|
||||||
|
$character\
|
||||||
$directory\
|
$directory\
|
||||||
|
$direnv\
|
||||||
$docker_context\
|
$docker_context\
|
||||||
$conda\
|
$conda\
|
||||||
$golang\
|
$golang\
|
||||||
|
|
@ -19,7 +21,6 @@ format = """\
|
||||||
$package\
|
$package\
|
||||||
$line_break\
|
$line_break\
|
||||||
$jobs\
|
$jobs\
|
||||||
$character\
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
right_format = """\
|
right_format = """\
|
||||||
|
|
@ -31,30 +32,30 @@ right_format = """\
|
||||||
|
|
||||||
# Git branch configuration
|
# Git branch configuration
|
||||||
[git_branch]
|
[git_branch]
|
||||||
format = "[ $branch(:$remote_branch)]($style)"
|
format = "[$branch(:$remote_branch) ]($style)"
|
||||||
style = "bold red"
|
style = "bold red"
|
||||||
|
|
||||||
# Git status configuration
|
# Git status configuration
|
||||||
[git_status]
|
[git_status]
|
||||||
format = '[ $all_status]($style)'
|
format = '[$all_status ]($style)'
|
||||||
style = "bold green"
|
style = "bold green"
|
||||||
|
|
||||||
# Git metric configuration
|
# Git metric configuration
|
||||||
[git_metrics]
|
[git_metrics]
|
||||||
format = '([ $added]($added_style))([ $deleted]($deleted_style))'
|
format = '([$added ]($added_style))([$deleted ]($deleted_style))'
|
||||||
added_style = "green"
|
added_style = "green"
|
||||||
deleted_style = "red"
|
deleted_style = "red"
|
||||||
disabled = false
|
disabled = true
|
||||||
|
|
||||||
# Configure the overall look of the prompt
|
# Configure the overall look of the prompt
|
||||||
[character]
|
[character]
|
||||||
success_symbol = "[ ❯](bold green)"
|
success_symbol = "[❯](bold green)"
|
||||||
error_symbol = "[ ✗](bold red)"
|
error_symbol = "[✗](bold red)"
|
||||||
vimcmd_symbol = "[ V](bold green)"
|
vimcmd_symbol = "[V](bold green)"
|
||||||
|
|
||||||
# Directory
|
# Directory
|
||||||
[directory]
|
[directory]
|
||||||
format = "[$path]($style)[$read_only]($read_only_style)"
|
format = "[$path ]($style)[$read_only]($read_only_style)"
|
||||||
style = "bright-cyan"
|
style = "bright-cyan"
|
||||||
truncation_length = 3
|
truncation_length = 3
|
||||||
truncation_symbol = "…/"
|
truncation_symbol = "…/"
|
||||||
|
|
@ -63,59 +64,63 @@ truncation_symbol = "…/"
|
||||||
disabled = true
|
disabled = true
|
||||||
|
|
||||||
[jobs]
|
[jobs]
|
||||||
format = '[ $symbol$count]($style)'
|
format = '[$symbol$count ]($style)'
|
||||||
number_threshold = 4
|
number_threshold = 4
|
||||||
|
|
||||||
[cmd_duration]
|
[cmd_duration]
|
||||||
format = "[ $duration]($style)"
|
format = "[$duration ]($style)"
|
||||||
style = "yellow"
|
style = "yellow"
|
||||||
|
|
||||||
|
[direnv]
|
||||||
|
format = '[$symbol$loaded/$allowed ]($style)'
|
||||||
|
disabled = false
|
||||||
|
|
||||||
# Container
|
# Container
|
||||||
[container]
|
[container]
|
||||||
format = '[ $symbol \[$name\]]($style)'
|
format = '[$symbol \[$name\] ]($style)'
|
||||||
style = "orange"
|
style = "orange"
|
||||||
|
|
||||||
# Docker
|
# Docker
|
||||||
[docker_context]
|
[docker_context]
|
||||||
format = '[ $symbol$container]($style)'
|
format = '[$symbol$container ]($style)'
|
||||||
style = "blue"
|
style = "blue"
|
||||||
|
|
||||||
# C
|
# C
|
||||||
[c]
|
[c]
|
||||||
format = "[ $symbol($version(-$name) )]($style)"
|
format = "[$symbol($version(-$name)) ]($style)"
|
||||||
style = "bold green"
|
style = "bold green"
|
||||||
detect_files = ["Makefile"]
|
detect_files = ["Makefile"]
|
||||||
|
|
||||||
# Conda
|
# Conda
|
||||||
[conda]
|
[conda]
|
||||||
format = "[ $environment]($style)"
|
format = "[$environment ]($style)"
|
||||||
style = "green"
|
style = "dimmed green"
|
||||||
|
|
||||||
# Python
|
# Python
|
||||||
[python]
|
[python]
|
||||||
format = "[ ${symbol}(${version})(\\($virtualenv\\) )]($style)"
|
format = "[${symbol}(${version})(\\($virtualenv\\)) ]($style)"
|
||||||
# pyenv_version_name = true
|
# pyenv_version_name = true
|
||||||
style = "blue"
|
style = "blue"
|
||||||
detect_files = ["Pipfile", "pyproject.toml", "poetry.lock", "requirements.txt"]
|
detect_files = ["Pipfile", "pyproject.toml", "poetry.lock", "requirements.txt"]
|
||||||
|
|
||||||
# Golang
|
# Golang
|
||||||
[golang]
|
[golang]
|
||||||
format = "[ $symbol($version)($mod_version)]($style)"
|
format = "[$symbol($version)($mod_version) ]($style)"
|
||||||
style = "blue"
|
style = "blue"
|
||||||
|
|
||||||
# Rust
|
# Rust
|
||||||
[rust]
|
[rust]
|
||||||
format = "[ $symbol$version]($style)"
|
format = "[$symbol$version ]($style)"
|
||||||
style = "purple"
|
style = "purple"
|
||||||
|
|
||||||
# Lua
|
# Lua
|
||||||
[lua]
|
[lua]
|
||||||
format = "[ $symbol$version]($style)"
|
format = "[$symbol$version ]($style)"
|
||||||
style = "purple"
|
style = "purple"
|
||||||
|
|
||||||
# Package
|
# Package
|
||||||
[package]
|
[package]
|
||||||
format = "[ $symbol$version]($style)"
|
format = "[$symbol$version ]($style)"
|
||||||
style = "208 bold"
|
style = "208 bold"
|
||||||
|
|
||||||
# Directory substitutions
|
# Directory substitutions
|
||||||
|
|
@ -182,4 +187,3 @@ surface0 = "#fdf6e3"
|
||||||
base = "#fdf6e3"
|
base = "#fdf6e3"
|
||||||
mantle = "#fdf6e3"
|
mantle = "#fdf6e3"
|
||||||
crust = "#fdf6e3"
|
crust = "#fdf6e3"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,8 @@ local tab_bar_colors = {
|
||||||
|
|
||||||
-- Check if a command is available (more reliable implementation)
|
-- Check if a command is available (more reliable implementation)
|
||||||
local function is_command_available(cmd)
|
local function is_command_available(cmd)
|
||||||
|
wezterm.log_info(os.execute("/usr/bin/env bash -c 'command -v " .. cmd .. "'"))
|
||||||
|
wezterm.log_info("WezTerm PATH: " .. os.getenv("PATH"))
|
||||||
return os.execute("type " .. cmd .. " >/dev/null 2>&1") == 0
|
return os.execute("type " .. cmd .. " >/dev/null 2>&1") == 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -67,6 +69,9 @@ local function update_starship_palette(palette_name)
|
||||||
local replace_command =
|
local replace_command =
|
||||||
string.format("%s 's/palette = .*/palette = \"%s\"/' %s", sed_inplace, palette_name, starship_config_path)
|
string.format("%s 's/palette = .*/palette = \"%s\"/' %s", sed_inplace, palette_name, starship_config_path)
|
||||||
|
|
||||||
|
wezterm.log_info("Starship config path: " .. starship_config_path)
|
||||||
|
wezterm.log_info("Generated reaplce command: " .. replace_command)
|
||||||
|
|
||||||
-- Use `sd` if available for consistency
|
-- Use `sd` if available for consistency
|
||||||
if is_command_available("sd") then
|
if is_command_available("sd") then
|
||||||
replace_command = string.format("sd 'palette = .+' 'palette = \"%s\"' %s", palette_name, starship_config_path)
|
replace_command = string.format("sd 'palette = .+' 'palette = \"%s\"' %s", palette_name, starship_config_path)
|
||||||
|
|
@ -84,9 +89,7 @@ end
|
||||||
-- Apply the configuration and update Starship palette
|
-- Apply the configuration and update Starship palette
|
||||||
function M.apply_to_config(config)
|
function M.apply_to_config(config)
|
||||||
local appearance = get_appearance()
|
local appearance = get_appearance()
|
||||||
wezterm.log_info("Appearance detected: " .. appearance)
|
|
||||||
config.color_scheme = scheme_for_appearance(appearance, color_schemes)
|
config.color_scheme = scheme_for_appearance(appearance, color_schemes)
|
||||||
wezterm.log_info("Using color scheme: " .. config.color_scheme)
|
|
||||||
config.colors = { tab_bar = scheme_for_appearance(appearance, tab_bar_colors) }
|
config.colors = { tab_bar = scheme_for_appearance(appearance, tab_bar_colors) }
|
||||||
|
|
||||||
-- Update the Starship palette based on appearance
|
-- Update the Starship palette based on appearance
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
local wezterm = require("wezterm")
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
M.filter = function(tbl, callback)
|
M.filter = function(tbl, callback)
|
||||||
|
|
@ -11,4 +12,23 @@ M.filter = function(tbl, callback)
|
||||||
return filt_table
|
return filt_table
|
||||||
end
|
end
|
||||||
|
|
||||||
|
M.log_info = function(msg)
|
||||||
|
wezterm.log_info("[workspace] " .. msg)
|
||||||
|
end
|
||||||
|
|
||||||
|
M.log_error = function(msg)
|
||||||
|
wezterm.log_error("[workspace] " .. msg)
|
||||||
|
end
|
||||||
|
|
||||||
|
M.merge_tables = function(t1, t2)
|
||||||
|
local result = {}
|
||||||
|
for k, v in pairs(t1 or {}) do
|
||||||
|
result[k] = v
|
||||||
|
end
|
||||||
|
for k, v in pairs(t2 or {}) do
|
||||||
|
result[k] = v
|
||||||
|
end
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
||||||
106
wezterm/.config/wezterm/workspace.lua
Normal file
106
wezterm/.config/wezterm/workspace.lua
Normal file
|
|
@ -0,0 +1,106 @@
|
||||||
|
local wezterm = require("wezterm")
|
||||||
|
local util = require("util") -- Make sure this module exports a `filter` function
|
||||||
|
local act = wezterm.action
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
--- Switch to a workspace and optionally spawn a command or pass SwitchToWorkspace options
|
||||||
|
-- @param window wezterm.Window: The active window
|
||||||
|
-- @param pane wezterm.Pane: The active pane
|
||||||
|
-- @param opts table: Options table containing:
|
||||||
|
-- - name (string): Name of the target workspace (required)
|
||||||
|
-- - spawn (table)?: Arguments for SpawnCommandInNewTab
|
||||||
|
-- - switch_opts (table)?: Extra options for SwitchToWorkspace
|
||||||
|
M.switch_workspace = function(window, pane, opts)
|
||||||
|
opts = opts or {}
|
||||||
|
|
||||||
|
wezterm.log_info(opts)
|
||||||
|
|
||||||
|
if not opts.name then
|
||||||
|
wezterm.log_error("Missing workspace name in switch_workspace()")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local workspace_name = opts.name
|
||||||
|
local current_workspace = window:active_workspace()
|
||||||
|
|
||||||
|
if current_workspace == workspace_name then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
wezterm.GLOBAL.previous_workspace = current_workspace
|
||||||
|
|
||||||
|
-- Merge workspace name with user-provided SwitchToWorkspace options
|
||||||
|
local switch_args = { name = workspace_name }
|
||||||
|
if opts.switch_opts then
|
||||||
|
for k, v in pairs(opts.switch_opts) do
|
||||||
|
switch_args[k] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
window:perform_action(act.SwitchToWorkspace(switch_args), pane)
|
||||||
|
|
||||||
|
if opts.spawn then
|
||||||
|
wezterm.log_info("Spawning in new tab for workspace: " .. workspace_name)
|
||||||
|
window:perform_action(act.SpawnCommandInNewTab(opts.spawn), pane)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Switch back to the previously used workspace
|
||||||
|
M.switch_to_previous_workspace = function(window, pane)
|
||||||
|
local previous = wezterm.GLOBAL.previous_workspace
|
||||||
|
if not previous then
|
||||||
|
wezterm.log_info("No previous workspace is set.")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local current = window:active_workspace()
|
||||||
|
if current == previous then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
M.switch_workspace(window, pane, { name = previous })
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Kill all panes in a given workspace
|
||||||
|
-- @param workspace string: The name of the workspace to kill
|
||||||
|
M.kill_workspace = function(workspace)
|
||||||
|
wezterm.log_info("Killing all panes in workspace: " .. workspace)
|
||||||
|
|
||||||
|
local success, stdout, stderr = wezterm.run_child_process({
|
||||||
|
"wezterm",
|
||||||
|
"cli",
|
||||||
|
"list",
|
||||||
|
"--format=json",
|
||||||
|
})
|
||||||
|
|
||||||
|
if not success or not stdout then
|
||||||
|
wezterm.log_error("Failed to run wezterm list. Error: " .. (stderr or "unknown"))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local panes = wezterm.json_parse(stdout)
|
||||||
|
if not panes then
|
||||||
|
wezterm.log_error("Failed to parse pane list JSON.")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local matching = util.filter(panes, function(p)
|
||||||
|
return p.workspace == workspace
|
||||||
|
end)
|
||||||
|
|
||||||
|
if #matching == 0 then
|
||||||
|
wezterm.log_info("No panes to kill in workspace: " .. workspace)
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, pane in ipairs(matching) do
|
||||||
|
wezterm.run_child_process({
|
||||||
|
"wezterm",
|
||||||
|
"cli",
|
||||||
|
"kill-pane",
|
||||||
|
"--pane-id=" .. pane.pane_id,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
@ -4,9 +4,9 @@ local act = wezterm.action
|
||||||
|
|
||||||
-- Pull custom modules
|
-- Pull custom modules
|
||||||
local theme = require("theme-switcher")
|
local theme = require("theme-switcher")
|
||||||
-- local kill_workspace = require("kill-workspace")
|
|
||||||
local sessionizer = require("sessionizer.plugin.init")
|
local sessionizer = require("sessionizer.plugin.init")
|
||||||
-- local gpu_adapters = require("gpu-adapter")
|
-- local gpu_adapters = require("gpu-adapter")
|
||||||
|
local workspace = require("workspace")
|
||||||
|
|
||||||
local config = {}
|
local config = {}
|
||||||
|
|
||||||
|
|
@ -20,21 +20,17 @@ end
|
||||||
-- Check the platform and configure settings accordingly
|
-- Check the platform and configure settings accordingly
|
||||||
if wezterm.target_triple == "x86_64-pc-windows-msvc" then
|
if wezterm.target_triple == "x86_64-pc-windows-msvc" then
|
||||||
config.default_prog = { "wsl.exe", "~", "-d", "Ubuntu-20.04" }
|
config.default_prog = { "wsl.exe", "~", "-d", "Ubuntu-20.04" }
|
||||||
elseif wezterm.target_triple == "x86_64-apple-darwin" then
|
elseif wezterm.target_triple == "x86_64-apple-darwin" or wezterm.target_triple == "aarch64-apple-darwin" then
|
||||||
config.default_prog = { "/bin/zsh", "-l" }
|
config.default_prog = { "/bin/zsh" }
|
||||||
config.font = wezterm.font_with_fallback({
|
|
||||||
{ family = "MesloLGS NF", scale = 1.0 },
|
|
||||||
{ family = "Menlo", scale = 1.0 },
|
|
||||||
})
|
|
||||||
elseif wezterm.target_triple == "aarch64-apple-darwin" then
|
|
||||||
config.default_prog = { "/bin/zsh", "-l" }
|
|
||||||
config.font = wezterm.font_with_fallback({
|
config.font = wezterm.font_with_fallback({
|
||||||
|
{ family = "Fira Code", scale = 1.0 },
|
||||||
{ family = "MesloLGS NF", scale = 1.0 },
|
{ family = "MesloLGS NF", scale = 1.0 },
|
||||||
{ family = "Menlo", scale = 1.0 },
|
{ family = "Menlo", scale = 1.0 },
|
||||||
})
|
})
|
||||||
elseif wezterm.target_triple == "x86_64-unknown-linux-gnu" then
|
elseif wezterm.target_triple == "x86_64-unknown-linux-gnu" then
|
||||||
config.default_prog = { "/bin/bash", "-l" }
|
config.default_prog = { "/bin/bash" }
|
||||||
config.font = wezterm.font_with_fallback({
|
config.font = wezterm.font_with_fallback({
|
||||||
|
{ family = "Fira Code", scale = 1.0 },
|
||||||
{ family = "MesloLGS NF", scale = 1.0 },
|
{ family = "MesloLGS NF", scale = 1.0 },
|
||||||
{ family = "Ubuntu Mono", scale = 1.0 },
|
{ family = "Ubuntu Mono", scale = 1.0 },
|
||||||
})
|
})
|
||||||
|
|
@ -43,20 +39,20 @@ end
|
||||||
config.check_for_updates = true
|
config.check_for_updates = true
|
||||||
config.use_ime = true
|
config.use_ime = true
|
||||||
config.use_dead_keys = false
|
config.use_dead_keys = false
|
||||||
|
config.front_end = "WebGpu"
|
||||||
config.term = "xterm-256color"
|
config.term = "xterm-256color"
|
||||||
theme.apply_to_config(config)
|
theme.apply_to_config(config)
|
||||||
config.line_height = 1.1
|
config.line_height = 1.1
|
||||||
|
|
||||||
config.animation_fps = 240
|
config.animation_fps = 240
|
||||||
config.max_fps = 240
|
config.max_fps = 240
|
||||||
config.front_end = "WebGpu"
|
|
||||||
config.webgpu_power_preference = "HighPerformance"
|
config.webgpu_power_preference = "HighPerformance"
|
||||||
-- config.webgpu_preferred_adapter = gpu_adapters:pick_best()
|
-- config.webgpu_preferred_adapter = gpu_adapters:pick_best()
|
||||||
|
|
||||||
config.window_padding = {
|
config.window_padding = {
|
||||||
left = 5,
|
left = 5,
|
||||||
right = 10,
|
right = 10,
|
||||||
top = 10,
|
top = 5,
|
||||||
bottom = 5,
|
bottom = 5,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -71,7 +67,6 @@ config.inactive_pane_hsb = {
|
||||||
config.initial_rows = 50
|
config.initial_rows = 50
|
||||||
config.initial_cols = 140
|
config.initial_cols = 140
|
||||||
|
|
||||||
config.use_dead_keys = false
|
|
||||||
config.enable_scroll_bar = false
|
config.enable_scroll_bar = false
|
||||||
config.scrollback_lines = 3000
|
config.scrollback_lines = 3000
|
||||||
|
|
||||||
|
|
@ -139,7 +134,7 @@ config.leader = { key = "a", mods = "CTRL", timeout_milliseconds = 1000 }
|
||||||
|
|
||||||
local keys = {
|
local keys = {
|
||||||
{ key = "LeftArrow", mods = "OPT", action = act.SendString("\x1bb") },
|
{ key = "LeftArrow", mods = "OPT", action = act.SendString("\x1bb") },
|
||||||
{ key = "RightArrow", mods = "OPT", action = act.SendString("\x1bf") },
|
{ key = "RightArrow", mods = "OPT", action = act.SendString("\x1bw") },
|
||||||
|
|
||||||
-- The physical CMD key on OSX is the Alt key on Win/*nix, so map the common Alt-combo commands.
|
-- The physical CMD key on OSX is the Alt key on Win/*nix, so map the common Alt-combo commands.
|
||||||
{ key = ".", mods = "CMD", action = act.SendString("\x1b.") },
|
{ key = ".", mods = "CMD", action = act.SendString("\x1b.") },
|
||||||
|
|
@ -175,7 +170,7 @@ local keys = {
|
||||||
key = "]",
|
key = "]",
|
||||||
mods = "LEADER",
|
mods = "LEADER",
|
||||||
action = act.SpawnCommandInNewTab({
|
action = act.SpawnCommandInNewTab({
|
||||||
args = { config.default_prog[1], "-c", "wzp" },
|
args = { config.default_prog[1], "-c", "scripts/wzp" },
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -234,22 +229,21 @@ local keys = {
|
||||||
-- },
|
-- },
|
||||||
|
|
||||||
--open wezterm config quickly
|
--open wezterm config quickly
|
||||||
{
|
-- {
|
||||||
key = ",",
|
-- key = ",",
|
||||||
mods = "LEADER",
|
-- mods = "LEADER",
|
||||||
action = wezterm.action.SpawnCommandInNewTab({
|
-- action = wezterm.action.SpawnCommandInNewTab({
|
||||||
cwd = os.getenv("WEZTERM_CONFIG_DIR") or os.getenv("HOME"), -- Use home directory if $WEZTERM_CONFIG_DIR is not set
|
-- set_environment_variables = {
|
||||||
set_environment_variables = {
|
-- TERM = "screen-256color",
|
||||||
TERM = "screen-256color",
|
-- },
|
||||||
},
|
-- args = {
|
||||||
args = {
|
-- config.default_prog[1],
|
||||||
config.default_prog[1],
|
-- "-c",
|
||||||
"-c",
|
-- os.getenv("EDITOR") or "vim",
|
||||||
os.getenv("EDITOR") or "vi", -- Default to vi if $EDITOR is not set
|
-- os.getenv("~") .. "/.config/wezterm/.wezterm.lua",
|
||||||
os.getenv("WEZTERM_CONFIG_FILE"),
|
-- },
|
||||||
},
|
-- }),
|
||||||
}),
|
-- },
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
key = "r",
|
key = "r",
|
||||||
|
|
@ -257,29 +251,47 @@ local keys = {
|
||||||
action = act.ReloadConfiguration,
|
action = act.ReloadConfiguration,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Swich to default orkspace
|
-- Swich to default workspace
|
||||||
{
|
{
|
||||||
key = "y",
|
key = "y",
|
||||||
mods = "CTRL | SHIFT",
|
mods = "CTRL | SHIFT",
|
||||||
action = act.SwitchToWorkspace({
|
action = wezterm.action_callback(function(window, pane)
|
||||||
name = "default",
|
wezterm.log_info("Switching to default workspace")
|
||||||
}),
|
workspace.switch_workspace(window, pane, { name = "default" })
|
||||||
|
end),
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Switch to previous workspace
|
||||||
|
{
|
||||||
|
key = "u",
|
||||||
|
mods = "CTRL | SHIFT",
|
||||||
|
action = wezterm.action_callback(function(window, pane)
|
||||||
|
workspace.switch_to_previous_workspace(window, pane)
|
||||||
|
end),
|
||||||
},
|
},
|
||||||
|
|
||||||
--Switch to monitoring workspace
|
--Switch to monitoring workspace
|
||||||
{
|
{
|
||||||
key = ".",
|
key = ".",
|
||||||
mods = "CTRL | SHIFT",
|
mods = "CTRL | SHIFT",
|
||||||
action = act.SwitchToWorkspace({
|
action = wezterm.action_callback(function(window, pane)
|
||||||
name = "monitoring",
|
workspace.switch_workspace(window, pane, {
|
||||||
spawn = {
|
name = "monitoring",
|
||||||
args = { "btm" },
|
spawn = {
|
||||||
},
|
args = { "btm" },
|
||||||
}),
|
},
|
||||||
|
})
|
||||||
|
end),
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Create a new workspace with a randomm name and switch to it
|
-- Create a new workspace with a randomm name and switch to it
|
||||||
{ key = "i", mods = "CTRL | SHIFT", action = act.SwitchToWorkspace },
|
{
|
||||||
|
key = "i",
|
||||||
|
mods = "CTRL | SHIFT",
|
||||||
|
action = wezterm.action_callback(function(window, pane)
|
||||||
|
workspace.switch_workspace(window, pane)
|
||||||
|
end),
|
||||||
|
},
|
||||||
|
|
||||||
-- Rename workspaces
|
-- Rename workspaces
|
||||||
{
|
{
|
||||||
|
|
@ -297,7 +309,7 @@ local keys = {
|
||||||
-- Or the actual line of text they wrote
|
-- Or the actual line of text they wrote
|
||||||
if line then
|
if line then
|
||||||
window:perform_action(
|
window:perform_action(
|
||||||
act.SwitchToWorkspace({
|
workspace.switch_workspace({
|
||||||
name = line,
|
name = line,
|
||||||
}),
|
}),
|
||||||
pane
|
pane
|
||||||
|
|
@ -307,6 +319,45 @@ local keys = {
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
-- Trigger QuickSelect for path-based file opening
|
||||||
|
{
|
||||||
|
key = "O",
|
||||||
|
mods = "CTRL|SHIFT",
|
||||||
|
action = wezterm.action.QuickSelectArgs({
|
||||||
|
label = "Open file",
|
||||||
|
patterns = {
|
||||||
|
[[/[\w./-]+]], -- Absolute paths
|
||||||
|
[[\./[\w./-]+]], -- Relative paths
|
||||||
|
},
|
||||||
|
action = wezterm.action_callback(function(window, pane)
|
||||||
|
local selection = window:get_selection_text_for_pane(pane)
|
||||||
|
if selection and #selection > 0 then
|
||||||
|
-- Check if the file exists
|
||||||
|
local success = wezterm.run_child_process({
|
||||||
|
"sh",
|
||||||
|
"-c",
|
||||||
|
"test -e '" .. selection .. "'",
|
||||||
|
}) == nil
|
||||||
|
|
||||||
|
if success then
|
||||||
|
-- Open with terminal editor in a new workspace
|
||||||
|
window:perform_action(
|
||||||
|
wezterm.action.SpawnWindow({
|
||||||
|
workspace = "file:" .. selection, -- Workspace named after the file
|
||||||
|
args = { "nvim", selection }, -- Change to "vim" or "nano" if preferred
|
||||||
|
}),
|
||||||
|
pane
|
||||||
|
)
|
||||||
|
else
|
||||||
|
-- Fallback to opening with the default app
|
||||||
|
wezterm.log_info("Opening with default app: " .. selection)
|
||||||
|
wezterm.open_with(selection)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end),
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
|
||||||
--Show launcher in fuzzy selecton mode
|
--Show launcher in fuzzy selecton mode
|
||||||
{
|
{
|
||||||
key = "s",
|
key = "s",
|
||||||
|
|
@ -410,6 +461,18 @@ local key_tables = {
|
||||||
{ key = "p", mods = "CTRL", action = act({ CopyMode = "PriorMatch" }) },
|
{ key = "p", mods = "CTRL", action = act({ CopyMode = "PriorMatch" }) },
|
||||||
{ key = "r", mods = "CTRL", action = act.CopyMode("CycleMatchType") },
|
{ key = "r", mods = "CTRL", action = act.CopyMode("CycleMatchType") },
|
||||||
{ key = "u", mods = "CTRL", action = act.CopyMode("ClearPattern") },
|
{ key = "u", mods = "CTRL", action = act.CopyMode("ClearPattern") },
|
||||||
|
{
|
||||||
|
key = "PageUp",
|
||||||
|
mods = "NONE",
|
||||||
|
action = act.CopyMode("PriorMatchPage"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key = "PageDown",
|
||||||
|
mods = "NONE",
|
||||||
|
action = act.CopyMode("NextMatchPage"),
|
||||||
|
},
|
||||||
|
{ key = "UpArrow", mods = "NONE", action = act.CopyMode("PriorMatch") },
|
||||||
|
{ key = "DownArrow", mods = "NONE", action = act.CopyMode("NextMatch") },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -425,7 +488,7 @@ local projects = {
|
||||||
wezterm.home_dir .. "/.dotfiles",
|
wezterm.home_dir .. "/.dotfiles",
|
||||||
wezterm.home_dir .. "/Documents",
|
wezterm.home_dir .. "/Documents",
|
||||||
wezterm.home_dir .. "/.local/bin",
|
wezterm.home_dir .. "/.local/bin",
|
||||||
wezterm.home_dir .. "/Google\\ Drive/My\\ Drive",
|
wezterm.home_dir .. "/Google Drive/My Drive",
|
||||||
}
|
}
|
||||||
|
|
||||||
sessionizer.set_projects(projects)
|
sessionizer.set_projects(projects)
|
||||||
|
|
@ -441,29 +504,60 @@ wezterm.on("mux-is-process-stateful", function(_)
|
||||||
return nil
|
return nil
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- wezterm.on("user-var-changed", function(window, pane, name, value)
|
-- wezterm.on("update-right-status", function(window, pane)
|
||||||
-- local overrides = window:get_config_overrides() or {}
|
-- local ssh_domain = pane:get_user_vars().SSH_CONNECTION or ""
|
||||||
-- if name == "ZEN_MODE" then
|
--
|
||||||
-- local incremental = value:find("+")
|
-- -- Check if '.prod' is in the SSH connection string
|
||||||
-- local number_value = tonumber(value)
|
-- if ssh_domain:find("%.prod") then
|
||||||
-- if incremental ~= nil then
|
-- -- Default to Solarized Light Red
|
||||||
-- while number_value > 0 do
|
-- local fallback_red_color = "#dc322f"
|
||||||
-- window:perform_action(wezterm.action.IncreaseFontSize, pane)
|
-- local overrides = window:get_config_overrides() or {}
|
||||||
-- number_value = number_value - 1
|
--
|
||||||
-- end
|
-- -- Attempt to get the red color from the current color scheme
|
||||||
-- overrides.enable_tab_bar = false
|
-- local red_color = fallback_red_color
|
||||||
-- elseif number_value < 0 then
|
-- if overrides.color_scheme and overrides.color_scheme.red then
|
||||||
-- window:perform_action(wezterm.action.ResetFontSize, pane)
|
-- red_color = overrides.color_scheme.red
|
||||||
-- overrides.font_size = nil
|
|
||||||
-- overrides.enable_tab_bar = true
|
|
||||||
-- else
|
|
||||||
-- overrides.font_size = number_value
|
|
||||||
-- overrides.enable_tab_bar = false
|
|
||||||
-- end
|
-- end
|
||||||
|
--
|
||||||
|
-- -- Set the production-specific overrides
|
||||||
|
-- window:set_config_overrides({
|
||||||
|
-- colors = {
|
||||||
|
-- background = red_color, -- Use theme-appropriate red or fallback
|
||||||
|
-- },
|
||||||
|
-- })
|
||||||
|
--
|
||||||
|
-- -- Set a clear label in the terminal
|
||||||
|
-- window:set_right_status(wezterm.format({
|
||||||
|
-- { Text = "🚨 PRODUCTION SERVER 🚨", Foreground = "white", Background = red_color, Bold = true },
|
||||||
|
-- }))
|
||||||
|
-- else
|
||||||
|
-- -- Reset to default background and clear status for non-prod
|
||||||
|
-- window:set_config_overrides(nil)
|
||||||
|
-- window:set_right_status("")
|
||||||
-- end
|
-- end
|
||||||
-- window:set_config_overrides(overrides)
|
|
||||||
-- end)
|
-- end)
|
||||||
|
|
||||||
|
wezterm.on("user-var-changed", function(window, pane, name, value)
|
||||||
|
local overrides = window:get_config_overrides() or {}
|
||||||
|
if name == "ZEN_MODE" then
|
||||||
|
local incremental = value:find("+")
|
||||||
|
local number_value = tonumber(value)
|
||||||
|
if incremental ~= nil then
|
||||||
|
while number_value > 0 do
|
||||||
|
window:perform_action(wezterm.action.IncreaseFontSize, pane)
|
||||||
|
number_value = number_value - 1
|
||||||
|
end
|
||||||
|
overrides.enable_tab_bar = false
|
||||||
|
elseif number_value < 0 then
|
||||||
|
window:perform_action(wezterm.action.ResetFontSize, pane)
|
||||||
|
overrides.font_size = nil
|
||||||
|
else
|
||||||
|
overrides.font_size = number_value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
window:set_config_overrides(overrides)
|
||||||
|
end)
|
||||||
|
|
||||||
-- wezterm.on("format-tab-title", function(tab)
|
-- wezterm.on("format-tab-title", function(tab)
|
||||||
-- local pane = tab.active_pane
|
-- local pane = tab.active_pane
|
||||||
-- local title = pane.title
|
-- local title = pane.title
|
||||||
|
|
|
||||||
3
zathura/.config/zathura/zathurarc
Normal file
3
zathura/.config/zathura/zathurarc
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
set synctex true
|
||||||
|
# set recolor true
|
||||||
|
|
||||||
40
zsh/.fzf.zsh
40
zsh/.fzf.zsh
|
|
@ -1,28 +1,28 @@
|
||||||
# Determine the FZF path based on the available package manager
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
# Indicate the shell explicitly
|
||||||
|
export FZF_SHELL="zsh"
|
||||||
|
|
||||||
|
# Ensure fzf is installed and get its path
|
||||||
if command -v fzf >/dev/null; then
|
if command -v fzf >/dev/null; then
|
||||||
FZF_PATH="$(dirname "$(command -v fzf)")"
|
export FZF_PATH="$(dirname "$(command -v fzf)")"
|
||||||
elif [[ -x "/run/current-system/sw/bin/fzf" ]]; then
|
|
||||||
FZF_PATH="/run/current-system/sw/bin/fzf"
|
|
||||||
elif command -v brew >/dev/null; then
|
|
||||||
FZF_PATH="$(brew --prefix)/opt/fzf"
|
|
||||||
else
|
else
|
||||||
FZF_PATH="/usr/local/opt/fzf"
|
export FZF_PATH=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Ensure the FZF binary is in the PATH
|
# Load fzf key bindings and completion for zsh
|
||||||
if [[ ! "$PATH" == *"$FZF_PATH/bin"* ]]; then
|
if command -v fzf >/dev/null; then
|
||||||
PATH="${PATH:+${PATH}:}$FZF_PATH/bin"
|
[ -f "$FZF_PATH/key-bindings.zsh" ] && . "$FZF_PATH/key-bindings.zsh"]
|
||||||
|
[ -f "$FZF_PATH/completion.zsh" ] && . "$FZF_PATH/completion.zsh"]
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Load FZF theme dynamically
|
# Load fzf theme if available
|
||||||
FZF_THEME_FILE="${HOME}/.local/bin/scripts/fzf_theme"
|
FZF_THEME_SCRIPT="$HOME/.local/bin/scripts/fzf_theme.sh"
|
||||||
if [[ -f "$FZF_THEME_FILE" ]]; then
|
if [[ -f "$FZF_THEME_SCRIPT" ]]; then
|
||||||
export FZF_DEFAULT_OPTS="$("$FZF_THEME_FILE")"
|
# If theme script is available, use it and add the default fzf options
|
||||||
fi
|
export FZF_DEFAULT_OPTS="$($FZF_THEME_SCRIPT) --height 40% --layout=reverse --border"
|
||||||
|
else
|
||||||
# Load fzf key-bindings and completion if available
|
# Set default options for fzf without any theme, with preview enabled for general use
|
||||||
if [[ $- == *i* ]]; then
|
export FZF_DEFAULT_OPTS="--height 40% --layout=reverse --border"
|
||||||
[[ -f "$HOME/.fzf/key-bindings.zsh" ]] && . "$HOME/.fzf/key-bindings.zsh"
|
|
||||||
[[ -f "$HOME/.fzf/completion.zsh" ]] && . "$HOME/.fzf/completion.zsh"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,50 +1,24 @@
|
||||||
# Determine the FZF path based on the available package manager
|
#!/usr/bin/env zsh
|
||||||
if [[ -x "$(command -v fzf)" ]] && [[ "$(command -v fzf)" == "/run/current-system/sw/bin/fzf" ]]; then
|
|
||||||
# FZF is installed via Nix
|
# Determine FZF installation path
|
||||||
export FZF_PATH="/run/current-system/sw/bin/fzf"
|
if command -v fzf &>/dev/null; then
|
||||||
elif command -v brew >/dev/null; then
|
if [[ "$(command -v fzf)" == "/run/current-system/sw/bin/fzf" ]]; then
|
||||||
# Homebrew is installed
|
FZF_PATH="/run/current-system/sw"
|
||||||
export FZF_PATH="$(brew --prefix)/opt/fzf"
|
elif command -v brew &>/dev/null; then
|
||||||
else
|
FZF_PATH="$(brew --prefix)/opt/fzf"
|
||||||
# Fallback to empty string if neither Nix nor Homebrew is available
|
else
|
||||||
export FZF_PATH=""
|
FZF_PATH=""
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Conditionally set the editor based on SSH connection
|
if [[ -n "$FZF_PATH" && ! "$PATH" =~ (^|:)"$FZF_PATH"(:|$) ]]; then
|
||||||
[[ -n ${SSH_CONNECTION} ]] && export EDITOR='vim'
|
export PATH="$FZF_PATH:$PATH"
|
||||||
|
|
||||||
# Load fzf theme options if the file exists
|
|
||||||
FZF_THEME_FILE="${HOME}/.local/bin/scripts/fzf_theme"
|
|
||||||
[[ -f "$FZF_THEME_FILE" ]] && export FZF_DEFAULT_OPTS="$("$FZF_THEME_FILE")"
|
|
||||||
|
|
||||||
# Source fzf configuration if installed
|
|
||||||
if [[ -n "$FZF_PATH" ]]; then
|
|
||||||
for config_file in "completion.bash" "key-bindings.bash"; do
|
|
||||||
[[ -f "$FZF_PATH/shell/$config_file" ]] && source "$FZF_PATH/shell/$config_file"
|
|
||||||
done
|
|
||||||
[[ -f "${HOME}/.fzf.zsh" ]] && source "${HOME}/.fzf.zsh"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Initialize direnv
|
if command -v brew &>/dev/null && brew list curl &>/dev/null; then
|
||||||
eval "$(direnv hook zsh)"
|
BREW_CURL_PATH="$(brew --prefix curl)/bin"
|
||||||
|
if [[ -d "$BREW_CURL_PATH" && ! "$PATH" =~ (^|:)"$BREW_CURL_PATH"(:|$) ]]; then
|
||||||
# Initialize zoxide
|
export PATH="$BREW_CURL_PATH:$PATH"
|
||||||
eval "$(zoxide init --cmd cd zsh)"
|
fi
|
||||||
|
|
||||||
# Initialize Starship
|
|
||||||
eval "$(starship init zsh)"
|
|
||||||
export STARSHIP_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/starship.toml"
|
|
||||||
|
|
||||||
# Initialize pyenv if available
|
|
||||||
if command -v pyenv >/dev/null; then
|
|
||||||
export PYENV_ROOT="${HOME}/.pyenv"
|
|
||||||
[[ -d "${PYENV_ROOT}/bin" && ! "${PATH}" == *"${PYENV_ROOT}/bin"* ]] && export PATH="${PYENV_ROOT}/bin:${PATH}"
|
|
||||||
eval "$(pyenv init -)"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Initialize nvm if available
|
|
||||||
# if command -v nvm >/dev/null; then
|
|
||||||
# export NVM_DIR="${HOME}/.nvm"
|
|
||||||
# [[ -s "${NVM_DIR}/nvm.sh" ]] && source "${NVM_DIR}/nvm.sh"
|
|
||||||
# fi
|
|
||||||
|
|
||||||
|
|
|
||||||
125
zsh/.zshenv
125
zsh/.zshenv
|
|
@ -1,7 +1,6 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
# ------------- Environment Setup -------------
|
# ------------- Environment Setup -------------
|
||||||
# XDG configuration defaults
|
|
||||||
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
|
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||||
export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
|
export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
|
||||||
export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
|
export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
|
||||||
|
|
@ -12,92 +11,58 @@ export EDITOR="nvim"
|
||||||
export BROWSER="firefox"
|
export BROWSER="firefox"
|
||||||
|
|
||||||
# ------------- Platform-Specific Setup -------------
|
# ------------- Platform-Specific Setup -------------
|
||||||
# Determine Homebrew prefix dynamically
|
OS_TYPE="$(uname -s)"
|
||||||
if [[ "$(uname -s)" == "Darwin" ]]; then
|
HOMEBREW_PREFIX="/opt/homebrew"
|
||||||
HOMEBREW_PREFIX=$(
|
|
||||||
if [[ -d "/nix/store" ]]; then
|
if [[ "$OS_TYPE" == "Darwin" ]]; then
|
||||||
echo "/run/current-system/sw"
|
if [[ "$(uname -m)" == "arm64" ]]; then
|
||||||
elif [[ "$(uname -m)" == "arm64" ]]; then
|
HOMEBREW_PREFIX="/opt/homebrew" # Apple Silicon
|
||||||
echo "/opt/homebrew"
|
else
|
||||||
else
|
HOMEBREW_PREFIX="/usr/local" # Intel Mac
|
||||||
echo "/usr/local"
|
fi
|
||||||
fi
|
elif [[ "$OS_TYPE" == "Linux" ]]; then
|
||||||
)
|
if [[ -d "/home/linuxbrew/.linuxbrew/bin" ]]; then
|
||||||
else
|
HOMEBREW_PREFIX="/home/linuxbrew/.linuxbrew"
|
||||||
HOMEBREW_PREFIX="/usr/local"
|
elif [[ -d "/linuxbrew/bin" ]]; then
|
||||||
|
HOMEBREW_PREFIX="/linuxbrew"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Helper function to safely add directories to PATH
|
# ------------- Helper Functions -------------
|
||||||
safe_path_add() {
|
safe_path_add() {
|
||||||
local dir="$1"
|
[[ -d "$1" && ":$PATH:" != *":$1:"* ]] && export PATH="$1:$PATH"
|
||||||
[[ -d "$dir" && ! "$PATH" =~ (^|:)$dir(:|$) ]] && export PATH="$dir:$PATH"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add Homebrew binaries
|
# ------------- PATH Setup -------------
|
||||||
safe_path_add "${HOMEBREW_PREFIX}/bin"
|
safe_path_add "$HOME/.local/bin/scripts"
|
||||||
safe_path_add "${HOMEBREW_PREFIX}/sbin"
|
safe_path_add "$HOMEBREW_PREFIX/bin"
|
||||||
|
safe_path_add "$HOMEBREW_PREFIX/sbin"
|
||||||
|
|
||||||
# ------------- PATH and Tools Setup -------------
|
if [[ "$OS_TYPE" == "Darwin" ]]; then
|
||||||
|
for dir in "$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin" \
|
||||||
# Directories to potentially add to PATH
|
"$HOMEBREW_PREFIX/opt/openssl@1.1/bin" \
|
||||||
POTENTIAL_PATHS=(
|
"$HOMEBREW_PREFIX/opt/llvm/bin" \
|
||||||
"$HOME/.local/bin"
|
"/Library/TeX/texbin"; do
|
||||||
"$HOME/.rvm/bin"
|
|
||||||
"$HOME/.cargo/bin"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Add potential paths
|
|
||||||
for dir in "${POTENTIAL_PATHS[@]}"; do
|
|
||||||
safe_path_add "$dir"
|
|
||||||
done
|
|
||||||
|
|
||||||
# Ensure PYENV_ROOT is in PATH if set
|
|
||||||
[[ -n "$PYENV_ROOT" ]] && safe_path_add "$PYENV_ROOT/bin"
|
|
||||||
|
|
||||||
# Go path setup
|
|
||||||
if command -v go &> /dev/null; then
|
|
||||||
export GOPATH="${GOPATH:-$HOME/.go}"
|
|
||||||
safe_path_add "$GOPATH/bin"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# NVM setup
|
|
||||||
if [[ -d "$HOME/.nvm" ]]; then
|
|
||||||
export NVM_DIR="$HOME/.nvm"
|
|
||||||
for script in nvm.sh bash_completion; do
|
|
||||||
[[ -s "$NVM_DIR/$script" ]] && . "$NVM_DIR/$script"
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
# ------------- Conda / Mamba Setup -------------
|
|
||||||
CONDA_PATHS=(
|
|
||||||
"/opt/homebrew/Caskroom/miniforge/base"
|
|
||||||
"/usr/local/Caskroom/miniforge/base"
|
|
||||||
)
|
|
||||||
|
|
||||||
for CONDA_PATH in "${CONDA_PATHS[@]}"; do
|
|
||||||
if [[ -d "$CONDA_PATH" ]]; then
|
|
||||||
for profile_script in conda.sh mamba.sh; do
|
|
||||||
[[ -f "$CONDA_PATH/etc/profile.d/$profile_script" ]] && . "$CONDA_PATH/etc/profile.d/$profile_script" 2>/dev/null
|
|
||||||
done
|
|
||||||
safe_path_add "$CONDA_PATH/bin"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# macOS-specific additional paths
|
|
||||||
if [[ "$(uname -s)" == "Darwin" ]]; then
|
|
||||||
MACOS_PATHS=(
|
|
||||||
"${HOMEBREW_PREFIX}/opt/coreutils/libexec/gnubin"
|
|
||||||
"/usr/local/opt/openssl@1.1/bin"
|
|
||||||
"/usr/local/opt/llvm/bin"
|
|
||||||
"/Library/TeX/texbin"
|
|
||||||
)
|
|
||||||
|
|
||||||
for dir in "${MACOS_PATHS[@]}"; do
|
|
||||||
safe_path_add "$dir"
|
safe_path_add "$dir"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Optional architecture flags (uncomment if needed)
|
# Python Paths
|
||||||
# export ARCHFLAGS="-arch x86_64 -arch arm64"
|
[[ -n "$PYENV_ROOT" ]] && safe_path_add "$PYENV_ROOT/bin"
|
||||||
|
|
||||||
|
# Go Paths
|
||||||
|
if command -v go &>/dev/null; then
|
||||||
|
export GOPATH="${GOPATH:-$HOME/.go}"
|
||||||
|
safe_path_add "$GOPATH/bin"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Rust Paths
|
||||||
|
export PATH="$HOMEBREW_PREFIX/opt/rustup/bin:$PATH"
|
||||||
|
|
||||||
|
# NVM Setup
|
||||||
|
if [[ -d "$HOME/.nvm" ]]; then
|
||||||
|
export NVM_DIR="$HOME/.nvm"
|
||||||
|
[[ -s "$NVM_DIR/nvm.sh" ]] && . "$NVM_DIR/nvm.sh"
|
||||||
|
[[ -s "$NVM_DIR/zsh_completion" ]] && . "$NVM_DIR/bash_completion"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
151
zsh/.zshrc
151
zsh/.zshrc
|
|
@ -1,8 +1,6 @@
|
||||||
# ------------ Profile Information -----------
|
#!/usr/bin/env zsh
|
||||||
# zmodload zsh/zprof # Load zprof for performance profiling
|
|
||||||
|
|
||||||
# ------------ Basic Settings -------------
|
|
||||||
|
|
||||||
|
# ================ Basic Settings ================
|
||||||
# Disable auto title
|
# Disable auto title
|
||||||
DISABLE_AUTO_TITLE="true"
|
DISABLE_AUTO_TITLE="true"
|
||||||
|
|
||||||
|
|
@ -10,40 +8,44 @@ DISABLE_AUTO_TITLE="true"
|
||||||
# CASE_SENSITIVE="true"
|
# CASE_SENSITIVE="true"
|
||||||
# HYPHEN_INSENSITIVE="true"
|
# HYPHEN_INSENSITIVE="true"
|
||||||
|
|
||||||
# Miscellaneous configurations (uncomment as needed)
|
# Miscellaneous settings (uncomment as needed)
|
||||||
# DISABLE_MAGIC_FUNCTIONS="true"
|
# DISABLE_MAGIC_FUNCTIONS="true"
|
||||||
# DISABLE_LS_COLORS="true"
|
# DISABLE_LS_COLORS="true"
|
||||||
# ENABLE_CORRECTION="true"
|
# ENABLE_CORRECTION="true"
|
||||||
# COMPLETION_WAITING_DOTS="true"
|
# COMPLETION_WAITING_DOTS="true"
|
||||||
# DISABLE_UNTRACKED_FILES_DIRTY="true"
|
# DISABLE_UNTRACKED_FILES_DIRTY="true"
|
||||||
|
|
||||||
# ------------ Path & Auto-Update Settings -------------
|
# ================ Path Optimizations ================
|
||||||
|
# Ensure no duplicates in PATH
|
||||||
# Uncomment if using Oh-My-Zsh
|
typeset -U PATH
|
||||||
# export ZSH="$HOME/.oh-my-zsh"
|
|
||||||
# export ZSH_CUSTOM="$HOME/.oh-my-zsh/custom"
|
|
||||||
# export UPDATE_ZSH_DAYS=1
|
|
||||||
# DISABLE_UPDATE_PROMPT=true
|
|
||||||
# zstyle ':omz:update' mode reminder # remind to update
|
|
||||||
|
|
||||||
# ------------ zsh Completion Settings -------------
|
|
||||||
|
|
||||||
|
# ================ Zsh Completion Settings ================
|
||||||
# Load zsh completions with optimization
|
# Load zsh completions with optimization
|
||||||
autoload -Uz compinit
|
if type brew &>/dev/null; then
|
||||||
fpath=(/run/current-system/sw/bin/zsh/site-functions $fpath)
|
export HOMEBREW_AUTO_UPDATE_SECS=86400 # Update every 24 hours
|
||||||
|
export HOMEBREW_PREFIX="$(brew --prefix)"
|
||||||
|
|
||||||
# Optimize compinit loading and reduce .zcompdump frequency
|
# Ensure Homebrew path is correct for your system (Intel vs M1)
|
||||||
|
if [[ -d "$HOMEBREW_PREFIX/share/zsh/site-functions" ]]; then
|
||||||
|
FPATH="$HOMEBREW_PREFIX/share/zsh/site-functions:$FPATH"
|
||||||
|
elif [[ -d "/usr/local/share/zsh/site-functions" ]]; then
|
||||||
|
FPATH="/usr/local/share/zsh/site-functions:$FPATH"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Initialize compinit for Zsh completions
|
||||||
|
autoload -Uz compinit
|
||||||
|
|
||||||
|
# Set the location of zcompdump for completion caching
|
||||||
ZSH_COMPDUMP="${ZDOTDIR:-$HOME}/.zcompdump"
|
ZSH_COMPDUMP="${ZDOTDIR:-$HOME}/.zcompdump"
|
||||||
if [[ ! -f $ZSH_COMPDUMP ]]; then
|
if [[ ! -f $ZSH_COMPDUMP || $ZSH_COMPDUMP -ot $ZDOTDIR/.zshrc ]]; then
|
||||||
compinit -d "$ZSH_COMPDUMP"
|
compinit -d "$ZSH_COMPDUMP"
|
||||||
else
|
else
|
||||||
compinit -C -d "$ZSH_COMPDUMP"
|
compinit -C -d "$ZSH_COMPDUMP"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ---------------- Plugin Manager (Zinit) ----------------
|
# ================ Plugin Manager (Zinit) ================
|
||||||
# Setup and initialize Zinit, a Zsh plugin manager
|
# Setup and initialize Zinit, a Zsh plugin manager
|
||||||
|
|
||||||
# Define the path for Zinit installation
|
|
||||||
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
|
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
|
||||||
|
|
||||||
# Install Zinit if it isn't already present
|
# Install Zinit if it isn't already present
|
||||||
|
|
@ -55,101 +57,116 @@ fi
|
||||||
# Source the Zinit script to enable plugin management
|
# Source the Zinit script to enable plugin management
|
||||||
. "${ZINIT_HOME}/zinit.zsh"
|
. "${ZINIT_HOME}/zinit.zsh"
|
||||||
|
|
||||||
# Ensure compinit (Zsh completion system) works with Zinit
|
# Ensure compinit works with Zinit
|
||||||
autoload -Uz _zinit
|
autoload -Uz _zinit
|
||||||
(( ${+_comps} )) && _comps[zinit]=_zinit
|
(( ${+_comps} )) && _comps[zinit]=_zinit
|
||||||
|
|
||||||
# ---------------- Zinit Plugin Configuration ----------------
|
# ================ Zinit Plugin Configuration ================
|
||||||
|
# Essential plugins for enhanced Zsh experience
|
||||||
# Load essential Zsh plugins
|
zinit light zsh-users/zsh-completions # Tab completions for Zsh
|
||||||
zinit light zsh-users/zsh-completions # Enhanced tab completions for Zsh
|
|
||||||
zinit light zsh-users/zsh-history-substring-search # Search through command history
|
zinit light zsh-users/zsh-history-substring-search # Search through command history
|
||||||
zinit load zdharma/history-search-multi-word # Multi-word history search
|
zinit load zdharma/history-search-multi-word # Multi-word history search
|
||||||
|
|
||||||
# Lazy load syntax highlighting for Zsh
|
# Syntax highlighting for Zsh (lazy-load)
|
||||||
zinit ice wait lucid atinit"ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern)"
|
zinit ice wait lucid atinit"ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern)"
|
||||||
zinit load zsh-users/zsh-syntax-highlighting
|
zinit load zsh-users/zsh-syntax-highlighting
|
||||||
|
|
||||||
# Enable asynchronous auto-suggestions
|
# Asynchronous auto-suggestions (lazy-load)
|
||||||
zinit ice wait lucid atload"zle-line-init() { zle autosuggest-enable }; zle -N zle-line-init"
|
zinit ice wait lucid atload"zle-line-init() { zle autosuggest-enable }; zle -N zle-line-init"
|
||||||
zinit load zsh-users/zsh-autosuggestions
|
zinit load zsh-users/zsh-autosuggestions
|
||||||
|
|
||||||
# ---------------- Docker Completions ----------------
|
# ================ Docker Completions ================
|
||||||
# Add CLI completions for Docker and Docker Compose
|
# Add Docker and Docker Compose completions
|
||||||
zinit ice wait lucid depth=1
|
zinit ice wait lucid depth=1
|
||||||
zinit load docker/compose
|
zinit load docker/compose
|
||||||
zinit ice wait lucid depth=1
|
|
||||||
zinit light zsh-users/zsh-completions
|
|
||||||
|
|
||||||
# ---------------- zoxide Plugin ----------------
|
# ================ zoxide Plugin ================
|
||||||
# Fast navigation tool for frequently used directories
|
# Fast navigation tool for frequently used directories
|
||||||
zinit ice from"gh-r" as"program" pick"bin/zoxide"
|
zinit ice from"gh-r" as"program" pick"bin/zoxide"
|
||||||
zinit load ajeetdsouza/zoxide
|
zinit load ajeetdsouza/zoxide
|
||||||
|
|
||||||
# ---------------- fzf Plugin ----------------
|
# ================ fzf Plugin ================
|
||||||
|
|
||||||
# Source additional fzf configuration where FZF_DEFAULT_OPTS is defined
|
# Install fzf (binary) using zinit
|
||||||
if [ -f ~/.fzf.zsh ]; then
|
|
||||||
. ~/.fzf.zsh
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Install fzf, a general-purpose command-line fuzzy finder
|
|
||||||
zinit ice from"gh-r" as"program" pick"bin/fzf"
|
zinit ice from"gh-r" as"program" pick"bin/fzf"
|
||||||
zinit light junegunn/fzf-bin
|
zinit light junegunn/fzf-bin
|
||||||
|
|
||||||
# Load fzf-tab for enhanced tab completion interface using fzf
|
# Optional: fzf-git.sh for git integration (if you want)
|
||||||
zinit ice wait lucid depth=1
|
zinit light junegunn/fzf-git.sh
|
||||||
zinit load Aloxaf/fzf-tab
|
|
||||||
|
|
||||||
# Load fzf shell integration (completion and key bindings)
|
# Load fzf-tab for enhanced fuzzy tab completion
|
||||||
zinit ice depth=1
|
zinit ice blockf
|
||||||
zinit light junegunn/fzf
|
zinit light Aloxaf/fzf-tab
|
||||||
|
|
||||||
# ------------ Additional Programs Initialization -------------
|
# ================ Additional Programs Initialization ================
|
||||||
|
# Initialize direnv (uncomment if needed)
|
||||||
# Initialize direnv
|
# eval "$(direnv hook zsh)"
|
||||||
eval "$(direnv hook zsh)"
|
|
||||||
|
|
||||||
# Initialize zoxide
|
# Initialize zoxide
|
||||||
eval "$(zoxide init --cmd cd zsh)"
|
eval "$(zoxide init --cmd cd zsh)"
|
||||||
|
|
||||||
# Initialize Starship
|
# Initialize Starship prompt
|
||||||
eval "$(starship init zsh)"
|
eval "$(starship init zsh)"
|
||||||
export STARSHIP_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/starship.toml"
|
export STARSHIP_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/starship.toml"
|
||||||
|
|
||||||
# ------------ Pyenv Setup -------------
|
# ================ Zoxide Initialization ================
|
||||||
|
if command -v eza &>/dev/null; then
|
||||||
|
export ZO_FZF_OPTS="--preview 'eza --tree --level=2 --color=always {}' --preview-window=down:30%:wrap"
|
||||||
|
else
|
||||||
|
export ZO_FZF_OPTS="--preview 'ls -la --color=always {}' --preview-window=down:30%:wrap"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ================ Conda Initialization ================
|
||||||
|
# Initialize Conda (uncomment if you use Conda)
|
||||||
|
# eval "$(conda init "$(basename "${SHELL}")")"
|
||||||
|
|
||||||
|
# ================ Pyenv Setup ================
|
||||||
|
# Initialize Pyenv if installed
|
||||||
if command -v pyenv 1>/dev/null 2>&1; then
|
if command -v pyenv 1>/dev/null 2>&1; then
|
||||||
export PYENV_ROOT="$HOME/.pyenv"
|
export PYENV_ROOT="$HOME/.pyenv"
|
||||||
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
|
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
|
||||||
eval "$(pyenv init -)"
|
eval "$(pyenv init -)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ------------ Custom Aliases -------------
|
# ================ Custom Aliases ================
|
||||||
|
# Define commonly used aliases
|
||||||
alias python="python3"
|
|
||||||
alias grep="grep --color=auto"
|
alias grep="grep --color=auto"
|
||||||
alias ..="cd .."
|
alias ..="cd .."
|
||||||
alias ...="cd ../.."
|
alias ...="cd ../.."
|
||||||
alias ....="cd ../../.."
|
alias ....="cd ../../.."
|
||||||
alias .....="cd ../../../.."
|
alias .....="cd ../../../.."
|
||||||
|
alias lzd='lazydocker'
|
||||||
|
alias v='nvim'
|
||||||
|
|
||||||
|
# Use eza for enhanced 'ls' command
|
||||||
|
alias ls='eza'
|
||||||
|
alias ll='eza -lh --group-directories-first'
|
||||||
|
alias la='eza -a --group-directories-first'
|
||||||
|
alias lla='eza -la --group-directories-first'
|
||||||
|
alias l='eza --classify'
|
||||||
|
|
||||||
|
alias gs='git status'
|
||||||
|
alias gc='git commit'
|
||||||
|
alias gcm='git commit -m'
|
||||||
|
alias gco='git checkout'
|
||||||
|
alias gb='git branch'
|
||||||
|
alias gu='git pull'
|
||||||
|
alias gp='git push'
|
||||||
|
alias gl='git log --oneline --graph --decorate'
|
||||||
|
alias gi='git init'
|
||||||
|
alias gcl='git clone'
|
||||||
|
|
||||||
|
|
||||||
# Source additional alias checks if available
|
# Source additional alias checks if available
|
||||||
if [[ -f ~/.local/bin/scripts/check_aliases ]]; then
|
if [[ -f ~/.local/bin/scripts/check_aliases ]]; then
|
||||||
. ~/.local/bin/scripts/check_aliases
|
. ~/.local/bin/scripts/check_aliases
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ------------ Conditional Settings -------------
|
# ================ Conditional Settings ================
|
||||||
|
# Set the editor to vim if using SSH
|
||||||
# Conditionally set the editor based on SSH connection
|
|
||||||
[[ -n ${SSH_CONNECTION} ]] && export EDITOR='vim'
|
[[ -n ${SSH_CONNECTION} ]] && export EDITOR='vim'
|
||||||
|
|
||||||
# ------------ Homebrew configuration -------------
|
# ================ Profiling (Optional) ================
|
||||||
|
# Uncomment to enable profiling (useful for debugging)
|
||||||
export HOMEBREW_AUTO_UPDATE_SECS=86400 # Update Homebrew every 24 hours
|
# zprof # Comment out if profiling is not needed
|
||||||
|
|
||||||
# ------------ Profiling (Optional) -------------
|
|
||||||
|
|
||||||
# Enable profiling
|
|
||||||
# zprof # Comment this line out if profiling is not needed
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue