mirror of https://github.com/ohmyzsh/ohmyzsh.git
Compare commits
No commits in common. "85c49414926ad86f76d7bad3635f948bb5f883cb" and "6e9cda3d30d8e73c11e4d32044b7f4c5e06f822d" have entirely different histories.
85c4941492
...
6e9cda3d30
11
README.md
11
README.md
|
@ -487,17 +487,6 @@ wait a week?) you just need to run:
|
||||||
omz update
|
omz update
|
||||||
```
|
```
|
||||||
|
|
||||||
> [!NOTE]
|
|
||||||
> If you want to automate this process in a script, you should call directly the `upgrade` script, like this:
|
|
||||||
>
|
|
||||||
> ```sh
|
|
||||||
> $ZSH/tools/upgrade.sh
|
|
||||||
> ```
|
|
||||||
>
|
|
||||||
> See more options in the [FAQ: How do I update Oh My Zsh?](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ#how-do-i-update-oh-my-zsh).
|
|
||||||
>
|
|
||||||
> **USE OF `omz update --unattended` HAS BEEN REMOVED, AS IT HAS SIDE EFFECTS**.
|
|
||||||
|
|
||||||
Magic! 🎉
|
Magic! 🎉
|
||||||
|
|
||||||
## Uninstalling Oh My Zsh
|
## Uninstalling Oh My Zsh
|
||||||
|
|
15
lib/cli.zsh
15
lib/cli.zsh
|
@ -823,13 +823,6 @@ function _omz::update {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check if --unattended was passed
|
|
||||||
[[ "$1" != --unattended ]] || {
|
|
||||||
_omz::log error "the \`\e[2m--unattended\e[0m\` flag is no longer supported, use the \`\e[2mupgrade.sh\e[0m\` script instead."
|
|
||||||
_omz::log error "for more information see https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ#how-do-i-update-oh-my-zsh"
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
local last_commit=$(builtin cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null)
|
local last_commit=$(builtin cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null)
|
||||||
[[ $? -eq 0 ]] || {
|
[[ $? -eq 0 ]] || {
|
||||||
_omz::log error "\`$ZSH\` is not a git directory. Aborting..."
|
_omz::log error "\`$ZSH\` is not a git directory. Aborting..."
|
||||||
|
@ -838,7 +831,11 @@ function _omz::update {
|
||||||
|
|
||||||
# Run update script
|
# Run update script
|
||||||
zstyle -s ':omz:update' verbose verbose_mode || verbose_mode=default
|
zstyle -s ':omz:update' verbose verbose_mode || verbose_mode=default
|
||||||
ZSH="$ZSH" command zsh -f "$ZSH/tools/upgrade.sh" -i -v $verbose_mode || return $?
|
if [[ "$1" != --unattended ]]; then
|
||||||
|
ZSH="$ZSH" command zsh -f "$ZSH/tools/upgrade.sh" -i -v $verbose_mode || return $?
|
||||||
|
else
|
||||||
|
ZSH="$ZSH" command zsh -f "$ZSH/tools/upgrade.sh" -v $verbose_mode || return $?
|
||||||
|
fi
|
||||||
|
|
||||||
# Update last updated file
|
# Update last updated file
|
||||||
zmodload zsh/datetime
|
zmodload zsh/datetime
|
||||||
|
@ -847,7 +844,7 @@ function _omz::update {
|
||||||
command rm -rf "$ZSH/log/update.lock"
|
command rm -rf "$ZSH/log/update.lock"
|
||||||
|
|
||||||
# Restart the zsh session if there were changes
|
# Restart the zsh session if there were changes
|
||||||
if [[ "$(builtin cd -q "$ZSH"; git rev-parse HEAD)" != "$last_commit" ]]; then
|
if [[ "$1" != --unattended && "$(builtin cd -q "$ZSH"; git rev-parse HEAD)" != "$last_commit" ]]; then
|
||||||
# Old zsh versions don't have ZSH_ARGZERO
|
# Old zsh versions don't have ZSH_ARGZERO
|
||||||
local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}"
|
local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}"
|
||||||
# Check whether to run a login shell
|
# Check whether to run a login shell
|
||||||
|
|
|
@ -36,10 +36,3 @@ Last login: Fri Jan 30 23:12:26 on ttys001
|
||||||
- `cowsay` if using `chuck_cow`
|
- `cowsay` if using `chuck_cow`
|
||||||
|
|
||||||
Available via homebrew, apt, ...
|
Available via homebrew, apt, ...
|
||||||
|
|
||||||
> [!NOTE]
|
|
||||||
> In addition to installing `fortune`, it may be necessary to run:
|
|
||||||
>
|
|
||||||
> `strfile $ZSH/plugins/chucknorris/fortunes/chucknorris\n`
|
|
||||||
>
|
|
||||||
> (include the "\n" literally) to write the fortune data to the proper directory.
|
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
# If direnv is not found, don't continue and print a warning
|
# Don't continue if direnv is not found
|
||||||
if (( ! $+commands[direnv] )); then
|
command -v direnv &>/dev/null || return
|
||||||
echo "Warning: direnv not found. Please install direnv and ensure it's in your PATH before using this plugin."
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
_direnv_hook() {
|
_direnv_hook() {
|
||||||
trap -- '' SIGINT;
|
trap -- '' SIGINT;
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
# foot
|
|
||||||
|
|
||||||
This plugin adds shell integration for [foot, a fast, lightweight and
|
|
||||||
minimalistic Wayland terminal emulator](https://codeberg.org/dnkl/foot).
|
|
||||||
|
|
||||||
To use, add `foot` to the list of plugins in your `.zshrc` file:
|
|
||||||
|
|
||||||
```zsh
|
|
||||||
plugins=(... foot)
|
|
||||||
```
|
|
||||||
|
|
||||||
## Spawning new terminal instances in the current working directory
|
|
||||||
|
|
||||||
When spawning a new terminal instance (with `ctrl+shift+n` by default), the new
|
|
||||||
instance will start in the current working directory.
|
|
||||||
|
|
||||||
## Jumping between prompts
|
|
||||||
|
|
||||||
Foot can move the current viewport to focus prompts of already executed
|
|
||||||
commands (bound to ctrl+shift+z/x by default).
|
|
||||||
|
|
||||||
## Piping last command's output
|
|
||||||
|
|
||||||
The key binding `pipe-command-output` can pipe the last command's output to an
|
|
||||||
application of your choice (similar to the other `pipe-*` key bindings):
|
|
||||||
|
|
||||||
```
|
|
||||||
[key-bindings]
|
|
||||||
pipe-command-output=[sh -c "f=$(mktemp); cat - > $f; footclient emacsclient -nw $f; rm $f"] Control+Shift+g
|
|
||||||
```
|
|
||||||
|
|
||||||
When pressing ctrl+shift+g, the last command's output is written to a
|
|
||||||
temporary file, then an emacsclient is started in a new footclient instance.
|
|
||||||
The temporary file is removed after the footclient instance has closed.
|
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
function precmd {
|
|
||||||
print -Pn "\e]133;A\e\\"
|
|
||||||
if ! builtin zle; then
|
|
||||||
print -n "\e]133;D\e\\"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function preexec {
|
|
||||||
print -n "\e]133;C\e\\"
|
|
||||||
}
|
|
|
@ -8,36 +8,30 @@ To use it, add `perl` to the plugins array in your zshrc file:
|
||||||
plugins=(... perl)
|
plugins=(... perl)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Perlbrew activation
|
|
||||||
|
|
||||||
If the plugin detects that `perlbrew` hasn't been activated, yet there is an installation of it in
|
|
||||||
`$PERLBREW_ROOT`, it'll initialize by default. To avoid this behaviour, set `ZSH_PERLBREW_ACTIVATE=false`
|
|
||||||
before `source oh-my-zsh.sh` in your zshrc.
|
|
||||||
|
|
||||||
## Aliases
|
## Aliases
|
||||||
|
|
||||||
| Aliases | Command | Description |
|
| Aliases | Command | Description |
|
||||||
| :---------- | :----------------- | :------------------------------------- |
|
| :------------ | :----------------- | :------------------------------------- |
|
||||||
| pbi | `perlbrew install` | Install specific perl version |
|
| pbi | `perlbrew install` | Install specific perl version |
|
||||||
| pbl | `perlbrew list` | List all perl version installed |
|
| pbl | `perlbrew list` | List all perl version installed |
|
||||||
| pbo | `perlbrew off` | Go back to the system perl |
|
| pbo | `perlbrew off` | Go back to the system perl |
|
||||||
| pbs | `perlbrew switch` | Turn it back on |
|
| pbs | `perlbrew switch` | Turn it back on |
|
||||||
| pbu | `perlbrew use` | Use specific version of perl |
|
| pbu | `perlbrew use` | Use specific version of perl |
|
||||||
| pd | `perldoc` | Show the perl documentation |
|
| pd | `perldoc` | Show the perl documentation |
|
||||||
| ple | `perl -wlne` | Use perl like awk/sed |
|
| ple | `perl -wlne` | Use perl like awk/sed |
|
||||||
| latest-perl | `curl ...` | Show the latest stable release of Perl |
|
| latest-perl | `curl ...` | Show the latest stable release of Perl |
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
|
|
||||||
- `newpl`: creates a basic Perl script file and opens it with $EDITOR.
|
* `newpl`: creates a basic Perl script file and opens it with $EDITOR.
|
||||||
|
|
||||||
- `pgs`: Perl Global Substitution: `pgs <find_pattern> <replace_pattern> <filename>` Looks for
|
* `pgs`: Perl Global Substitution: `pgs <find_pattern> <replace_pattern> <filename>`
|
||||||
`<find_pattern>` and replaces it with `<replace_pattern>` in `<filename>`.
|
Looks for `<find_pattern>` and replaces it with `<replace_pattern>` in `<filename>`.
|
||||||
|
|
||||||
- `prep`: Perl grep, because 'grep -P' is terrible: `prep <pattern> [<filename>]` Lets you work with pipes or
|
* `prep`: Perl grep, because 'grep -P' is terrible: `prep <pattern> [<filename>]`
|
||||||
files (if no `<filename>` provided, use stdin).
|
Lets you work with pipes or files (if no `<filename>` provided, use stdin).
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
In order to make this work, you will need to have perl installed. More info on the usage and install:
|
In order to make this work, you will need to have perl installed.
|
||||||
https://www.perl.org/get.html
|
More info on the usage and install: https://www.perl.org/get.html
|
||||||
|
|
|
@ -54,12 +54,3 @@ pgs() { # [find] [replace] [filename]
|
||||||
prep() { # [pattern] [filename unless STDOUT]
|
prep() { # [pattern] [filename unless STDOUT]
|
||||||
perl -nle 'print if /'"$1"'/;' $2
|
perl -nle 'print if /'"$1"'/;' $2
|
||||||
}
|
}
|
||||||
|
|
||||||
# If the 'perlbrew' function isn't defined, perlbrew isn't setup.
|
|
||||||
if [[ $ZSH_PERLBREW_ACTIVATE != false ]] && (( ! $+functions[perlbrew] )); then
|
|
||||||
local _perlbrew="${PERLBREW_ROOT:-${HOME}/perl5/perlbrew}"
|
|
||||||
if [[ -f "${_perlbrew}/etc/bashrc" ]]; then
|
|
||||||
source "${_perlbrew}/etc/bashrc"
|
|
||||||
fi
|
|
||||||
unset _perlbrew
|
|
||||||
fi
|
|
||||||
|
|
|
@ -24,45 +24,16 @@ plugins=(... python)
|
||||||
The plugin provides three utilities to manage Python 3.3+ [venv](https://docs.python.org/3/library/venv.html)
|
The plugin provides three utilities to manage Python 3.3+ [venv](https://docs.python.org/3/library/venv.html)
|
||||||
virtual environments:
|
virtual environments:
|
||||||
|
|
||||||
- `mkv [name]`: make a new virtual environment called `name` in the current directory.
|
- `mkv [name]`: make a new virtual environment called `name` (default: if set `$PYTHON_VENV_NAME`, else
|
||||||
**Default**: `$PYTHON_VENV_NAME` if set, otherwise `venv`.
|
`venv`) in the current directory.
|
||||||
|
|
||||||
- `vrun [name]`: activate the virtual environment called `name` in the current directory.
|
- `vrun [name]`: Activate the virtual environment called `name` (default: if set `$PYTHON_VENV_NAME`, else
|
||||||
**Default**: the first existing in `$PYTHON_VENV_NAMES`.
|
`venv`) in the current directory.
|
||||||
|
|
||||||
- `auto_vrun`: automatically activate the venv virtual environment when entering a directory containing
|
- `auto_vrun`: Automatically activate the venv virtual environment when entering a directory containing
|
||||||
`<venv-name>/bin/activate`, and automatically deactivate it when navigating out of it (keeps venv activated
|
`<venv-name>/bin/activate`, and automatically deactivate it when navigating out of it (keeps venv activated
|
||||||
in subdirectories).
|
in subdirectories).
|
||||||
- To enable the feature, set `PYTHON_AUTO_VRUN=true` before sourcing oh-my-zsh.
|
- To enable the feature, set `export PYTHON_AUTO_VRUN=true` before sourcing oh-my-zsh.
|
||||||
- The plugin activates the first existing virtual environment, in order, appearing in `$PYTON_VENV_NAMES`.
|
- Plugin activates first virtual environment in lexicographic order whose name begins with `<venv-name>`.
|
||||||
The default virtual environment name is `venv`. To use a different name, set
|
The default virtual environment name is `venv`. To use a different name, set
|
||||||
`PYTHON_VENV_NAME=<venv-name>`. For example: `PYTHON_VENV_NAME=".venv"`
|
`export PYTHON_VENV_NAME=<venv-name>`. For example: `export PYTHON_VENV_NAME=".venv"`
|
||||||
|
|
||||||
### Settings
|
|
||||||
|
|
||||||
You can set these variables in your `.zshrc` file, before Oh My Zsh is sourced.
|
|
||||||
For example:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
PYTHON_VENV_NAME=".venv"
|
|
||||||
PYTHON_VENV_NAMES=($PYTHON_VENV_NAME venv)
|
|
||||||
...
|
|
||||||
plugins=(... python)
|
|
||||||
source "$ZSH/oh-my-zsh.sh"
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## `$PYTHON_VENV_NAME`
|
|
||||||
|
|
||||||
**Default**: `venv`.
|
|
||||||
|
|
||||||
Preferred name for virtual environments, for example when creating via `mkv`.
|
|
||||||
|
|
||||||
## `$PYTHON_VENV_NAMES`
|
|
||||||
|
|
||||||
**Default**: `$PYTHON_VENV_NAME venv .venv`.
|
|
||||||
|
|
||||||
Array of virtual environment names to be checked, in order, by `vrun` and `auto_vrun`.
|
|
||||||
This means these functions will load the first existing virtual environment in this list.
|
|
||||||
Duplicate names are ignored.
|
|
||||||
|
|
||||||
|
|
|
@ -47,29 +47,12 @@ alias pygrep='grep -nr --include="*.py"'
|
||||||
alias pyserver="python3 -m http.server"
|
alias pyserver="python3 -m http.server"
|
||||||
|
|
||||||
|
|
||||||
## venv settings
|
## venv utilities
|
||||||
: ${PYTHON_VENV_NAME:=venv}
|
: ${PYTHON_VENV_NAME:=venv}
|
||||||
|
|
||||||
# Array of possible virtual environment names to look for, in order
|
|
||||||
# -U for removing duplicates
|
|
||||||
typeset -gaU PYTHON_VENV_NAMES
|
|
||||||
[[ -n "$PYTHON_VENV_NAMES" ]] || PYTHON_VENV_NAMES=($PYTHON_VENV_NAME venv .venv)
|
|
||||||
|
|
||||||
# Activate a the python virtual environment specified.
|
# Activate a the python virtual environment specified.
|
||||||
# If none specified, use the first existing in $PYTHON_VENV_NAMES.
|
# If none specified, use $PYTHON_VENV_NAME, else 'venv'.
|
||||||
function vrun() {
|
function vrun() {
|
||||||
if [[ -z "$1" ]]; then
|
|
||||||
local name
|
|
||||||
for name in $PYTHON_VENV_NAMES; do
|
|
||||||
local venvpath="${name:P}"
|
|
||||||
if [[ -d "$venvpath" ]]; then
|
|
||||||
vrun "$name"
|
|
||||||
return $?
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
echo >&2 "Error: no virtual environment found in current directory"
|
|
||||||
fi
|
|
||||||
|
|
||||||
local name="${1:-$PYTHON_VENV_NAME}"
|
local name="${1:-$PYTHON_VENV_NAME}"
|
||||||
local venvpath="${name:P}"
|
local venvpath="${name:P}"
|
||||||
|
|
||||||
|
@ -108,11 +91,10 @@ if [[ "$PYTHON_AUTO_VRUN" == "true" ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $PWD != ${VIRTUAL_ENV:h} ]]; then
|
if [[ $PWD != ${VIRTUAL_ENV:h} ]]; then
|
||||||
local file
|
for _file in "${PYTHON_VENV_NAME}"*/bin/activate(N.); do
|
||||||
for file in "${^PYTHON_VENV_NAMES[@]}"/bin/activate(N.); do
|
|
||||||
# make sure we're not in a venv already
|
# make sure we're not in a venv already
|
||||||
(( $+functions[deactivate] )) && deactivate > /dev/null 2>&1
|
(( $+functions[deactivate] )) && deactivate > /dev/null 2>&1
|
||||||
source $file > /dev/null 2>&1
|
source $_file > /dev/null 2>&1
|
||||||
break
|
break
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -15,11 +15,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_tailscale" ]]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If using the alias, let's make sure that the aliased executable is also bound
|
|
||||||
# in case the alias points to "Tailscale" instead of "tailscale".
|
|
||||||
# See https://github.com/ohmyzsh/ohmyzsh/discussions/12928
|
|
||||||
if (( $+aliases[tailscale] )); then
|
|
||||||
_comps[${aliases[tailscale]:t}]=_tailscale
|
|
||||||
fi
|
|
||||||
|
|
||||||
tailscale completion zsh >| "$ZSH_CACHE_DIR/completions/_tailscale" &|
|
tailscale completion zsh >| "$ZSH_CACHE_DIR/completions/_tailscale" &|
|
||||||
|
|
|
@ -6,7 +6,7 @@ __timer_current_time() {
|
||||||
}
|
}
|
||||||
|
|
||||||
__timer_format_duration() {
|
__timer_format_duration() {
|
||||||
local mins=$(printf '%.0f' $(($(IFS='.' read int dec <<< "$1"; echo $int) / 60)))
|
local mins=$(printf '%.0f' $(($1 / 60)))
|
||||||
local secs=$(printf "%.${TIMER_PRECISION:-1}f" $(($1 - 60 * mins)))
|
local secs=$(printf "%.${TIMER_PRECISION:-1}f" $(($1 - 60 * mins)))
|
||||||
local duration_str=$(echo "${mins}m${secs}s")
|
local duration_str=$(echo "${mins}m${secs}s")
|
||||||
local format="${TIMER_FORMAT:-/%d}"
|
local format="${TIMER_FORMAT:-/%d}"
|
||||||
|
|
|
@ -400,9 +400,6 @@ function display-release {
|
||||||
function display:breaking {
|
function display:breaking {
|
||||||
(( $#breaking != 0 )) || return 0
|
(( $#breaking != 0 )) || return 0
|
||||||
|
|
||||||
# If we reach here we have shown commits, set flag
|
|
||||||
shown_commits=1
|
|
||||||
|
|
||||||
case "$output" in
|
case "$output" in
|
||||||
text) printf '\e[31m'; fmt:header "BREAKING CHANGES" 3 ;;
|
text) printf '\e[31m'; fmt:header "BREAKING CHANGES" 3 ;;
|
||||||
raw) fmt:header "BREAKING CHANGES" 3 ;;
|
raw) fmt:header "BREAKING CHANGES" 3 ;;
|
||||||
|
@ -430,9 +427,6 @@ function display-release {
|
||||||
# If no commits found of type $type, go to next type
|
# If no commits found of type $type, go to next type
|
||||||
(( $#hashes != 0 )) || return 0
|
(( $#hashes != 0 )) || return 0
|
||||||
|
|
||||||
# If we reach here we have shown commits, set flag
|
|
||||||
shown_commits=1
|
|
||||||
|
|
||||||
fmt:header "${TYPES[$type]}" 3
|
fmt:header "${TYPES[$type]}" 3
|
||||||
for hash in $hashes; do
|
for hash in $hashes; do
|
||||||
echo " - $(fmt:hash) $(fmt:scope)$(fmt:subject)"
|
echo " - $(fmt:hash) $(fmt:scope)$(fmt:subject)"
|
||||||
|
@ -450,9 +444,6 @@ function display-release {
|
||||||
# If no commits found under "other" types, don't display anything
|
# If no commits found under "other" types, don't display anything
|
||||||
(( $#changes != 0 )) || return 0
|
(( $#changes != 0 )) || return 0
|
||||||
|
|
||||||
# If we reach here we have shown commits, set flag
|
|
||||||
shown_commits=1
|
|
||||||
|
|
||||||
fmt:header "Other changes" 3
|
fmt:header "Other changes" 3
|
||||||
for hash type in ${(kv)changes}; do
|
for hash type in ${(kv)changes}; do
|
||||||
case "$type" in
|
case "$type" in
|
||||||
|
@ -507,7 +498,7 @@ function main {
|
||||||
|
|
||||||
# Commit classification arrays
|
# Commit classification arrays
|
||||||
local -A types subjects scopes breaking reverts
|
local -A types subjects scopes breaking reverts
|
||||||
local truncate=0 read_commits=0 shown_commits=0
|
local truncate=0 read_commits=0
|
||||||
local version tag
|
local version tag
|
||||||
local hash refs subject body
|
local hash refs subject body
|
||||||
|
|
||||||
|
@ -578,10 +569,6 @@ function main {
|
||||||
echo " ...more commits omitted"
|
echo " ...more commits omitted"
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (( ! shown_commits )); then
|
|
||||||
echo "No changes to mention."
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Use raw output if stdout is not a tty
|
# Use raw output if stdout is not a tty
|
||||||
|
|
Loading…
Reference in New Issue