I often use ctrl+c to copy text from some gui application and then paste it into my terminal emulator (terminator), using right-mouse-click-menu and paste. Sometimes I forget that the clipboard contains several lines, which when pasted into bash causes each line to be "executed"
Is there some solution to prevent multi-line paste entirely?
Best Answer
This answer is not the most-specific for the user's question Please see my 2nd answer. I am leaving this here because it addresses the more general issue.
Per the comments to your original post, you need (1) a terminal emulator which supports bracketed paste and (2) corresponding support for whatever is running in the terminal, ie,
vim
,bash
,zsh
. Terminal emulators supporting bracketed paste (list to be updated based on comments to this post):xterm
- since ??gnome-terminal
- since ??putty
- since 0.63 (2013-08-06 release date)Applications supporting bracketed mode:
vim
zsh
For
bash
, StéphaneChazelas has put together a shell script to facilitate the detection of that mode and take appropriate action.A more specific answer -- preventing lines from getting chopped off -- is unanswerable without knowing about the unix program that is running when you hit paste.
A clipboard manager maybe what you need.