# Nushell Environment Configuration (Templated) {{ if eq .chezmoi.os "windows" -}} $env.CACHE_DIR = ($env.HOME | path join "AppData" "Local" "nushell" "cache") {{- else -}} $env.CACHE_DIR = ($env.HOME | path join ".cache" "nushell") {{- end }} # Ensure cache directory exists try { mkdir $env.CACHE_DIR } # Initialize Zoxide if (which zoxide | is-not-empty) { zoxide init nushell | save -f ($env.CACHE_DIR | path join "zoxide.nu") } else { "" | save -f ($env.CACHE_DIR | path join "zoxide.nu") } # Initialize Starship if (which starship | is-not-empty) { starship init nu | save -f ($env.CACHE_DIR | path join "starship.nu") } else { "" | save -f ($env.CACHE_DIR | path join "starship.nu") } # Set default editor and pager {{ if eq .chezmoi.os "windows" -}} $env.EDITOR = "nvim.exe" $env.VISUAL = "nvim.exe" {{- else -}} $env.EDITOR = "nvim" $env.VISUAL = "nvim" {{- end }} {{- if (which bat | is-not-empty) }} $env.PAGER = "bat --paging=always" {{- else if (which batcat | is-not-empty) }} $env.PAGER = "batcat --paging=always" {{- end }} {{ if eq .chezmoi.os "windows" -}} # Modern PowerShell 7 wrapper (pw7) for Nushell (Windows Only) def --env pw7 [cmd: string] { let profile = "{{ joinPath .chezmoi.homeDir "onedrive" "Documents" "PowerShell" "Gemini_Profile.ps1" }}" ^pwsh.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command $". '($profile)'; ($cmd) | Out-String" } {{- end }} # Useful env variables $env.BAT_THEME = "TwoDark"