mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-13 16:04:08 +08:00
Compare commits
2 Commits
07b3f5b8c5
...
225eb39785
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
225eb39785 | ||
|
|
d6552d8887 |
@ -54,6 +54,23 @@ function detect-clipboard() {
|
|||||||
if [[ "${OSTYPE}" == darwin* ]] && (( ${+commands[pbcopy]} )) && (( ${+commands[pbpaste]} )); then
|
if [[ "${OSTYPE}" == darwin* ]] && (( ${+commands[pbcopy]} )) && (( ${+commands[pbpaste]} )); then
|
||||||
function clipcopy() { cat "${1:-/dev/stdin}" | pbcopy; }
|
function clipcopy() { cat "${1:-/dev/stdin}" | pbcopy; }
|
||||||
function clippaste() { pbpaste; }
|
function clippaste() { pbpaste; }
|
||||||
|
elif [[ -n "$SSH_CONNECTION" || -n "$SSH_TTY" ]] && \
|
||||||
|
[[ "$TERM" =~ '^(screen|xterm|iterm|kitty|wezterm|alacritty)' || -n "$TERMINAL_EMULATOR" ]] && \
|
||||||
|
(( ${+commands[base64]} )); then
|
||||||
|
function clipcopy() {
|
||||||
|
emulate -L zsh
|
||||||
|
local content
|
||||||
|
if [[ -n "$1" && -f "$1" ]]; then
|
||||||
|
content=$(<"$1")
|
||||||
|
else
|
||||||
|
content=$(</dev/stdin)
|
||||||
|
fi
|
||||||
|
printf "\e]52;c;%s\a" "$(echo -n "$content" | base64 | tr -d '\n')"
|
||||||
|
}
|
||||||
|
function clippaste() {
|
||||||
|
print "clippaste: reading clipboard via OSC 52 is not supported for security reasons." >&2
|
||||||
|
return 1
|
||||||
|
}
|
||||||
elif [[ "${OSTYPE}" == (cygwin|msys)* ]]; then
|
elif [[ "${OSTYPE}" == (cygwin|msys)* ]]; then
|
||||||
function clipcopy() { cat "${1:-/dev/stdin}" > /dev/clipboard; }
|
function clipcopy() { cat "${1:-/dev/stdin}" > /dev/clipboard; }
|
||||||
function clippaste() { cat /dev/clipboard; }
|
function clippaste() { cat /dev/clipboard; }
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user