Compare commits

..
Author SHA1 Message Date
Jakub Boukal 5873e1cfec docs(python): add PYTHON_AUTO_VRUN to settings (#14233) 2026-11-27 16:20:27 -08:00
alexanderxc 03ba23c9f6 chore(brew): use bu instead of bubo in bubu (#14229) 2026-11-27 16:19:51 -08:00
PerryLink 597dff9477 fix(extract): untar .tar.Z and .taz archives (#14223) 2026-11-27 16:19:46 -08:00
Marco Trevisan 80ec81e340 feat(clipboard): add OSC 52 fallback (#14251)
OSC 52 makes the terminal emulator set the clipboard of the machine the
user is connected from, which is the only way to copy to it when running
over SSH or inside a container with no access to the local display
server.

Use it when no other clipboard tool is available, or when
ZSH_CLIPBOARD_OSC52 is set to "always"; set it to "never" to disable the
fallback. OSC 52 is write-only in practice, so clippaste keeps failing
unless a real clipboard tool is available.

Closes #13459
2026-11-27 16:19:24 -08:00
8 changed files with 46 additions and 46 deletions

No files matched your search

+1 -2
View File
@@ -562,8 +562,7 @@ omz diagnose
It runs a few quick checks and tells you what to fix — for example, it will warn you when
your locale is not UTF-8, which is a common cause of duplicated characters at the prompt
(see the [FAQ](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ#i-see-duplicate-typed-characters-after-i-complete-a-command)),
and it validates your `plugins=(...)` list, suggesting the closest name for any plugin it can't find.
(see the [FAQ](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ#i-see-duplicate-typed-characters-after-i-complete-a-command)).
For a full report suitable for attaching to a bug report, use `omz_diagnostic_dump`.
-42
View File
@@ -190,56 +190,14 @@ function _omz::diagnose {
codeset="$(locale charmap 2>/dev/null)"
fi
local ret=0
if [[ "${codeset:l}" = (utf-8|utf8) ]]; then
_omz::log info "locale charmap is UTF-8"
else
_omz::log warn "your locale is not UTF-8 (charmap: ${codeset:-unknown})"
_omz::log info "non-UTF-8 locales may cause glitches in completions and international characters"
_omz::log info "consider setting a UTF-8 locale, e.g.: export LANG=C.UTF-8"
ret=1
fi
_omz::diagnose::plugins || ret=1
return $ret
}
function _omz::diagnose::plugins {
# Validate the plugins array: flag entries with no matching plugin folder,
# and suggest the closest plugin name (up to 2 typos) for each one.
setopt localoptions extendedglob nullglob
local plugin base found=0
local -a missing guesses
for plugin ($plugins); do
if [[ -f "$ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh" || -f "$ZSH_CUSTOM/plugins/$plugin/_$plugin" \
|| -f "$ZSH/plugins/$plugin/$plugin.plugin.zsh" || -f "$ZSH/plugins/$plugin/_$plugin" ]]; then
(( ++found ))
continue
fi
missing+=("$plugin")
done
for plugin ($missing); do
guesses=()
for base ("$ZSH_CUSTOM/plugins" "$ZSH/plugins"); do
guesses+=("$base"/(#a1)${(b)plugin}(/:t) "$base"/(#a2)${(b)plugin}(/:t))
done
guesses=(${guesses:#$plugin})
if (( $#guesses )); then
_omz::log warn "plugin '$plugin' not found (did you mean '${guesses[1]}'?)" omz::diagnose
else
_omz::log warn "plugin '$plugin' not found" omz::diagnose
fi
done
if (( $#missing )); then
_omz::log info "$found of ${#plugins} plugins found" omz::diagnose
return 1
fi
(( $#plugins )) && _omz::log info "all ${#plugins} plugins found" omz::diagnose
return 0
}
function _omz::help {
+27
View File
@@ -16,6 +16,10 @@
# - doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/
# - win32yank (Windows)
# - tmux (if $TMUX is set)
# - OSC 52 (when no clipboard tool is available, e.g. over SSH or in a container)
#
# Set ZSH_CLIPBOARD_OSC52 to "always" to copy through OSC 52 even if a
# clipboard tool is available, or to "never" to disable the fallback.
#
# Defines two functions, clipcopy and clippaste, based on the detected platform.
##
@@ -48,6 +52,22 @@
# # Paste to a file
# clippaste > file.txt
#
function _has_osc52_clipboard() {
[[ -n "${TTY:-}" ]] && [[ -w "${TTY}" ]] && (( ${+commands[base64]} ))
}
function _clipcopy_osc52() {
emulate -L zsh
local content
content=$(cat "${1:-/dev/stdin}" | base64 | tr -d '\n') || return 1
print -rn -- $'\e]52;c;'"${content}"$'\e\\' > /dev/tty
}
function _clippaste_osc52() {
print 'clippaste: OSC 52 is write-only and no other clipboard tool was found' >&2
return 1
}
function detect-clipboard() {
emulate -L zsh
@@ -87,6 +107,9 @@ function detect-clipboard() {
elif [ -n "${TMUX:-}" ] && (( ${+commands[tmux]} )); then
function clipcopy() { tmux load-buffer -w "${1:--}"; }
function clippaste() { tmux save-buffer -; }
elif [[ "${ZSH_CLIPBOARD_OSC52:-}" != never ]] && _has_osc52_clipboard; then
function clipcopy() { _clipcopy_osc52 "$@"; }
function clippaste() { _clippaste_osc52; }
else
function _retry_clipboard_detection_or_fail() {
local clipcmd="${1}"; shift
@@ -101,6 +124,10 @@ function detect-clipboard() {
function clippaste() { _retry_clipboard_detection_or_fail clippaste "$@"; }
return 1
fi
if [[ "${ZSH_CLIPBOARD_OSC52:-}" == always ]] && _has_osc52_clipboard; then
function clipcopy() { _clipcopy_osc52 "$@"; }
fi
}
function clipcopy clippaste {
+1 -1
View File
@@ -59,7 +59,7 @@ ensures the `bdr` alias runs without warnings.
| `bsra` | `bsr --all` | Run all stopped services. |
| `bu` | `brew update` | Update brew and all installed formulae. |
| `bubo` | `brew update && brew outdated` | Update Homebrew data, then list outdated formulae and casks. |
| `bubu` | `bubo && bup` | Do the last two operations above. |
| `bubu` | `bu && bup` | Update Homebrew data, then upgrade outdated, unpinned brews. |
| `bugbc` | `brew upgrade --greedy && brew cleanup` | Upgrade outdated formulae and casks (greedy), then run cleanup. |
| `bup` | `brew upgrade` | Upgrade outdated, unpinned brews. |
| `buz` | `brew uninstall --zap` | Remove all files associated with a cask. |
+1 -1
View File
@@ -75,7 +75,7 @@ alias bsr='brew services run'
alias bsra='bsr --all'
alias bu='brew update'
alias bubo='brew update && brew outdated'
alias bubu='bubo && bup'
alias bubu='bu && bup'
alias bubug='bubo && bugbc'
alias bugbc='brew upgrade --greedy && brew cleanup'
alias bup='brew upgrade'
+2
View File
@@ -49,6 +49,8 @@ plugins=(... extract)
| `tar.xz` | Tarball with lzma2 compression |
| `tar.zma` | Tarball with lzma compression |
| `tar.zst` | Tarball with zstd compression |
| `tar.Z` | Tarball with compress (LZW) compression |
| `taz` | Tarball with compress (LZW) compression |
| `tbz` | Tarball with bzip compression |
| `tbz2` | Tarball with bzip2 compression |
| `tgz` | Tarball with gzip compression |
+5
View File
@@ -97,6 +97,11 @@ EOF
&& tar --zstd -xvf "$full_path" \
|| zstdcat "$full_path" | tar xvf - ;;
(*.tar) tar xvf "$full_path" ;;
# `tar cf - dir | compress > dir.tar.Z`: the plain `.Z` arm below only decompresses the
# stream back to `dir.tar`, so the combined form has to untar it in one step. `.taz` is the
# historic name for the same file, next to `.tgz`/`.tbz`/`.tlz`/`.txz`/`.tzst`. Matching is
# on the lowercased name, so `.tar.Z` lands here too.
(*.tar.z|*.taz) uncompress -c "$full_path" | tar xvf - ;;
(*.tar.lz) (( $+commands[lzip] )) && tar xvf "$full_path" ;;
(*.tar.lz4) lz4 -c -d "$full_path" | tar xvf - ;;
(*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$full_path" ;;
+9
View File
@@ -46,6 +46,7 @@ You can set these variables in your `.zshrc` file, before Oh My Zsh is sourced.
For example:
```sh
PYTHON_AUTO_VRUN=true
PYTHON_VENV_NAME=".venv"
PYTHON_VENV_NAMES=($PYTHON_VENV_NAME venv)
...
@@ -54,6 +55,14 @@ source "$ZSH/oh-my-zsh.sh"
```
## `$PYTHON_AUTO_VRUN`
**Default**: `false`.
Enable automatic activation of virtual environments when entering a directory containing
`<venv-name>/bin/activate`, and automatically deactivate it when navigating out of it.
Set to `true` to enable this feature.
## `$PYTHON_VENV_NAME`
**Default**: `venv`.