I'm trying to set my terminal's tab title in iterm2. It works when I'm at the shell with using
echo -ne "\033];foobar\007"
but when I do it in neovim, the tab title doesn't change. In neovim I'm trying it with
!echo -ne "\033];foobar\007"
My shell is zsh and not I'm using tmux or anything like that (tmux tag is deliberately missing in this question although its often related to stuff like this). I tried some variants of that echo command (e.g. \a instead of \007 but thats just zsh sugar) and tried to use a function I've found at https://gist.github.com/bignimbus/1da46a18416da4119778 but also without any luck.
I've set the option in my iTerm2 profile that the terminal is allowed to set tab title and window title. As I said that even works if I just echo that string from the shell without being in vim.
Any ideas what I might be missing?