Fix Shift+A autocomplete interference with refined approach

- Replace single key sequence binding with multiple potential Shift+A sequences
- Add explicit self-insert bindings for 'A', '^[[1;2A', and '^[[65;2u' to cover different terminals
- Configure ZSH_AUTOSUGGEST_CLEAR_WIDGETS to prevent autosuggestion interference with vim modes
- Add vi-add-eol and vi-add-next to clear widgets to ensure proper vim behavior
- Set ZSH_AUTOSUGGEST_ACCEPT_WIDGETS to handle vim end-of-line operations correctly

This should prevent Shift+A from triggering autocomplete while preserving vim functionality.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Yan Lin 2025-07-29 23:58:40 +02:00
parent 107b668e3a
commit a7164a0ff3

View file

@ -100,7 +100,18 @@ in
bindkey '^H' backward-delete-char # Ctrl+H (alternative backspace)
# Prevent Shift+A from triggering autocomplete in vim insert mode
bindkey -M viins '^[[1;2A' vi-add-eol
# Try multiple potential key sequences for Shift+A across different terminals
bindkey -M viins 'A' self-insert
bindkey -M viins '^[[1;2A' self-insert
bindkey -M viins '^[[65;2u' self-insert
# Disable expand-or-complete on potential problematic keys in vim insert mode
bindkey -M viins '^I' expand-or-complete # Keep tab completion but be explicit
# Configure autosuggestions to not interfere with vim mode
ZSH_AUTOSUGGEST_CLEAR_WIDGETS+=(vi-add-eol)
ZSH_AUTOSUGGEST_CLEAR_WIDGETS+=(vi-add-next)
ZSH_AUTOSUGGEST_ACCEPT_WIDGETS=(end-of-line vi-end-of-line vi-add-eol)
'';
};