mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-12 15:34:50 +08:00
Compare commits
3 Commits
225eb39785
...
07b3f5b8c5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
07b3f5b8c5 | ||
|
|
92aed2e936 | ||
|
|
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; }
|
||||||
|
|||||||
@ -77,7 +77,15 @@ EOF
|
|||||||
(*.lzma) unlzma "$full_path" ;;
|
(*.lzma) unlzma "$full_path" ;;
|
||||||
(*.z) uncompress "$full_path" ;;
|
(*.z) uncompress "$full_path" ;;
|
||||||
(*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl|*.vsix|*.crx|*.pk3|*.pk4) unzip "$full_path" ;;
|
(*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl|*.vsix|*.crx|*.pk3|*.pk4) unzip "$full_path" ;;
|
||||||
(*.rar) unrar x -ad "$full_path" ;;
|
(*.rar)
|
||||||
|
if (( $+commands[unrar] )); then
|
||||||
|
unrar x -ad "$full_path"
|
||||||
|
elif (( $+commands[unar] )); then
|
||||||
|
unar -o . "$full_path"
|
||||||
|
else
|
||||||
|
echo "extract: cannot extract RAR files: install unrar or unar" >&2
|
||||||
|
success=1
|
||||||
|
fi ;;
|
||||||
(*.rpm)
|
(*.rpm)
|
||||||
rpm2cpio "$full_path" | cpio --quiet -id ;;
|
rpm2cpio "$full_path" | cpio --quiet -id ;;
|
||||||
(*.7z | *.7z.[0-9]* | *.pk7) 7za x "$full_path" ;;
|
(*.7z | *.7z.[0-9]* | *.pk7) 7za x "$full_path" ;;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user