Terminal: To make Option-Control keyboard shortcut work

I use the fish shell, and I added a function that expands variables, like it works by default in Zsh. That is, I can type e.g. $PWD, press the keyboard shortcut, and it will be expanded to the current path.

For some reason though, Option-Control-E doesn’t work, whereas Control-E works fine. What might be a reason?

~/.config/fish/functions/fish_user_key_bindings.fish:

function fish_user_key_bindings
    # option-control-e, doesn't work
    # bind \e\ce bind_expand_all

    # control-e, works
    bind \ce bind_expand_all
end

~/.config/fish/functions/bind_expand_all.fish:

# $__fish_config_dir/functions/bind_expand_all.fish
function bind_expand_all
    set -l expanded
    for token in (commandline --tokenize)
        set expanded $expanded (eval echo $token)
    end
    set -l new (string join " " $expanded)
    commandline -r $new
    commandline -C (string length $new)
end

Without knowing any of the details of what you are doing, I do know that control + any alpha key is just another ASCII character while option plus anything is a key code, thus they will be treated differently in the system. (This is true for any OS.) Since they are treated differently by the system there is no reason to expect that any program will treat them in the same manner.

Guys on Stack Overflow and on Reddit say the same fish code works fine for them with Control-Alt-E.

Since they talk about Control-Alt-E, they use Windows, Linux, or BSD. And for me, it doesn’t work neither in Terminal nor in iTerm2.

So it seems the issue is related to macOS somehow… Hope I can find some help here!