diff --git a/.gitignore b/.gitignore index 2523250..29a696e 100755 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,8 @@ firefox/* !firefox/Library/Application Support/Firefox/Profiles/*/user.js nix-darwin/.config/nix-darwin/flake.lock + +shpotify/.shpotify.cfg + +colima/.config/colima/_lima/ +colima/.config/colima/default/daemon/ diff --git a/aerospace/.config/aerospace/aerospace.toml b/aerospace/.config/aerospace/aerospace.toml index 8bfd892..777720f 100644 --- a/aerospace/.config/aerospace/aerospace.toml +++ b/aerospace/.config/aerospace/aerospace.toml @@ -10,8 +10,9 @@ after-login-command = [] # 'after-startup-command' is run after 'after-login-command' # Available commands : https://nikitabobko.github.io/AeroSpace/commands # after-startup-command = ['exec-and-forget sketchybar'] -after-startup-command = [] - +# after-startup-command = [ +# 'exec-and-forget borders active_color=0xffe6e8eb inactive_color=0xff3a3f4b width=5.0', +# ] # Start AeroSpace at login start-at-login = true @@ -109,8 +110,8 @@ cmd-h = [] # Disable "hide application" cmd-alt-h = [] # Disable "hide others" # See: https://nikitabobko.github.io/AeroSpace/commands#layout -alt-slash = 'layout tiles horizontal vertical' -alt-comma = 'layout accordion horizontal vertical' +alt-shift-slash = 'layout h_tiles vertical horizontal' +alt-shift-comma = 'layout accordion vertical horizontal' # See: https://nikitabobko.github.io/AeroSpace/commands#focus alt-h = 'focus left' @@ -118,7 +119,10 @@ alt-j = 'focus down' alt-k = 'focus up' alt-l = 'focus right' -alt-r = 'layout horizontal vertical' +ctrl-j = 'focus dfs-next --boundaries-action wrap-around-the-workspace' +ctrl-k = 'focus dfs-prev --boundaries-action wrap-around-the-workspace' + +alt-shift-r = 'layout horizontal vertical' # See: https://nikitabobko.github.io/AeroSpace/commands#move alt-shift-h = 'move left' @@ -130,13 +134,12 @@ alt-shift-l = 'move right' alt-shift-minus = 'resize smart -50' alt-shift-equal = 'resize smart +50' -alt-shift-r = 'resize - # See: https://nikitabobko.github.io/AeroSpace/commands#workspace alt-1 = 'workspace 1' alt-2 = 'workspace 2' alt-3 = 'workspace 3' alt-c = 'workspace C' +alt-d = 'workspace D' alt-e = 'workspace E' alt-g = 'workspace G' alt-n = 'workspace N' @@ -154,6 +157,7 @@ alt-shift-1 = 'move-node-to-workspace 1' alt-shift-2 = 'move-node-to-workspace 2' alt-shift-3 = 'move-node-to-workspace 3' alt-shift-c = 'move-node-to-workspace C' +alt-shift-d = 'move-node-to-workspace D' alt-shift-e = 'move-node-to-workspace E' alt-shift-g = 'move-node-to-workspace G' alt-shift-n = 'move-node-to-workspace N' @@ -172,10 +176,10 @@ alt-tab = 'workspace-back-and-forth' alt-shift-tab = 'move-workspace-to-monitor --wrap-around next' # See: https://nikitabobko.github.io/AeroSpace/commands#mode -alt-shift-semicolon = 'mode service' -alt-shift-r = 'mode resize' +alt-ctrl-semicolon = 'mode service' +alt-ctrl-r = 'mode resize' -alt-f = 'fullscreen' +alt-shift-f = 'fullscreen' # 'service' binding mode declaration. # See: https://nikitabobko.github.io/AeroSpace/guide#binding-modes [mode.service.binding] @@ -187,7 +191,7 @@ f = [ ] # Toggle between floating and tiling layout backspace = ['close-all-windows-but-current', 'mode main'] -# 'resize' binding mode declaration. +# 'resize' binding mode declarationr [mode.resize.binding] esc = ['mode main'] enter = ['mode main'] @@ -216,6 +220,10 @@ Z = ['secondary', 'dell'] if.app-id = 'com.apple.iCal' run = "move-node-to-workspace C" +[[on-window-detected]] +if.app-id = 'com.hnc.Discord' +run = "move-node-to-workspace D" + [[on-window-detected]] if.app-id = 'com.apple.finder' run = "move-node-to-workspace E" @@ -251,3 +259,15 @@ run = "move-node-to-workspace V" [[on-window-detected]] if.app-id = 'com.apple.Safari' run = "move-node-to-workspace X" + +[[on-window-detected]] +if.app-id = 'com.apple.Preview' +run = "move-node-to-workspace 1" + +[[on-window-detected]] +if.app-id = 'com.apple.TextEdit' +run = "move-node-to-workspace 2" + +[[on-window-detected]] +if.app-id = 'com.apple.iWork.Pages' +run = "move-node-to-workspace 3" diff --git a/colima/.config/colima/default/colima.yaml b/colima/.config/colima/default/colima.yaml new file mode 100644 index 0000000..3d940ce --- /dev/null +++ b/colima/.config/colima/default/colima.yaml @@ -0,0 +1,216 @@ +# Number of CPUs to be allocated to the virtual machine. +# Default: 2 +cpu: 2 + +# Size of the disk in GiB to be allocated to the virtual machine. +# NOTE: value can only be increased after virtual machine has been created. +# +# Default: 100 +disk: 100 + +# Size of the memory in GiB to be allocated to the virtual machine. +# Default: 2 +memory: 2 + +# Architecture of the virtual machine (x86_64, aarch64, host). +# +# NOTE: value cannot be changed after virtual machine is created. +# Default: host +arch: aarch64 + +# Container runtime to be used (docker, containerd). +# +# NOTE: value cannot be changed after virtual machine is created. +# Default: docker +runtime: docker + +# Set custom hostname for the virtual machine. +# Default: colima +# colima-profile_name for other profiles +hostname: colima + +# Kubernetes configuration for the virtual machine. +kubernetes: + # Enable kubernetes. + # Default: false + enabled: false + + # Kubernetes version to use. + # This needs to exactly match a k3s version https://github.com/k3s-io/k3s/releases + # Default: latest stable release + version: v1.31.2+k3s1 + + # Additional args to pass to k3s https://docs.k3s.io/cli/server + # Default: traefik is disabled + k3sArgs: + - --disable=traefik + +# Auto-activate on the Host for client access. +# Setting to true does the following on startup +# - sets as active Docker context (for Docker runtime). +# - sets as active Kubernetes context (if Kubernetes is enabled). +# Default: true +autoActivate: true + +# Network configurations for the virtual machine. +network: + # Assign reachable IP address to the virtual machine. + # NOTE: this is currently macOS only and ignored on Linux. + # Default: false + address: false + + # Custom DNS resolvers for the virtual machine. + # + # EXAMPLE + # dns: [8.8.8.8, 1.1.1.1] + # + # Default: [] + dns: [] + + # DNS hostnames to resolve to custom targets using the internal resolver. + # This setting has no effect if a custom DNS resolver list is supplied above. + # It does not configure the /etc/hosts files of any machine or container. + # The value can be an IP address or another host. + # + # EXAMPLE + # dnsHosts: + # example.com: 1.2.3.4 + dnsHosts: {} + + # Replicate host IP addresses in the VM. This enables port forwarding to specific + # host IP addresses. + # e.g. `docker run --port 10.0.1.2:8080:8080 alpine` would only forward to the + # specified IP address. + # + # Default: false + hostAddresses: false + +# ===================================================================== # +# ADVANCED CONFIGURATION +# ===================================================================== # + +# Forward the host's SSH agent to the virtual machine. +# Default: false +forwardAgent: false + +# Docker daemon configuration that maps directly to daemon.json. +# https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file. +# NOTE: some settings may affect Colima's ability to start docker. e.g. `hosts`. +# +# EXAMPLE - disable buildkit +# docker: +# features: +# buildkit: false +# +# EXAMPLE - add insecure registries +# docker: +# insecure-registries: +# - myregistry.com:5000 +# - host.docker.internal:5000 +# +# Colima default behaviour: buildkit enabled +# Default: {} +docker: {} + +# Virtual Machine type (qemu, vz) +# NOTE: this is macOS 13 only. For Linux and macOS <13.0, qemu is always used. +# +# vz is macOS virtualization framework and requires macOS 13 +# +# NOTE: value cannot be changed after virtual machine is created. +# Default: qemu +vmType: vz + +# Utilise rosetta for amd64 emulation (requires m1 mac and vmType `vz`) +# Default: false +rosetta: false + +# Enable nested virtualization for the virtual machine (requires m3 mac and vmType `vz`) +# Default: false +nestedVirtualization: false + +# Volume mount driver for the virtual machine (virtiofs, 9p, sshfs). +# +# virtiofs is limited to macOS and vmType `vz`. It is the fastest of the options. +# +# 9p is the recommended and the most stable option for vmType `qemu`. +# +# sshfs is faster than 9p but the least reliable of the options (when there are lots +# of concurrent reads or writes). +# +# NOTE: value cannot be changed after virtual machine is created. +# Default: virtiofs (for vz), sshfs (for qemu) +mountType: sshfs + +# Propagate inotify file events to the VM. +# NOTE: this is experimental. +mountInotify: true + +# The CPU type for the virtual machine (requires vmType `qemu`). +# Options available for host emulation can be checked with: `qemu-system-$(arch) -cpu help`. +# Instructions are also supported by appending to the cpu type e.g. "qemu64,+ssse3". +# Default: host +cpuType: "" + +# Custom provision scripts for the virtual machine. +# Provisioning scripts are executed on startup and therefore needs to be idempotent. +# +# EXAMPLE - script executed as root +# provision: +# - mode: system +# script: apt-get install htop vim +# +# EXAMPLE - script executed as user +# provision: +# - mode: user +# script: | +# [ -f ~/.provision ] && exit 0; +# echo provisioning as $USER... +# touch ~/.provision +# +# Default: [] +provision: [] + +# Modify ~/.ssh/config automatically to include a SSH config for the virtual machine. +# SSH config will still be generated in $COLIMA_HOME/ssh_config regardless. +# Default: true +sshConfig: true + +# The port number for the SSH server for the virtual machine. +# When set to 0, a random available port is used. +# +# Default: 0 +sshPort: 0 + +# Configure volume mounts for the virtual machine. +# Colima mounts user's home directory by default to provide a familiar +# user experience. +# +# EXAMPLE +# mounts: +# - location: ~/secrets +# writable: false +# - location: ~/projects +# writable: true +# +# Colima default behaviour: $HOME and /tmp/colima are mounted as writable. +# Default: [] +mounts: [] + +# Specify a custom disk image for the virtual machine. +# When not specified, Colima downloads an appropriate disk image from Github at +# https://github.com/abiosoft/colima-core/releases. +# The file path to a custom disk image can be specified to override the behaviour. +# +# Default: "" +diskImage: "" + +# Environment variables for the virtual machine. +# +# EXAMPLE +# env: +# KEY: value +# ANOTHER_KEY: another value +# +# Default: {} +env: {} diff --git a/colima/.config/colima/ssh_config b/colima/.config/colima/ssh_config new file mode 100644 index 0000000..58c5c9e --- /dev/null +++ b/colima/.config/colima/ssh_config @@ -0,0 +1,21 @@ +# This SSH config file can be passed to 'ssh -F'. +# This file is created by Lima, but not used by Lima itself currently. +# Modifications to this file will be lost on restarting the Lima instance. +Host colima + IdentityFile "/Users/jfraeys/.dotfiles/colima/.config/colima/_lima/_config/user" + StrictHostKeyChecking no + UserKnownHostsFile /dev/null + NoHostAuthenticationForLocalhost yes + GSSAPIAuthentication no + PreferredAuthentications publickey + Compression no + BatchMode yes + IdentitiesOnly yes + Ciphers "^aes128-gcm@openssh.com,aes256-gcm@openssh.com" + User jfraeys + ControlMaster auto + ControlPath "/Users/jfraeys/.dotfiles/colima/.config/colima/_lima/colima/ssh.sock" + ControlPersist yes + Hostname 127.0.0.1 + Port 64193 + diff --git a/conda/.condarc b/conda/.condarc index 2c3f45e..e6c56c3 100755 --- a/conda/.condarc +++ b/conda/.condarc @@ -2,6 +2,4 @@ channels: - conda-forge auto_activate_base: false changeps1: false - channel_priority: strict - diff --git a/git/.gitconfig b/git/.gitconfig index 08154c9..a6eed18 100755 --- a/git/.gitconfig +++ b/git/.gitconfig @@ -14,6 +14,7 @@ side-by-side = true line-numbers = true preload = true + excludesfile = /Users/jfraeys/.gitignore_global [interactive] diffFilter = delta --color-only [delta] diff --git a/nix-darwin/.config/nix-darwin/flake.nix b/nix-darwin/.config/nix-darwin/flake.nix deleted file mode 100644 index a319788..0000000 --- a/nix-darwin/.config/nix-darwin/flake.nix +++ /dev/null @@ -1,203 +0,0 @@ -{ - description = "jfraeys Darwin system flake"; - - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - nix-darwin.url = "github:LnL7/nix-darwin"; - nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; - nix-homebrew.url = "github:zhaofengli-wip/nix-homebrew"; - home-manager = { - url = "github:nix-community/home-manager"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - }; - - outputs = inputs@{ self, nix-darwin, nixpkgs, nix-homebrew, home-manager }: - let - userConfig = import ./user.nix; - inherit (userConfig) username hostname; - - configuration = { pkgs, config, ... }: { - # Allow unfree packages - nixpkgs.config.allowUnfree = true; - - # User configuration - users.users.${username} = { - home = "/Users/${username}"; - shell = pkgs.zsh; - }; - - # System packages - environment.systemPackages = with pkgs; [ - neovim wezterm git ripgrep fd pyenv mos docker docker-compose gh rustup - sd sphinx starship stow tree zoxide spotify unibilium uv raycast skim - eza fzf zsh gettext python3 lua luarocks bat go openssl topgrade vault - yamllint jq yq lazydocker delta bottom luarocks zig pkg-config cmake cairo - k3d kubectl kubectx golangci-lint ollama duckdb - ]; - - # Fonts - fonts.packages = with pkgs; [ nerd-fonts.meslo-lg nerd-fonts.fira-code ]; - - # Homebrew setup - homebrew = { - enable = true; - brews = [ "mas" "shpotify" "colima" "ruff" "zathura" "zathura-pdf-poppler" ]; - # brews = [ "mas" "shpotify" "colima" "ruff" ]; - casks = [ - { name = "zotero"; greedy = true; } - { name = "microsoft-teams"; greedy = true; } - { name = "firefox"; greedy = true; } - { name = "aerospace"; greedy = true; } - { name = "logi-options+"; greedy = true; } - { name = "hiddenbar"; greedy = true; } - { name = "insomnia"; greedy=true; } - { name = "miniforge"; greedy = true; } - { name = "google-drive"; greedy = true; } - { name = "vscodium"; greedy = true; } - { name = "mactex-no-gui"; greedy = true; } - { name = "notion"; greedy = true; } - { name = "obsidian"; greedy = true; } - { name = "display-pilot"; greedy = true; } - { name = "zen-browser"; greedy = true; } - ]; - masApps = { - "notability" = 360593530; - "keynote" = 409183694; - "pages" = 409201541; - "numbers" = 409203825; - }; - taps = [ "nikitabobko/tap" "zegervdv/zathura" ]; - onActivation = { - cleanup = "zap"; - autoUpdate = true; - upgrade = true; - }; - }; - - # System activation scripts - system.activationScripts = { - applications.text = let - env = pkgs.buildEnv { - name = "system-applications"; - paths = config.environment.systemPackages; - pathsToLink = "/Applications"; - }; - in pkgs.lib.mkForce '' - echo "Setting up /Applications..." >&2 - - [ ! -d "/Applications" ] && echo "ERROR: /Applications does not exist." && exit 1 - rm -rf "/Applications/Nix Apps" - mkdir -p "/Applications/Nix Apps" - for app in ${env}/Applications/*; do - [ -e "$app" ] && ln -s "$app" "/Applications/Nix Apps/$(basename "$app")" - done - echo "Applications setup complete." - ''; - }; - - system = { - configurationRevision = self.rev or self.dirtyRev or null; - stateVersion = 5; - defaults = { - dock = { - autohide = true; - orientation = "bottom"; - show-recents = false; - tilesize = 48; - magnification = false; - mineffect = "scale"; - persistent-apps = [ - "/System/Applications/Launchpad.app" - "/System/Applications/Messages.app" - "/System/Applications/Mail.app" - "/System/Applications/Calendar.app" - "/System/Applications/FaceTime.app" - "/System/Applications/System Settings.app" - # "/Applications/Firefox.app" - "/Applications/Zen.app/" - ]; - persistent-others = [ - "/Users/jfraeys/Downloads" - "/Users/jfraeys/Documents" - ]; - wvous-br-corner = 14; # 14: Quick Note - }; - # universalaccess = { - # reduceMotion = true; - # reduceTransparency = true; - # }; - finder = { - FXPreferredViewStyle = "Nlsv"; - }; - loginwindow.GuestEnabled = false; - NSGlobalDomain.AppleICUForce24HourTime = true; - }; - startup = { - chime = false; - }; - }; - - # Zsh configuration - programs.zsh = { - enable = true; - shellInit = '' - export LUA_PATH="$HOME/.luarocks/share/lua/5.4/?.lua;$HOME/.luarocks/share/lua/5.4/?/init.lua;;" - export LUA_CPATH="$HOME/.luarocks/lib/lua/5.4/?.so;;" - ''; - }; - - # LuaRocks setup - system.activationScripts.luarocksConfig.text = '' - mkdir -p "$HOME/.luarocks" - echo 'local_by_default = true' > "$HOME/.luarocks/config-5.4.lua" - ''; - - # Enable Nix daemon and Touch ID - # services.nix-daemon.enable = true; - security.pam.services.sudo_local.touchIdAuth = true; - - # Home Manager integration - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - users.${username} = import ./home.nix; - backupFileExtension = "backup"; - }; - - nixpkgs.hostPlatform = "aarch64-darwin"; - - # Nix configuration - nix = { - # configureBuildUsers = true; - # useDaemon = true; - settings.experimental-features = [ "nix-command" "flakes" ]; - extraOptions = '' - extra-platforms = x86_64-darwin aarch64-darwin - ''; - - }; - }; - in - { - darwinConfigurations = { - "${hostname}" = nix-darwin.lib.darwinSystem { - # system = "aarch64-darwin"; - modules = [ - configuration - nix-homebrew.darwinModules.nix-homebrew - home-manager.darwinModules.home-manager - { - nix-homebrew = { - enable = true; - enableRosetta = true; # Enable Rosetta for Apple Silicon - user = "${username}"; - autoMigrate = true; - }; - } - ]; - }; - }; - }; -} - diff --git a/nix-darwin/.config/nix-darwin/home.nix b/nix-darwin/.config/nix-darwin/home.nix deleted file mode 100644 index 8361d5e..0000000 --- a/nix-darwin/.config/nix-darwin/home.nix +++ /dev/null @@ -1,52 +0,0 @@ -{ config, pkgs, ... }: - -{ - # General home configuration - home = { - username = "jfraeys"; - homeDirectory = "/Users/jfraeys"; - stateVersion = "25.05"; # Match your NixOS/Home Manager version. - - # Define packages to install - packages = with pkgs; [ - zsh - neovim - wezterm - starship - fzf - ripgrep - bat - lazygit - zoxide - ]; - - # Session variables - sessionVariables = { - PATH = "${pkgs.coreutils}/bin:${pkgs.gnugrep}/bin:/run/current-system/sw/bin:$HOME/.nix-profile/bin"; - }; - - # Session PATH configuration - sessionPath = [ - "/run/current-system/sw/bin" - "$HOME/.nix-profile/bin" - ]; - }; - - # Enable Home Manager - programs = { - home-manager.enable = true; - - # Zsh configuration - zsh = { - enable = true; - oh-my-zsh.enable = false; - initExtra = '' - export PATH=/run/current-system/sw/bin:$HOME/.nix-profile/bin:$PATH - if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then - . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' - fi - ''; - }; - }; -} - diff --git a/nix-darwin/.config/nix-darwin/user.nix b/nix-darwin/.config/nix-darwin/user.nix deleted file mode 100644 index 7fbc6a5..0000000 --- a/nix-darwin/.config/nix-darwin/user.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ - username = "jfraeys"; - hostname = "Jays-Mac-Studio"; -} - diff --git a/nvim/.config/nvim b/nvim/.config/nvim index 9759205..d1de57b 160000 --- a/nvim/.config/nvim +++ b/nvim/.config/nvim @@ -1 +1 @@ -Subproject commit 9759205e22863960be91cfe626e3141a240df198 +Subproject commit d1de57be726001177ec541b1e4414d393ac41c1c diff --git a/oh-my-zsh/.oh-my-zsh/custom/colour-ssh.zsh b/oh-my-zsh/.oh-my-zsh/custom/colour-ssh.zsh deleted file mode 100755 index dd8224a..0000000 --- a/oh-my-zsh/.oh-my-zsh/custom/colour-ssh.zsh +++ /dev/null @@ -1,41 +0,0 @@ -# Function to change the tmux window background color based on SSH environment -function windowc() { - local profile_name="$1" - - case "$profile_name" in - services*|service*) - tmux set-window-option -g window-status-bg colour1 # Change to the desired color - ;; - production*|prod*|web*) - tmux set-window-option -g window-status-bg "rgb:00/7F/7F" # Change to the desired color - ;; - staging*|stage*) - tmux set-window-option -g window-status-bg colour3 # Change to the desired color - ;; - *) - tmux set-window-option -g window-status-bg default # Use default color for any other server - ;; - esac -} - -# Function to automatically create a new tmux window when using ssh -function colourssh() { - # Run the original ssh command, capturing its output - ssh_output=$(command ssh "$@") - - # Check if the ssh command was successful - if [ $? -eq 0 ]; then - # Extract the hostname from the ssh command using pcregrep - host=$(echo "$ssh_output" | pcregrep -o1 'ssh\s+([^\@]+)') - - # Change tmux window background color based on SSH environment - windowc "$host" - - # Create a new tmux window - tmux new-window - fi -} - -# Alias to use the modified ssh function -alias ssh="colourssh" - diff --git a/setup.sh b/setup.sh index 56b17d2..da60ca7 100755 --- a/setup.sh +++ b/setup.sh @@ -24,6 +24,7 @@ useronly_macos=( zsh aerospace # sketchybar + colima ) #Folders that should, or only need to be installed for a local user on Linux diff --git a/skhd/.config/skhd/skhdrc b/skhd/.config/skhd/skhdrc deleted file mode 100755 index 3bf9682..0000000 --- a/skhd/.config/skhd/skhdrc +++ /dev/null @@ -1,109 +0,0 @@ -# --------------------------- -# WINDOW FOCUS -# --------------------------- -# Change window focus within the current space -shift + cmd - j : yabai -m window --focus south -shift + cmd - k : yabai -m window --focus north -shift + cmd - h : yabai -m window --focus west -shift + cmd - l : yabai -m window --focus east - -# Change focus between external displays (left and right) -cmd - h : yabai -m display --focus west -cmd - l : yabai -m display --focus east - -# --------------------------- -# WINDOW RESIZE -# --------------------------- -# Resize windows in one direction (left, right, up, down) -lctrl + alt - h : yabai -m window --resize left:-50:0 -lctrl + alt - l : yabai -m window --resize right:50:0 -lctrl + alt - j : yabai -m window --resize bottom:0:50 -lctrl + alt - k : yabai -m window --resize top:0:-50 - -# Equalize the size of all windows in the current space -lctrl + alt - e : yabai -m space --balance - -# --------------------------- -# SPACE MANAGEMENT -# --------------------------- -# Switch between spaces -shift + cmd - 1 : yabai -m space --focus 1 -shift + cmd - 2 : yabai -m space --focus 2 -shift + cmd - 3 : yabai -m space --focus 3 -shift + cmd - 4 : yabai -m space --focus 4 -shift + cmd - 5 : yabai -m space --focus 5 -shift + cmd - 6 : yabai -m space --focus 6 -shift + cmd - 7 : yabai -m space --focus 7 - -# Move the current window to a specific space -shift + alt - 1 : yabai -m window --space 1 -shift + alt - 2 : yabai -m window --space 2 -shift + alt - 3 : yabai -m window --space 3 -shift + alt - 4 : yabai -m window --space 4 -shift + alt - 5 : yabai -m window --space 5 -shift + alt - 6 : yabai -m window --space 6 -shift + alt - 7 : yabai -m window --space 7 - -# Move window to previous and next space -shift + alt - p : yabai -m window --space prev -shift + alt - n : yabai -m window --space next - -# --------------------------- -# WINDOW MOVEMENT AND SWAP -# --------------------------- -# Move window within the current space -ctrl + alt - h : yabai -m window --warp west -ctrl + alt - l : yabai -m window --warp east -ctrl + alt - j : yabai -m window --warp south -ctrl + alt - k : yabai -m window --warp north - -# Swap windows -shift + alt - j : yabai -m window --swap south -shift + alt - k : yabai -m window --swap north -shift + alt - h : yabai -m window --swap west -shift + alt - l : yabai -m window --swap east - -# --------------------------- -# WINDOW AND SPACE MODIFICATIONS -# --------------------------- -# Toggle window float and maximize (zoom fullscreen) -shift + alt - t : yabai -m window --toggle float --grid 4:4:1:1:2:2 -shift + alt - m : yabai -m window --toggle zoom-fullscreen - -# Toggle window sticky (always visible across all spaces) -shift + alt - a : yabai -m window --toggle sticky - -# Rotate space layout clockwise and flip along axes -shift + alt - r : yabai -m space --rotate 270 -shift + alt - y : yabai -m space --mirror y-axis -shift + alt - x : yabai -m space --mirror x-axis - -# Move window between displays -shift + alt - s : yabai -m window --display west; yabai -m display --focus west -shift + alt - g : yabai -m window --display east; yabai -m display --focus east - -# --------------------------- -# APPLICATION LAUNCHER -# --------------------------- -alt - t : open -a /Applications/WezTerm.app -alt - f : open -a /Applications/Firefox.app -alt - s : open -a /Applications/Safari.app -alt - v : open -a /Applications/VSCodium.app -alt - m : open -a /System/Applications/Mail.app -alt - w : open -a /Applications/Bitwarden.app -alt - i : open -a /System/Applications/Messages.app - -# --------------------------- -# SCREEN CAPTURE -# --------------------------- -cmd + shift - 3 : screencapture -x ~/Desktop/screenshot_$(date +%Y-%m-%d_%H-%M-%S).png -cmd + shift - 4 : screencapture -i ~/Desktop/screenshot_$(date +%Y-%m-%d_%H-%M-%S).png -cmd + shift - 5 : screencapture -w ~/Desktop/screenshot_$(date +%Y-%m-%d_%H-%M-%S).png - -# --------------------------- -# YABAI SERVICE CONTROL -# --------------------------- -ctrl + alt - q : yabai --stop-service -ctrl + alt - s : yabai --start-service -ctrl + alt - r : yabai --restart-service - diff --git a/starship/.config/starship.toml b/starship/.config/starship.toml index 5ccd25b..d01d4d7 100644 --- a/starship/.config/starship.toml +++ b/starship/.config/starship.toml @@ -3,31 +3,31 @@ add_newline = false palette = "solarized_light" -# palette = "monokai_pro" command_timeout = 5000 # Customize your prompt to ensure everything is on a single line format = """\ - $character\ - $directory\ - $direnv\ - $docker_context\ - $conda\ - $golang\ - $lua\ - $rust\ - $c\ - $python\ - $package\ - $line_break\ - $jobs\ - """ +${custom.context}\ +$character\ +$directory\ +$direnv\ +$docker_context\ +$conda\ +$golang\ +$lua\ +$rust\ +$c\ +$python\ +$package\ +$line_break\ +$jobs\ +""" right_format = """\ - $git_branch\ - $git_status\ - $git_metrics\ - $cmd_duration\ +$cmd_duration\ +$git_branch\ +$git_status\ +$git_metrics\ """ # Git branch configuration @@ -59,6 +59,8 @@ format = "[$path ]($style)[$read_only]($read_only_style)" style = "bright-cyan" truncation_length = 3 truncation_symbol = "…/" +use_logical_path = true # speeds up when working with symlinks (optional) +fish_style_pwd_dir_length = 1 # makes truncation lighter and faster [line_break] disabled = true @@ -95,6 +97,7 @@ detect_files = ["Makefile"] [conda] format = "[$environment ]($style)" style = "dimmed green" +disabled = false # Python [python] @@ -125,10 +128,25 @@ style = "208 bold" # Directory substitutions [directory.substitutions] -"Documents/projects" = "proj" -".config" = "config" -".dotfiles" = "dot" -".local" = "local" +"~/Documents/dev" = "dev" +"~/.config" = "config" +"~/.dotfiles" = "dot" +"~/.local" = "local" +"~/Library/CloudStorage/GoogleDrive-*" = "GDrive" + +# ── Context-Aware Session Tag ── +[custom.context] +command = ''' +case "$(uname -r)" in + *microsoft*) echo "WSL" ;; +esac +[ -n "$CODESPACES" ] && echo "Codespaces" +[ -n "$SSH_CONNECTION" ] && echo "Remote" +''' +when = 'true' +shell = ['sh'] +style = 'bold yellow' +format = '[$output]($style)' # Monokai Pro palette [palettes.monokai_pro] diff --git a/wezterm/.config/wezterm/domains/docker.lua b/wezterm/.config/wezterm/plugins/domains/docker.lua similarity index 100% rename from wezterm/.config/wezterm/domains/docker.lua rename to wezterm/.config/wezterm/plugins/domains/docker.lua diff --git a/wezterm/.config/wezterm/profiles/infra.lua b/wezterm/.config/wezterm/plugins/profiles/infra.lua similarity index 100% rename from wezterm/.config/wezterm/profiles/infra.lua rename to wezterm/.config/wezterm/plugins/profiles/infra.lua diff --git a/wezterm/.config/wezterm/profiles/job_req.lua b/wezterm/.config/wezterm/plugins/profiles/job_req.lua similarity index 100% rename from wezterm/.config/wezterm/profiles/job_req.lua rename to wezterm/.config/wezterm/plugins/profiles/job_req.lua diff --git a/wezterm/.config/wezterm/profiles/neovim.lua b/wezterm/.config/wezterm/plugins/profiles/neovim.lua similarity index 100% rename from wezterm/.config/wezterm/profiles/neovim.lua rename to wezterm/.config/wezterm/plugins/profiles/neovim.lua diff --git a/wezterm/.config/wezterm/plugins/sessionizer b/wezterm/.config/wezterm/plugins/sessionizer new file mode 160000 index 0000000..c437965 --- /dev/null +++ b/wezterm/.config/wezterm/plugins/sessionizer @@ -0,0 +1 @@ +Subproject commit c4379654bc179c72c57693b12d16a95d21c1651d diff --git a/wezterm/.config/wezterm/profiles/dev.lua b/wezterm/.config/wezterm/profiles/dev.lua new file mode 100644 index 0000000..be58e69 --- /dev/null +++ b/wezterm/.config/wezterm/profiles/dev.lua @@ -0,0 +1,24 @@ +local wezterm = require("wezterm") + +return { + name = "dev", + spawn = function() + local mux = wezterm.mux + local cwd = "/home/YOU/dev" -- customize per profile + + local tab, pane, window = mux.spawn_window({ + workspace = "dev", + cwd = cwd, + args = { "nvim" }, + }) + + local shell_pane = pane:split({ + direction = "Right", + size = 0.5, + cwd = cwd, + args = { "zsh" }, + }) + + return window:gui_window() + end, +} diff --git a/wezterm/.config/wezterm/sessionizer b/wezterm/.config/wezterm/sessionizer deleted file mode 160000 index 417aec1..0000000 --- a/wezterm/.config/wezterm/sessionizer +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 417aec1d74cd463c1a00324e3a52cd27d2ced79d diff --git a/wezterm/.config/wezterm/theme-switcher.lua b/wezterm/.config/wezterm/theme-switcher.lua index f8237b0..70c2393 100644 --- a/wezterm/.config/wezterm/theme-switcher.lua +++ b/wezterm/.config/wezterm/theme-switcher.lua @@ -1,101 +1,94 @@ local wezterm = require("wezterm") -local os = require("os") local M = {} --- Determine the appearance (light or dark) -local function get_appearance() - if wezterm.gui then - return wezterm.gui.get_appearance() - end - return os.getenv("DEFAULT_APPEARANCE") or "Dark" -- Default fallback -end +local starship_script_path = os.getenv("HOME") .. "/.local/bin/scripts/update_starship_theme.sh" +local border_script_path = os.getenv("HOME") .. "/.local/bin/scripts/update_border_theme.sh" --- Set the color scheme and tab bar colors based on appearance -local function scheme_for_appearance(appearance, schemes) - return appearance:find("Dark") and schemes.dark or schemes.light -end - --- Color schemes for light and dark appearances local color_schemes = { - dark = "Monokai (dark) (terminal.sexy)", - light = "Solarized (light) (terminal.sexy)", -} - --- Custom tab bar colors for light and dark themes -local tab_bar_colors = { dark = { - active_tab = { bg_color = "#1c1f24", fg_color = "#f8f8f2" }, - inactive_tab = { bg_color = "#3e4451", fg_color = "#a0a0a0" }, - inactive_tab_hover = { bg_color = "#4e545e", fg_color = "#c0c0c0" }, - new_tab = { bg_color = "#1c1f24", fg_color = "#f8f8f2" }, - new_tab_hover = { bg_color = "#4e545e", fg_color = "#c0c0c0" }, + name = "Monokai (dark) (terminal.sexy)", + ss_palette = "monokai_pro", + tab_bar = { + active_tab = { bg_color = "#1c1f24", fg_color = "#f8f8f2" }, + inactive_tab = { bg_color = "#3e4451", fg_color = "#a0a0a0" }, + inactive_tab_hover = { bg_color = "#4e545e", fg_color = "#c0c0c0" }, + new_tab = { bg_color = "#1c1f24", fg_color = "#f8f8f2" }, + new_tab_hover = { bg_color = "#4e545e", fg_color = "#c0c0c0" }, + }, }, light = { - active_tab = { bg_color = "#eee8d5", fg_color = "#073642" }, - inactive_tab = { bg_color = "#93a1a1", fg_color = "#586e75" }, - inactive_tab_hover = { bg_color = "#839496", fg_color = "#586e75" }, - new_tab = { bg_color = "#eee8d5", fg_color = "#073642" }, - new_tab_hover = { bg_color = "#839496", fg_color = "#586e75" }, + name = "Solarized (light) (terminal.sexy)", + ss_palette = "solarized_light", + tab_bar = { + active_tab = { bg_color = "#eee8d5", fg_color = "#073642" }, + inactive_tab = { bg_color = "#93a1a1", fg_color = "#586e75" }, + inactive_tab_hover = { bg_color = "#839496", fg_color = "#586e75" }, + new_tab = { bg_color = "#eee8d5", fg_color = "#073642" }, + new_tab_hover = { bg_color = "#839496", fg_color = "#586e75" }, + }, }, } --- Check if a command is available (more reliable implementation) -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 +--- Get the current appearance of the system or use a default value. +--- Falls back to "dark" if neither WezTerm GUI appearance nor environment variable is available. +--- @return string Either "dark" or "light" +local function get_appearance() + return ((wezterm.gui and wezterm.gui.get_appearance()) or os.getenv("DEFAULT_APPEARANCE") or "dark"):lower() end --- Function to update the Starship palette in the starship.toml file -local function update_starship_palette(palette_name) - if not is_command_available("starship") then - wezterm.log_info("Starship is not installed. Skipping palette update.") +--- Check if a file is executable. +--- @param file_path string Absolute path to the file to check +--- @return boolean True if the file is executable, false otherwise +local function is_executable(file_path) + local ok = wezterm.run_child_process({ "test", "-x", file_path }) + return ok == true +end + +--- Run a Starship theme updater script with the given palette. +--- Logs success or failure accordingly. +--- @param script_path string Absolute path to the Starship updater script +--- @param palette string Name of the color palette to apply +local function update_starship_theme(script_path, palette) + local script_name = script_path:match("^.+/(.+)$") or script_path + if not is_executable(script_path) then + wezterm.log_error("Script " .. script_name .. " is not executable or does not exist") return end - local starship_config_path = os.getenv("XDG_CONFIG_HOME") and os.getenv("XDG_CONFIG_HOME") .. "/starship.toml" - or os.getenv("HOME") .. "/.config/starship.toml" - - local file = io.open(starship_config_path, "r") - if not file then - wezterm.log_error("starship.toml file not found at: " .. starship_config_path) - return - end - file:close() - - -- Determine sed command - local sed_inplace = wezterm.target_triple and wezterm.target_triple:find("darwin") and "sed -i ''" or "sed -i" - local replace_command = - 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 - if is_command_available("sd") then - replace_command = string.format("sd 'palette = .+' 'palette = \"%s\"' %s", palette_name, starship_config_path) - end - - -- Execute the replace command - local result = os.execute(replace_command) - if result ~= 0 then - wezterm.log_error("Failed to update Starship palette in " .. starship_config_path) - else - wezterm.log_info("Successfully updated Starship palette to: " .. palette_name) + local ok = wezterm.run_child_process({ script_path, palette }) + if not ok then + wezterm.log_error("Failed to run " .. script_name) end end --- Apply the configuration and update Starship palette +--- Run a Border theme updater script with the given palette. +--- @param script_path string Absolute path to the Border updater script +--- @param mode string Name of the color palette to apply +local function update_border_theme(script_path, mode) + local script_name = script_path:match("^.+/(.+)$") or script_path + if not is_executable(script_path) then + wezterm.log_error("Script " .. script_name .. " is not executable or does not exist") + return + end + + local ok = wezterm.run_child_process({ script_path, mode }) + if not ok then + wezterm.log_error("Failed to run " .. script_name) + end +end + +--- Apply the color scheme to the WezTerm configuration. +--- @param config table The WezTerm configuration table to modify function M.apply_to_config(config) - local appearance = get_appearance() - config.color_scheme = scheme_for_appearance(appearance, color_schemes) - config.colors = { tab_bar = scheme_for_appearance(appearance, tab_bar_colors) } + local mode = get_appearance():find("dark") and "dark" or "light" + local theme = color_schemes[mode] - -- Update the Starship palette based on appearance - local palette_name = appearance:find("Dark") and "monokai_pro" or "solarized_light" - wezterm.log_info("Starship palette set to: " .. palette_name) - update_starship_palette(palette_name) + config.color_scheme = theme.name + config.colors = { tab_bar = theme.tab_bar } + + update_starship_theme(starship_script_path, theme.ss_palette) + update_border_theme(border_script_path, mode) end return M diff --git a/wezterm/.wezterm.lua b/wezterm/.wezterm.lua index 55015b3..4270397 100644 --- a/wezterm/.wezterm.lua +++ b/wezterm/.wezterm.lua @@ -4,8 +4,8 @@ local act = wezterm.action -- Pull custom modules local theme = require("theme-switcher") -local sessionizer = require("sessionizer.plugin.init") -- local gpu_adapters = require("gpu-adapter") +local sessionizer = require("plugins.sessionizer") local workspace = require("workspace") local config = {} @@ -21,14 +21,14 @@ end if wezterm.target_triple == "x86_64-pc-windows-msvc" then config.default_prog = { "wsl.exe", "~", "-d", "Ubuntu-20.04" } elseif wezterm.target_triple == "x86_64-apple-darwin" or wezterm.target_triple == "aarch64-apple-darwin" then - config.default_prog = { "/bin/zsh" } + config.default_prog = { "/bin/zsh", "-l" } config.font = wezterm.font_with_fallback({ { family = "Fira Code", scale = 1.0 }, { family = "MesloLGS NF", scale = 1.0 }, { family = "Menlo", scale = 1.0 }, }) elseif wezterm.target_triple == "x86_64-unknown-linux-gnu" then - config.default_prog = { "/bin/bash" } + config.default_prog = { "/bin/bash", "-l" } config.font = wezterm.font_with_fallback({ { family = "Fira Code", scale = 1.0 }, { family = "MesloLGS NF", scale = 1.0 }, @@ -41,7 +41,6 @@ config.use_ime = true config.use_dead_keys = false config.front_end = "WebGpu" config.term = "xterm-256color" -theme.apply_to_config(config) config.line_height = 1.1 config.animation_fps = 240 @@ -49,6 +48,9 @@ config.max_fps = 240 config.webgpu_power_preference = "HighPerformance" -- config.webgpu_preferred_adapter = gpu_adapters:pick_best() +-- Change color scheme +theme.apply_to_config(config) + config.window_padding = { left = 5, right = 10, @@ -84,7 +86,7 @@ if config.enable_tab_bar then end config.switch_to_last_active_tab_when_closing_tab = true -config.window_close_confirmation = "NeverPrompt" +config.window_close_confirmation = "AlwaysPrompt" config.audible_bell = "Disabled" @@ -270,6 +272,12 @@ local keys = { end), }, + { + key = "w", + mods = "CMD", + action = wezterm.action.CloseCurrentTab({ confirm = true }), + }, + --Switch to monitoring workspace { key = ".", @@ -484,15 +492,17 @@ local key_tables = { config.keys = keys config.key_tables = key_tables -local projects = { - wezterm.home_dir .. "/.dotfiles", - wezterm.home_dir .. "/Documents", - wezterm.home_dir .. "/.local/bin", - wezterm.home_dir .. "/Google Drive/My Drive", +local user_config = { + projects = { + { path = wezterm.home_dir .. "/.dotfiles" }, + { path = wezterm.home_dir .. "/Documents" }, + }, + key = "f", + mods = "LEADER", + add_to_launch_menu = false, } -sessionizer.set_projects(projects) -sessionizer.configure(config) +sessionizer.apply_to_config(config, user_config) -- wezterm.on("window-config-reload", function() -- -- Set up the meeting notifier to check every 60 seconds diff --git a/yabai/.config/yabai/yabairc b/yabai/.config/yabai/yabairc deleted file mode 100755 index 97f6230..0000000 --- a/yabai/.config/yabai/yabairc +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env sh - -# --------------------------- -# GLOBAL SETTINGS -# --------------------------- -yabai -m config mouse_follows_focus off -yabai -m config focus_follows_mouse off -yabai -m config window_placement second_child -yabai -m config window_opacity on # Opacity settings will now be respected -yabai -m config window_opacity_duration 0.2 -yabai -m config window_shadow off - -# Uncomment the following line to disable window borders -# yabai -m config window_border off -# yabai -m config window_border_width 2 - -# --------------------------- -# WINDOW MANAGEMENT -# --------------------------- -yabai -m config active_window_opacity 1.0 # Full opacity for active window -yabai -m config normal_window_opacity 0.75 # Reduced opacity for inactive windows -yabai -m config split_ratio 0.65 # Adjust split ratio for bsp layout -yabai -m config auto_balance on # Auto-balance window sizes - -# --------------------------- -# MOUSE SETTINGS -# --------------------------- -yabai -m config mouse_modifier fn -yabai -m config mouse_action1 move -yabai -m config mouse_action2 resize - -# --------------------------- -# SPACE SETTINGS -# --------------------------- -yabai -m config layout bsp -yabai -m config top_padding 5 # Consistent padding for aesthetics -yabai -m config bottom_padding 50 -yabai -m config left_padding 10 -yabai -m config right_padding 10 -yabai -m config window_gap 5 # Unified window gap for consistency - diff --git a/zathura/.config/zathura/zathurarc b/zathura/.config/zathura/zathurarc deleted file mode 100644 index 493f8e3..0000000 --- a/zathura/.config/zathura/zathurarc +++ /dev/null @@ -1,3 +0,0 @@ -set synctex true -# set recolor true - diff --git a/zsh/.config/zsh/aliases.zsh b/zsh/.config/zsh/aliases.zsh new file mode 100644 index 0000000..494fe0e --- /dev/null +++ b/zsh/.config/zsh/aliases.zsh @@ -0,0 +1,66 @@ +# General aliases +alias grep="grep --color=auto" +alias ..="cd .." +alias ...="cd ../.." +alias ....="cd ../../.." +alias .....="cd ../../../.." + +# Use Neovim if available +if command -v nvim >/dev/null; then + alias v='nvim' +fi + +# Enhanced ls with eza +if command -v eza >/dev/null; then + alias ls='eza --group-directories-first --color=auto' + alias la='eza -a --group-directories-first --color=auto' + alias ll='eza -lh --group-directories-first --color=auto' + alias lla='eza -la --group-directories-first --color=auto' + alias l='eza --classify' + alias lt='eza -lt modified --sort newest' + alias lS='eza -lS --group-directories-first --color=auto' + alias tree='eza --tree --level=5' + alias lg='eza --git' +fi + +# Bat for pretty `cat` and help +if command -v bat >/dev/null; then + # Define a function instead of aliasing inside same unit + function cat() { + command bat --paging=never "$@" + } + + function bathelp() { + bat --plain --language=help + } + + function help() { + "$@" --help 2>&1 | bathelp + } + + # Global aliases for help text + alias -g ':h'='-h 2>&1 | bat --language=help --style=plain' + alias -g ':help'='--help 2>&1 | bat --language=help --style=plain' +fi + +# Use trash instead of rm on non-Windows systems +if [[ "$(uname -s)" != MINGW* && "$(uname -s)" != CYGWIN* ]]; then + alias rm='trash' +fi + +# Dev tools +alias lzd='lazydocker' +alias v='nvim' # This can be overridden in check_aliases if nvim doesn't exist + +# Git aliases +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' + diff --git a/zsh/.config/zsh/completion.zsh b/zsh/.config/zsh/completion.zsh new file mode 100644 index 0000000..2b3f5fa --- /dev/null +++ b/zsh/.config/zsh/completion.zsh @@ -0,0 +1,22 @@ +# Homebrew setup and completions +if command -v brew &>/dev/null; then + export HOMEBREW_PREFIX="$(brew --prefix)" + eval "$("${HOMEBREW_PREFIX}/bin/brew" shellenv)" + + # Add site-functions to FPATH for completions + FPATH="${HOMEBREW_PREFIX}/share/zsh/site-functions:${FPATH}" +fi + +# zcompdump cache +mkdir -p "$HOME/.zsh/cache" +ZSH_COMPDUMP="${ZDOTDIR:-$HOME}/.zcompdump" +zstyle ':completion::complete:*' use-cache on +zstyle ':completion::complete:*' cache-path "$HOME/.zsh/cache" + +# Load compinit safely +if [[ -z "$_compinit_done" ]]; then + autoload -Uz compinit + compinit -C -d "$ZSH_COMPDUMP" + _compinit_done=1 +fi + diff --git a/zsh/.config/zsh/external.zsh b/zsh/.config/zsh/external.zsh new file mode 100644 index 0000000..885d1b3 --- /dev/null +++ b/zsh/.config/zsh/external.zsh @@ -0,0 +1,32 @@ +# Starship prompt +export STARSHIP_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/starship.toml" +eval "$(starship init zsh)" + +# zoxide init +if command -v eza &>/dev/null; then + export _ZO_FZF_OPTS="--preview='eza -a --color=always {} | head -30' --preview-window=down:30%" +else + export _ZO_FZF_OPTS="--preview='ls -la {} | head -30' --preview-window=down:30%" +fi +eval "$(zoxide init --cmd cd zsh)" + +# pyenv +if command -v pyenv 1>/dev/null 2>&1; then + export PYENV_ROOT="$HOME/.pyenv" + [[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH" + eval "$(pyenv init -)" +fi + +# direnv +command -v direnv &>/dev/null && eval "$(direnv hook zsh)" + +# conda (OFFICIAL – preferred over manual conda.sh sourcing) +if [ -f "/opt/homebrew/Caskroom/miniforge/base/bin/conda" ]; then + eval "$(/opt/homebrew/Caskroom/miniforge/base/bin/conda shell.zsh hook)" + + # Manually assign the conda completion function to mamba + if type mamba &>/dev/null && type _conda &>/dev/null; then + compdef _conda mamba + fi +fi + diff --git a/zsh/.config/zsh/plugins.zsh b/zsh/.config/zsh/plugins.zsh new file mode 100644 index 0000000..2be8ba7 --- /dev/null +++ b/zsh/.config/zsh/plugins.zsh @@ -0,0 +1,40 @@ +# ~/.config/zsh/plugins.zsh + +# Zinit setup +ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git" +[[ ! -d "$ZINIT_HOME" ]] && git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME" +source "${ZINIT_HOME}/zinit.zsh" + +# Core plugins +zinit light zsh-users/zsh-completions + +# Ollama CLI completion +zinit ice as"completion" +zinit snippet https://raw.githubusercontent.com/Katrovsky/zsh-ollama-completion/main/_ollama + +# Syntax highlighting +zinit ice wait lucid atinit"ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern)" +zinit load zsh-users/zsh-syntax-highlighting + +# Autosuggestions +zinit ice wait lucid atload"zle-line-init() { zle autosuggest-enable }; zle -N zle-line-init" +zinit load zsh-users/zsh-autosuggestions + +# History search +zinit light zsh-users/zsh-history-substring-search +zinit load zdharma-continuum/history-search-multi-word + +# FZF and extras +zinit ice from"gh-r" as"program" pick"bin/fzf" +zinit light junegunn/fzf-bin +zinit light junegunn/fzf-git.sh + +zinit ice wait lucid blockf +zinit load Aloxaf/fzf-tab + +zinit ice from"gh-r" as"program" pick"bin/zoxide" +zinit load ajeetdsouza/zoxide + +# Update alias +alias zupdate='zinit update --all' + diff --git a/zsh/.zprofile b/zsh/.zprofile index 6f42867..7ae0fbc 100755 --- a/zsh/.zprofile +++ b/zsh/.zprofile @@ -1,24 +1,37 @@ #!/usr/bin/env zsh -# Determine FZF installation path -if command -v fzf &>/dev/null; then - if [[ "$(command -v fzf)" == "/run/current-system/sw/bin/fzf" ]]; then - FZF_PATH="/run/current-system/sw" - elif command -v brew &>/dev/null; then - FZF_PATH="$(brew --prefix)/opt/fzf" - else - FZF_PATH="" - fi -fi - -if [[ -n "$FZF_PATH" && ! "$PATH" =~ (^|:)"$FZF_PATH"(:|$) ]]; then - export PATH="$FZF_PATH:$PATH" +# ── Brew shellenv ─────────────────────────────────────── +if command -v brew &>/dev/null; then + export PATH="/opt/homebrew/bin:${PATH}" + eval "$(/opt/homebrew/bin/brew shellenv)" fi +# ── Add Homebrew curl to PATH if installed ───────────── if command -v brew &>/dev/null && brew list curl &>/dev/null; then - BREW_CURL_PATH="$(brew --prefix curl)/bin" - if [[ -d "$BREW_CURL_PATH" && ! "$PATH" =~ (^|:)"$BREW_CURL_PATH"(:|$) ]]; then - export PATH="$BREW_CURL_PATH:$PATH" - fi + CURL_PATH="$(brew --prefix curl)/bin" + [[ ":$PATH:" != *":$CURL_PATH:"* ]] && export PATH="$CURL_PATH:$PATH" fi +# ── Add FZF path to PATH ─────────────────────────────── +if command -v fzf &>/dev/null; then + if command -v brew &>/dev/null; then + FZF_PATH="$(brew --prefix fzf)/bin" + else + FZF_PATH="$(dirname "$(command -v fzf)")" + fi + [[ ":$PATH:" != *":$FZF_PATH:"* ]] && export PATH="$FZF_PATH:$PATH" +fi + +# ── Add TeX to PATH (macOS specific) ─────────────────── +[[ -d "/Library/TeX/texbin" ]] && export PATH="/Library/TeX/texbin:$PATH" + +# ── Zsh completion fpath for brew and other packages ── +# Add Homebrew’s zsh completions if they exist +BREW_ZSH_FUNCTIONS="$(brew --prefix 2>/dev/null)/share/zsh/site-functions" +if [[ -d "$BREW_ZSH_FUNCTIONS" ]]; then + fpath=("$BREW_ZSH_FUNCTIONS" $fpath) +fi + +# Optional: Add your own completions directory +[[ -d "$HOME/.zsh/site-functions" ]] && fpath=("$HOME/.zsh/site-functions" $fpath) + diff --git a/zsh/.zshenv b/zsh/.zshenv index a462598..5f37713 100755 --- a/zsh/.zshenv +++ b/zsh/.zshenv @@ -1,65 +1,90 @@ #!/usr/bin/env zsh -# ------------- Environment Setup ------------- +# ------------------ 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 EDITOR="nvim" -export BROWSER="firefox" +export BROWSER="/Applications/Zen.app/Contents/MacOS/zen" -# ------------- Platform-Specific Setup ------------- -OS_TYPE="$(uname -s)" -HOMEBREW_PREFIX="/opt/homebrew" - -if [[ "$OS_TYPE" == "Darwin" ]]; then - if [[ "$(uname -m)" == "arm64" ]]; then - HOMEBREW_PREFIX="/opt/homebrew" # Apple Silicon - else - HOMEBREW_PREFIX="/usr/local" # Intel Mac - fi -elif [[ "$OS_TYPE" == "Linux" ]]; then - if [[ -d "/home/linuxbrew/.linuxbrew/bin" ]]; then - HOMEBREW_PREFIX="/home/linuxbrew/.linuxbrew" - elif [[ -d "/linuxbrew/bin" ]]; then - HOMEBREW_PREFIX="/linuxbrew" - fi -fi - -# ------------- Helper Functions ------------- +# ------------------ Helper Functions ------------------ safe_path_add() { [[ -d "$1" && ":$PATH:" != *":$1:"* ]] && export PATH="$1:$PATH" } -# ------------- PATH Setup ------------- -safe_path_add "$HOME/.local/bin/scripts" -safe_path_add "$HOMEBREW_PREFIX/bin" -safe_path_add "$HOMEBREW_PREFIX/sbin" +# ------------------ Platform Detection ------------------ +OS_TYPE="$(uname -s)" +ARCH="$(uname -m)" +# ------------------ macOS Setup ------------------ +# macOS Homebrew and Toolchain Setup if [[ "$OS_TYPE" == "Darwin" ]]; then - for dir in "$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin" \ - "$HOMEBREW_PREFIX/opt/openssl@1.1/bin" \ - "$HOMEBREW_PREFIX/opt/llvm/bin" \ - "/Library/TeX/texbin"; do + if [[ "$ARCH" == "arm64" ]]; then + export HOMEBREW_PREFIX="/opt/homebrew" + else + export HOMEBREW_PREFIX="/usr/local" + fi + + safe_path_add "$HOMEBREW_PREFIX/bin" + safe_path_add "$HOMEBREW_PREFIX/sbin" + + for dir in \ + "$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin" \ + "$HOMEBREW_PREFIX/opt/openssl@1.1/bin" \ + "$HOMEBREW_PREFIX/opt/llvm/bin" \ + "/Library/TeX/texbin" \ + "$HOMEBREW_PREFIX/opt/rustup/bin"; do safe_path_add "$dir" done +# ------------------ Linux Setup ------------------ +elif [[ "$OS_TYPE" == "Linux" ]]; then + safe_path_add "$HOME/.local/bin" + safe_path_add "$HOME/.cargo/bin" + safe_path_add "$HOME/.local/share/flatpak/exports/bin" + safe_path_add "/var/lib/flatpak/exports/bin" + [[ -d "/nix" ]] && safe_path_add "/nix/var/nix/profiles/default/bin" + + # ------------------ WSL Detection ------------------ + if grep -qEi "microsoft|wsl" /proc/version &>/dev/null; then + export IS_WSL=1 + export BROWSER="wslview" + export DISPLAY="${DISPLAY:-:0}" + export WSL_HOST="$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}')" + export NO_AT_BRIDGE=1 + safe_path_add "/mnt/c/Windows/System32" # useful for calling Windows commands from WSL + fi + + # ------------------ Remote Development Detection ------------------ + if [[ -n "$SSH_CONNECTION" ]]; then + export IS_REMOTE=1 + fi + + if [[ -n "$CODESPACES" ]] || [[ -d "/workspaces" ]]; then + export IS_CODESPACES=1 + safe_path_add "/workspaces/bin" + fi fi -# Python Paths -[[ -n "$PYENV_ROOT" ]] && safe_path_add "$PYENV_ROOT/bin" +# ------------------ Common PATH ------------------ +safe_path_add "$HOME/.local/bin/scripts" -# Go Paths +# ------------------ Language Toolchains ------------------ + +# Python (pyenv) +export PYENV_ROOT="$HOME/.pyenv" + +safe_path_add "$PYENV_ROOT/bin" +safe_path_add "$PYENV_ROOT/shims" + +# Go 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 +# NVM if [[ -d "$HOME/.nvm" ]]; then export NVM_DIR="$HOME/.nvm" [[ -s "$NVM_DIR/nvm.sh" ]] && . "$NVM_DIR/nvm.sh" diff --git a/zsh/.zshrc b/zsh/.zshrc index c292816..7d4c9e9 100755 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -1,172 +1,20 @@ #!/usr/bin/env zsh -# ================ Basic Settings ================ -# Disable auto title -DISABLE_AUTO_TITLE="true" +# Optional profiling +[[ -n $ZSH_DEBUGRC ]] && zmodload zsh/zprof -# Uncomment to enable case-sensitive or hyphen-insensitive completion -# CASE_SENSITIVE="true" -# HYPHEN_INSENSITIVE="true" - -# Miscellaneous settings (uncomment as needed) -# DISABLE_MAGIC_FUNCTIONS="true" -# DISABLE_LS_COLORS="true" -# ENABLE_CORRECTION="true" -# COMPLETION_WAITING_DOTS="true" -# DISABLE_UNTRACKED_FILES_DIRTY="true" - -# ================ Path Optimizations ================ -# Ensure no duplicates in PATH +# Path cleanup typeset -U PATH -# ================ Zsh Completion Settings ================ -# Load zsh completions with optimization -if type brew &>/dev/null; then - export HOMEBREW_AUTO_UPDATE_SECS=86400 # Update every 24 hours - export HOMEBREW_PREFIX="$(brew --prefix)" +# Core config +source ~/.config/zsh/completion.zsh +source ~/.config/zsh/plugins.zsh +source ~/.config/zsh/aliases.zsh +source ~/.config/zsh/external.zsh - # 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" -if [[ ! -f $ZSH_COMPDUMP || $ZSH_COMPDUMP -ot $ZDOTDIR/.zshrc ]]; then - compinit -d "$ZSH_COMPDUMP" -else - compinit -C -d "$ZSH_COMPDUMP" -fi - -# ================ Plugin Manager (Zinit) ================ -# Setup and initialize Zinit, a Zsh plugin manager -ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git" - -# Install Zinit if it isn't already present -if [ ! -d "$ZINIT_HOME" ]; then - mkdir -p "$(dirname "$ZINIT_HOME")" - git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME" -fi - -# Source the Zinit script to enable plugin management -. "${ZINIT_HOME}/zinit.zsh" - -# Ensure compinit works with Zinit -autoload -Uz _zinit -(( ${+_comps} )) && _comps[zinit]=_zinit - -# ================ Zinit Plugin Configuration ================ -# Essential plugins for enhanced Zsh experience -zinit light zsh-users/zsh-completions # Tab completions for Zsh -zinit light zsh-users/zsh-history-substring-search # Search through command history -zinit load zdharma/history-search-multi-word # Multi-word history search - -# Syntax highlighting for Zsh (lazy-load) -zinit ice wait lucid atinit"ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern)" -zinit load zsh-users/zsh-syntax-highlighting - -# Asynchronous auto-suggestions (lazy-load) -zinit ice wait lucid atload"zle-line-init() { zle autosuggest-enable }; zle -N zle-line-init" -zinit load zsh-users/zsh-autosuggestions - -# ================ Docker Completions ================ -# Add Docker and Docker Compose completions -zinit ice wait lucid depth=1 -zinit load docker/compose - -# ================ zoxide Plugin ================ -# Fast navigation tool for frequently used directories -zinit ice from"gh-r" as"program" pick"bin/zoxide" -zinit load ajeetdsouza/zoxide - -# ================ fzf Plugin ================ - -# Install fzf (binary) using zinit -zinit ice from"gh-r" as"program" pick"bin/fzf" -zinit light junegunn/fzf-bin - -# Optional: fzf-git.sh for git integration (if you want) -zinit light junegunn/fzf-git.sh - -# Load fzf-tab for enhanced fuzzy tab completion -zinit ice blockf -zinit light Aloxaf/fzf-tab - -# ================ Additional Programs Initialization ================ -# Initialize direnv (uncomment if needed) -# eval "$(direnv hook zsh)" - -# Initialize zoxide -eval "$(zoxide init --cmd cd zsh)" - -# Initialize Starship prompt -eval "$(starship init zsh)" -export STARSHIP_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/starship.toml" - -# ================ 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 - export PYENV_ROOT="$HOME/.pyenv" - [[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH" - eval "$(pyenv init -)" -fi - -# ================ Custom Aliases ================ -# Define commonly used aliases -alias grep="grep --color=auto" -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 -if [[ -f ~/.local/bin/scripts/check_aliases ]]; then - . ~/.local/bin/scripts/check_aliases -fi - -# ================ Conditional Settings ================ -# Set the editor to vim if using SSH +# Editor for SSH [[ -n ${SSH_CONNECTION} ]] && export EDITOR='vim' -# ================ Profiling (Optional) ================ -# Uncomment to enable profiling (useful for debugging) -# zprof # Comment out if profiling is not needed +# Show zprof results if debugging +[[ -n $ZSH_DEBUGRC ]] && zprof