zsh enable case-insensitive completion

Move transient prompt config into nix expression directly
This commit is contained in:
Evie Litherland-Smith 2024-02-12 06:57:13 +00:00
parent 25302a878f
commit 7e9463d371
2 changed files with 44 additions and 32 deletions

View file

@ -7,11 +7,54 @@
enableVteIntegration = true;
autocd = true;
historySubstringSearch.enable = true;
history = {
extended = true;
ignoreDups = true;
ignoreSpace = true;
};
oh-my-zsh = {
enable = true;
plugins = ["colored-man-pages" "lol" "rand-quote"];
theme = "";
};
initExtra = "source ${./transient.zsh}\n";
completionInit = ''
autoload -Uz +X compinit && compinit
## case insensitive path-completion
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
zstyle ':completion:*' menu select
'';
initExtra = ''
## enable transient prompt
zle-line-init() {
emulate -L zsh
[[ $CONTEXT == start ]] || return 0
while true; do
zle .recursive-edit
local -i ret=$?
[[ $ret == 0 && $KEYS == $"\4" ]] || break
[[ -o ignore_eof ]] || exit 0
done
local saved_prompt=$PROMPT
local saved_rprompt=$RPROMPT
PROMPT="> "
RPROMPT=""
zle .reset-prompt
PROMPT=$saved_prompt
RPROMPT=$saved_rprompt
if ((ret)); then
zle .send-break
else
zle .accept-line
fi
return ret
}
zle -N zle-line-init
'';
};
}

View file

@ -1,31 +0,0 @@
#!/usr/bin/env zsh
zle-line-init() {
emulate -L zsh
[[ $CONTEXT == start ]] || return 0
while true; do
zle .recursive-edit
local -i ret=$?
[[ $ret == 0 && $KEYS == $'\4' ]] || break
[[ -o ignore_eof ]] || exit 0
done
local saved_prompt=$PROMPT
local saved_rprompt=$RPROMPT
PROMPT='> '
RPROMPT=''
zle .reset-prompt
PROMPT=$saved_prompt
RPROMPT=$saved_rprompt
if ((ret)); then
zle .send-break
else
zle .accept-line
fi
return ret
}
zle -N zle-line-init