remove cross platform from config

This commit is contained in:
Brian Pooe 2026-06-06 11:20:21 +02:00
parent 62404cb60f
commit 21c315d5f2
4 changed files with 54 additions and 1486 deletions

File diff suppressed because it is too large Load diff

61
.zshrc
View file

@ -1,16 +1,6 @@
# Homebrew / Linuxbrew (portable across macOS and Linux/WSL)
if [ -x /home/linuxbrew/.linuxbrew/bin/brew ]; then
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
elif [ -x /opt/homebrew/bin/brew ]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
elif [ -x /usr/local/bin/brew ]; then
eval "$(/usr/local/bin/brew shellenv)"
fi
# Theme (kanagawa variants: dragon|wave)
# Example: export KANAGAWA_THEME="wave"
export KANAGAWA_THEME="${KANAGAWA_THEME:-wave}"
case "${KANAGAWA_THEME:l}" in
case "${KANAGAWA_THEME}" in
wave|kanagawa-wave)
export TMUX_THEME="wave"
export NVIM_THEME="wave"
@ -27,8 +17,6 @@ case "${KANAGAWA_THEME:l}" in
;;
esac
source /opt/homebrew/opt/antidote/share/antidote/antidote.zsh
# Write a deterministic tmux theme selector file so tmux servers don't depend
# on inherited shell env vars.
export TMUX_THEME_FILE="$HOME/.config/tmux/current-theme.conf"
@ -49,10 +37,8 @@ if command -v zoxide >/dev/null 2>&1; then
eval "$(zoxide init zsh)"
fi
# Activate syntax highlighting
if command -v brew >/dev/null 2>&1 && [ -f "$(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ]; then
source "$(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
elif [ -f /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]; then
# Syntax highlighting
if [ -f /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]; then
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
fi
@ -61,27 +47,25 @@ fi
ZSH_HIGHLIGHT_STYLES[path]=none
ZSH_HIGHLIGHT_STYLES[path_prefix]=none
# Activate autosuggestions
if command -v brew >/dev/null 2>&1 && [ -f "$(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh" ]; then
source "$(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh"
elif [ -f /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh ]; then
# Autosuggestions
if [ -f /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh ]; then
source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh
fi
# ------------FZF--------------
# Set up fzf key bindings and fuzzy completion
export FZF_DEFAULT_COMMAND="fd --hidden --strip-cwd-prefix --exclude .git "
export FZF_DEFAULT_COMMAND="fd --hidden --strip-cwd-prefix --exclude .git"
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_ALT_C_COMMAND="fd --type=d --hidden --strip-cwd-prefix --exclude .git"
export FZF_DEFAULT_OPTS="--height 50% --layout=default --border --color=hl:#2dd4bf"
# Setup fzf previews
export FZF_CTRL_T_OPTS="--preview 'bat --color=always -n --line-range :500 {}'"
export FZF_ALT_C_OPTS="--preview 'eza --icons=always --tree --color=always {} | head -200'"
# fzf preview for tmux
export FZF_TMUX_OPTS=" -p90%,70% "
# fzf key bindings and completion
if [ -f /usr/share/fzf/shell/key-bindings.zsh ]; then
source /usr/share/fzf/shell/key-bindings.zsh
fi
# -----------------------------
unalias lt 2>/dev/null
@ -92,9 +76,8 @@ lt() {
}
# aliases
alias weztermconfig="nvim ~/.config/wezterm/wezterm.lua"
alias zshconfig="vim ~/.zshrc"
alias nvimconfig="vim ~/.config/nvim"
alias zshconfig="nvim ~/.zshrc"
alias nvimconfig="nvim ~/.config/nvim"
alias dev="cd $HOME/Documents"
alias ls="eza --no-filesize --long --color=always --icons=always --no-user"
alias ll="eza -lah --group-directories-first --no-filesize --long --color=always --icons=always --no-user"
@ -102,24 +85,12 @@ alias vim="nvim"
alias crq="cargo run -q"
alias sudo="sudo "
alias lg="lazygit"
if command -v apt >/dev/null 2>&1; then
alias update="sudo apt update && sudo apt upgrade -y"
elif command -v brew >/dev/null 2>&1; then
alias update="brew update && brew upgrade"
fi
alias update="sudo dnf update -y"
if command -v tmux &>/dev/null && [ -z "$TMUX" ]; then
tmux attach -t default 2>/dev/null || tmux new -s default
fi
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
if [ -n "${WSL_DISTRO_NAME:-}" ]; then
export NVIM_OFFLINE=1
fi
export NVIM_RELEASE_TAG=v0.11.6
export NVIM_PREPARE_TIMEOUT=120m
export BUILDER_IMAGE=ubuntu:24.04
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"

View file

@ -1,45 +1,55 @@
# dotfiles
## Windows + WSL Sync (No Stow)
Linux/Fedora focused dotfiles. Managed manually — symlink configs into place or copy as needed.
If you use manual copy/paste on Windows, you can sync configs automatically with:
`scripts/sync-windows-wsl-dotfiles.ps1`
This script runs in Windows PowerShell and syncs:
- `nvim`, `tmux`, `starship` -> `\\wsl.localhost\<distro>\home\<user>\.config`
- `.zshrc` -> `\\wsl.localhost\<distro>\home\<user>\.zshrc`
- `.config/.vimrc` -> `\\wsl.localhost\<distro>\home\<user>\.vimrc`
- `.config/.ideavimrc` -> `\\wsl.localhost\<distro>\home\<user>\.ideavimrc`
- `.config/wezterm/wezterm.lua` -> Windows WezTerm config path
On macOS/Linux, JetBrains reads IdeaVim config from `~/.ideavimrc`. You can
symlink it to this repo-managed file:
## Quick Setup
```bash
# Clone
git clone <repo-url> ~/dotfiles
# Symlink configs
ln -sfn ~/dotfiles/.config/nvim ~/.config/nvim
ln -sfn ~/dotfiles/.config/tmux ~/.config/tmux
ln -sfn ~/dotfiles/.config/starship ~/.config/starship
ln -sfn ~/dotfiles/.config/lazygit ~/.config/lazygit
ln -sfn ~/dotfiles/.config/wezterm ~/.config/wezterm
ln -sfn ~/dotfiles/.config/zed ~/.config/zed
ln -sfn ~/dotfiles/.config/.ideavimrc ~/.ideavimrc
ln -sfn ~/dotfiles/.zshrc ~/.zshrc
ln -sfn ~/dotfiles/.gitconfig ~/.gitconfig
```
### Run From Windows PowerShell
## Dependencies (Fedora)
Dry run:
```powershell
powershell -ExecutionPolicy Bypass -File "\\wsl.localhost\Ubuntu-24.04\home\<user>\dotfiles\scripts\sync-windows-wsl-dotfiles.ps1" -Distro "Ubuntu-24.04" -WslUser "<user>" -WindowsWeztermPath "C:\Users\<user>\wezterm.lua" -DryRun
```bash
sudo dnf install -y \
zsh \
zsh-syntax-highlighting \
zsh-autosuggestions \
fzf \
fd-find \
bat \
eza \
zoxide \
tmux \
lazygit \
neovim \
starship
```
Apply:
Install nvm separately: https://github.com/nvm-sh/nvm
```powershell
powershell -ExecutionPolicy Bypass -File "\\wsl.localhost\Ubuntu-24.04\home\<user>\dotfiles\scripts\sync-windows-wsl-dotfiles.ps1" -Distro "Ubuntu-24.04" -WslUser "<user>" -WindowsWeztermPath "C:\Users\<user>\wezterm.lua"
## Theme
Kanagawa theme with two variants: `dragon` (dark) and `wave` (darker blue).
Set in shell:
```bash
export KANAGAWA_THEME="wave" # or "dragon"
```
Notes:
- `-WslUser` can be omitted; the script auto-detects it from WSL.
- `-WindowsWeztermPath` can be omitted; the script defaults to `%USERPROFILE%\.wezterm.lua` (or `%USERPROFILE%\wezterm.lua` if that exists and `.wezterm.lua` does not).
## Neovim Offline Setup (Corporate Proxy)
If you're behind a corporate proxy where Mason, Treesitter, or plugin installs fail, you can pre-download everything on a machine with internet access and deploy offline.
@ -62,49 +72,22 @@ Optionally pin Neovim to a specific tag:
NVIM_RELEASE_TAG=v0.11.6 ./scripts/nvim-offline-prepare.sh
```
This pre-downloads:
- All lazy.nvim plugins (git clones + build steps)
- All Mason packages (LSP servers, linters, formatters, DAP adapters)
- All Treesitter parsers (compiled .so files)
Output: `scripts/nvim-offline-bundle-output/nvim-offline-bundle.tar.gz`
### Step 2: Install the bundle (on the proxy machine)
Transfer the tarball to your corporate machine, then run:
```bash
./scripts/nvim-offline-install.sh ./scripts/nvim-offline-bundle-output/nvim-offline-bundle.tar.gz
```
This extracts plugins to `~/.local/share/nvim/lazy/` and Mason packages to `~/.local/share/nvim/mason/`.
### Step 3: Enable offline mode
Add to your `~/.zshrc` (or `~/.bashrc`):
```bash
export NVIM_OFFLINE=1
```
Then restart your shell or run `source ~/.zshrc`.
### What offline mode disables
| Component | Behavior when `NVIM_OFFLINE=1` |
| ----------------- | ------------------------------------------------------- |
| **lazy.nvim** | Disables update checker, sets git timeout to 1s |
| **Mason** | Skips `ensure_installed` for LSP servers and tools |
| **Treesitter** | Disables `auto_install` for parsers |
| **mason-nvim-dap**| Disables `automatic_installation` for debug adapters |
### Re-enabling network access
To go back to normal (online) mode:
```bash
unset NVIM_OFFLINE
```
Or remove the `export NVIM_OFFLINE=1` line from your shell profile.

View file

@ -1,163 +0,0 @@
[CmdletBinding()]
param(
[string]$Distro = "Ubuntu-24.04",
[string]$WslUser,
[string]$RepoName = "dotfiles",
[string]$RepoRoot,
[string]$WindowsWeztermPath,
[switch]$DryRun
)
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
function Write-Step {
param([string]$Message)
Write-Host "==> $Message"
}
function Resolve-WslUser {
param([string]$DistroName)
$value = (& wsl.exe -d $DistroName -e sh -c 'whoami' 2>$null | Select-Object -First 1)
if (-not $value) {
throw "Unable to resolve WSL user from distro '$DistroName'. Pass -WslUser explicitly."
}
return $value.Trim()
}
function Ensure-Directory {
param([string]$Path)
if (-not (Test-Path -LiteralPath $Path)) {
if ($DryRun) {
Write-Step "[dry-run] mkdir $Path"
return
}
New-Item -ItemType Directory -Path $Path -Force | Out-Null
}
}
function Sync-Directory {
param(
[string]$Source,
[string]$Target
)
if (-not (Test-Path -LiteralPath $Source)) {
throw "Missing source directory: $Source"
}
Write-Step "Sync dir: $Source -> $Target"
Ensure-Directory -Path $Target
if ($DryRun) {
return
}
$null = & robocopy "$Source" "$Target" /MIR /R:2 /W:1 /NFL /NDL /NP /NJH /NJS
if ($LASTEXITCODE -gt 7) {
throw "robocopy failed for '$Source' -> '$Target' (exit code $LASTEXITCODE)"
}
}
function Sync-File {
param(
[string]$Source,
[string]$Target
)
if (-not (Test-Path -LiteralPath $Source)) {
throw "Missing source file: $Source"
}
Write-Step "Sync file: $Source -> $Target"
$parent = Split-Path -Parent $Target
if ($parent) {
Ensure-Directory -Path $parent
}
if ($DryRun) {
return
}
Copy-Item -LiteralPath $Source -Destination $Target -Force
}
function Normalize-WslLineEndings {
param(
[string]$DistroName,
[string]$UserName
)
# Normalize LF endings for files consumed inside WSL. Keep this as a
# single-line command string to avoid CRLF/BOM parsing issues in sh -c.
$script = 'set -eu; sanitize(){ f="$1"; [ -f "$f" ] || return 0; sed -i "s/\r$//" "$f"; }; sanitize "$HOME/.zshrc"; sanitize "$HOME/.vimrc"; sanitize "$HOME/.ideavimrc"; for d in "$HOME/.config/nvim" "$HOME/.config/tmux" "$HOME/.config/starship"; do [ -d "$d" ] || continue; find "$d" -type f \( -name "*.lua" -o -name "*.toml" -o -name "*.conf" -o -name "*.vim" -o -name "*.vimrc" -o -name "*.sh" -o -name "*.zsh" \) -exec sed -i "s/\r$//" {} +; done'
Write-Step "Normalizing line endings in WSL targets (LF)"
if ($DryRun) {
return
}
& wsl.exe -d $DistroName -u $UserName -e sh -c $script
if ($LASTEXITCODE -ne 0) {
throw "Failed to normalize line endings in WSL (exit code $LASTEXITCODE)"
}
}
if (-not $WslUser) {
$WslUser = Resolve-WslUser -DistroName $Distro
}
$wslHome = "\\wsl.localhost\$Distro\home\$WslUser"
if (-not $RepoRoot) {
$RepoRoot = Join-Path $wslHome $RepoName
}
$repoConfigRoot = Join-Path $RepoRoot ".config"
$wslConfigRoot = Join-Path $wslHome ".config"
if (-not (Test-Path -LiteralPath $RepoRoot)) {
throw "Repo root not found: $RepoRoot"
}
if (-not $WindowsWeztermPath) {
$defaultDot = Join-Path $env:USERPROFILE ".wezterm.lua"
$defaultPlain = Join-Path $env:USERPROFILE "wezterm.lua"
if ((Test-Path -LiteralPath $defaultPlain) -and -not (Test-Path -LiteralPath $defaultDot)) {
$WindowsWeztermPath = $defaultPlain
}
else {
$WindowsWeztermPath = $defaultDot
}
}
Write-Step "Distro : $Distro"
Write-Step "WSL User : $WslUser"
Write-Step "Repo Root : $RepoRoot"
Write-Step "WSL Config Root : $wslConfigRoot"
Write-Step "Windows WezTerm : $WindowsWeztermPath"
if ($DryRun) {
Write-Step "Mode : dry-run"
}
Ensure-Directory -Path $wslConfigRoot
$configDirs = @(
"nvim",
"tmux",
"starship"
)
foreach ($dir in $configDirs) {
$src = Join-Path $repoConfigRoot $dir
$dst = Join-Path $wslConfigRoot $dir
Sync-Directory -Source $src -Target $dst
}
Sync-File -Source (Join-Path $RepoRoot ".zshrc") -Target (Join-Path $wslHome ".zshrc")
Sync-File -Source (Join-Path $RepoRoot ".tmux.conf") -Target (Join-Path $wslHome ".tmux.conf")
Sync-File -Source (Join-Path $repoConfigRoot ".vimrc") -Target (Join-Path $wslHome ".vimrc")
Sync-File -Source (Join-Path $repoConfigRoot ".ideavimrc") -Target (Join-Path $wslHome ".ideavimrc")
Sync-File -Source (Join-Path $repoConfigRoot "wezterm\wezterm.lua") -Target $WindowsWeztermPath
Normalize-WslLineEndings -DistroName $Distro -UserName $WslUser
Write-Step "Done."