diff --git a/share/functions/fish_clipboard_paste.fish b/share/functions/fish_clipboard_paste.fish index 7be522291..dc95e41d6 100644 --- a/share/functions/fish_clipboard_paste.fish +++ b/share/functions/fish_clipboard_paste.fish @@ -2,6 +2,11 @@ function fish_clipboard_paste if type -q pbpaste commandline -i -- (pbpaste) else if type -q xsel - commandline -i -- (xsel --clipboard) + # 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. + if set -l data (xsel --clipboard) + commandline -i -- $data + end end end