I've been using bracketed paste in VIM which is excellent for ensuring pasted content gets into the editor un-modified without triggering actions (such as auto formatting, and auto closing parenthesis).

I've built and installed the latest bash 4.4, and enabled bracketed-paste-mode via ~/.inputrc.

It technically works perfectly, when pasting into the command-line, but it remains active after pressing enter. So if I type cat <enter> for example, and attempt to paste to a file, the file contains the paste-begin and paste-end markers.

Can BASH 4.4 be configure to enable bracketed paste mode ONLY while at the prompt?


1 Answer 1


My apologies for answering my own question, but the answer in my case was not what I expected.

.. anyhow ..

My issue turned out to be gnu-screen. The problem was essentially that I was manually entering bracketed paste mode by sending '\<ESC>P\<ESC>[?2004h\<ESC>\' which is the bracketed paste code wrapped in a screen pass-through escape sequence.

I eventually took the screen source files, and merge in a feature branch which added full bracketed paste support. Once I did that, not only did it work, but screen now tracked the bracketed paste state, turning it on/off as I switched panes.

This was important because I had used the same technique for telling VIM to use bracketed paste, which also backfired. Once I had bash-4.4 bracketed paste and vim-8 bracketed paste working normally, running them under the newly patched gnu screen was a pure pleasure.

I haven't tried TMUX. After using screen since the late 80's, switching to tmux seems like hard work, though I've been planning on doing just that for at least the last two years now :-)

Again, bash-4.4 bracketed paste works perfectly, vim-8 bracketed paste works perfectly, I just forgot to mention I glued them together with gnu screen, using the default ubuntu packages which are based on old source.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .