4 ms·
What I find super irritating is that some terminals will automatically execute a command if you paste it from the clipboard and there is a newline char at the e
by jansan 3y ago
What I find super irritating is that some terminals will automatically execute a command if you paste it from the clipboard and there is a newline char at the end. IMO command line interfaces should not do this.
- bloopernova 3y agoOn macOS, iTerm asks if you try to paste a string with a newline. You can disable it if you find it annoying.
- riddley 3y agoYou might try a clipboard manager. Most of these that I've used have an option to strip new lines from anything in the clipboard.
- crlfcrlf 3y agoYou find it irritating that terminals execute commands when they receive a newline, which is indistinguishable from pressing the enter key? The program is doing exactly as it should. Consider not copying newline characters, and you will solve the problem.
- crlfcrlf 3y ago[dead]
- mixmastamyk 3y agoBracketed paste has been a thing for twenty years now: https://en.wikipedia.org/wiki/Bracketed-paste https://en.wikipedia.org/wiki/Bracketed-paste Put in .inputrc: https://wiki.archlinux.org/title/Readline#Bracketed_paste https://wiki.archlinux.org/title/Readline#Bracketed_paste
- marcosdumay 3y agoYou want to use C-x C-e.
- avgcorrection 3y agoBash bind 'set enable-bracketed-paste on'
- mixmastamyk 3y agoPut in .inputrc which I believe is portable to readline shells: https://wiki.archlinux.org/title/Readline#Bracketed_paste https://wiki.archlinux.org/title/Readline#Bracketed_paste
- avgcorrection 3y agoWouldn’t surprise me if that’s the article where I got it from. :)
- aequitas 3y agoFish shell by default does the expected behaviour of inserting in and allowing you to edit the command (multiline if needed) before executing it with [enter]. I've found Fish shell to have a lot of sane defaults and have yet to find a thing I would like to customize except for the prompt.
- theshrike79 3y agoAnd the best way to customise the prompt is to install https://starship.rs https://starship.rs =)
- twic 3y agoIf i know there will be at most one newline, i start by typing "# ", then paste. If the newline gets interpreted, then the whole line is just a comment anyway. It's then easy to edit the # off the start of the line before running it for real.