The following setting in .tmux.conf breaks arrow keys in terminal in tmux:
set-window-option -g xterm-keys on
When I disable this setting, then arrow keys work as expected in terminal but then they don't work in Vim.
With this setting, the arrow keys move the cursor word wise as option+arrow keys.
The problem occurs both inside Terminal and iterm2.