mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2026-11-28 03:13:03 +01:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
54982410a9 |
No files matched your search
+8
-14
@@ -295,23 +295,17 @@ function _omz::plugin::disable {
|
||||
fi
|
||||
|
||||
# Remove plugins substitution awk script
|
||||
# A match consumes the whitespace around the plugin, so adjacent plugins
|
||||
# can't match in the same pass: repeat until the line stops changing.
|
||||
local awk_subst_plugins="\
|
||||
do {
|
||||
prev = \$0
|
||||
gsub(/[ \t]+(${(j:|:)dis_plugins})[ \t]+/, \" \") # with spaces before or after
|
||||
gsub(/[ \t]+(${(j:|:)dis_plugins})$/, \"\") # with spaces before and EOL
|
||||
gsub(/^(${(j:|:)dis_plugins})[ \t]+/, \"\") # with BOL and spaces after
|
||||
|
||||
gsub(/[ \t]+(${(j:|:)dis_plugins})[ \t]+/, \" \") # with spaces before or after
|
||||
gsub(/[ \t]+(${(j:|:)dis_plugins})$/, \"\") # with spaces before and EOL
|
||||
gsub(/^(${(j:|:)dis_plugins})[ \t]+/, \"\") # with BOL and spaces after
|
||||
gsub(/\((${(j:|:)dis_plugins})[ \t]+/, \"(\") # with parenthesis before and spaces after
|
||||
gsub(/[ \t]+(${(j:|:)dis_plugins})\)/, \")\") # with spaces before or parenthesis after
|
||||
gsub(/\((${(j:|:)dis_plugins})\)/, \"()\") # with only parentheses
|
||||
|
||||
gsub(/\((${(j:|:)dis_plugins})[ \t]+/, \"(\") # with parenthesis before and spaces after
|
||||
gsub(/[ \t]+(${(j:|:)dis_plugins})\)/, \")\") # with spaces before or parenthesis after
|
||||
gsub(/\((${(j:|:)dis_plugins})\)/, \"()\") # with only parentheses
|
||||
|
||||
gsub(/^(${(j:|:)dis_plugins})\)/, \")\") # with BOL and closing parenthesis
|
||||
gsub(/\((${(j:|:)dis_plugins})$/, \"(\") # with opening parenthesis and EOL
|
||||
} while (\$0 != prev)
|
||||
gsub(/^(${(j:|:)dis_plugins})\)/, \")\") # with BOL and closing parenthesis
|
||||
gsub(/\((${(j:|:)dis_plugins})$/, \"(\") # with opening parenthesis and EOL
|
||||
"
|
||||
|
||||
# Disable plugins awk script
|
||||
|
||||
@@ -16,10 +16,6 @@
|
||||
# - 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.
|
||||
##
|
||||
@@ -52,22 +48,6 @@
|
||||
# # 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
|
||||
|
||||
@@ -107,9 +87,6 @@ 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
|
||||
@@ -124,10 +101,6 @@ 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 {
|
||||
|
||||
+8
-43
@@ -7,20 +7,16 @@ run_awk() {
|
||||
(( ! DEBUG )) || set -xv
|
||||
|
||||
local awk_subst_plugins="\
|
||||
do {
|
||||
prev = \$0
|
||||
gsub(/[ \t]+(${(j:|:)dis_plugins})[ \t]+/, \" \") # with spaces before or after
|
||||
gsub(/[ \t]+(${(j:|:)dis_plugins})$/, \"\") # with spaces before and EOL
|
||||
gsub(/^(${(j:|:)dis_plugins})[ \t]+/, \"\") # with BOL and spaces after
|
||||
|
||||
gsub(/[ \t]+(${(j:|:)dis_plugins})[ \t]+/, \" \") # with spaces before or after
|
||||
gsub(/[ \t]+(${(j:|:)dis_plugins})$/, \"\") # with spaces before and EOL
|
||||
gsub(/^(${(j:|:)dis_plugins})[ \t]+/, \"\") # with BOL and spaces after
|
||||
gsub(/\((${(j:|:)dis_plugins})[ \t]+/, \"(\") # with parenthesis before and spaces after
|
||||
gsub(/[ \t]+(${(j:|:)dis_plugins})\)/, \")\") # with spaces before or parenthesis after
|
||||
gsub(/\((${(j:|:)dis_plugins})\)/, \"()\") # with only parentheses
|
||||
|
||||
gsub(/\((${(j:|:)dis_plugins})[ \t]+/, \"(\") # with parenthesis before and spaces after
|
||||
gsub(/[ \t]+(${(j:|:)dis_plugins})\)/, \")\") # with spaces before or parenthesis after
|
||||
gsub(/\((${(j:|:)dis_plugins})\)/, \"()\") # with only parentheses
|
||||
|
||||
gsub(/^(${(j:|:)dis_plugins})\)/, \")\") # with BOL and closing parenthesis
|
||||
gsub(/\((${(j:|:)dis_plugins})$/, \"(\") # with opening parenthesis and EOL
|
||||
} while (\$0 != prev)
|
||||
gsub(/^(${(j:|:)dis_plugins})\)/, \")\") # with BOL and closing parenthesis
|
||||
gsub(/\((${(j:|:)dis_plugins})$/, \"(\") # with opening parenthesis and EOL
|
||||
"
|
||||
# Disable plugins awk script
|
||||
local awk_script="
|
||||
@@ -171,34 +167,3 @@ z)" \
|
||||
"plugins=(
|
||||
git
|
||||
)"
|
||||
|
||||
run_awk_and_test \
|
||||
"it should delete two adjacent plugins among others in oneline format" \
|
||||
"docker kubectl" \
|
||||
"plugins=(git docker kubectl npm)" \
|
||||
"plugins=(git npm)"
|
||||
|
||||
run_awk_and_test \
|
||||
"it should delete three adjacent plugins among others in oneline format" \
|
||||
"docker kubectl aws" \
|
||||
"plugins=(git docker kubectl aws npm)" \
|
||||
"plugins=(git npm)"
|
||||
|
||||
run_awk_and_test \
|
||||
"it should delete every plugin of a long oneline list" \
|
||||
"git docker kubectl aws npm z" \
|
||||
"plugins=(git docker kubectl aws npm z)" \
|
||||
"plugins=()"
|
||||
|
||||
run_awk_and_test \
|
||||
"it should delete adjacent plugins sharing a line in multiline format" \
|
||||
"docker kubectl aws" \
|
||||
"plugins=(
|
||||
git
|
||||
docker kubectl aws
|
||||
npm
|
||||
)" \
|
||||
"plugins=(
|
||||
git
|
||||
npm
|
||||
)"
|
||||
@@ -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` | `bu && bup` | Update Homebrew data, then upgrade outdated, unpinned brews. |
|
||||
| `bubu` | `bubo && bup` | Do the last two operations above. |
|
||||
| `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='bu && bup'
|
||||
alias bubu='bubo && bup'
|
||||
alias bubug='bubo && bugbc'
|
||||
alias bugbc='brew upgrade --greedy && brew cleanup'
|
||||
alias bup='brew upgrade'
|
||||
|
||||
+3
-11
@@ -1,6 +1,6 @@
|
||||
# conda plugin
|
||||
|
||||
The conda plugin provides [aliases](#aliases) and [completion](#completion) for `conda`, usually installed via [anaconda](https://www.anaconda.com/) or [miniconda](https://docs.conda.io/en/latest/miniconda.html).
|
||||
The conda plugin provides [aliases](#aliases) for `conda`, usually installed via [anaconda](https://www.anaconda.com/) or [miniconda](https://docs.conda.io/en/latest/miniconda.html).
|
||||
|
||||
To use it, add `conda` to the plugins array in your zshrc file:
|
||||
|
||||
@@ -28,18 +28,10 @@ plugins=(... conda)
|
||||
| `cnle` | `conda list --export` | Export the list of installed packages in the current environment |
|
||||
| `cnles` | `conda list --explicit > spec-file.txt` | Export the list of installed packages in the current environment to a spec file |
|
||||
| `cnr` | `conda remove` | Remove given package |
|
||||
| `cnrn` | `conda remove -y --all -n` | Remove all packages in the specified environment |
|
||||
| `cnrp` | `conda remove -y --all -p` | Remove all packages in the specified prefix |
|
||||
| `cnrn` | `conda remove -y -all -n` | Remove all packages in the specified environment |
|
||||
| `cnrp` | `conda remove -y -all -p` | Remove all packages in the specified prefix |
|
||||
| `cnry` | `conda remove -y` | Remove given package without confirmation |
|
||||
| `cnsr` | `conda search` | Search conda repositories for package |
|
||||
| `cnu` | `conda update` | Update conda package manager |
|
||||
| `cnua` | `conda update --all` | Update all installed packages |
|
||||
| `cnuc` | `conda update conda` | Update conda package manager |
|
||||
|
||||
## Completion
|
||||
|
||||
Tab completion is available for the following commands, using the environment list conda keeps in
|
||||
`~/.conda/environments.txt`:
|
||||
|
||||
- `cna`: completes environment names for `conda activate`
|
||||
- `cnrn`: completes environment names for `conda remove -y --all -n`
|
||||
@@ -1,7 +1,4 @@
|
||||
unalias cna cnrn 2>/dev/null
|
||||
cna() { conda activate "$@"; }
|
||||
cnrn() { conda remove -y --all -n "$@"; }
|
||||
|
||||
alias cna='conda activate'
|
||||
alias cnab='conda activate base'
|
||||
alias cncf='conda env create -f'
|
||||
alias cncn='conda create -y -n'
|
||||
@@ -17,26 +14,10 @@ alias cnl='conda list'
|
||||
alias cnle='conda list --export'
|
||||
alias cnles='conda list --explicit > spec-file.txt'
|
||||
alias cnr='conda remove'
|
||||
alias cnrn='conda remove -y --all -n'
|
||||
alias cnrp='conda remove -y --all -p'
|
||||
alias cnry='conda remove -y'
|
||||
alias cnsr='conda search'
|
||||
alias cnu='conda update'
|
||||
alias cnua='conda update --all'
|
||||
alias cnuc='conda update conda'
|
||||
|
||||
_omz_conda_envs() {
|
||||
emulate -L zsh -o extended_glob
|
||||
local envs_file="$HOME/.conda/environments.txt"
|
||||
[[ -r "$envs_file" ]] || return 1
|
||||
|
||||
# Each line is an env prefix; named envs live under <dir>/envs/<name>.
|
||||
# The root prefix (base) and envs created with -p have no name and are skipped.
|
||||
local -aU envs
|
||||
envs=(${(f)"$(<$envs_file)"})
|
||||
envs=(${${(M)envs:#*/envs/[^/]##}:t})
|
||||
(( ${#envs} )) && compadd -Q -a envs
|
||||
}
|
||||
|
||||
if (( $+functions[compdef] )); then
|
||||
compdef _omz_conda_envs cna cnrn
|
||||
fi
|
||||
@@ -263,9 +263,9 @@ _dotenv_check_syntax() {
|
||||
local filename="$1"
|
||||
|
||||
if (( $# == 2 )); then
|
||||
printf '%s' "$2" | command zsh -fn /dev/stdin
|
||||
printf '%s' "$2" | zsh -fn /dev/stdin
|
||||
else
|
||||
command zsh -fn -- "$filename"
|
||||
zsh -fn -- "$filename"
|
||||
fi || {
|
||||
echo "dotenv: error when sourcing '$filename' file" >&2
|
||||
return 1
|
||||
|
||||
@@ -45,12 +45,9 @@ plugins=(... extract)
|
||||
| `tar.lrz` | Tarball with lrzip compression |
|
||||
| `tar.lz` | Tarball with lzip compression |
|
||||
| `tar.lz4` | Tarball with lz4 compression |
|
||||
| `tar.lzma` | Tarball with lzma compression |
|
||||
| `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 |
|
||||
|
||||
@@ -31,7 +31,6 @@ local -a exts=(
|
||||
tar.lrz
|
||||
tar.lz
|
||||
tar.lz4
|
||||
tar.lzma
|
||||
tar.xz
|
||||
tar.zma
|
||||
tar.zst
|
||||
|
||||
Regular → Executable
+1
-6
@@ -88,7 +88,7 @@ EOF
|
||||
tar --xz --help &> /dev/null \
|
||||
&& tar --xz -xvf "$full_path" \
|
||||
|| xzcat "$full_path" | tar xvf - } ;;
|
||||
(*.tar.lzma|*.tar.zma|*.tlz)
|
||||
(*.tar.zma|*.tlz)
|
||||
tar --lzma --help &> /dev/null \
|
||||
&& tar --lzma -xvf "$full_path" \
|
||||
|| lzcat "$full_path" | tar xvf - ;;
|
||||
@@ -97,11 +97,6 @@ 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" ;;
|
||||
|
||||
@@ -167,11 +167,7 @@ check_deb_multiple() {
|
||||
printf '\037\235\220\150\312\260\141\363\106\001' \
|
||||
> "$test_dir/fixture.Z"
|
||||
|
||||
cp "$test_dir/plain" "$test_dir/sample.txt"
|
||||
tar -cf "$test_dir/fixture.tar" -C "$test_dir" sample.txt
|
||||
lzma -c "$test_dir/fixture.tar" > "$test_dir/fixture.tar.lzma"
|
||||
|
||||
for extension in lzma Z tar.lzma; do
|
||||
for extension in lzma Z; do
|
||||
for mode in default target remove; do
|
||||
check_extract "$extension" "$mode"
|
||||
done
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
# Fizzy CLI plugin
|
||||
|
||||
This plugin adds completion for the [Fizzy CLI (fizzy)](https://github.com/basecamp/fizzy-cli).
|
||||
|
||||
To use it, add `fizzy` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... fizzy)
|
||||
```
|
||||
|
||||
This plugin does not add any aliases.
|
||||
|
||||
## Cache
|
||||
|
||||
This plugin caches the completion script and automatically updates it when the
|
||||
plugin is loaded, which is usually when you start a new terminal emulator.
|
||||
|
||||
The cache is stored at `$ZSH_CACHE_DIR/completions/_fizzy`.
|
||||
@@ -1,24 +0,0 @@
|
||||
# Autocompletion for the Fizzy CLI (fizzy).
|
||||
if (( ! $+commands[fizzy] )); then
|
||||
return
|
||||
fi
|
||||
|
||||
# If the completion isn't registered yet, autoload it and bind it to `fizzy`.
|
||||
# Otherwise, compinit will have already done that from the cache.
|
||||
if [[ -z ${_comps[fizzy]-} ]]; then
|
||||
typeset -g -A _comps
|
||||
autoload -Uz _fizzy
|
||||
_comps[fizzy]=_fizzy
|
||||
fi
|
||||
|
||||
zmodload -F zsh/files b:zf_mv || return
|
||||
() {
|
||||
local cache_file="$ZSH_CACHE_DIR/completions/_fizzy"
|
||||
local temp_file
|
||||
temp_file=$(mktemp "$ZSH_CACHE_DIR/completions/._fizzy.XXXXXXXX") || return
|
||||
if command fizzy completion zsh >| "$temp_file" && [[ -s "$temp_file" ]] &&
|
||||
zf_mv -f -- "$temp_file" "$cache_file"; then
|
||||
return
|
||||
fi
|
||||
rm -f -- "$temp_file"
|
||||
} &|
|
||||
@@ -44,7 +44,6 @@ plugins=(... jj)
|
||||
| jjgi | `jj git init` |
|
||||
| jjgp | `jj git push` |
|
||||
| jjgpa | `jj git push --all` |
|
||||
| jjgpb | `jj git push --bookmark` |
|
||||
| jjgpd | `jj git push --deleted` |
|
||||
| jjgpt | `jj git push --tracked` |
|
||||
| jjgrl | `jj git remote list` |
|
||||
|
||||
@@ -70,7 +70,6 @@ alias jjgfa='jj git fetch --all-remotes'
|
||||
alias jjgi='jj git init'
|
||||
alias jjgp='jj git push'
|
||||
alias jjgpa='jj git push --all'
|
||||
alias jjgpb='jj git push --bookmark'
|
||||
alias jjgpd='jj git push --deleted'
|
||||
alias jjgpt='jj git push --tracked'
|
||||
alias jjgrl='jj git remote list'
|
||||
|
||||
+12
-15
@@ -72,6 +72,11 @@ EOF
|
||||
return 0
|
||||
;;
|
||||
shuf|shuff|shuffle)
|
||||
# The shuffle property of current playlist can't be changed in iTunes 12,
|
||||
# so this workaround uses AppleScript to simulate user input instead.
|
||||
# Defaults to toggling when no options are given.
|
||||
# The toggle option depends on the shuffle button being visible in the Now playing area.
|
||||
# On and off use the menu bar items.
|
||||
local state=$1
|
||||
|
||||
if [[ -n "$state" && "$state" != (on|off|toggle) ]]; then
|
||||
@@ -80,24 +85,16 @@ EOF
|
||||
fi
|
||||
|
||||
case "$state" in
|
||||
# Inspired by: https://stackoverflow.com/a/43942013/2396771
|
||||
on)
|
||||
osascript -e "tell application \"$APP_NAME\" to set shuffle enabled to true";
|
||||
return 0
|
||||
;;
|
||||
off)
|
||||
osascript -e "tell application \"$APP_NAME\" to set shuffle enabled to false";
|
||||
on|off)
|
||||
# Inspired by: https://stackoverflow.com/a/14675583
|
||||
osascript >/dev/null 2>&1 <<EOF
|
||||
tell application "System Events" to perform action "AXPress" of (menu item "${state}" of menu "Shuffle" of menu item "Shuffle" of menu "Controls" of menu bar item "Controls" of menu bar 1 of application process "iTunes" )
|
||||
EOF
|
||||
return 0
|
||||
;;
|
||||
toggle|*)
|
||||
osascript 2>/dev/null <<EOF
|
||||
tell application "$APP_NAME"
|
||||
if shuffle enabled then
|
||||
set shuffle enabled to false
|
||||
else
|
||||
set shuffle enabled to true
|
||||
end
|
||||
end tell
|
||||
osascript >/dev/null 2>&1 <<EOF
|
||||
tell application "System Events" to perform action "AXPress" of (button 2 of process "iTunes"'s window "iTunes"'s scroll area 1)
|
||||
EOF
|
||||
return 0
|
||||
;;
|
||||
|
||||
@@ -15,7 +15,7 @@ plugins=(... pre-commit)
|
||||
| Alias | Command | Description |
|
||||
| ----- | ------------------------------------------------------ | --------------------------------------------- |
|
||||
| prc | `prek` or `pre-commit` | The pre-commit command |
|
||||
| prcau | `prek autoupdate` or `pre-commit autoupdate` | Update hooks automatically |
|
||||
| prcau | `prek auto-update` or `pre-commit autoupdate` | Update hooks automatically |
|
||||
| prcr | `prek run` or `pre-commit run` | The pre-commit run command |
|
||||
| prcra | `prek run --all-files` or `pre-commit run --all-files` | Run pre-commit hooks on all files |
|
||||
| prcrf | `prek run --files` or `pre-commit run --files` | Run pre-commit hooks on a given list of files |
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
# Aliases for pre-commit (uses prek if available, else pre-commit)
|
||||
if command -v prek &> /dev/null; then
|
||||
_prc_cmd='prek'
|
||||
_prc_autoupdate='auto-update'
|
||||
else
|
||||
_prc_cmd='pre-commit'
|
||||
_prc_autoupdate='autoupdate'
|
||||
fi
|
||||
|
||||
alias prc="$_prc_cmd"
|
||||
|
||||
alias prcau="$_prc_cmd autoupdate"
|
||||
alias prcau="$_prc_cmd $_prc_autoupdate"
|
||||
|
||||
alias prcr="$_prc_cmd run"
|
||||
alias prcra="$_prc_cmd run --all-files"
|
||||
|
||||
@@ -46,7 +46,6 @@ 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)
|
||||
...
|
||||
@@ -55,14 +54,6 @@ 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`.
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
# zellij
|
||||
|
||||
This plugin provides aliases, functions, and completions for [zellij](https://zellij.dev/),
|
||||
the terminal workspace (multiplexer). To use it, add `zellij` to the plugins array in your
|
||||
zshrc file.
|
||||
|
||||
```zsh
|
||||
plugins=(... zellij)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
| ------ | ---------------------------- | --------------------------- |
|
||||
| `zj` | `zellij` | Zellij command |
|
||||
| `zjl` | `zellij list-sessions` | List sessions |
|
||||
| `zjs` | `zellij -s` | Start a named session |
|
||||
| `zjda` | `zellij delete-all-sessions` | Delete all sessions |
|
||||
| `zjka` | `zellij kill-all-sessions` | Kill all sessions |
|
||||
| `zjr` | `zellij run` | Run a command in a pane |
|
||||
| `zjad` | `zellij action detach` | Detach from current session |
|
||||
|
||||
## Functions
|
||||
|
||||
| Function | Command | Description |
|
||||
| -------- | -------------------------------- | -------------------------------- |
|
||||
| `zja` | `zellij attach` | Attach to a session |
|
||||
| `zjd` | `zellij delete-session` | Delete a session (exited only) |
|
||||
| `zjdf` | `zellij delete-session --force` | Force-delete any session |
|
||||
| `zjk` | `zellij kill-session` | Kill a session |
|
||||
| `zjas` | `zellij action switch-session` | Switch to a session |
|
||||
| `zjrf` | `zellij run --floating --` | Run a command in a floating pane |
|
||||
| `zje` | `zellij edit` | Edit a file in a pane |
|
||||
|
||||
## Completions
|
||||
|
||||
This plugin caches the zellij completion script. On first load the cache is generated
|
||||
synchronously; subsequent updates (when the `zellij` binary is newer than the cache) happen in
|
||||
the background. The cache is written to a temporary file and moved into place, so a
|
||||
partially written file is never loaded.
|
||||
|
||||
Session-aware completions are provided for `zja`, `zjdf` and `zjas` (all sessions), `zjk`
|
||||
(running sessions) and `zjd` (exited sessions).
|
||||
@@ -1,77 +0,0 @@
|
||||
if (( ! $+commands[zellij] )); then
|
||||
return
|
||||
fi
|
||||
|
||||
# Aliases
|
||||
alias zj='zellij'
|
||||
alias zjl='zellij list-sessions'
|
||||
alias zjs='zellij -s'
|
||||
alias zjda='zellij delete-all-sessions'
|
||||
alias zjka='zellij kill-all-sessions'
|
||||
alias zjr='zellij run'
|
||||
alias zjad='zellij action detach'
|
||||
|
||||
# Functions (with session-aware completion)
|
||||
function zja { command zellij attach "$@"; }
|
||||
function zjd { command zellij delete-session "$@"; }
|
||||
function zjdf { command zellij delete-session --force "$@"; }
|
||||
function zjk { command zellij kill-session "$@"; }
|
||||
function zjas { command zellij action switch-session "$@"; }
|
||||
|
||||
# Convenience functions
|
||||
function zjrf { command zellij run --floating -- "$@"; }
|
||||
function zje { command zellij edit "$@"; }
|
||||
|
||||
# Completion cache: generate synchronously on first load, regenerate in the
|
||||
# background when the zellij binary is newer than the cache. Write to a temp
|
||||
# file in the same directory and rename it, so a partial file is never loaded.
|
||||
_omz_zellij_gen_completion() {
|
||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._zellij"
|
||||
zf_mv -f -- =( command zellij setup --generate-completion zsh 2>/dev/null ) "$ZSH_CACHE_DIR/completions/_zellij"
|
||||
}
|
||||
|
||||
zmodload -F zsh/files b:zf_mv
|
||||
if [[ ! -s "$ZSH_CACHE_DIR/completions/_zellij" ]]; then
|
||||
_omz_zellij_gen_completion
|
||||
elif [[ $commands[zellij] -nt "$ZSH_CACHE_DIR/completions/_zellij" ]]; then
|
||||
_omz_zellij_gen_completion &|
|
||||
fi
|
||||
|
||||
_omz_zellij_ls_raw() {
|
||||
command zellij list-sessions --no-formatting 2>/dev/null || command zellij list-sessions 2>/dev/null
|
||||
}
|
||||
|
||||
_omz_zellij_session_names() {
|
||||
# Use --short if available (zellij >= 0.44), fall back to sed parsing
|
||||
command zellij list-sessions --short --no-formatting 2>/dev/null \
|
||||
|| _omz_zellij_ls_raw | LC_ALL=C sed -nE 's/^([^[:space:]]+).*/\1/p'
|
||||
}
|
||||
|
||||
_omz_zellij_all_sessions() {
|
||||
emulate -L zsh
|
||||
local -a sessions
|
||||
sessions=(${(f)"$(_omz_zellij_session_names)"})
|
||||
(( ${#sessions} )) && compadd -Q -a sessions
|
||||
}
|
||||
|
||||
_omz_zellij_running_sessions() {
|
||||
emulate -L zsh
|
||||
local -a sessions
|
||||
sessions=(${(f)"$(_omz_zellij_ls_raw | LC_ALL=C sed -nE '/\(EXITED/!s/^([^[:space:]]+).*/\1/p')"})
|
||||
(( ${#sessions} )) && compadd -Q -a sessions
|
||||
}
|
||||
|
||||
_omz_zellij_exited_sessions() {
|
||||
emulate -L zsh
|
||||
local -a sessions
|
||||
sessions=(${(f)"$(_omz_zellij_ls_raw | LC_ALL=C sed -nE '/\(EXITED/s/^([^[:space:]]+).*/\1/p')"})
|
||||
(( ${#sessions} )) && compadd -Q -a sessions
|
||||
}
|
||||
|
||||
if (( $+functions[compdef] )); then
|
||||
autoload -Uz _zellij
|
||||
compdef _zellij zellij
|
||||
compdef _omz_zellij_all_sessions zja zjdf zjas
|
||||
compdef _omz_zellij_running_sessions zjk
|
||||
compdef _omz_zellij_exited_sessions zjd
|
||||
fi
|
||||
@@ -338,7 +338,7 @@ prompt_status() {
|
||||
[[ $RETVAL -ne 0 ]] && symbols+="%{%F{$AGNOSTER_STATUS_RETVAL_FG}%}✘"
|
||||
fi
|
||||
[[ $UID -eq 0 ]] && symbols+="%{%F{$AGNOSTER_STATUS_ROOT_FG}%}⚡"
|
||||
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{$AGNOSTER_STATUS_JOB_FG}%}⚙"
|
||||
(( ${#jobstates} )) && symbols+="%{%F{$AGNOSTER_STATUS_JOB_FG}%}⚙"
|
||||
|
||||
[[ -n "$symbols" ]] && prompt_segment "$AGNOSTER_STATUS_BG" "$AGNOSTER_STATUS_FG" "$symbols"
|
||||
}
|
||||
|
||||
@@ -160,13 +160,13 @@ function update_ohmyzsh() {
|
||||
fi
|
||||
|
||||
if [[ "$update_mode" != background-alpha ]] \
|
||||
&& LANG= ZSH="$ZSH" command zsh -f "$ZSH/tools/upgrade.sh" -i -v $verbose_mode -c $cooldown_days; then
|
||||
&& LANG= ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" -i -v $verbose_mode -c $cooldown_days; then
|
||||
update_last_updated_file
|
||||
return $?
|
||||
fi
|
||||
|
||||
local exit_status error
|
||||
if error=$(LANG= ZSH="$ZSH" command zsh -f "$ZSH/tools/upgrade.sh" -i -v silent -c $cooldown_days 2>&1); then
|
||||
if error=$(LANG= ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" -i -v silent -c $cooldown_days 2>&1); then
|
||||
update_last_updated_file 0 "Update successful"
|
||||
else
|
||||
exit_status=$?
|
||||
|
||||
Reference in new issue
Block a user