2016-05-24 11:17:03 +00:00
|
|
|
function fish_clipboard_paste
|
2016-11-28 05:27:22 +00:00
|
|
|
if type -q pbpaste
|
2016-07-03 10:25:56 +00:00
|
|
|
commandline -i -- (pbpaste)
|
2016-05-24 11:17:03 +00:00
|
|
|
else if type -q xsel
|
2016-11-28 09:09:58 +00: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 20:26:51 +00:00
|
|
|
# Also require non-empty contents to not clear the buffer.
|
2016-11-28 09:09:58 +00:00
|
|
|
if set -l data (xsel --clipboard)
|
2016-12-10 20:26:51 +00:00
|
|
|
and test -n "$data"
|
2016-11-28 09:09:58 +00:00
|
|
|
commandline -i -- $data
|
|
|
|
end
|
2016-05-24 11:17:03 +00:00
|
|
|
end
|
|
|
|
end
|