4 ms·
A much better feature is available in zsh, called safe-paste, that does this without the user having to insert "tap" or anything else manually. It relies on som
by semi-extrinsic 10y ago
A much better feature is available in zsh, called safe-paste, that does this without the user having to insert "tap" or anything else manually. It relies on something called bracketed paste, where the terminal emulator sends special escape sequences to indicate the beginning and end of a paste. These are intercepted by the zsh plugin, which opens $EDITOR with the pasted content.
https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/safe-paste/safe-paste.plugin.zsh https://github.com/robbyrussell/oh-my-zsh/blob/master/plugin...
- JadeNB 10y agoBracketed paste mode can still be broken by a malicious web-site: https://thejh.net/misc/website-terminal-copy-paste https://thejh.net/misc/website-terminal-copy-paste . Does this solution have the same vulnerability?
- semi-extrinsic 10y agoDepends on the terminal emulator you're using, I believe. It (and not zsh) needs to filter out escape sequences.
- tree_of_item 10y agoHow is it better? Pasting is a totally different use case from `curl | sh`.
- semi-extrinsic 10y agoTypical use case: * type "curl <paste>" in zsh, vim opens with "curl <pasted-url> * inspect URL, if OK in Normal mode do !!zsh<CR> (I assume emacs can also somehow eval current line in shell and replace line with output) * inspect the code downloaded (still in vim) and then execute it (or save to file then execute).