fish-shell/share/functions/fish_clipboard_copy.fish
Fabian Homborg bcce6d691f Keep "; and" and "; or" on fish files
This reformats *.fish files from before commit
c2970f9618 with the changes to fish_indent.

[ci skip]
2019-05-05 13:34:38 +02:00

16 lines
629 B
Fish

function fish_clipboard_copy
# Copy the current selection, or the entire commandline if that is empty.
set -l cmdline (commandline --current-selection)
test -n "$cmdline"; or set cmdline (commandline)
if type -q pbcopy
printf '%s\n' $cmdline | pbcopy
else if type -q xsel
# Silence error so no error message shows up
# if e.g. X isn't running.
printf '%s\n' $cmdline | xsel --clipboard 2>/dev/null
else if type -q xclip
printf '%s\n' $cmdline | xclip -selection clipboard 2>/dev/null
else if type -q wl-copy
printf '%s\n' $cmdline | wl-copy
end
end