fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Johannes AltmanningerExtended & human-friendly keys8bf8b10f6

master
891 B27 linesraw
1function fish_clipboard_paste
2    set -l data
3    if type -q pbpaste
4        set data (pbpaste 2>/dev/null | string collect -N)
5    else if set -q WAYLAND_DISPLAY; and type -q wl-paste
6        set data (wl-paste -n 2>/dev/null | string collect -N)
7    else if set -q DISPLAY; and type -q xsel
8        set data (xsel --clipboard | string collect -N)
9    else if set -q DISPLAY; and type -q xclip
10        set data (xclip -selection clipboard -o 2>/dev/null | string collect -N)
11    else if type -q powershell.exe
12        set data (powershell.exe Get-Clipboard | string trim -r -c \r | string collect -N)
13    end
14
15    # Issue 6254: Handle zero-length clipboard content
16    if not string length -q -- "$data"
17        return 1
18    end
19
20    if not isatty stdout
21        # If we're redirected, just write the data *as-is*.
22        printf %s $data
23        return
24    end
25
26    __fish_paste $data
27end