diff --git a/modules/home/rsydn/base.nix b/modules/home/rsydn/base.nix index 7650eb0..3c3c98c 100644 --- a/modules/home/rsydn/base.nix +++ b/modules/home/rsydn/base.nix @@ -17,14 +17,17 @@ aliases = { ll = "ls -alF"; }; extraAfter = '' function rsydn-accept-autosuggest-or-complete() { - if [[ -n "''${POSTDISPLAY:-}" ]]; then - zle autosuggest-accept - else + local original_buffer=$BUFFER + local original_cursor=$CURSOR + zle autosuggest-accept 2>/dev/null + if [[ $BUFFER == "$original_buffer" && $CURSOR -eq $original_cursor ]]; then zle expand-or-complete fi } zle -N rsydn-accept-autosuggest-or-complete - bindkey '^I' rsydn-accept-autosuggest-or-complete + for keymap in main viins; do + bindkey -M "$keymap" '^I' rsydn-accept-autosuggest-or-complete || true + done ''; }; diff --git a/modules/home/rsydn/shell/zsh.nix b/modules/home/rsydn/shell/zsh.nix index 8489ac0..110ee6f 100644 --- a/modules/home/rsydn/shell/zsh.nix +++ b/modules/home/rsydn/shell/zsh.nix @@ -78,7 +78,7 @@ in { autosuggestion.enable = cfg.enableAutoSuggestion; syntaxHighlighting.enable = cfg.enableSyntaxHighlighting; shellAliases = cfg.aliases; - initExtra = cfg.extraAfter; + initContent = lib.mkAfter cfg.extraAfter; }; } { programs.zsh.initContent = lib.mkOrder 550 cfg.extraBeforeCompInit; }