2016-05-24 13:17:03 +02:00
|
|
|
function fish_clipboard_paste
|
2016-11-27 21:27:22 -08:00
|
|
|
if type -q pbpaste
|
2016-07-03 12:25:56 +02:00
|
|
|
commandline -i -- (pbpaste)
|
2016-05-24 13:17:03 +02:00
|
|
|
else if type -q xsel
|
2016-11-28 10:09:58 +01:00
|
|
|
# Only run `commandline` if `xsel` succeeded.
|
|
|
|
|
# That way any xsel error is printed (to show e.g. a non-functioning X connection),
|
|
|
|
|
# but we don't print the redundant (and overly verbose for this) commandline error.
|
2016-12-10 21:26:51 +01:00
|
|
|
# Also require non-empty contents to not clear the buffer.
|
2016-11-28 10:09:58 +01:00
|
|
|
if set -l data (xsel --clipboard)
|
2016-12-10 21:26:51 +01:00
|
|
|
and test -n "$data"
|
2016-11-28 10:09:58 +01:00
|
|
|
commandline -i -- $data
|
|
|
|
|
end
|
2016-05-24 13:17:03 +02:00
|
|
|
end
|
|
|
|
|
end
|