terminal mode bracketed paste ?

132 views
Skip to first unread message

M Kelly

unread,
Jun 14, 2018, 10:46:45 PM6/14/18
to vim_use
Hi,

It seems for me bracketed paste is not enabled in terminal mode.
If I copy a few lines then paste into my zsh outside of vim (in tmux) then bracketed paste is enabled and the lines are not executed until I hit enter.
But if in terminal mode I paste then each line is executed.

Is this possible ? Is there a config setting I can enable ?
Any help appreciated.
thx,
mark

Christian Brabandt

unread,
Jun 15, 2018, 2:28:32 AM6/15/18
to vim_use
If you copy, make sure not to include the line ending.

Best,
Christian
--
Ein Pessimist ist ein Optimist, der nachgedacht hat.
-- Dan Bennet

IWAMOTO Kouichi

unread,
Jun 15, 2018, 4:27:02 AM6/15/18
to vim...@googlegroups.com
On Thu, 14 Jun 2018 19:46:45 -0700 (PDT)
M Kelly <mckel...@gmail.com> wrote:

> It seems for me bracketed paste is not enabled in terminal mode.
> If I copy a few lines then paste into my zsh outside of vim (in tmux) then bracketed paste is enabled and the lines are not executed until I hit enter.
> But if in terminal mode I paste then each line is executed.

Vim does not enables bracketed paste mode if TERM=screen.
To enable bracketed paste mode when vim runs in tmux, you may add following
setting into .vimrc.

if &term =~ "screen"
let &t_BE = "\e[?2004h"
let &t_BD = "\e[?2004l"
exec "set t_PS=\e[200~"
exec "set t_PE=\e[201~"
endif

--
IWAMOTO Kouichi (s...@iwmt.org/s...@postfix.jp/s...@TeraTerm.Net)

M Kelly

unread,
Jun 15, 2018, 1:37:35 PM6/15/18
to vim_use
> Vim does not enables bracketed paste mode if TERM=screen.
> To enable bracketed paste mode when vim runs in tmux, you may add following
> setting into .vimrc.
>
> if &term =~ "screen"
> let &t_BE = "\e[?2004h"
> let &t_BD = "\e[?2004l"
> exec "set t_PS=\e[200~"
> exec "set t_PE=\e[201~"
> endif

Thank you, works great :-)

take care,
-mark

Bram Moolenaar

unread,
Jun 15, 2018, 3:28:43 PM6/15/18
to vim...@googlegroups.com, M Kelly
How exactly do you paste?

I guess when using the middle mouse, which pastes the * register,
the call to start/end bracketed paste is missing. That is where
insert_reg() is called.

--
hundred-and-one symptoms of being an internet addict:
43. You tell the kids they can't use the computer because "Daddy's got work to
do" and you don't even have a job.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

M Kelly

unread,
Jun 15, 2018, 3:48:24 PM6/15/18
to vim_use

> How exactly do you paste?

first -
<C-\><C-n> to get into normal mode
V, select a few lines moving around
yank
back to terminal mode

then -
paste with ctrl-shift-v or with mouse middle button

thx,
-m

Bram Moolenaar

unread,
Jun 15, 2018, 4:40:27 PM6/15/18
to vim...@googlegroups.com, M Kelly
I cannot reproduce this when running Vim in a terminal window.
What do you run, zsh? How do you start it, with ":term zsh" or with
":term" while 'shell' is set to "zsh"?

And what terminal is Vim running in and what is 'term' set to?

--
hundred-and-one symptoms of being an internet addict:
44. Your friends no longer send you e-mail...they just log on to your IRC
channel.

M Kelly

unread,
Jun 15, 2018, 5:46:04 PM6/15/18
to vim_use
> I cannot reproduce this when running Vim in a terminal window.
> What do you run, zsh? How do you start it, with ":term zsh" or with
> ":term" while 'shell' is set to "zsh"?
>
> And what terminal is Vim running in and what is 'term' set to?

Hi,

just :terminal
my shell is zsh
TERM=screen-256color
(all from within tmux)

thx,
-m

Bram Moolenaar

unread,
Jun 16, 2018, 9:33:08 AM6/16/18
to vim...@googlegroups.com, M Kelly
In this situation t_BE and t_BD are empty, thus bracketed paste is not
supported.

--
hundred-and-one symptoms of being an internet addict:
48. You get a tatoo that says "This body best viewed with Netscape 3.1 or
higher."

M Kelly

unread,
Jun 16, 2018, 10:21:34 AM6/16/18
to vim_use
Hi,

> In this situation t_BE and t_BD are empty, thus bracketed paste is not
> supported.

Thanks for looking into it.

Adding this -

if &term =~ "screen"
let &t_BE = "\e[?2004h"
let &t_BD = "\e[?2004l"
exec "set t_PS=\e[200~"
exec "set t_PE=\e[201~"
endif

is a good solution for me.

thank you so much for vim, and thanks to everyone for all their support,
-m

Reply all
Reply to author
Forward
0 new messages