Reaction score: 5
I'm on FreeBSD 13, and I don't know how to disable "bracketed paste". I already tried with inputrc (set enable-bracketed-paste off) and it does not work. I switched to zsh and it is still there, active.
It's a function of the terminal, not the shell.I don't know how to disable "bracketed paste"
Copying and Pasting Text with a Mouse Copying and pasting text from the screen with a mouse is supported. Press and hold down mouse button 1, usually the left button, while moving the mouse to select text. Selected text is highlighted with reversed foreground and background colors. To select more text after releasing mouse button 1, press mouse button 3, usually the right button. To paste text that has been selected, press mouse button 2, usually the middle button. The text is entered as if it were typed at the keyboard. The VT_TWOBUTTON_MOUSE kernel option can be used with mice that only have two buttons. Setting this option makes the second mouse button into the paste button. See moused(8) for more information.
set enable-bracketed-paste offin ~/.inputrc (like you tried), or compile devel/readline configured with
--disable-bracketed-paste-default. There's a bug report that aims to make this the default: PR 253142
unset zle_bracketed_pastein an interactive session to disable it for that session. You can also simply disable the highlighting to retain the "safety" feature provided by bracketed paste using
zle_highlight=('paste:none')in your .zshrc.
unset zle_bracketed_pastein every one of them still did not disable bracketed paste at the start of an interactive session, whether it was a login shell or not. Bracketed paste is enabled by default, so if it's unset (or not an array) then it is subsequently enabled. This behavior makes some sense at least: startup files are read prior to ZLE's initialization because the session may not be interactive, and if ZLE's initialization code doesn't find an array named zle_bracketed_paste, probably because it was unset or simply not declared in a startup file, then it will create the array and set default values.
typeset -A zle_bracketed_pastein something like .zshrc instead of unsetting it. This only works because the ZLE code simply checks whether zle_bracketed_paste is an array of length 2 to determine whether to print the "bracket" strings. This means if it's an array with any other length, the "bracket" strings will not be printed to the terminal, and the terminal will not interpret the pasted text.
Arguably, it will make it easier. Bracketed paste requires an extra keystroke that's otherwise not necessary.Will that make it less easy for me to paste?
When pasting commands into a terminal, it requires an extra keystroke before they are executed, provided that newline(s) exist after the command(s). To some, that's a useful security feature (especially for users who frequently paste commands from StackExchange or something).And bracketed paste fixes exactly that problem: It allows the program that consumes the "keystrokes" to know that what it is seeing is not being typed by a human at a keyboard, but is already finished. For example, the editor can turn off auto-indent.
So why do you want to turn that off?
Funny, it's the other way around for me The optics don't bother me much, but the extra keystroke is terrible. It forces my right hand from the mouse back to the keyboard (when I'm not expecting it), which is a major annoyance.The extra keystroke can be a feature but it should be possible to toggle on/off in the user settings. I use iTerm2 and I set it there.
For all I know so far, you can compile devel/readline to have the option off by default, which should take care of all consumers of that library. Alternatively, you canSo back to the original question, how to turn it off: Is it sufficient to turn it off in the terminal emulator? I know the one I use (iTerm2 on the Mac) has the ability to turn it off, either for the current session, or permanenty.set enable-bracketed-paste off
set enable-bracketed-paste offin ~/.inputrc, which should also take care of consumers—but who knows. I've personally tested it to work as expected for shells/bash.
Let me ask a more fundamental question: Why do you want to disable bracketed paste? What's there to gain?
So why do you want to turn that off?
Strange, but no idea. I usually copy from xterm to xterm (x11/xterm).For me, that exact use case works excellently pasting into emacs and into bash. And for emacs, it works even better than it used to, because when pasting code, the auto-indent turns itself off for pasted code. And I don't have to hit an extra CR at the end of the pasted area if it contains line ends.
Could it be an environment issue?