From baa5669ff6dcefc414fac7e1fc787834c6e59fa8 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Wed, 24 Sep 2014 11:22:50 -0700 Subject: [PATCH] drop check for terminals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From the original author: "Note that this only enables bracketed paste mode when the $TERM value starts with "xterm".. you could omit the test altogether, since it isn’t strictly necessary—it’s just trying to be careful not to do something that might be incompatible with some other terminal type." (http://stackoverflow.com/questions/5585129/pasting-code-into-terminal-window-into-vim-on-mac-os-x/7053522#7053522) Since we don't understand yet if this is a problem, I recommend dropping the check and seeing if it comes back to bite us. Should be safe since vim has undo. (My machine has term set to 'linux', and I'm reluctant to keep adding clauses to that check.) --- plugin/bracketed-paste.vim | 46 ++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/plugin/bracketed-paste.vim b/plugin/bracketed-paste.vim index a55fcfa..bb4f0cd 100644 --- a/plugin/bracketed-paste.vim +++ b/plugin/bracketed-paste.vim @@ -8,32 +8,30 @@ " http://www.xfree86.org/current/ctlseqs.html " Docs on mapping fast escape codes in vim " http://vim.wikia.com/wiki/Mapping_fast_keycodes_in_terminal_Vim -if &term =~ "xterm.*" || &term =~ "screen*" || &term =~ "rxvt*" - function! WrapForTmux(s) - if !exists('$TMUX') - return a:s - endif +function! WrapForTmux(s) + if !exists('$TMUX') + return a:s + endif - let tmux_start = "\Ptmux;" - let tmux_end = "\\\" + let tmux_start = "\Ptmux;" + let tmux_end = "\\\" - return tmux_start . substitute(a:s, "\", "\\", 'g') . tmux_end - endfunction + return tmux_start . substitute(a:s, "\", "\\", 'g') . tmux_end +endfunction - let &t_SI .= WrapForTmux("\[?2004h") - let &t_EI .= WrapForTmux("\[?2004l") +let &t_SI .= WrapForTmux("\[?2004h") +let &t_EI .= WrapForTmux("\[?2004l") - function! XTermPasteBegin(ret) - set pastetoggle= - set paste - return a:ret - endfunction +function! XTermPasteBegin(ret) + set pastetoggle= + set paste + return a:ret +endfunction - execute "set =\[200~" - execute "set =\[201~" - map XTermPasteBegin("i") - imap XTermPasteBegin("") - vmap XTermPasteBegin("c") - cmap - cmap -endif +execute "set =\[200~" +execute "set =\[201~" +map XTermPasteBegin("i") +imap XTermPasteBegin("") +vmap XTermPasteBegin("c") +cmap +cmap