Created
September 5, 2011 18:08
-
Star
(124)
You must be signed in to star a gist -
Fork
(12)
You must be signed in to fork a gist
-
-
Save andyfowler/1195581 to your computer and use it in GitHub Desktop.
Swap iTerm2 cursors in vim insert mode when using tmux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" tmux will only forward escape sequences to the terminal if surrounded by a DCS sequence | |
" http://sourceforge.net/mailarchive/forum.php?thread_name=AANLkTinkbdoZ8eNR1X2UobLTeww1jFrvfJxTMfKSq-L%2B%40mail.gmail.com&forum_name=tmux-users | |
if exists('$TMUX') | |
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\" | |
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\" | |
else | |
let &t_SI = "\<Esc>]50;CursorShape=1\x7" | |
let &t_EI = "\<Esc>]50;CursorShape=0\x7" | |
endif |
thanks
Thanks!
How can I get this working in the case of running ssh and opening vim on a remote machine from within a local tmux session?
https://stackoverflow.com/questions/42377945/vim-adding-cursorshape-support-over-tmux-ssh
@AdamBrodzinski
Try adding this line to your .vimrc to get rid of the delay while switching between normal mode and insert mode
set timeoutlen=1000 ttimeoutlen=0
Thanks!
We should all get together for a drink some day.
Thanks!
A note if you are using tmux with a custom term-info (like many tutorials in the internet instructs you to have something like - italic in vim)
This is what you want inside your tmux.conf (assuming using iterm2 + tmux)
set -g default-terminal 'tmux-256color' # replace this with your custom term-info name
set -ga terminal-overrides ',*:Tc' # this is for 256 color
set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q' # this is for the cursor shape
won't work for tmux 2.6 and terminator
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks @jcorbin