mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2026-11-28 03:13:03 +01:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5873e1cfec | ||
|
|
03ba23c9f6 | ||
|
|
597dff9477 | ||
|
|
80ec81e340 |
No files matched your search
@@ -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 {
|
||||
|
||||
@@ -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. |
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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 |
|
||||
|
||||
@@ -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" ;;
|
||||
|
||||
@@ -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`.
|
||||
|
||||
Reference in new issue
Block a user