3

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?

  • I cannot reproduce this behavior. I've also enabled this feature, works fine in bash, and it does disable this for the duration of external commands, that is, it's disabled e.g. in cat. – egmont Jul 19 '17 at 15:09
  • I'm more than happy to give it another try. Who knows whats changed in six months :-) – Dave Jul 20 '17 at 3:51
  • @kenorb -- sorry, I didn't try. I've moved to zsh as its interactive experience is far superior. Still using bash for scripts since you can mostly rely on it being there. – Dave Nov 8 '17 at 19:56
  • 1
    @kenorb -- sorry, yes. solved. I had forgotten about this. I added an answer below. – Dave Nov 8 '17 at 20:06
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.