mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-23 02:35:38 +01:00
Merge branch 'master' of https://github.com/ohmyzsh/ohmyzsh
This commit is contained in:
commit
2318eddff9
39 changed files with 491 additions and 115 deletions
|
|
@ -4,4 +4,4 @@ idna==3.10
|
||||||
PyYAML==6.0.2
|
PyYAML==6.0.2
|
||||||
requests==2.32.3
|
requests==2.32.3
|
||||||
semver==3.0.4
|
semver==3.0.4
|
||||||
urllib3==2.3.0
|
urllib3==2.4.0
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,7 @@ adds any) and extra goodies that are included in that particular plugin.
|
||||||
|
|
||||||
### Themes
|
### Themes
|
||||||
|
|
||||||
We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme happy. We have over one
|
We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme-happy. We have over one
|
||||||
hundred and fifty themes now bundled. Most of them have
|
hundred and fifty themes now bundled. Most of them have
|
||||||
[screenshots](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes) on the wiki (We are working on updating this!).
|
[screenshots](https://github.com/ohmyzsh/ohmyzsh/wiki/Themes) on the wiki (We are working on updating this!).
|
||||||
Check them out!
|
Check them out!
|
||||||
|
|
@ -245,7 +245,7 @@ terminal window.
|
||||||
ZSH_THEME="random" # (...please let it be pie... please be some pie..)
|
ZSH_THEME="random" # (...please let it be pie... please be some pie..)
|
||||||
```
|
```
|
||||||
|
|
||||||
And if you want to pick random theme from a list of your favorite themes:
|
And if you want to pick a random theme from a list of your favorite themes:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
ZSH_THEME_RANDOM_CANDIDATES=(
|
ZSH_THEME_RANDOM_CANDIDATES=(
|
||||||
|
|
@ -453,7 +453,7 @@ turn it off by setting the following in your .zshrc file, before Oh My Zsh is so
|
||||||
zstyle ':omz:alpha:lib:git' async-prompt no
|
zstyle ':omz:alpha:lib:git' async-prompt no
|
||||||
```
|
```
|
||||||
|
|
||||||
If your problem is that the git prompt just stopped appearing, you can try to force it setting the following
|
If your problem is that the git prompt just stopped appearing, you can try to force it by setting the following
|
||||||
configuration before `oh-my-zsh.sh` is sourced. If it still does not work, please open an issue with your
|
configuration before `oh-my-zsh.sh` is sourced. If it still does not work, please open an issue with your
|
||||||
case.
|
case.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ autoload -Uz is-at-least
|
||||||
# This API is subject to change and optimization. Rely on it at your own risk.
|
# This API is subject to change and optimization. Rely on it at your own risk.
|
||||||
|
|
||||||
function _omz_register_handler {
|
function _omz_register_handler {
|
||||||
setopt localoptions noksharrays
|
setopt localoptions noksharrays unset
|
||||||
typeset -ga _omz_async_functions
|
typeset -ga _omz_async_functions
|
||||||
# we want to do nothing if there's no $1 function or we already set it up
|
# we want to do nothing if there's no $1 function or we already set it up
|
||||||
if [[ -z "$1" ]] || (( ! ${+functions[$1]} )) \
|
if [[ -z "$1" ]] || (( ! ${+functions[$1]} )) \
|
||||||
|
|
@ -44,6 +44,7 @@ function _omz_register_handler {
|
||||||
|
|
||||||
# Set up async handlers and callbacks
|
# Set up async handlers and callbacks
|
||||||
function _omz_async_request {
|
function _omz_async_request {
|
||||||
|
setopt localoptions noksharrays unset
|
||||||
local -i ret=$?
|
local -i ret=$?
|
||||||
typeset -gA _OMZ_ASYNC_FDS _OMZ_ASYNC_PIDS _OMZ_ASYNC_OUTPUT
|
typeset -gA _OMZ_ASYNC_FDS _OMZ_ASYNC_PIDS _OMZ_ASYNC_OUTPUT
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -193,7 +193,7 @@ EOF
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
"$ZSH/tools/changelog.sh" "$version" "${2:-}" "$format"
|
ZSH="$ZSH" command zsh -f "$ZSH/tools/changelog.sh" "$version" "${2:-}" "$format"
|
||||||
}
|
}
|
||||||
|
|
||||||
function _omz::plugin {
|
function _omz::plugin {
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ fi
|
||||||
|
|
||||||
# Runs before showing the prompt
|
# Runs before showing the prompt
|
||||||
function omz_termsupport_precmd {
|
function omz_termsupport_precmd {
|
||||||
[[ "${DISABLE_AUTO_TITLE:-}" != true ]] || return
|
[[ "${DISABLE_AUTO_TITLE:-}" != true ]] || return 0
|
||||||
title "$ZSH_THEME_TERM_TAB_TITLE_IDLE" "$ZSH_THEME_TERM_TITLE_IDLE"
|
title "$ZSH_THEME_TERM_TAB_TITLE_IDLE" "$ZSH_THEME_TERM_TITLE_IDLE"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -145,6 +145,7 @@ esac
|
||||||
# Identifies the directory using a file: URI scheme, including
|
# Identifies the directory using a file: URI scheme, including
|
||||||
# the host name to disambiguate local vs. remote paths.
|
# the host name to disambiguate local vs. remote paths.
|
||||||
function omz_termsupport_cwd {
|
function omz_termsupport_cwd {
|
||||||
|
setopt localoptions unset
|
||||||
# Percent-encode the host and path names.
|
# Percent-encode the host and path names.
|
||||||
local URL_HOST URL_PATH
|
local URL_HOST URL_PATH
|
||||||
URL_HOST="$(omz_urlencode -P $HOST)" || return 1
|
URL_HOST="$(omz_urlencode -P $HOST)" || return 1
|
||||||
|
|
|
||||||
|
|
@ -36,14 +36,18 @@ alias-finder() {
|
||||||
# make filter to find only shorter results than current cmd
|
# make filter to find only shorter results than current cmd
|
||||||
if [[ $cheaper == true ]]; then
|
if [[ $cheaper == true ]]; then
|
||||||
cmdLen=$(echo -n "$cmd" | wc -c)
|
cmdLen=$(echo -n "$cmd" | wc -c)
|
||||||
filter="^'{0,1}.{0,$((cmdLen - 1))}="
|
if [[ $cmdLen -le 1 ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
filter="^'?.{1,$((cmdLen - 1))}'?=" # some aliases is surrounded by single quotes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
alias | grep -E "$filter" | grep -E "=$finder"
|
alias | grep -E "$filter" | grep -E "=$finder"
|
||||||
|
|
||||||
if [[ $exact == true ]]; then
|
if [[ $exact == true ]]; then
|
||||||
break # because exact case is only one
|
break # because exact case is only one
|
||||||
elif [[ $longer = true ]]; then
|
elif [[ $longer == true ]]; then
|
||||||
break # because above grep command already found every longer aliases during first cycle
|
break # because above grep command already found every longer aliases during first cycle
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -178,26 +178,27 @@ fi
|
||||||
|
|
||||||
# Check Arch Linux PGP Keyring before System Upgrade to prevent failure.
|
# Check Arch Linux PGP Keyring before System Upgrade to prevent failure.
|
||||||
function upgrade() {
|
function upgrade() {
|
||||||
|
sudo pacman -Sy
|
||||||
echo ":: Checking Arch Linux PGP Keyring..."
|
echo ":: Checking Arch Linux PGP Keyring..."
|
||||||
local installedver="$(LANG= sudo pacman -Qi archlinux-keyring | grep -Po '(?<=Version : ).*')"
|
local installedver="$(LANG= sudo pacman -Qi archlinux-keyring | grep -Po '(?<=Version : ).*')"
|
||||||
local currentver="$(LANG= sudo pacman -Si archlinux-keyring | grep -Po '(?<=Version : ).*')"
|
local currentver="$(LANG= sudo pacman -Si archlinux-keyring | grep -Po '(?<=Version : ).*')"
|
||||||
if [ $installedver != $currentver ]; then
|
if [ $installedver != $currentver ]; then
|
||||||
echo " Arch Linux PGP Keyring is out of date."
|
echo " Arch Linux PGP Keyring is out of date."
|
||||||
echo " Updating before full system upgrade."
|
echo " Updating before full system upgrade."
|
||||||
sudo pacman -Sy --needed --noconfirm archlinux-keyring
|
sudo pacman -S --needed --noconfirm archlinux-keyring
|
||||||
else
|
else
|
||||||
echo " Arch Linux PGP Keyring is up to date."
|
echo " Arch Linux PGP Keyring is up to date."
|
||||||
echo " Proceeding with full system upgrade."
|
echo " Proceeding with full system upgrade."
|
||||||
fi
|
fi
|
||||||
if (( $+commands[yay] )); then
|
if (( $+commands[yay] )); then
|
||||||
yay -Syu
|
yay -Su
|
||||||
elif (( $+commands[trizen] )); then
|
elif (( $+commands[trizen] )); then
|
||||||
trizen -Syu
|
trizen -Su
|
||||||
elif (( $+commands[pacaur] )); then
|
elif (( $+commands[pacaur] )); then
|
||||||
pacaur -Syu
|
pacaur -Su
|
||||||
elif (( $+commands[aura] )); then
|
elif (( $+commands[aura] )); then
|
||||||
sudo aura -Syu
|
sudo aura -Su
|
||||||
else
|
else
|
||||||
sudo pacman -Syu
|
sudo pacman -Su
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,48 @@
|
||||||
## asdf
|
# asdf
|
||||||
|
|
||||||
Adds integration with [asdf](https://github.com/asdf-vm/asdf), the extendable version manager, with support for Ruby, Node.js, Elixir, Erlang and more.
|
Adds integration with [asdf](https://github.com/asdf-vm/asdf), the extendable version manager, with support for Ruby, Node.js, Elixir, Erlang and more.
|
||||||
|
|
||||||
### Installation
|
## Installation
|
||||||
|
|
||||||
1. [Download asdf](https://asdf-vm.com/guide/getting-started.html#_2-download-asdf) by running the following:
|
1. [Install](https://asdf-vm.com/guide/getting-started.html#_1-install-asdf) asdf and ensure that's it's discoverable on `$PATH`;
|
||||||
|
2. Enable it by adding it to your `plugins` definition in `~/.zshrc`:
|
||||||
```
|
|
||||||
git clone https://github.com/asdf-vm/asdf.git ~/.asdf
|
|
||||||
```
|
|
||||||
|
|
||||||
2. [Enable asdf](https://asdf-vm.com/guide/getting-started.html#_3-install-asdf) by adding it to your `plugins` definition in `~/.zshrc`.
|
|
||||||
|
|
||||||
```
|
|
||||||
plugins=(asdf)
|
|
||||||
```
|
|
||||||
|
|
||||||
### Usage
|
|
||||||
|
|
||||||
See the [asdf documentation](https://asdf-vm.com/guide/getting-started.html#_4-install-a-plugin) for information on how to use asdf:
|
|
||||||
|
|
||||||
|
```sh
|
||||||
|
plugins=(asdf)
|
||||||
```
|
```
|
||||||
asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Refer to the [asdf plugin documentation](https://asdf-vm.com/guide/getting-started.html#_4-install-a-plugin) for information on how to add a plugin and install the many runtime versions for it.
|
||||||
|
|
||||||
|
Example for installing the nodejs plugin and the many runtimes for it:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Add plugin to asdf
|
||||||
|
asdf plugin add nodejs
|
||||||
|
|
||||||
|
# Install the latest available version
|
||||||
asdf install nodejs latest
|
asdf install nodejs latest
|
||||||
asdf global nodejs latest
|
|
||||||
asdf local nodejs latest
|
# Uninstall the latest version
|
||||||
|
asdf uninstall nodejs latest
|
||||||
|
|
||||||
|
# Install a specific version
|
||||||
|
asdf install nodejs 16.5.0
|
||||||
|
|
||||||
|
# Set the latest version in .tool-versions of the `current directory`
|
||||||
|
asdf set nodejs latest
|
||||||
|
|
||||||
|
# Set a specific version in the `parent directory`
|
||||||
|
asdf set -p nodejs 16.5.0 # -p is shorthand for --parent
|
||||||
|
|
||||||
|
# Set a global version under `$HOME`
|
||||||
|
asdf set -u nodejs 16.5.0 # -u is shorthand for --home
|
||||||
```
|
```
|
||||||
|
|
||||||
### Maintainer
|
For more commands, run `asdf help` or refer to the
|
||||||
|
[asdf CLI documentation](https://asdf-vm.com/manage/commands.html#all-commands).
|
||||||
|
|
||||||
|
## Maintainer
|
||||||
|
|
||||||
- [@RobLoach](https://github.com/RobLoach)
|
- [@RobLoach](https://github.com/RobLoach)
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,13 @@
|
||||||
# Find where asdf should be installed
|
(( ! $+commands[asdf] )) && return
|
||||||
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
|
|
||||||
ASDF_COMPLETIONS="$ASDF_DIR/completions"
|
|
||||||
|
|
||||||
if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/_asdf" ]]; then
|
export ASDF_DATA_DIR="${ASDF_DATA_DIR:-$HOME/.asdf}"
|
||||||
# If not found, check for archlinux/AUR package (/opt/asdf-vm/)
|
path=("$ASDF_DATA_DIR/shims" $path)
|
||||||
if [[ -f "/opt/asdf-vm/asdf.sh" ]]; then
|
|
||||||
ASDF_DIR="/opt/asdf-vm"
|
|
||||||
ASDF_COMPLETIONS="$ASDF_DIR"
|
|
||||||
# If not found, check for Homebrew package
|
|
||||||
elif (( $+commands[brew] )); then
|
|
||||||
_ASDF_PREFIX="$(brew --prefix asdf)"
|
|
||||||
ASDF_DIR="${_ASDF_PREFIX}/libexec"
|
|
||||||
ASDF_COMPLETIONS="${_ASDF_PREFIX}/share/zsh/site-functions"
|
|
||||||
unset _ASDF_PREFIX
|
|
||||||
else
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Load command
|
# If the completion file doesn't exist yet, we need to autoload it and
|
||||||
if [[ -f "$ASDF_DIR/asdf.sh" ]]; then
|
# bind it to `asdf`. Otherwise, compinit will have already done that.
|
||||||
source "$ASDF_DIR/asdf.sh"
|
if [[ ! -f "$ZSH_CACHE_DIR/completions/_asdf" ]]; then
|
||||||
# Load completions
|
typeset -g -A _comps
|
||||||
if [[ -f "$ASDF_COMPLETIONS/_asdf" ]]; then
|
autoload -Uz _asdf
|
||||||
fpath+=("$ASDF_COMPLETIONS")
|
_comps[asdf]=_asdf
|
||||||
autoload -Uz _asdf
|
|
||||||
compdef _asdf asdf # compdef is already loaded before loading plugins
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
asdf completion zsh >| "$ZSH_CACHE_DIR/completions/_asdf" &|
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ function bgnotify_formatted {
|
||||||
function bgnotify_appid {
|
function bgnotify_appid {
|
||||||
if (( ${+commands[osascript]} )); then
|
if (( ${+commands[osascript]} )); then
|
||||||
osascript -e "tell application id \"$(bgnotify_programid)\" to get the {id, frontmost, id of front window, visible of front window}" 2>/dev/null
|
osascript -e "tell application id \"$(bgnotify_programid)\" to get the {id, frontmost, id of front window, visible of front window}" 2>/dev/null
|
||||||
elif [[ -n $WAYLAND_DISPLAY ]] && (( ${+commands[swaymsg]} )); then # wayland+sway
|
elif [[ -n $WAYLAND_DISPLAY ]] && ([[ -n $SWAYSOCK ]] || [[ -n $I3SOCK ]]) && (( ${+commands[swaymsg]} )); then # wayland+sway
|
||||||
local app_id=$(bgnotify_find_sway_appid)
|
local app_id=$(bgnotify_find_sway_appid)
|
||||||
[[ -n "$app_id" ]] && echo "$app_id" || echo $EPOCHSECONDS
|
[[ -n "$app_id" ]] && echo "$app_id" || echo $EPOCHSECONDS
|
||||||
elif [[ -z $WAYLAND_DISPLAY ]] && [[ -n $DISPLAY ]] && (( ${+commands[xprop]} )); then
|
elif [[ -z $WAYLAND_DISPLAY ]] && [[ -n $DISPLAY ]] && (( ${+commands[xprop]} )); then
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ function branch_prompt_info() {
|
||||||
while [[ "$dir" != '/' ]]; do
|
while [[ "$dir" != '/' ]]; do
|
||||||
# Found .git directory
|
# Found .git directory
|
||||||
if [[ -d "${dir}/.git" ]]; then
|
if [[ -d "${dir}/.git" ]]; then
|
||||||
branch="${"$(<"${dir}/.git/HEAD")"##*/}"
|
branch="${"$(<"${dir}/.git/HEAD")"##ref: refs/heads/}"
|
||||||
echo '±' "${branch:gs/%/%%}"
|
echo '±' "${branch:gs/%/%%}"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ _source-from-homebrew() {
|
||||||
# check default brew prefix
|
# check default brew prefix
|
||||||
if [[ -h /usr/local/opt/chruby ]];then
|
if [[ -h /usr/local/opt/chruby ]];then
|
||||||
_brew_prefix="/usr/local/opt/chruby"
|
_brew_prefix="/usr/local/opt/chruby"
|
||||||
|
elif [[ -h /opt/homebrew/opt/chruby ]]; then
|
||||||
|
_brew_prefix="/opt/homebrew/opt/chruby"
|
||||||
else
|
else
|
||||||
# ok , it is not default prefix
|
# ok , it is not default prefix
|
||||||
# this call to brew is expensive ( about 400 ms ), so at least let's make it only once
|
# this call to brew is expensive ( about 400 ms ), so at least let's make it only once
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,8 @@ alias cnl='conda list'
|
||||||
alias cnle='conda list --export'
|
alias cnle='conda list --export'
|
||||||
alias cnles='conda list --explicit > spec-file.txt'
|
alias cnles='conda list --explicit > spec-file.txt'
|
||||||
alias cnr='conda remove'
|
alias cnr='conda remove'
|
||||||
alias cnrn='conda remove -y -all -n'
|
alias cnrn='conda remove -y --all -n'
|
||||||
alias cnrp='conda remove -y -all -p'
|
alias cnrp='conda remove -y --all -p'
|
||||||
alias cnry='conda remove -y'
|
alias cnry='conda remove -y'
|
||||||
alias cnsr='conda search'
|
alias cnsr='conda search'
|
||||||
alias cnu='conda update'
|
alias cnu='conda update'
|
||||||
|
|
|
||||||
|
|
@ -60,3 +60,46 @@ to `/usr` again.
|
||||||
After that, <kbd>Alt</kbd> + <kbd>Down</kbd> will probably go to `/usr/bin` if `bin` is the first directory in alphabetical
|
After that, <kbd>Alt</kbd> + <kbd>Down</kbd> will probably go to `/usr/bin` if `bin` is the first directory in alphabetical
|
||||||
order (depends on your `/usr` folder structure). <kbd>Alt</kbd> + <kbd>Up</kbd> will return to `/usr`, and once more will get
|
order (depends on your `/usr` folder structure). <kbd>Alt</kbd> + <kbd>Up</kbd> will return to `/usr`, and once more will get
|
||||||
you to the root folder (`/`).
|
you to the root folder (`/`).
|
||||||
|
|
||||||
|
### cde
|
||||||
|
|
||||||
|
This plugin also provides a `cde` alias that allows you to change to a directory without clearing the next directory stack.
|
||||||
|
This changes the default behavior of `dirhistory`, which is to clear the next directory stack when changing directories.
|
||||||
|
|
||||||
|
For example, if the shell was started, and the following commands were entered:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
cd ~
|
||||||
|
cd /usr
|
||||||
|
cd share
|
||||||
|
cd doc
|
||||||
|
|
||||||
|
# <Alt + Left>
|
||||||
|
# <Alt + Left>
|
||||||
|
```
|
||||||
|
|
||||||
|
The directory stack would look like this:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
➜ /usr typeset -pm dirhistory_\*
|
||||||
|
typeset -ax dirhistory_past=( /home/user /usr )
|
||||||
|
typeset -ax dirhistory_future=( /usr/share/doc /usr/share )
|
||||||
|
```
|
||||||
|
|
||||||
|
This means that pressing <kbd>Alt</kbd> + <kbd>Right</kbd>, you'd go to `/usr/share` and `/usr/share/doc` (the "future" directories).
|
||||||
|
|
||||||
|
If you run `cd /usr/bin`, the "future" directories will be removed, and you won't be able to access them with <kbd>Alt</kbd> + <kbd>Right</kbd>:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
➜ /u/bin typeset -pm dirhistory_\*
|
||||||
|
typeset -ax dirhistory_past=( /home/user /usr )
|
||||||
|
typeset -ax dirhistory_future=( /usr/bin )
|
||||||
|
```
|
||||||
|
|
||||||
|
If you instead run `cde /usr/bin`, the "future" directories will be preserved:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
➜ /u/bin typeset -pm dirhistory_\*
|
||||||
|
typeset -ax dirhistory_past=( /home/user /usr /usr/bin )
|
||||||
|
typeset -ax dirhistory_future=( /usr/share/doc /usr/share )
|
||||||
|
```
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,10 @@ dirhistory_past=($PWD)
|
||||||
dirhistory_future=()
|
dirhistory_future=()
|
||||||
export dirhistory_past
|
export dirhistory_past
|
||||||
export dirhistory_future
|
export dirhistory_future
|
||||||
|
|
||||||
export DIRHISTORY_SIZE=30
|
export DIRHISTORY_SIZE=30
|
||||||
|
|
||||||
|
alias cde='dirhistory_cd'
|
||||||
|
|
||||||
# Pop the last element of dirhistory_past.
|
# Pop the last element of dirhistory_past.
|
||||||
# Pass the name of the variable to return the result in.
|
# Pass the name of the variable to return the result in.
|
||||||
# Returns the element if the array was not empty,
|
# Returns the element if the array was not empty,
|
||||||
|
|
@ -136,7 +137,11 @@ for keymap in emacs vicmd viins; do
|
||||||
|
|
||||||
case "$TERM_PROGRAM" in
|
case "$TERM_PROGRAM" in
|
||||||
Apple_Terminal) bindkey -M $keymap "^[b" dirhistory_zle_dirhistory_back ;; # Terminal.app
|
Apple_Terminal) bindkey -M $keymap "^[b" dirhistory_zle_dirhistory_back ;; # Terminal.app
|
||||||
iTerm.app) bindkey -M $keymap "^[^[[D" dirhistory_zle_dirhistory_back ;; # iTerm2
|
ghostty) bindkey -M $keymap "^[b" dirhistory_zle_dirhistory_back ;; # ghostty
|
||||||
|
iTerm.app)
|
||||||
|
bindkey -M $keymap "^[^[[D" dirhistory_zle_dirhistory_back
|
||||||
|
bindkey -M $keymap "^[b" dirhistory_zle_dirhistory_back
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if (( ${+terminfo[kcub1]} )); then
|
if (( ${+terminfo[kcub1]} )); then
|
||||||
|
|
@ -151,7 +156,11 @@ for keymap in emacs vicmd viins; do
|
||||||
|
|
||||||
case "$TERM_PROGRAM" in
|
case "$TERM_PROGRAM" in
|
||||||
Apple_Terminal) bindkey -M $keymap "^[f" dirhistory_zle_dirhistory_future ;; # Terminal.app
|
Apple_Terminal) bindkey -M $keymap "^[f" dirhistory_zle_dirhistory_future ;; # Terminal.app
|
||||||
iTerm.app) bindkey -M $keymap "^[^[[C" dirhistory_zle_dirhistory_future ;; # iTerm2
|
ghostty) bindkey -M $keymap "^[f" dirhistory_zle_dirhistory_future ;; # ghostty
|
||||||
|
iTerm.app)
|
||||||
|
bindkey -M $keymap "^[^[[C" dirhistory_zle_dirhistory_future
|
||||||
|
bindkey -M $keymap "^[f" dirhistory_zle_dirhistory_future
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if (( ${+terminfo[kcuf1]} )); then
|
if (( ${+terminfo[kcuf1]} )); then
|
||||||
|
|
@ -200,6 +209,7 @@ for keymap in emacs vicmd viins; do
|
||||||
case "$TERM_PROGRAM" in
|
case "$TERM_PROGRAM" in
|
||||||
Apple_Terminal) bindkey -M $keymap "^[[A" dirhistory_zle_dirhistory_up ;; # Terminal.app
|
Apple_Terminal) bindkey -M $keymap "^[[A" dirhistory_zle_dirhistory_up ;; # Terminal.app
|
||||||
iTerm.app) bindkey -M $keymap "^[^[[A" dirhistory_zle_dirhistory_up ;; # iTerm2
|
iTerm.app) bindkey -M $keymap "^[^[[A" dirhistory_zle_dirhistory_up ;; # iTerm2
|
||||||
|
ghostty) bindkey -M $keymap "^[[1;3A" dirhistory_zle_dirhistory_up ;; # ghostty
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if (( ${+terminfo[kcuu1]} )); then
|
if (( ${+terminfo[kcuu1]} )); then
|
||||||
|
|
@ -215,6 +225,7 @@ for keymap in emacs vicmd viins; do
|
||||||
case "$TERM_PROGRAM" in
|
case "$TERM_PROGRAM" in
|
||||||
Apple_Terminal) bindkey -M $keymap "^[[B" dirhistory_zle_dirhistory_down ;; # Terminal.app
|
Apple_Terminal) bindkey -M $keymap "^[[B" dirhistory_zle_dirhistory_down ;; # Terminal.app
|
||||||
iTerm.app) bindkey -M $keymap "^[^[[B" dirhistory_zle_dirhistory_down ;; # iTerm2
|
iTerm.app) bindkey -M $keymap "^[^[[B" dirhistory_zle_dirhistory_down ;; # iTerm2
|
||||||
|
ghostty) bindkey -M $keymap "^[[1;3B" dirhistory_zle_dirhistory_down ;; # ghostty
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if (( ${+terminfo[kcud1]} )); then
|
if (( ${+terminfo[kcud1]} )); then
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ _dnf5_rpm_files() {
|
||||||
|
|
||||||
_dnf5_packages_or_rpms() {
|
_dnf5_packages_or_rpms() {
|
||||||
if [[ "$words[CURRENT]" = (*/*|\~*) ]]; then # if looks like a path name
|
if [[ "$words[CURRENT]" = (*/*|\~*) ]]; then # if looks like a path name
|
||||||
_dnf_rpm_files
|
_dnf5_rpm_files
|
||||||
else
|
else
|
||||||
_dnf5_packages "$@"
|
_dnf5_packages "$@"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,10 @@ following setting. See https://github.com/ohmyzsh/ohmyzsh/issues/11789 for more
|
||||||
zstyle ':omz:plugins:docker' legacy-completion yes
|
zstyle ':omz:plugins:docker' legacy-completion yes
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### For Podman's Docker wrapper users
|
||||||
|
|
||||||
|
If you use Podman's Docker wrapper, you need to enable legacy completion. See above section.
|
||||||
|
|
||||||
## Aliases
|
## Aliases
|
||||||
|
|
||||||
| Alias | Command | Description |
|
| Alias | Command | Description |
|
||||||
|
|
@ -73,6 +77,7 @@ zstyle ':omz:plugins:docker' legacy-completion yes
|
||||||
| drs | `docker container restart` | Restart one or more containers |
|
| drs | `docker container restart` | Restart one or more containers |
|
||||||
| dsta | `docker stop $(docker ps -q)` | Stop all running containers |
|
| dsta | `docker stop $(docker ps -q)` | Stop all running containers |
|
||||||
| dstp | `docker container stop` | Stop one or more running containers |
|
| dstp | `docker container stop` | Stop one or more running containers |
|
||||||
|
| dsts | `docker stats` | Display real-time streaming statistics for containers |
|
||||||
| dtop | `docker top` | Display the running processes of a container |
|
| dtop | `docker top` | Display the running processes of a container |
|
||||||
| dvi | `docker volume inspect` | Display detailed information about one or more volumes |
|
| dvi | `docker volume inspect` | Display detailed information about one or more volumes |
|
||||||
| dvls | `docker volume ls` | List all the volumes known to docker |
|
| dvls | `docker volume ls` | List all the volumes known to docker |
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ alias dst='docker container start'
|
||||||
alias drs='docker container restart'
|
alias drs='docker container restart'
|
||||||
alias dsta='docker stop $(docker ps -q)'
|
alias dsta='docker stop $(docker ps -q)'
|
||||||
alias dstp='docker container stop'
|
alias dstp='docker container stop'
|
||||||
|
alias dsts='docker stats'
|
||||||
alias dtop='docker top'
|
alias dtop='docker top'
|
||||||
alias dvi='docker volume inspect'
|
alias dvi='docker volume inspect'
|
||||||
alias dvls='docker volume ls'
|
alias dvls='docker volume ls'
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,10 @@ def get_tagname_or_hash():
|
||||||
return hash_
|
return hash_
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# Re-use method from https://github.com/magicmonty/bash-git-prompt to get stashs count
|
# Re-use method from https://github.com/magicmonty/bash-git-prompt to get stash count
|
||||||
|
# Use `--git-common-dir` to avoid problems with git worktrees, which don't have individual stashes
|
||||||
def get_stash():
|
def get_stash():
|
||||||
cmd = Popen(['git', 'rev-parse', '--git-dir'], stdout=PIPE, stderr=PIPE)
|
cmd = Popen(['git', 'rev-parse', '--git-common-dir'], stdout=PIPE, stderr=PIPE)
|
||||||
so, se = cmd.communicate()
|
so, se = cmd.communicate()
|
||||||
stash_file = '%s%s' % (so.decode('utf-8').rstrip(), '/logs/refs/stash')
|
stash_file = '%s%s' % (so.decode('utf-8').rstrip(), '/logs/refs/stash')
|
||||||
|
|
||||||
|
|
@ -35,7 +36,6 @@ def get_stash():
|
||||||
except IOError:
|
except IOError:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
# `git status --porcelain --branch` can collect all information
|
# `git status --porcelain --branch` can collect all information
|
||||||
# branch, remote_branch, untracked, staged, changed, conflicts, ahead, behind
|
# branch, remote_branch, untracked, staged, changed, conflicts, ahead, behind
|
||||||
po = Popen(['git', 'status', '--porcelain', '--branch'], env=dict(os.environ, LANG="C"), stdout=PIPE, stderr=PIPE)
|
po = Popen(['git', 'status', '--porcelain', '--branch'], env=dict(os.environ, LANG="C"), stdout=PIPE, stderr=PIPE)
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,7 @@ plugins=(... git)
|
||||||
| `gcss` | `git commit -S -s` |
|
| `gcss` | `git commit -S -s` |
|
||||||
| `gcssm` | `git commit -S -s -m` |
|
| `gcssm` | `git commit -S -s -m` |
|
||||||
| `gcf` | `git config --list` |
|
| `gcf` | `git config --list` |
|
||||||
|
| `gcfu` | `git commit --fixup` |
|
||||||
| `gdct` | `git describe --tags $(git rev-list --tags --max-count=1)` |
|
| `gdct` | `git describe --tags $(git rev-list --tags --max-count=1)` |
|
||||||
| `gd` | `git diff` |
|
| `gd` | `git diff` |
|
||||||
| `gdca` | `git diff --cached` |
|
| `gdca` | `git diff --cached` |
|
||||||
|
|
|
||||||
|
|
@ -200,6 +200,7 @@ alias gc!='git commit --verbose --amend'
|
||||||
alias gcn='git commit --verbose --no-edit'
|
alias gcn='git commit --verbose --no-edit'
|
||||||
alias gcn!='git commit --verbose --no-edit --amend'
|
alias gcn!='git commit --verbose --no-edit --amend'
|
||||||
alias gcf='git config --list'
|
alias gcf='git config --list'
|
||||||
|
alias gcfu='git commit --fixup'
|
||||||
alias gdct='git describe --tags $(git rev-list --tags --max-count=1)'
|
alias gdct='git describe --tags $(git rev-list --tags --max-count=1)'
|
||||||
alias gd='git diff'
|
alias gd='git diff'
|
||||||
alias gdca='git diff --cached'
|
alias gdca='git diff --cached'
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ This plugin supplies one command, `jira`, through which all its features are exp
|
||||||
| `jira new` | Opens a new Jira issue dialogue |
|
| `jira new` | Opens a new Jira issue dialogue |
|
||||||
| `jira ABC-123` | Opens an existing issue |
|
| `jira ABC-123` | Opens an existing issue |
|
||||||
| `jira ABC-123 m` | Opens an existing issue for adding a comment |
|
| `jira ABC-123 m` | Opens an existing issue for adding a comment |
|
||||||
|
| `jira project ABC` | Opens JIRA project summary |
|
||||||
| `jira dashboard [rapid_view]` | Opens your JIRA dashboard |
|
| `jira dashboard [rapid_view]` | Opens your JIRA dashboard |
|
||||||
| `jira mine` | Queries for your own issues |
|
| `jira mine` | Queries for your own issues |
|
||||||
| `jira tempo` | Opens your JIRA Tempo |
|
| `jira tempo` | Opens your JIRA Tempo |
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ local -a _1st_arguments
|
||||||
_1st_arguments=(
|
_1st_arguments=(
|
||||||
'new:create a new issue'
|
'new:create a new issue'
|
||||||
'mine:open my issues'
|
'mine:open my issues'
|
||||||
|
'project:open the project'
|
||||||
'dashboard:open the dashboard'
|
'dashboard:open the dashboard'
|
||||||
'tempo:open the tempo'
|
'tempo:open the tempo'
|
||||||
'reported:search for issues reported by a user'
|
'reported:search for issues reported by a user'
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ jira Performs the default action
|
||||||
jira new Opens a new Jira issue dialogue
|
jira new Opens a new Jira issue dialogue
|
||||||
jira ABC-123 Opens an existing issue
|
jira ABC-123 Opens an existing issue
|
||||||
jira ABC-123 m Opens an existing issue for adding a comment
|
jira ABC-123 m Opens an existing issue for adding a comment
|
||||||
|
jira project ABC Opens JIRA project summary
|
||||||
jira dashboard [rapid_view] Opens your JIRA dashboard
|
jira dashboard [rapid_view] Opens your JIRA dashboard
|
||||||
jira mine Queries for your own issues
|
jira mine Queries for your own issues
|
||||||
jira tempo Opens your JIRA Tempo
|
jira tempo Opens your JIRA Tempo
|
||||||
|
|
@ -88,6 +89,9 @@ function jira() {
|
||||||
elif [[ "$action" == "mine" ]]; then
|
elif [[ "$action" == "mine" ]]; then
|
||||||
echo "Opening my issues"
|
echo "Opening my issues"
|
||||||
open_command "${jira_url}/issues/?filter=-1"
|
open_command "${jira_url}/issues/?filter=-1"
|
||||||
|
elif [[ "$action" == "project" ]]; then
|
||||||
|
echo "Opening project"
|
||||||
|
open_command "${jira_url}/jira/software/c/projects/${2}/summary"
|
||||||
elif [[ "$action" == "dashboard" ]]; then
|
elif [[ "$action" == "dashboard" ]]; then
|
||||||
echo "Opening dashboard"
|
echo "Opening dashboard"
|
||||||
if [[ "$JIRA_RAPID_BOARD" == "true" ]]; then
|
if [[ "$JIRA_RAPID_BOARD" == "true" ]]; then
|
||||||
|
|
|
||||||
89
plugins/jj/README.md
Normal file
89
plugins/jj/README.md
Normal file
|
|
@ -0,0 +1,89 @@
|
||||||
|
# jj - Jujutsu CLI
|
||||||
|
|
||||||
|
This plugin provides autocompletion for [jj](https://martinvonz.github.io/jj).
|
||||||
|
|
||||||
|
To use it, add `jj` to the plugins array of your zshrc file:
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
plugins=(... jj)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Aliases
|
||||||
|
|
||||||
|
| Alias | Command |
|
||||||
|
| ------ | ----------------------------- |
|
||||||
|
| jjc | `jj commit` |
|
||||||
|
| jjcmsg | `jj commit --message` |
|
||||||
|
| jjd | `jj diff` |
|
||||||
|
| jjdmsg | `jj desc --message` |
|
||||||
|
| jjds | `jj desc` |
|
||||||
|
| jje | `jj edit` |
|
||||||
|
| jjgcl | `jj git clone` |
|
||||||
|
| jjgf | `jj git fetch` |
|
||||||
|
| jjgp | `jj git push` |
|
||||||
|
| jjl | `jj log` |
|
||||||
|
| jjla | `jj log -r "all()"` |
|
||||||
|
| jjn | `jj new` |
|
||||||
|
| jjrb | `jj rebase` |
|
||||||
|
| jjrs | `jj restore` |
|
||||||
|
| jjrt | `cd "$(jj root \|\| echo .)"` |
|
||||||
|
| jjsp | `jj split` |
|
||||||
|
| jjsq | `jj squash` |
|
||||||
|
|
||||||
|
## Prompt usage
|
||||||
|
|
||||||
|
Because `jj` has a very powerful [template syntax](https://martinvonz.github.io/jj/latest/templates/), this
|
||||||
|
plugin only exposes a convenience function `jj_prompt_template` to read information from the current change.
|
||||||
|
It is basically the same as `jj log --no-graph -r @ -T $1`:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
_my_theme_jj_info() {
|
||||||
|
jj_prompt_template 'self.change_id().shortest(3)'
|
||||||
|
}
|
||||||
|
|
||||||
|
PROMPT='$(_my_theme_jj_info) $'
|
||||||
|
```
|
||||||
|
|
||||||
|
`jj_prompt_template` escapes `%` signs in the output. Use `jj_prompt_template_raw` if you don't want that
|
||||||
|
(e.g. to colorize the output).
|
||||||
|
|
||||||
|
However, because `jj` can be used inside a Git repository, some themes might clash with it. Generally, you can
|
||||||
|
fix it with a wrapper function that tries `jj` first and then falls back to `git` if it didn't work:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
_my_theme_vcs_info() {
|
||||||
|
jj_prompt_template 'self.change_id().shortest(3)' \
|
||||||
|
|| git_prompt_info
|
||||||
|
}
|
||||||
|
|
||||||
|
PROMPT='$(_my_theme_vcs_info) $'
|
||||||
|
```
|
||||||
|
|
||||||
|
You can find an example
|
||||||
|
[here](https://github.com/nasso/omzsh/blob/e439e494f22f4fd4ef1b6cb64626255f4b341c1b/themes/sunakayu.zsh-theme).
|
||||||
|
|
||||||
|
### Performance
|
||||||
|
|
||||||
|
Sometimes `jj` can be slower than `git`.
|
||||||
|
|
||||||
|
If you feel slowdowns, consider using the following:
|
||||||
|
|
||||||
|
```
|
||||||
|
zstyle :omz:plugins:jj ignore-working-copy yes
|
||||||
|
```
|
||||||
|
|
||||||
|
This will add `--ignore-working-copy` to all `jj` commands executed by your prompt. The downside here is that
|
||||||
|
your prompt might be out-of-sync until the next time `jj` gets a chance to _not_ ignore the working copy (i.e.
|
||||||
|
you manually run a `jj` command).
|
||||||
|
|
||||||
|
If you prefer to keep your prompt always up-to-date but still don't want to _feel_ the slowdown, you can make
|
||||||
|
your prompt asynchronous. This plugin doesn't do this automatically so you'd have to hack your theme a bit for
|
||||||
|
that.
|
||||||
|
|
||||||
|
## See Also
|
||||||
|
|
||||||
|
- [martinvonz/jj](https://github.com/martinvonz/jj)
|
||||||
|
|
||||||
|
## Contributors
|
||||||
|
|
||||||
|
- [nasso](https://github.com/nasso) - Plugin Author
|
||||||
53
plugins/jj/jj.plugin.zsh
Normal file
53
plugins/jj/jj.plugin.zsh
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
# if jj is not found, don't do the rest of the script
|
||||||
|
if (( ! $+commands[jj] )); then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If the completion file doesn't exist yet, we need to autoload it and
|
||||||
|
# bind it to `jj`. Otherwise, compinit will have already done that.
|
||||||
|
if [[ ! -f "$ZSH_CACHE_DIR/completions/_jj" ]]; then
|
||||||
|
typeset -g -A _comps
|
||||||
|
autoload -Uz _jj
|
||||||
|
_comps[jj]=_jj
|
||||||
|
fi
|
||||||
|
|
||||||
|
COMPLETE=zsh jj >| "$ZSH_CACHE_DIR/completions/_jj" &|
|
||||||
|
|
||||||
|
function __jj_prompt_jj() {
|
||||||
|
local -a flags
|
||||||
|
flags=("--no-pager")
|
||||||
|
if zstyle -t ':omz:plugins:jj' ignore-working-copy; then
|
||||||
|
flags+=("--ignore-working-copy")
|
||||||
|
fi
|
||||||
|
command jj $flags "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
# convenience functions for themes
|
||||||
|
function jj_prompt_template_raw() {
|
||||||
|
__jj_prompt_jj log --no-graph -r @ -T "$@" 2> /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
function jj_prompt_template() {
|
||||||
|
local out
|
||||||
|
out=$(jj_prompt_template_raw "$@") || return 1
|
||||||
|
echo "${out:gs/%/%%}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Aliases (sorted alphabetically)
|
||||||
|
alias jjc='jj commit'
|
||||||
|
alias jjcmsg='jj commit --message'
|
||||||
|
alias jjd='jj diff'
|
||||||
|
alias jjdmsg='jj desc --message'
|
||||||
|
alias jjds='jj desc'
|
||||||
|
alias jje='jj edit'
|
||||||
|
alias jjgcl='jj git clone'
|
||||||
|
alias jjgf='jj git fetch'
|
||||||
|
alias jjgp='jj git push'
|
||||||
|
alias jjl='jj log'
|
||||||
|
alias jjla='jj log -r "all()"'
|
||||||
|
alias jjn='jj new'
|
||||||
|
alias jjrb='jj rebase'
|
||||||
|
alias jjrs='jj restore'
|
||||||
|
alias jjrt='cd "$(jj root || echo .)"'
|
||||||
|
alias jjsp='jj split'
|
||||||
|
alias jjsq='jj squash'
|
||||||
|
|
@ -13,6 +13,7 @@ plugins=(... macos)
|
||||||
- [iTerm2](https://iterm2.com/)
|
- [iTerm2](https://iterm2.com/)
|
||||||
- [Hyper](https://hyper.is/)
|
- [Hyper](https://hyper.is/)
|
||||||
- [Tabby](https://tabby.sh/)
|
- [Tabby](https://tabby.sh/)
|
||||||
|
- [Ghostty](https://ghostty.org)
|
||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,12 @@ EOF
|
||||||
tell application "System Events"
|
tell application "System Events"
|
||||||
tell process "Tabby" to keystroke "t" using command down
|
tell process "Tabby" to keystroke "t" using command down
|
||||||
end tell
|
end tell
|
||||||
|
EOF
|
||||||
|
elif [[ "$the_app" == 'ghostty' ]]; then
|
||||||
|
osascript >/dev/null <<EOF
|
||||||
|
tell application "System Events"
|
||||||
|
tell process "Ghostty" to keystroke "t" using command down
|
||||||
|
end tell
|
||||||
EOF
|
EOF
|
||||||
else
|
else
|
||||||
echo "$0: unsupported terminal app: $the_app" >&2
|
echo "$0: unsupported terminal app: $the_app" >&2
|
||||||
|
|
@ -139,6 +145,12 @@ EOF
|
||||||
tell application "System Events"
|
tell application "System Events"
|
||||||
tell process "Tabby" to keystroke "D" using command down
|
tell process "Tabby" to keystroke "D" using command down
|
||||||
end tell
|
end tell
|
||||||
|
EOF
|
||||||
|
elif [[ "$the_app" == 'ghostty' ]]; then
|
||||||
|
osascript >/dev/null <<EOF
|
||||||
|
tell application "System Events"
|
||||||
|
tell process "Ghostty" to keystroke "D" using command down
|
||||||
|
end tell
|
||||||
EOF
|
EOF
|
||||||
else
|
else
|
||||||
echo "$0: unsupported terminal app: $the_app" >&2
|
echo "$0: unsupported terminal app: $the_app" >&2
|
||||||
|
|
@ -194,6 +206,12 @@ EOF
|
||||||
tell application "System Events"
|
tell application "System Events"
|
||||||
tell process "Tabby" to keystroke "d" using command down
|
tell process "Tabby" to keystroke "d" using command down
|
||||||
end tell
|
end tell
|
||||||
|
EOF
|
||||||
|
elif [[ "$the_app" == 'ghostty' ]]; then
|
||||||
|
osascript >/dev/null <<EOF
|
||||||
|
tell application "System Events"
|
||||||
|
tell process "Ghostty" to keystroke "d" using command down
|
||||||
|
end tell
|
||||||
EOF
|
EOF
|
||||||
else
|
else
|
||||||
echo "$0: unsupported terminal app: $the_app" >&2
|
echo "$0: unsupported terminal app: $the_app" >&2
|
||||||
|
|
@ -253,7 +271,7 @@ function man-preview() {
|
||||||
[[ $# -eq 0 ]] && >&2 echo "Usage: $0 command1 [command2 ...]" && return 1
|
[[ $# -eq 0 ]] && >&2 echo "Usage: $0 command1 [command2 ...]" && return 1
|
||||||
|
|
||||||
local page
|
local page
|
||||||
for page in "${(@f)"$(man -w $@)"}"; do
|
for page in "${(@f)"$(command man -w $@)"}"; do
|
||||||
command mandoc -Tpdf $page | open -f -a Preview
|
command mandoc -Tpdf $page | open -f -a Preview
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -146,6 +146,16 @@ case $state in
|
||||||
(help)
|
(help)
|
||||||
_arguments ':feature:__task_list'
|
_arguments ':feature:__task_list'
|
||||||
;;
|
;;
|
||||||
|
(format)
|
||||||
|
_arguments -C \
|
||||||
|
'--check-formatted' \
|
||||||
|
'--dot-formatter' \
|
||||||
|
'--dry-run' \
|
||||||
|
'--force' \
|
||||||
|
'--migrate' \
|
||||||
|
'--no-exit' \
|
||||||
|
'*::file:_files'
|
||||||
|
;;
|
||||||
(test)
|
(test)
|
||||||
_files
|
_files
|
||||||
;;
|
;;
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,19 @@ if (( ! $+commands[procs] )); then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If the completion file doesn't exist yet, we need to autoload it and
|
# If the completion file doesn't exist yet, we need to autoload it and
|
||||||
# bind it to `minikube`. Otherwise, compinit will have already done that.
|
# bind it to `procs`. Otherwise, compinit will have already done that.
|
||||||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_procs" ]]; then
|
if [[ ! -f "$ZSH_CACHE_DIR/completions/_procs" ]]; then
|
||||||
typeset -g -A _comps
|
typeset -g -A _comps
|
||||||
autoload -Uz _procs
|
autoload -Uz _procs
|
||||||
_comps[procs]=_procs
|
_comps[procs]=_procs
|
||||||
fi
|
fi
|
||||||
|
|
||||||
procs --gen-completion-out zsh >| "$ZSH_CACHE_DIR/completions/_procs" &|
|
{
|
||||||
|
autoload -Uz is-at-least
|
||||||
|
local _version=$(procs --version)
|
||||||
|
if is-at-least "0.14" "${_version#procs }"; then
|
||||||
|
procs --gen-completion-out zsh >| "$ZSH_CACHE_DIR/completions/_procs"
|
||||||
|
else
|
||||||
|
procs --completion-out zsh >| "$ZSH_CACHE_DIR/completions/_procs"
|
||||||
|
fi
|
||||||
|
} &|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ function quote {
|
||||||
|
|
||||||
# Get random quote data
|
# Get random quote data
|
||||||
local data
|
local data
|
||||||
data="$(command curl -s --connect-timeout 2 "http://www.quotationspage.com/random.php" \
|
data="$(command curl -s --connect-timeout 2 "https://www.quotationspage.com/random.php" \
|
||||||
| iconv -c -f ISO-8859-1 -t UTF-8 \
|
| iconv -c -f ISO-8859-1 -t UTF-8 \
|
||||||
| command grep -a -m 1 'dt class="quote"')"
|
| command grep -a -m 1 'dt class="quote"')"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ The plugin also supports the following:
|
||||||
|
|
||||||
| Variable | Description |
|
| Variable | Description |
|
||||||
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
|
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
|
||||||
|
| `ZSH_TMUX_AUTOREFRESH` | Automatically refresh global environments (default: `false`) |
|
||||||
| `ZSH_TMUX_AUTOSTART` | Automatically starts tmux (default: `false`) |
|
| `ZSH_TMUX_AUTOSTART` | Automatically starts tmux (default: `false`) |
|
||||||
| `ZSH_TMUX_AUTOSTART_ONCE` | Autostart only if tmux hasn't been started previously (default: `true`) |
|
| `ZSH_TMUX_AUTOSTART_ONCE` | Autostart only if tmux hasn't been started previously (default: `true`) |
|
||||||
| `ZSH_TMUX_AUTOCONNECT` | Automatically connect to a previous session if it exits (default: `true`) |
|
| `ZSH_TMUX_AUTOCONNECT` | Automatically connect to a previous session if it exits (default: `true`) |
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,8 @@ fi
|
||||||
: ${ZSH_TMUX_AUTOQUIT:=$ZSH_TMUX_AUTOSTART}
|
: ${ZSH_TMUX_AUTOQUIT:=$ZSH_TMUX_AUTOSTART}
|
||||||
# Automatically name the new session based on the basename of PWD
|
# Automatically name the new session based on the basename of PWD
|
||||||
: ${ZSH_TMUX_AUTONAME_SESSION:=false}
|
: ${ZSH_TMUX_AUTONAME_SESSION:=false}
|
||||||
|
# Automatically pick up tmux environments
|
||||||
|
: ${ZSH_TMUX_AUTOREFRESH:=false}
|
||||||
# Set term to screen or screen-256color based on current terminal support
|
# Set term to screen or screen-256color based on current terminal support
|
||||||
: ${ZSH_TMUX_DETACHED:=false}
|
: ${ZSH_TMUX_DETACHED:=false}
|
||||||
# Set detached mode
|
# Set detached mode
|
||||||
|
|
@ -158,6 +160,15 @@ function _zsh_tmux_plugin_run() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Refresh tmux environment variables.
|
||||||
|
function _zsh_tmux_plugin_preexec()
|
||||||
|
{
|
||||||
|
local -a tmux_cmd
|
||||||
|
tmux_cmd=(command tmux)
|
||||||
|
|
||||||
|
eval $($tmux_cmd show-environment -s)
|
||||||
|
}
|
||||||
|
|
||||||
# Use the completions for tmux for our function
|
# Use the completions for tmux for our function
|
||||||
compdef _tmux _zsh_tmux_plugin_run
|
compdef _tmux _zsh_tmux_plugin_run
|
||||||
# Alias tmux to our wrapper function.
|
# Alias tmux to our wrapper function.
|
||||||
|
|
@ -184,3 +195,9 @@ if [[ -z "$TMUX" && "$ZSH_TMUX_AUTOSTART" == "true" && -z "$INSIDE_EMACS" && -z
|
||||||
_zsh_tmux_plugin_run
|
_zsh_tmux_plugin_run
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Automatically refresh tmux environments if tmux is running.
|
||||||
|
if [[ -n "$TMUX" && "$ZSH_TMUX_AUTOREFRESH" == "true" ]] && tmux ls >/dev/null 2>/dev/null; then
|
||||||
|
autoload -U add-zsh-hook
|
||||||
|
add-zsh-hook preexec _zsh_tmux_plugin_preexec
|
||||||
|
fi
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ if (( ! ${+commands[uv]} )); then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
alias uv="noglob uv"
|
||||||
|
|
||||||
alias uva='uv add'
|
alias uva='uv add'
|
||||||
alias uvexp='uv export --format requirements-txt --no-hashes --output-file requirements.txt --quiet'
|
alias uvexp='uv export --format requirements-txt --no-hashes --output-file requirements.txt --quiet'
|
||||||
alias uvl='uv lock'
|
alias uvl='uv lock'
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,74 @@
|
||||||
CURRENT_BG='NONE'
|
CURRENT_BG='NONE'
|
||||||
|
|
||||||
case ${SOLARIZED_THEME:-dark} in
|
case ${SOLARIZED_THEME:-dark} in
|
||||||
light) CURRENT_FG='white';;
|
light)
|
||||||
*) CURRENT_FG='black';;
|
CURRENT_FG=${CURRENT_FG:-'white'}
|
||||||
|
CURRENT_DEFAULT_FG=${CURRENT_DEFAULT_FG:-'white'}
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
CURRENT_FG=${CURRENT_FG:-'black'}
|
||||||
|
CURRENT_DEFAULT_FG=${CURRENT_DEFAULT_FG:-'default'}
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
### Theme Configuration Initialization
|
||||||
|
#
|
||||||
|
# Override these settings in your ~/.zshrc
|
||||||
|
|
||||||
|
# Current working directory
|
||||||
|
: ${AGNOSTER_DIR_FG:=${CURRENT_FG}}
|
||||||
|
: ${AGNOSTER_DIR_BG:=blue}
|
||||||
|
|
||||||
|
# user@host
|
||||||
|
: ${AGNOSTER_CONTEXT_FG:=${CURRENT_DEFAULT_FG}}
|
||||||
|
: ${AGNOSTER_CONTEXT_BG:=black}
|
||||||
|
|
||||||
|
# Git related
|
||||||
|
: ${AGNOSTER_GIT_CLEAN_FG:=${CURRENT_FG}}
|
||||||
|
: ${AGNOSTER_GIT_CLEAN_BG:=green}
|
||||||
|
: ${AGNOSTER_GIT_DIRTY_FG:=black}
|
||||||
|
: ${AGNOSTER_GIT_DIRTY_BG:=yellow}
|
||||||
|
|
||||||
|
# Bazaar related
|
||||||
|
: ${AGNOSTER_BZR_CLEAN_FG:=${CURRENT_FG}}
|
||||||
|
: ${AGNOSTER_BZR_CLEAN_BG:=green}
|
||||||
|
: ${AGNOSTER_BZR_DIRTY_FG:=black}
|
||||||
|
: ${AGNOSTER_BZR_DIRTY_BG:=yellow}
|
||||||
|
|
||||||
|
# Mercurial related
|
||||||
|
: ${AGNOSTER_HG_NEWFILE_FG:=white}
|
||||||
|
: ${AGNOSTER_HG_NEWFILE_BG:=red}
|
||||||
|
: ${AGNOSTER_HG_CHANGED_FG:=black}
|
||||||
|
: ${AGNOSTER_HG_CHANGED_BG:=yellow}
|
||||||
|
: ${AGNOSTER_HG_CLEAN_FG:=${CURRENT_FG}}
|
||||||
|
: ${AGNOSTER_HG_CLEAN_BG:=green}
|
||||||
|
|
||||||
|
# VirtualEnv colors
|
||||||
|
: ${AGNOSTER_VENV_FG:=black}
|
||||||
|
: ${AGNOSTER_VENV_BG:=blue}
|
||||||
|
|
||||||
|
# AWS Profile colors
|
||||||
|
: ${AGNOSTER_AWS_PROD_FG:=yellow}
|
||||||
|
: ${AGNOSTER_AWS_PROD_BG:=red}
|
||||||
|
: ${AGNOSTER_AWS_FG:=black}
|
||||||
|
: ${AGNOSTER_AWS_BG:=green}
|
||||||
|
|
||||||
|
# Status symbols
|
||||||
|
: ${AGNOSTER_STATUS_RETVAL_FG:=red}
|
||||||
|
: ${AGNOSTER_STATUS_ROOT_FG:=yellow}
|
||||||
|
: ${AGNOSTER_STATUS_JOB_FG:=cyan}
|
||||||
|
: ${AGNOSTER_STATUS_FG:=${CURRENT_DEFAULT_FG}}
|
||||||
|
: ${AGNOSTER_STATUS_BG:=black}
|
||||||
|
|
||||||
|
## Non-Color settings - set to 'true' to enable
|
||||||
|
# Show the actual numeric return value rather than a cross symbol.
|
||||||
|
: ${AGNOSTER_STATUS_RETVAL_NUMERIC:=false}
|
||||||
|
# Show git working dir in the style "/git/root master relative/dir" instead of "/git/root/relative/dir master"
|
||||||
|
: ${AGNOSTER_GIT_INLINE:=false}
|
||||||
|
# Show the git branch status in the prompt rather than the generic branch symbol
|
||||||
|
: ${AGNOSTER_GIT_BRANCH_STATUS:=true}
|
||||||
|
|
||||||
|
|
||||||
# Special Powerline characters
|
# Special Powerline characters
|
||||||
|
|
||||||
() {
|
() {
|
||||||
|
|
@ -83,16 +147,36 @@ prompt_end() {
|
||||||
CURRENT_BG=''
|
CURRENT_BG=''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
git_toplevel() {
|
||||||
|
local repo_root=$(git rev-parse --show-toplevel)
|
||||||
|
if [[ $repo_root = '' ]]; then
|
||||||
|
# We are in a bare repo. Use git dir as root
|
||||||
|
repo_root=$(git rev-parse --git-dir)
|
||||||
|
if [[ $repo_root = '.' ]]; then
|
||||||
|
repo_root=$PWD
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo -n $repo_root
|
||||||
|
}
|
||||||
|
|
||||||
### Prompt components
|
### Prompt components
|
||||||
# Each component will draw itself, and hide itself if no information needs to be shown
|
# Each component will draw itself, and hide itself if no information needs to be shown
|
||||||
|
|
||||||
# Context: user@hostname (who am I and where am I)
|
# Context: user@hostname (who am I and where am I)
|
||||||
prompt_context() {
|
prompt_context() {
|
||||||
if [[ "$USERNAME" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
|
if [[ "$USERNAME" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
|
||||||
prompt_segment black default "%(!.%{%F{yellow}%}.)%n@%m"
|
prompt_segment "$AGNOSTER_CONTEXT_BG" "$AGNOSTER_CONTEXT_FG" "%(!.%{%F{$AGNOSTER_STATUS_ROOT_FG}%}.)%n@%m"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prompt_git_relative() {
|
||||||
|
local repo_root=$(git_toplevel)
|
||||||
|
local path_in_repo=$(pwd | sed "s/^$(echo "$repo_root" | sed 's:/:\\/:g;s/\$/\\$/g')//;s:^/::;s:/$::;")
|
||||||
|
if [[ $path_in_repo != '' ]]; then
|
||||||
|
prompt_segment "$AGNOSTER_DIR_BG" "$AGNOSTER_DIR_FG" "$path_in_repo"
|
||||||
|
fi;
|
||||||
|
}
|
||||||
|
|
||||||
# Git: branch/detached head, dirty status
|
# Git: branch/detached head, dirty status
|
||||||
prompt_git() {
|
prompt_git() {
|
||||||
(( $+commands[git] )) || return
|
(( $+commands[git] )) || return
|
||||||
|
|
@ -113,20 +197,22 @@ prompt_git() {
|
||||||
ref="◈ $(command git describe --exact-match --tags HEAD 2> /dev/null)" || \
|
ref="◈ $(command git describe --exact-match --tags HEAD 2> /dev/null)" || \
|
||||||
ref="➦ $(command git rev-parse --short HEAD 2> /dev/null)"
|
ref="➦ $(command git rev-parse --short HEAD 2> /dev/null)"
|
||||||
if [[ -n $dirty ]]; then
|
if [[ -n $dirty ]]; then
|
||||||
prompt_segment yellow black
|
prompt_segment "$AGNOSTER_GIT_DIRTY_BG" "$AGNOSTER_GIT_DIRTY_FG"
|
||||||
else
|
else
|
||||||
prompt_segment green $CURRENT_FG
|
prompt_segment "$AGNOSTER_GIT_CLEAN_BG" "$AGNOSTER_GIT_CLEAN_FG"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local ahead behind
|
if [[ $AGNOSTER_GIT_BRANCH_STATUS == 'true' ]]; then
|
||||||
ahead=$(command git log --oneline @{upstream}.. 2>/dev/null)
|
local ahead behind
|
||||||
behind=$(command git log --oneline ..@{upstream} 2>/dev/null)
|
ahead=$(command git log --oneline @{upstream}.. 2>/dev/null)
|
||||||
if [[ -n "$ahead" ]] && [[ -n "$behind" ]]; then
|
behind=$(command git log --oneline ..@{upstream} 2>/dev/null)
|
||||||
PL_BRANCH_CHAR=$'\u21c5'
|
if [[ -n "$ahead" ]] && [[ -n "$behind" ]]; then
|
||||||
elif [[ -n "$ahead" ]]; then
|
PL_BRANCH_CHAR=$'\u21c5'
|
||||||
PL_BRANCH_CHAR=$'\u21b1'
|
elif [[ -n "$ahead" ]]; then
|
||||||
elif [[ -n "$behind" ]]; then
|
PL_BRANCH_CHAR=$'\u21b1'
|
||||||
PL_BRANCH_CHAR=$'\u21b0'
|
elif [[ -n "$behind" ]]; then
|
||||||
|
PL_BRANCH_CHAR=$'\u21b0'
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -e "${repo_path}/BISECT_LOG" ]]; then
|
if [[ -e "${repo_path}/BISECT_LOG" ]]; then
|
||||||
|
|
@ -149,6 +235,7 @@ prompt_git() {
|
||||||
zstyle ':vcs_info:*' actionformats ' %u%c'
|
zstyle ':vcs_info:*' actionformats ' %u%c'
|
||||||
vcs_info
|
vcs_info
|
||||||
echo -n "${${ref:gs/%/%%}/refs\/heads\//$PL_BRANCH_CHAR }${vcs_info_msg_0_%% }${mode}"
|
echo -n "${${ref:gs/%/%%}/refs\/heads\//$PL_BRANCH_CHAR }${vcs_info_msg_0_%% }${mode}"
|
||||||
|
[[ $AGNOSTER_GIT_INLINE == 'true' ]] && prompt_git_relative
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -168,12 +255,12 @@ prompt_bzr() {
|
||||||
status_all=$(echo -n "$bzr_status" | head -n1 | wc -m)
|
status_all=$(echo -n "$bzr_status" | head -n1 | wc -m)
|
||||||
revision=${$(command bzr log -r-1 --log-format line | cut -d: -f1):gs/%/%%}
|
revision=${$(command bzr log -r-1 --log-format line | cut -d: -f1):gs/%/%%}
|
||||||
if [[ $status_mod -gt 0 ]] ; then
|
if [[ $status_mod -gt 0 ]] ; then
|
||||||
prompt_segment yellow black "bzr@$revision ✚"
|
prompt_segment "$AGNOSTER_BZR_DIRTY_BG" "$AGNOSTER_BZR_DIRTY_FG" "bzr@$revision ✚"
|
||||||
else
|
else
|
||||||
if [[ $status_all -gt 0 ]] ; then
|
if [[ $status_all -gt 0 ]] ; then
|
||||||
prompt_segment yellow black "bzr@$revision"
|
prompt_segment "$AGNOSTER_BZR_DIRTY_BG" "$AGNOSTER_BZR_DIRTY_FG" "bzr@$revision"
|
||||||
else
|
else
|
||||||
prompt_segment green black "bzr@$revision"
|
prompt_segment "$AGNOSTER_BZR_CLEAN_BG" "$AGNOSTER_BZR_CLEAN_FG" "bzr@$revision"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
@ -186,15 +273,15 @@ prompt_hg() {
|
||||||
if $(command hg prompt >/dev/null 2>&1); then
|
if $(command hg prompt >/dev/null 2>&1); then
|
||||||
if [[ $(command hg prompt "{status|unknown}") = "?" ]]; then
|
if [[ $(command hg prompt "{status|unknown}") = "?" ]]; then
|
||||||
# if files are not added
|
# if files are not added
|
||||||
prompt_segment red white
|
prompt_segment "$AGNOSTER_HG_NEWFILE_BG" "$AGNOSTER_HG_NEWFILE_FG"
|
||||||
st='±'
|
st='±'
|
||||||
elif [[ -n $(command hg prompt "{status|modified}") ]]; then
|
elif [[ -n $(command hg prompt "{status|modified}") ]]; then
|
||||||
# if any modification
|
# if any modification
|
||||||
prompt_segment yellow black
|
prompt_segment "$AGNOSTER_HG_CHANGED_BG" "$AGNOSTER_HG_CHANGED_FG"
|
||||||
st='±'
|
st='±'
|
||||||
else
|
else
|
||||||
# if working copy is clean
|
# if working copy is clean
|
||||||
prompt_segment green $CURRENT_FG
|
prompt_segment "$AGNOSTER_HG_CLEAN_BG" "$AGNOSTER_HG_CLEAN_FG"
|
||||||
fi
|
fi
|
||||||
echo -n ${$(command hg prompt "☿ {rev}@{branch}"):gs/%/%%} $st
|
echo -n ${$(command hg prompt "☿ {rev}@{branch}"):gs/%/%%} $st
|
||||||
else
|
else
|
||||||
|
|
@ -202,13 +289,13 @@ prompt_hg() {
|
||||||
rev=$(command hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
|
rev=$(command hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
|
||||||
branch=$(command hg id -b 2>/dev/null)
|
branch=$(command hg id -b 2>/dev/null)
|
||||||
if command hg st | command grep -q "^\?"; then
|
if command hg st | command grep -q "^\?"; then
|
||||||
prompt_segment red black
|
prompt_segment "$AGNOSTER_HG_NEWFILE_BG" "$AGNOSTER_HG_NEWFILE_FG"
|
||||||
st='±'
|
st='±'
|
||||||
elif command hg st | command grep -q "^[MA]"; then
|
elif command hg st | command grep -q "^[MA]"; then
|
||||||
prompt_segment yellow black
|
prompt_segment "$AGNOSTER_HG_CHANGED_BG" "$AGNOSTER_HG_CHANGED_FG"
|
||||||
st='±'
|
st='±'
|
||||||
else
|
else
|
||||||
prompt_segment green $CURRENT_FG
|
prompt_segment "$AGNOSTER_HG_CLEAN_BG" "$AGNOSTER_HG_CLEAN_FG"
|
||||||
fi
|
fi
|
||||||
echo -n "☿ ${rev:gs/%/%%}@${branch:gs/%/%%}" $st
|
echo -n "☿ ${rev:gs/%/%%}@${branch:gs/%/%%}" $st
|
||||||
fi
|
fi
|
||||||
|
|
@ -217,13 +304,18 @@ prompt_hg() {
|
||||||
|
|
||||||
# Dir: current working directory
|
# Dir: current working directory
|
||||||
prompt_dir() {
|
prompt_dir() {
|
||||||
prompt_segment blue $CURRENT_FG '%~'
|
if [[ $AGNOSTER_GIT_INLINE == 'true' ]] && $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
|
||||||
|
# Git repo and inline path enabled, hence only show the git root
|
||||||
|
prompt_segment "$AGNOSTER_DIR_BG" "$AGNOSTER_DIR_FG" "$(git_toplevel | sed "s:^$HOME:~:")"
|
||||||
|
else
|
||||||
|
prompt_segment "$AGNOSTER_DIR_BG" "$AGNOSTER_DIR_FG" '%~'
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Virtualenv: current working virtualenv
|
# Virtualenv: current working virtualenv
|
||||||
prompt_virtualenv() {
|
prompt_virtualenv() {
|
||||||
if [[ -n "$VIRTUAL_ENV" && -n "$VIRTUAL_ENV_DISABLE_PROMPT" ]]; then
|
if [[ -n "$VIRTUAL_ENV" && -n "$VIRTUAL_ENV_DISABLE_PROMPT" ]]; then
|
||||||
prompt_segment blue black "(${VIRTUAL_ENV:t:gs/%/%%})"
|
prompt_segment "$AGNOSTER_VENV_BG" "$AGNOSTER_VENV_FG" "(${VIRTUAL_ENV:t:gs/%/%%})"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -234,11 +326,15 @@ prompt_virtualenv() {
|
||||||
prompt_status() {
|
prompt_status() {
|
||||||
local -a symbols
|
local -a symbols
|
||||||
|
|
||||||
[[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}✘"
|
if [[ $AGNOSTER_STATUS_RETVAL_NUMERIC == 'true' ]]; then
|
||||||
[[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡"
|
[[ $RETVAL -ne 0 ]] && symbols+="%{%F{$AGNOSTER_STATUS_RETVAL_FG}%}$RETVAL"
|
||||||
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙"
|
else
|
||||||
|
[[ $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}%}⚙"
|
||||||
|
|
||||||
[[ -n "$symbols" ]] && prompt_segment black default "$symbols"
|
[[ -n "$symbols" ]] && prompt_segment "$AGNOSTER_STATUS_BG" "$AGNOSTER_STATUS_FG" "$symbols"
|
||||||
}
|
}
|
||||||
|
|
||||||
#AWS Profile:
|
#AWS Profile:
|
||||||
|
|
@ -249,8 +345,8 @@ prompt_status() {
|
||||||
prompt_aws() {
|
prompt_aws() {
|
||||||
[[ -z "$AWS_PROFILE" || "$SHOW_AWS_PROMPT" = false ]] && return
|
[[ -z "$AWS_PROFILE" || "$SHOW_AWS_PROMPT" = false ]] && return
|
||||||
case "$AWS_PROFILE" in
|
case "$AWS_PROFILE" in
|
||||||
*-prod|*production*) prompt_segment red yellow "AWS: ${AWS_PROFILE:gs/%/%%}" ;;
|
*-prod|*production*) prompt_segment "$AGNOSTER_AWS_PROD_BG" "$AGNOSTER_AWS_PROD_FG" "AWS: ${AWS_PROFILE:gs/%/%%}" ;;
|
||||||
*) prompt_segment green black "AWS: ${AWS_PROFILE:gs/%/%%}" ;;
|
*) prompt_segment "$AGNOSTER_AWS_BG" "$AGNOSTER_AWS_FG" "AWS: ${AWS_PROFILE:gs/%/%%}" ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
12
themes/nicoulaj.zsh-theme
Normal file → Executable file
12
themes/nicoulaj.zsh-theme
Normal file → Executable file
|
|
@ -12,12 +12,12 @@
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
# Customizable parameters.
|
# Customizable parameters.
|
||||||
PROMPT_PATH_MAX_LENGTH=30
|
PROMPT_PATH_MAX_LENGTH=${PROMPT_PATH_MAX_LENGTH:-30}
|
||||||
PROMPT_DEFAULT_END=❯
|
PROMPT_DEFAULT_END=${PROMPT_DEFAULT_END:-❯}
|
||||||
PROMPT_ROOT_END=❯❯❯
|
PROMPT_ROOT_END=${PROMPT_ROOT_END:-❯❯❯}
|
||||||
PROMPT_SUCCESS_COLOR=$FG[071]
|
PROMPT_SUCCESS_COLOR=${PROMPT_SUCCESS_COLOR:-$FG[071]}
|
||||||
PROMPT_FAILURE_COLOR=$FG[124]
|
PROMPT_FAILURE_COLOR=${PROMPT_FAILURE_COLOR:-$FG[124]}
|
||||||
PROMPT_VCS_INFO_COLOR=$FG[242]
|
PROMPT_VCS_INFO_COLOR=${PROMPT_VCS_INFO_COLOR:-$FG[242]}
|
||||||
|
|
||||||
# Set required options.
|
# Set required options.
|
||||||
setopt promptsubst
|
setopt promptsubst
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ zstyle -s ':omz:update' mode update_mode || {
|
||||||
# - $ZSH is not a git repository
|
# - $ZSH is not a git repository
|
||||||
if [[ "$update_mode" = disabled ]] \
|
if [[ "$update_mode" = disabled ]] \
|
||||||
|| [[ ! -w "$ZSH" || ! -O "$ZSH" ]] \
|
|| [[ ! -w "$ZSH" || ! -O "$ZSH" ]] \
|
||||||
|| [[ ! -t 1 ]] \
|
|| [[ ! -t 1 && ${POWERLEVEL9K_INSTANT_PROMPT:-off} == off ]] \
|
||||||
|| ! command git --version 2>&1 >/dev/null \
|
|| ! command git --version 2>&1 >/dev/null \
|
||||||
|| (builtin cd -q "$ZSH"; ! command git rev-parse --is-inside-work-tree &>/dev/null); then
|
|| (builtin cd -q "$ZSH"; ! command git rev-parse --is-inside-work-tree &>/dev/null); then
|
||||||
unset update_mode
|
unset update_mode
|
||||||
|
|
@ -112,6 +112,11 @@ function update_ohmyzsh() {
|
||||||
local verbose_mode
|
local verbose_mode
|
||||||
zstyle -s ':omz:update' verbose verbose_mode || verbose_mode=default
|
zstyle -s ':omz:update' verbose verbose_mode || verbose_mode=default
|
||||||
|
|
||||||
|
# Force verbose mode to silent if p10k instant prompt is enabled
|
||||||
|
if [[ ${POWERLEVEL9K_INSTANT_PROMPT:-off} != "off" ]]; then
|
||||||
|
verbose_mode=silent
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "$update_mode" != background-alpha ]] \
|
if [[ "$update_mode" != background-alpha ]] \
|
||||||
&& LANG= ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" -i -v $verbose_mode; then
|
&& LANG= ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" -i -v $verbose_mode; then
|
||||||
update_last_updated_file
|
update_last_updated_file
|
||||||
|
|
|
||||||
|
|
@ -400,8 +400,8 @@ EOF
|
||||||
"$FMT_YELLOW" "$FMT_RESET"
|
"$FMT_YELLOW" "$FMT_RESET"
|
||||||
read -r opt
|
read -r opt
|
||||||
case $opt in
|
case $opt in
|
||||||
y*|Y*|"") ;;
|
[Yy]*|"") ;;
|
||||||
n*|N*) echo "Shell change skipped."; return ;;
|
[Nn]*) echo "Shell change skipped."; return ;;
|
||||||
*) echo "Invalid choice. Shell change skipped."; return ;;
|
*) echo "Invalid choice. Shell change skipped."; return ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -254,7 +254,7 @@ if LANG= git pull --quiet --rebase $remote $branch; then
|
||||||
|
|
||||||
# Print changelog to the terminal
|
# Print changelog to the terminal
|
||||||
if [[ $interactive == true && $verbose_mode == default ]]; then
|
if [[ $interactive == true && $verbose_mode == default ]]; then
|
||||||
"$ZSH/tools/changelog.sh" HEAD "$last_commit"
|
ZSH="$ZSH" command zsh -f "$ZSH/tools/changelog.sh" HEAD "$last_commit"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $verbose_mode != silent ]]; then
|
if [[ $verbose_mode != silent ]]; then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue