Open prashcr opened 8 years ago
I removed just the tmux stuff but there are still some differences between it and this snippet that works for me.
Could anyone shed light on what differences there are between the two scripts? Try using my script and let me know if there are any perceivable differences.
" Auto-toggle paste mode for xterm
let &t_SI .= "\<Esc>[?2004h"
let &t_EI .= "\<Esc>[?2004l"
inoremap <special> <expr> <Esc>[200~ XTermPasteBegin()
function! XTermPasteBegin()
set pastetoggle=<Esc>[201~
set paste
return ""
endfunction
let &t_ti .= "\<Esc>[?2004h"
let &t_te .= "\<Esc>[?2004l"
function! XTermPasteBegin(ret)
set pastetoggle=<f29>
set paste
return a:ret
endfunction
execute "set <f28>=\<Esc>[200~"
execute "set <f29>=\<Esc>[201~"
map <expr> <f28> XTermPasteBegin("i")
imap <expr> <f28> XTermPasteBegin("")
vmap <expr> <f28> XTermPasteBegin("c")
cmap <f28> <nop>
cmap <f29> <nop>
This works and solves all the tmux
issues for me. I made it a plugin: https://github.com/ryanpcmcquen/fix-vim-pasting
24