fix(zsh): apply keybindings reliably on first startup

- set bindkey -e before custom binds and load zsh/terminfo early
- remove later bindkey -e that reset earlier keymaps
- preserve terminfo application mode hooks

This prevents Ctrl+Arrow and other navigation keys from failing until .zshrc is re-sourced.

🤖 Generated with [opencode](https://opencode.ai)

Co-Authored-By: opencode <noreply@opencode.ai>
This commit is contained in:
Martin Büchler 2025-08-10 01:37:32 +02:00
parent bab7526ac9
commit 92b9d417fb

12
.zshrc
View File

@ -139,6 +139,12 @@ alias ...="cd ../.."
# Robust keybinds for navigation and editing (support most terminals) # Robust keybinds for navigation and editing (support most terminals)
# ===================== # =====================
# Ensure Emacs keymap is set before custom bindings so later changes don't reset them
bindkey -e
# Load terminfo module for $terminfo[] and echoti
zmodload zsh/terminfo 2>/dev/null || true
# VSCode terminal compatibility detection # VSCode terminal compatibility detection
export IS_VSCODE_TERM=0 export IS_VSCODE_TERM=0
if [[ "$TERM_PROGRAM" == "vscode" ]] || [[ -n "$VSCODE_IPC_HOOK_CLI" ]]; then if [[ "$TERM_PROGRAM" == "vscode" ]] || [[ -n "$VSCODE_IPC_HOOK_CLI" ]]; then
@ -256,10 +262,8 @@ autoload -Uz compinit && compinit
# Keybinds (Navigation, Editing, FZF, Completion) # Keybinds (Navigation, Editing, FZF, Completion)
# ===================== # =====================
# Emacs mode by default (comment out for vi mode) # Emacs/vi mode selection handled earlier to avoid resetting custom binds
bindkey -e # bindkey -v # Uncomment to use vi mode instead
# Uncomment below for vi mode
# bindkey -v
# History search # History search
bindkey '^R' fzf-history-widget # fzf history search (fzf-tab) bindkey '^R' fzf-history-widget # fzf history search (fzf-tab)