title: vim change cursor in different modes with tmux and iTerm2 - works on ssh but not on local machine?
body: <p>I am trying to make the cursor change depending on the mode in vim while in tmux (using iTerm2 as my terminal emulator). The below setup in my .vimrc works on my local machine without being in tmux, as well as when I ssh and use tmux, but not when I use tmux on my local machine. The setup (see below) is from here: <a href="https://vim.fandom.com/wiki/Change_cursor_shape_in_different_modes" rel="nofollow noreferrer">https://vim.fandom.com/wiki/Change_cursor_shape_in_different_modes</a></p>
  <pre><code>if exists('$TMUX')
      let &amp;t_SI = &quot;\&lt;Esc&gt;Ptmux;\&lt;Esc&gt;\&lt;Esc&gt;]50;CursorShape=1\x7\&lt;Esc&gt;\\&quot;
         let &amp;t_SR =  &quot;\&lt;Esc&gt;Ptmux;\&lt;Esc&gt;\&lt;Esc&gt;]50;CursorShape=2\x7\&lt;Esc&gt;\\&quot;
           let &amp;t_EI = &quot;\&lt;Esc&gt;Ptmux;\&lt;Esc&gt;\&lt;Esc&gt;]50;CursorShape=0\x7\&lt;Esc&gt;\\&quot;
       else
             let &amp;t_SI = &quot;\&lt;Esc&gt;]50;CursorShape=1\x7&quot;
               let &amp;t_SR = &quot;\&lt;Esc&gt;]50;CursorShape=2\x7&quot;
                 let &amp;t_EI = &quot;\&lt;Esc&gt;]50;CursorShape=0\x7&quot;
           endif
  :autocmd InsertEnter,InsertLeave * set cul!
  </code></pre>