flutter_ecommerce_app
flutter_ecommerce_app copied to clipboard
z -I seen as z -i when bash shell option nocasematch is set
In bash, when the environment has shopt -s nocasematch set then options -i and -I are considered equal and so interactive fzf is never used.
A solution is in the function _zlua in the script_zlua variable to make the following changes:
- Before the
casestatement add the following:
local restore_nocasematch=$(shopt -p nocasematch; true)
shopt -u nocasematch
- After the
casestatement add the following:
$restore_nocasematch
I don't know the situation in zsh.
The function _zlua is not just for bash exclusively, but for all the posix shells like zsh and dash.
So there should not be any bash special code. nocasematch is rarely set in most working environment, before I make my decision whether or not include this, you can patch your self, append the code below after zlua 's initialization:
function _zlua_safe() {
local restore_nocasematch=$(shopt -p nocasematch; true)
shopt -u nocasematch
_zlua "$@"
$restore_nocasematch
}
alias z='_zlua_safe'
I realised that the function was used by other shells after having a look at the code, but nocasematch is set here when [ -n "$PS1" ] (primarily for easier terminal use of the [[ conditional expression) and it took me some time to find out why fzf interactive selection wasn't working. It was only after I found the undocumented variable _ZL_LOG_NAME that I found -I was being seen as -i and so knew the issue. I thought perhaps my proposed changes could be wrapped in
if [ -n "$BASH_VERSION" ]; then
...
fi
as used elsewhere in the code for bash specific processing, to ensure that this potential issue didn't affect other fzf users.
Anyway, having moved from autojump, many thanks for this project.