ConradIrwin / vim-bracketed-paste

Handles bracketed-paste-mode in vim (aka. automatic `:set paste`)
MIT License
483 stars 28 forks source link

Remove unnecessary tmux-specific code #25

Open prashcr opened 8 years ago

prashcr commented 8 years ago

24

prashcr commented 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.

My script

" 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

This plugin

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>
ryanpcmcquen commented 7 years ago

This works and solves all the tmux issues for me. I made it a plugin: https://github.com/ryanpcmcquen/fix-vim-pasting