fix: windows keybinds

This commit is contained in:
Brian Pooe 2026-02-26 21:53:50 +02:00
parent d1dfb3c3f8
commit 172754b2b8
4 changed files with 54 additions and 0 deletions

View file

@ -16,6 +16,7 @@ set -g focus-events on # Enable focus events for Neovim autoread/FocusG
# Set prefix key
unbind C-b # Unbind the default prefix key
set -g prefix C-Space # Set new prefix key to Ctrl+Space
set -g prefix2 C-b # Fallback to original tmux prefix
# Refresh tmux config with r
unbind r

14
.gitattributes vendored Normal file
View file

@ -0,0 +1,14 @@
* text=auto
# Keep Unix configs LF so copies into WSL don't break parsers.
*.sh text eol=lf
*.zsh text eol=lf
*.conf text eol=lf
*.lua text eol=lf
*.toml text eol=lf
*.vim text eol=lf
*.vimrc text eol=lf
*.md text eol=lf
# Keep PowerShell script native on Windows.
*.ps1 text eol=crlf

1
.tmux.conf Normal file
View file

@ -0,0 +1 @@
source-file ~/.config/tmux/tmux.conf

View file

@ -83,6 +83,42 @@ function Sync-File {
Copy-Item -LiteralPath $Source -Destination $Target -Force
}
function Normalize-WslLineEndings {
param(
[string]$DistroName,
[string]$UserName
)
# Normalize LF endings for files consumed inside WSL. This avoids tmux/zsh
# parse issues when source files were checked out with CRLF on Windows.
$script = @'
set -eu
sanitize() {
f="$1"
[ -f "$f" ] || return 0
sed -i "s/\r$//" "$f"
}
sanitize "$HOME/.zshrc"
sanitize "$HOME/.vimrc"
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 -lc $script
if ($LASTEXITCODE -ne 0) {
throw "Failed to normalize line endings in WSL (exit code $LASTEXITCODE)"
}
}
if (-not $WslUser) {
$WslUser = Resolve-WslUser -DistroName $Distro
}
@ -133,7 +169,9 @@ foreach ($dir in $configDirs) {
}
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 "wezterm\wezterm.lua") -Target $WindowsWeztermPath
Normalize-WslLineEndings -DistroName $Distro -UserName $WslUser
Write-Step "Done."