-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Yanking multiple lines #821
Description
When using C-y to paste from the X clipboard, fish is immune to this trick which I think is a feature. Instead of running the invisible commands, it inserts them on the commandline. This is great not just because it prevents an "attack" of sorts, but also because it is annoying when you paste benevolent commands that you want to edit before executing, but then they're executed before you have a chance to edit them.
But I think we could improve how it inserts the text on the commandline. Currently, newlines are inserted literally as the \n escape, and the following commands become part of an argument to the first command. I think it would be more useful to insert actual newlines in the commandline, as the commandline editor in fish handles multiple lines just fine. In fact you can do this from fish with commandline line1 line2.
If you actually do want to paste text as a single argument, just use quotes, since quotes can span multiple lines in fish. This would even work better than the current behavior as currently spaces aren't escaped so you get multiple arguments, and if you quote it you get escape codes in your string that's not expanded.
Possibly the pasted commandline could also be automatically formatted like when you type in it manually, but this is of lesser import. On the other hand we might get this for free since it appears to be the behavior of e.g. commandline begin echo end.