mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-06 02:51:32 +01:00
Merge branch 'master' of https://github.com/ohmyzsh/ohmyzsh
This commit is contained in:
commit
8e4513b619
102 changed files with 350 additions and 237 deletions
12
README.md
12
README.md
|
|
@ -43,6 +43,7 @@ To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://twi
|
||||||
- [Custom Plugins And Themes](#custom-plugins-and-themes)
|
- [Custom Plugins And Themes](#custom-plugins-and-themes)
|
||||||
- [Enable GNU ls In macOS And freeBSD Systems](#enable-gnu-ls-in-macos-and-freebsd-systems)
|
- [Enable GNU ls In macOS And freeBSD Systems](#enable-gnu-ls-in-macos-and-freebsd-systems)
|
||||||
- [Skip Aliases](#skip-aliases)
|
- [Skip Aliases](#skip-aliases)
|
||||||
|
- [Disable async git prompt](#disable-async-git-prompt)
|
||||||
- [Getting Updates](#getting-updates)
|
- [Getting Updates](#getting-updates)
|
||||||
- [Updates Verbosity](#updates-verbosity)
|
- [Updates Verbosity](#updates-verbosity)
|
||||||
- [Manual Updates](#manual-updates)
|
- [Manual Updates](#manual-updates)
|
||||||
|
|
@ -361,6 +362,17 @@ Instead, you can now use the following:
|
||||||
zstyle ':omz:lib:directories' aliases no
|
zstyle ':omz:lib:directories' aliases no
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Disable async git prompt
|
||||||
|
|
||||||
|
Async prompt functions are an experimental feature (included on April 3, 2024) that allows Oh My Zsh to render prompt information
|
||||||
|
asyncronously. This can improve prompt rendering performance, but it might not work well with some setups. We hope that's not an
|
||||||
|
issue, but if you're seeing problems with this new feature, you can turn it off by setting the following in your .zshrc file,
|
||||||
|
before Oh My Zsh is sourced:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
zstyle ':omz:alpha:lib:git' async-prompt no
|
||||||
|
```
|
||||||
|
|
||||||
#### Notice <!-- omit in toc -->
|
#### Notice <!-- omit in toc -->
|
||||||
|
|
||||||
> This feature is currently in a testing phase and it may be subject to change in the future.
|
> This feature is currently in a testing phase and it may be subject to change in the future.
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
# https://github.com/woefe/git-prompt.zsh/blob/master/git-prompt.zsh
|
# https://github.com/woefe/git-prompt.zsh/blob/master/git-prompt.zsh
|
||||||
|
|
||||||
zmodload zsh/system
|
zmodload zsh/system
|
||||||
|
autoload -Uz is-at-least
|
||||||
|
|
||||||
# For now, async prompt function handlers are set up like so:
|
# For now, async prompt function handlers are set up like so:
|
||||||
# First, define the async function handler and register the handler
|
# First, define the async function handler and register the handler
|
||||||
|
|
@ -82,10 +83,8 @@ function _omz_async_request {
|
||||||
exec {fd}< <(
|
exec {fd}< <(
|
||||||
# Tell parent process our PID
|
# Tell parent process our PID
|
||||||
builtin echo ${sysparams[pid]}
|
builtin echo ${sysparams[pid]}
|
||||||
# Store handler name for callback
|
|
||||||
builtin echo $handler
|
|
||||||
# Set exit code for the handler if used
|
# Set exit code for the handler if used
|
||||||
(exit $ret)
|
() { return $ret }
|
||||||
# Run the async function handler
|
# Run the async function handler
|
||||||
$handler
|
$handler
|
||||||
)
|
)
|
||||||
|
|
@ -95,11 +94,11 @@ function _omz_async_request {
|
||||||
|
|
||||||
# There's a weird bug here where ^C stops working unless we force a fork
|
# There's a weird bug here where ^C stops working unless we force a fork
|
||||||
# See https://github.com/zsh-users/zsh-autosuggestions/issues/364
|
# See https://github.com/zsh-users/zsh-autosuggestions/issues/364
|
||||||
command true
|
# and https://github.com/zsh-users/zsh-autosuggestions/pull/612
|
||||||
|
is-at-least 5.8 || command true
|
||||||
|
|
||||||
# Save the PID from the handler child process
|
# Save the PID from the handler child process
|
||||||
read pid <&$fd
|
read -u $fd "_OMZ_ASYNC_PIDS[$handler]"
|
||||||
_OMZ_ASYNC_PIDS[$handler]=$pid
|
|
||||||
|
|
||||||
# When the fd is readable, call the response handler
|
# When the fd is readable, call the response handler
|
||||||
zle -F "$fd" _omz_async_callback
|
zle -F "$fd" _omz_async_callback
|
||||||
|
|
@ -114,15 +113,14 @@ function _omz_async_callback() {
|
||||||
local err=$2 # Second arg will be passed in case of error
|
local err=$2 # Second arg will be passed in case of error
|
||||||
|
|
||||||
if [[ -z "$err" || "$err" == "hup" ]]; then
|
if [[ -z "$err" || "$err" == "hup" ]]; then
|
||||||
# Get handler name from first line
|
# Get handler name from fd
|
||||||
local handler
|
local handler="${(k)_OMZ_ASYNC_FDS[(r)$fd]}"
|
||||||
read handler <&$fd
|
|
||||||
|
|
||||||
# Store old output which is supposed to be already printed
|
# Store old output which is supposed to be already printed
|
||||||
local old_output="${_OMZ_ASYNC_OUTPUT[$handler]}"
|
local old_output="${_OMZ_ASYNC_OUTPUT[$handler]}"
|
||||||
|
|
||||||
# Read output from fd
|
# Read output from fd
|
||||||
_OMZ_ASYNC_OUTPUT[$handler]="$(cat <&$fd)"
|
IFS= read -r -u $fd -d '' "_OMZ_ASYNC_OUTPUT[$handler]"
|
||||||
|
|
||||||
# Repaint prompt if output has changed
|
# Repaint prompt if output has changed
|
||||||
if [[ "$old_output" != "${_OMZ_ASYNC_OUTPUT[$handler]}" ]]; then
|
if [[ "$old_output" != "${_OMZ_ASYNC_OUTPUT[$handler]}" ]]; then
|
||||||
|
|
|
||||||
12
lib/cli.zsh
12
lib/cli.zsh
|
|
@ -773,7 +773,17 @@ function _omz::theme::use {
|
||||||
}
|
}
|
||||||
|
|
||||||
function _omz::update {
|
function _omz::update {
|
||||||
local last_commit=$(builtin cd -q "$ZSH"; git rev-parse HEAD)
|
# Check if git command is available
|
||||||
|
(( $+commands[git] )) || {
|
||||||
|
_omz::log error "git is not installed. Aborting..."
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
local last_commit=$(builtin cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null)
|
||||||
|
[[ $? -eq 0 ]] || {
|
||||||
|
_omz::log error "\`$ZSH\` is not a git directory. Aborting..."
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
# 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
|
||||||
|
|
|
||||||
32
lib/git.zsh
32
lib/git.zsh
|
|
@ -1,3 +1,5 @@
|
||||||
|
autoload -Uz is-at-least
|
||||||
|
|
||||||
# The git prompt's git commands are read-only and should not interfere with
|
# The git prompt's git commands are read-only and should not interfere with
|
||||||
# other processes. This environment variable is equivalent to running with `git
|
# other processes. This environment variable is equivalent to running with `git
|
||||||
# --no-optional-locks`, but falls back gracefully for older versions of git.
|
# --no-optional-locks`, but falls back gracefully for older versions of git.
|
||||||
|
|
@ -9,7 +11,7 @@ function __git_prompt_git() {
|
||||||
GIT_OPTIONAL_LOCKS=0 command git "$@"
|
GIT_OPTIONAL_LOCKS=0 command git "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
function _omz_git_prompt_status() {
|
function _omz_git_prompt_info() {
|
||||||
# If we are on a folder not tracked by git, get out.
|
# If we are on a folder not tracked by git, get out.
|
||||||
# Otherwise, check for hide-info at global and local repository level
|
# Otherwise, check for hide-info at global and local repository level
|
||||||
if ! __git_prompt_git rev-parse --git-dir &> /dev/null \
|
if ! __git_prompt_git rev-parse --git-dir &> /dev/null \
|
||||||
|
|
@ -37,9 +39,19 @@ function _omz_git_prompt_status() {
|
||||||
echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${ref:gs/%/%%}${upstream:gs/%/%%}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}"
|
echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${ref:gs/%/%%}${upstream:gs/%/%%}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Enable async prompt by default unless the setting is at false / no
|
# Use async version if setting is enabled, or undefined but zsh version is at least 5.0.6
|
||||||
if zstyle -t ':omz:alpha:lib:git' async-prompt; then
|
# https://github.com/ohmyzsh/ohmyzsh/issues/12331#issuecomment-2059460268
|
||||||
|
if zstyle -t ':omz:alpha:lib:git' async-prompt \
|
||||||
|
|| { is-at-least 5.0.6 && zstyle -T ':omz:alpha:lib:git' async-prompt }; then
|
||||||
function git_prompt_info() {
|
function git_prompt_info() {
|
||||||
|
setopt localoptions noksharrays
|
||||||
|
if [[ -n "$_OMZ_ASYNC_OUTPUT[_omz_git_prompt_info]" ]]; then
|
||||||
|
echo -n "$_OMZ_ASYNC_OUTPUT[_omz_git_prompt_info]"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function git_prompt_status() {
|
||||||
|
setopt localoptions noksharrays
|
||||||
if [[ -n "$_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]" ]]; then
|
if [[ -n "$_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]" ]]; then
|
||||||
echo -n "$_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]"
|
echo -n "$_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]"
|
||||||
fi
|
fi
|
||||||
|
|
@ -49,10 +61,15 @@ if zstyle -t ':omz:alpha:lib:git' async-prompt; then
|
||||||
# or any of the other prompt variables
|
# or any of the other prompt variables
|
||||||
function _defer_async_git_register() {
|
function _defer_async_git_register() {
|
||||||
# Check if git_prompt_info is used in a prompt variable
|
# Check if git_prompt_info is used in a prompt variable
|
||||||
case "${PS1}:${PS2}:${PS3}:${PS4}:${RPS1}:${RPS2}:${RPS3}:${RPS4}" in
|
case "${PS1}:${PS2}:${PS3}:${PS4}:${RPROMPT}:${RPS1}:${RPS2}:${RPS3}:${RPS4}" in
|
||||||
*(\$\(git_prompt_info\)|\`git_prompt_info\`)*)
|
*(\$\(git_prompt_info\)|\`git_prompt_info\`)*)
|
||||||
|
_omz_register_handler _omz_git_prompt_info
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
case "${PS1}:${PS2}:${PS3}:${PS4}:${RPROMPT}:${RPS1}:${RPS2}:${RPS3}:${RPS4}" in
|
||||||
|
*(\$\(git_prompt_status\)|\`git_prompt_status\`)*)
|
||||||
_omz_register_handler _omz_git_prompt_status
|
_omz_register_handler _omz_git_prompt_status
|
||||||
return
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
@ -65,6 +82,9 @@ if zstyle -t ':omz:alpha:lib:git' async-prompt; then
|
||||||
precmd_functions=(_defer_async_git_register $precmd_functions)
|
precmd_functions=(_defer_async_git_register $precmd_functions)
|
||||||
else
|
else
|
||||||
function git_prompt_info() {
|
function git_prompt_info() {
|
||||||
|
_omz_git_prompt_info
|
||||||
|
}
|
||||||
|
function git_prompt_status() {
|
||||||
_omz_git_prompt_status
|
_omz_git_prompt_status
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
@ -197,7 +217,7 @@ function git_prompt_long_sha() {
|
||||||
SHA=$(__git_prompt_git rev-parse HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
|
SHA=$(__git_prompt_git rev-parse HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
|
||||||
}
|
}
|
||||||
|
|
||||||
function git_prompt_status() {
|
function _omz_git_prompt_status() {
|
||||||
[[ "$(__git_prompt_git config --get oh-my-zsh.hide-status 2>/dev/null)" = 1 ]] && return
|
[[ "$(__git_prompt_git config --get oh-my-zsh.hide-status 2>/dev/null)" = 1 ]] && return
|
||||||
|
|
||||||
# Maps a git status prefix to an internal constant
|
# Maps a git status prefix to an internal constant
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,20 @@
|
||||||
## History wrapper
|
## History wrapper
|
||||||
function omz_history {
|
function omz_history {
|
||||||
local clear list
|
# parse arguments and remove from $@
|
||||||
zparseopts -E c=clear l=list
|
local clear list stamp
|
||||||
|
zparseopts -E -D c=clear l=list f=stamp E=stamp i=stamp t:=stamp
|
||||||
|
|
||||||
if [[ -n "$clear" ]]; then
|
if [[ -n "$clear" ]]; then
|
||||||
# if -c provided, clobber the history file
|
# if -c provided, clobber the history file
|
||||||
echo -n >| "$HISTFILE"
|
echo -n >| "$HISTFILE"
|
||||||
fc -p "$HISTFILE"
|
fc -p "$HISTFILE"
|
||||||
echo >&2 History file deleted.
|
echo >&2 History file deleted.
|
||||||
elif [[ -n "$list" ]]; then
|
elif [[ $# -eq 0 ]]; then
|
||||||
# if -l provided, run as if calling `fc' directly
|
# if no arguments provided, show full history starting from 1
|
||||||
builtin fc "$@"
|
builtin fc $stamp -l 1
|
||||||
else
|
else
|
||||||
# unless a number is provided, show all history events (starting from 1)
|
# otherwise, run `fc -l` with a custom format
|
||||||
[[ ${@[-1]-} = *[0-9]* ]] && builtin fc -l "$@" || builtin fc -l "$@" 1
|
builtin fc $stamp -l "$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -179,8 +179,8 @@ 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() {
|
||||||
echo ":: Checking Arch Linux PGP Keyring..."
|
echo ":: Checking Arch Linux PGP Keyring..."
|
||||||
local installedver="$(sudo pacman -Qi archlinux-keyring | grep -Po '(?<=Version : ).*')"
|
local installedver="$(LANG= sudo pacman -Qi archlinux-keyring | grep -Po '(?<=Version : ).*')"
|
||||||
local currentver="$(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."
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ autojump_paths=(
|
||||||
/opt/local/etc/profile.d/autojump.sh # macOS with MacPorts
|
/opt/local/etc/profile.d/autojump.sh # macOS with MacPorts
|
||||||
/usr/local/etc/profile.d/autojump.sh # macOS with Homebrew (default)
|
/usr/local/etc/profile.d/autojump.sh # macOS with Homebrew (default)
|
||||||
/opt/homebrew/etc/profile.d/autojump.sh # macOS with Homebrew (default on M1 macs)
|
/opt/homebrew/etc/profile.d/autojump.sh # macOS with Homebrew (default on M1 macs)
|
||||||
|
/opt/pkg/share/autojump/autojump.zsh # macOS with pkgsrc
|
||||||
/etc/profiles/per-user/$USER/etc/profile.d/autojump.sh # macOS Nix, Home Manager and flakes
|
/etc/profiles/per-user/$USER/etc/profile.d/autojump.sh # macOS Nix, Home Manager and flakes
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ if [[ -z "${CLOUDSDK_HOME}" ]]; then
|
||||||
"/usr/local/share/google-cloud-sdk"
|
"/usr/local/share/google-cloud-sdk"
|
||||||
"/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
|
"/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
|
||||||
"/opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
|
"/opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
|
||||||
|
"/opt/homebrew/share/google-cloud-sdk"
|
||||||
"/usr/share/google-cloud-sdk"
|
"/usr/share/google-cloud-sdk"
|
||||||
"/snap/google-cloud-sdk/current"
|
"/snap/google-cloud-sdk/current"
|
||||||
"/snap/google-cloud-cli/current"
|
"/snap/google-cloud-cli/current"
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@ To use it, add `git-prompt` to the plugins array in your zshrc file:
|
||||||
plugins=(... git-prompt)
|
plugins=(... git-prompt)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You may also need to [customize your theme](https://github.com/ohmyzsh/ohmyzsh/issues/9395#issuecomment-1027130429)
|
||||||
|
to change the way the prompt is built. See the
|
||||||
|
[OMZ wiki on customizing themes](https://github.com/ohmyzsh/ohmyzsh/wiki/Customization#overriding-and-adding-themes).
|
||||||
|
|
||||||
See the [original repository](https://github.com/olivierverdier/zsh-git-prompt).
|
See the [original repository](https://github.com/olivierverdier/zsh-git-prompt).
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,7 @@ plugins=(... git)
|
||||||
| `gfg` | `git ls-files \| grep` |
|
| `gfg` | `git ls-files \| grep` |
|
||||||
| `gm` | `git merge` |
|
| `gm` | `git merge` |
|
||||||
| `gma` | `git merge --abort` |
|
| `gma` | `git merge --abort` |
|
||||||
|
| `gmc` | `git merge --continue` |
|
||||||
| `gms` | `git merge --squash` |
|
| `gms` | `git merge --squash` |
|
||||||
| `gmom` | `git merge origin/$(git_main_branch)` |
|
| `gmom` | `git merge origin/$(git_main_branch)` |
|
||||||
| `gmum` | `git merge upstream/$(git_main_branch)` |
|
| `gmum` | `git merge upstream/$(git_main_branch)` |
|
||||||
|
|
@ -166,6 +167,7 @@ plugins=(... git)
|
||||||
| `grhk` | `git reset --keep` |
|
| `grhk` | `git reset --keep` |
|
||||||
| `grhs` | `git reset --soft` |
|
| `grhs` | `git reset --soft` |
|
||||||
| `gpristine` | `git reset --hard && git clean --force -dfx` |
|
| `gpristine` | `git reset --hard && git clean --force -dfx` |
|
||||||
|
| `gwipe` | `git reset --hard && git clean --force -df` |
|
||||||
| `groh` | `git reset origin/$(git_current_branch) --hard` |
|
| `groh` | `git reset origin/$(git_current_branch) --hard` |
|
||||||
| `grs` | `git restore` |
|
| `grs` | `git restore` |
|
||||||
| `grss` | `git restore --source` |
|
| `grss` | `git restore --source` |
|
||||||
|
|
|
||||||
|
|
@ -252,6 +252,7 @@ alias gignored='git ls-files -v | grep "^[[:lower:]]"'
|
||||||
alias gfg='git ls-files | grep'
|
alias gfg='git ls-files | grep'
|
||||||
alias gm='git merge'
|
alias gm='git merge'
|
||||||
alias gma='git merge --abort'
|
alias gma='git merge --abort'
|
||||||
|
alias gmc='git merge --continue'
|
||||||
alias gms="git merge --squash"
|
alias gms="git merge --squash"
|
||||||
alias gmom='git merge origin/$(git_main_branch)'
|
alias gmom='git merge origin/$(git_main_branch)'
|
||||||
alias gmum='git merge upstream/$(git_main_branch)'
|
alias gmum='git merge upstream/$(git_main_branch)'
|
||||||
|
|
@ -349,6 +350,7 @@ alias grhh='git reset --hard'
|
||||||
alias grhk='git reset --keep'
|
alias grhk='git reset --keep'
|
||||||
alias grhs='git reset --soft'
|
alias grhs='git reset --soft'
|
||||||
alias gpristine='git reset --hard && git clean --force -dfx'
|
alias gpristine='git reset --hard && git clean --force -dfx'
|
||||||
|
alias gwipe='git reset --hard && git clean --force -df'
|
||||||
alias groh='git reset origin/$(git_current_branch) --hard'
|
alias groh='git reset origin/$(git_current_branch) --hard'
|
||||||
alias grs='git restore'
|
alias grs='git restore'
|
||||||
alias grss='git restore --source'
|
alias grss='git restore --source'
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#compdef http
|
#compdef http https
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# Copyright (c) 2015 GitHub zsh-users - http://github.com/zsh-users
|
# Copyright (c) 2015 GitHub zsh-users - http://github.com/zsh-users
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
|
|
|
||||||
|
|
@ -16,18 +16,21 @@ This plugin supplies one command, `jira`, through which all its features are exp
|
||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
|
|
||||||
|
`jira help` or `jira usage` will print the below usage instructions
|
||||||
|
|
||||||
| Command | Description |
|
| Command | Description |
|
||||||
| :------------ | :-------------------------------------------------------- |
|
| :------------ | :-------------------------------------------------------- |
|
||||||
| `jira` | Performs the default action |
|
| `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 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 |
|
||||||
| `jira reported [username]` | Queries for issues reported by a user |
|
| `jira reported [username]` | Queries for issues reported by a user |
|
||||||
| `jira assigned [username]` | Queries for issues assigned to a user |
|
| `jira assigned [username]` | Queries for issues assigned to a user |
|
||||||
| `jira branch` | Opens an existing issue matching the current branch name |
|
| `jira branch` | Opens an existing issue matching the current branch name |
|
||||||
|
| `jira help` | Prints usage instructions |
|
||||||
|
|
||||||
|
|
||||||
### Jira Branch usage notes
|
### Jira Branch usage notes
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ _1st_arguments=(
|
||||||
'assigned:search for issues assigned to a user'
|
'assigned:search for issues assigned to a user'
|
||||||
'branch:open the issue named after the git branch of the current directory'
|
'branch:open the issue named after the git branch of the current directory'
|
||||||
'dumpconfig:display effective jira configuration'
|
'dumpconfig:display effective jira configuration'
|
||||||
|
'help:print usage help to stdout'
|
||||||
)
|
)
|
||||||
|
|
||||||
_arguments -C \
|
_arguments -C \
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,21 @@
|
||||||
#
|
#
|
||||||
# See README.md for details
|
# See README.md for details
|
||||||
|
|
||||||
|
function _jira_usage() {
|
||||||
|
cat <<EOF
|
||||||
|
jira Performs the default action
|
||||||
|
jira new Opens a new Jira issue dialogue
|
||||||
|
jira ABC-123 Opens an existing issue
|
||||||
|
jira ABC-123 m Opens an existing issue for adding a comment
|
||||||
|
jira dashboard [rapid_view] Opens your JIRA dashboard
|
||||||
|
jira mine Queries for your own issues
|
||||||
|
jira tempo Opens your JIRA Tempo
|
||||||
|
jira reported [username] Queries for issues reported by a user
|
||||||
|
jira assigned [username] Queries for issues assigned to a user
|
||||||
|
jira branch Opens an existing issue matching the current branch name
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
function jira() {
|
function jira() {
|
||||||
emulate -L zsh
|
emulate -L zsh
|
||||||
local action jira_url jira_prefix
|
local action jira_url jira_prefix
|
||||||
|
|
@ -44,6 +59,8 @@ function jira() {
|
||||||
open_command "${jira_url}/secure/CreateIssue!default.jspa"
|
open_command "${jira_url}/secure/CreateIssue!default.jspa"
|
||||||
elif [[ "$action" == "assigned" || "$action" == "reported" ]]; then
|
elif [[ "$action" == "assigned" || "$action" == "reported" ]]; then
|
||||||
_jira_query ${@:-$action}
|
_jira_query ${@:-$action}
|
||||||
|
elif [[ "$action" == "help" || "$action" == "usage" ]]; then
|
||||||
|
_jira_usage
|
||||||
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"
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ plugins=(... laravel)
|
||||||
|:-:|:-:|
|
|:-:|:-:|
|
||||||
| `artisan` | `php artisan` |
|
| `artisan` | `php artisan` |
|
||||||
| `pas` | `php artisan serve` |
|
| `pas` | `php artisan serve` |
|
||||||
|
| `pats` | `php artisan test` |
|
||||||
|
|
||||||
## Database
|
## Database
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ alias bob='php artisan bob::build'
|
||||||
|
|
||||||
# Development
|
# Development
|
||||||
alias pas='php artisan serve'
|
alias pas='php artisan serve'
|
||||||
|
alias pats='php artisan test'
|
||||||
|
|
||||||
# Database
|
# Database
|
||||||
alias pam='php artisan migrate'
|
alias pam='php artisan migrate'
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ Original author: [Sorin Ionescu](https://github.com/sorin-ionescu)
|
||||||
| `tab` | Open the current directory in a new tab |
|
| `tab` | Open the current directory in a new tab |
|
||||||
| `split_tab` | Split the current terminal tab horizontally |
|
| `split_tab` | Split the current terminal tab horizontally |
|
||||||
| `vsplit_tab` | Split the current terminal tab vertically |
|
| `vsplit_tab` | Split the current terminal tab vertically |
|
||||||
| `ofd` | Open the current directory in a Finder window |
|
| `ofd` | Open passed directories (or $PWD by default) in Finder |
|
||||||
| `pfd` | Return the path of the frontmost Finder window |
|
| `pfd` | Return the path of the frontmost Finder window |
|
||||||
| `pfs` | Return the current Finder selection |
|
| `pfs` | Return the current Finder selection |
|
||||||
| `cdf` | `cd` to the current Finder directory |
|
| `cdf` | `cd` to the current Finder directory |
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,15 @@
|
||||||
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
|
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
|
||||||
0="${${(M)0:#/*}:-$PWD/$0}"
|
0="${${(M)0:#/*}:-$PWD/$0}"
|
||||||
|
|
||||||
# Open the current directory in a Finder window
|
# Open in Finder the directories passed as arguments, or the current directory if
|
||||||
alias ofd='open_command $PWD'
|
# no directories are passed
|
||||||
|
function ofd {
|
||||||
|
if (( ! $# )); then
|
||||||
|
open_command $PWD
|
||||||
|
else
|
||||||
|
open_command $@
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Show/hide hidden files in the Finder
|
# Show/hide hidden files in the Finder
|
||||||
alias showfiles="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
|
alias showfiles="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,9 @@ fi
|
||||||
# Load mise hooks
|
# Load mise hooks
|
||||||
eval "$($__mise activate zsh)"
|
eval "$($__mise activate zsh)"
|
||||||
|
|
||||||
|
# Hook mise into current environment
|
||||||
|
eval "$($__mise hook-env -s zsh)"
|
||||||
|
|
||||||
# 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 `mise`. Otherwise, compinit will have already done that.
|
# bind it to `mise`. Otherwise, compinit will have already done that.
|
||||||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_$__mise" ]]; then
|
if [[ ! -f "$ZSH_CACHE_DIR/completions/_$__mise" ]]; then
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,27 @@
|
||||||
# Automatic poetry environment activation/deactivation
|
|
||||||
_togglePoetryShell() {
|
_togglePoetryShell() {
|
||||||
# deactivate environment if pyproject.toml doesn't exist and not in a subdir
|
# Determine if currently in a Poetry-managed directory
|
||||||
if [[ ! -f "$PWD/pyproject.toml" ]] ; then
|
local in_poetry_dir=0
|
||||||
if [[ "$poetry_active" == 1 ]]; then
|
if [[ -f "$PWD/pyproject.toml" ]] && grep -q 'tool.poetry' "$PWD/pyproject.toml"; then
|
||||||
if [[ "$PWD" != "$poetry_dir"* ]]; then
|
in_poetry_dir=1
|
||||||
export poetry_active=0
|
|
||||||
deactivate
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# activate the environment if pyproject.toml exists
|
# Deactivate the current environment if moving out of a Poetry directory or into a different Poetry directory
|
||||||
if [[ "$poetry_active" != 1 ]]; then
|
if [[ $poetry_active -eq 1 ]] && { [[ $in_poetry_dir -eq 0 ]] || [[ "$PWD" != "$poetry_dir"* ]]; }; then
|
||||||
if [[ -f "$PWD/pyproject.toml" ]]; then
|
export poetry_active=0
|
||||||
if grep -q 'tool.poetry' "$PWD/pyproject.toml"; then
|
unset poetry_dir
|
||||||
export poetry_active=1
|
deactivate
|
||||||
export poetry_dir="$PWD"
|
fi
|
||||||
source "$(poetry env info --path)/bin/activate"
|
|
||||||
fi
|
# Activate the environment if in a Poetry directory and no environment is currently active
|
||||||
|
if [[ $in_poetry_dir -eq 1 ]] && [[ $poetry_active -ne 1 ]]; then
|
||||||
|
venv_dir=$(poetry env info --path 2>/dev/null)
|
||||||
|
if [[ -n "$venv_dir" ]]; then
|
||||||
|
export poetry_active=1
|
||||||
|
export poetry_dir="$PWD"
|
||||||
|
source "${venv_dir}/bin/activate"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
autoload -U add-zsh-hook
|
autoload -U add-zsh-hook
|
||||||
add-zsh-hook chpwd _togglePoetryShell
|
add-zsh-hook chpwd _togglePoetryShell
|
||||||
_togglePoetryShell
|
_togglePoetryShell # Initial call to check the current directory at shell startup
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,8 @@ if parsed.scheme not in proxy_protocols:
|
||||||
|
|
||||||
def make_argv():
|
def make_argv():
|
||||||
yield "nc"
|
yield "nc"
|
||||||
if sys.platform == 'linux':
|
if sys.platform in {'linux', 'cygwin'}:
|
||||||
|
# caveats: the built-in netcat of most linux distributions and cygwin support proxy type
|
||||||
# caveats: macOS built-in netcat command not supported proxy-type
|
# caveats: macOS built-in netcat command not supported proxy-type
|
||||||
yield "-X" # --proxy-type
|
yield "-X" # --proxy-type
|
||||||
# Supported protocols are 4 (SOCKS v4), 5 (SOCKS v5) and connect (HTTP proxy).
|
# Supported protocols are 4 (SOCKS v4), 5 (SOCKS v5) and connect (HTTP proxy).
|
||||||
|
|
|
||||||
|
|
@ -98,8 +98,10 @@ function _add_identities() {
|
||||||
|
|
||||||
# Add a nifty symlink for screen/tmux if agent forwarding is enabled
|
# Add a nifty symlink for screen/tmux if agent forwarding is enabled
|
||||||
if zstyle -t :omz:plugins:ssh-agent agent-forwarding \
|
if zstyle -t :omz:plugins:ssh-agent agent-forwarding \
|
||||||
&& [[ -n "$SSH_AUTH_SOCK" && ! -L "$SSH_AUTH_SOCK" ]]; then
|
&& [[ -n "$SSH_AUTH_SOCK" ]]; then
|
||||||
ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USERNAME-screen
|
if [[ ! -L "$SSH_AUTH_SOCK" ]]; then
|
||||||
|
ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USERNAME-screen
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
_start_agent
|
_start_agent
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
# ignore oh-my-zsh theme
|
|
||||||
unset ZSH_THEME
|
|
||||||
|
|
||||||
if (( $+commands[starship] )); then
|
if (( $+commands[starship] )); then
|
||||||
|
# ignore oh-my-zsh theme
|
||||||
|
unset ZSH_THEME
|
||||||
|
|
||||||
eval "$(starship init zsh)"
|
eval "$(starship init zsh)"
|
||||||
else
|
else
|
||||||
echo '[oh-my-zsh] starship not found, please install it from https://starship.rs'
|
echo '[oh-my-zsh] starship not found, please install it from https://starship.rs'
|
||||||
|
|
|
||||||
|
|
@ -15,19 +15,20 @@ plugins=(... terraform)
|
||||||
|
|
||||||
## Aliases
|
## Aliases
|
||||||
|
|
||||||
| Alias | Command |
|
| Alias | Command |
|
||||||
| ----- | -------------------- |
|
| ------ | -------------------- |
|
||||||
| `tf` | `terraform` |
|
| `tf` | `terraform` |
|
||||||
| `tfa` | `terraform apply` |
|
| `tfa` | `terraform apply` |
|
||||||
| `tfc` | `terraform console` |
|
| `tfc` | `terraform console` |
|
||||||
| `tfd` | `terraform destroy` |
|
| `tfd` | `terraform destroy` |
|
||||||
| `tff` | `terraform fmt` |
|
| `tff` | `terraform fmt` |
|
||||||
| `tfi` | `terraform init` |
|
| `tfi` | `terraform init` |
|
||||||
| `tfo` | `terraform output` |
|
| `tfo` | `terraform output` |
|
||||||
| `tfp` | `terraform plan` |
|
| `tfp` | `terraform plan` |
|
||||||
| `tfv` | `terraform validate` |
|
| `tfv` | `terraform validate` |
|
||||||
| `tfs` | `terraform state` |
|
| `tfs` | `terraform state` |
|
||||||
| `tfsh`| `terraform show` |
|
| `tft` | `terraform test` |
|
||||||
|
| `tfsh` | `terraform show` |
|
||||||
|
|
||||||
|
|
||||||
## Prompt function
|
## Prompt function
|
||||||
|
|
|
||||||
|
|
@ -25,4 +25,5 @@ alias tfo='terraform output'
|
||||||
alias tfp='terraform plan'
|
alias tfp='terraform plan'
|
||||||
alias tfv='terraform validate'
|
alias tfv='terraform validate'
|
||||||
alias tfs='terraform state'
|
alias tfs='terraform state'
|
||||||
|
alias tft='terraform test'
|
||||||
alias tfsh='terraform show'
|
alias tfsh='terraform show'
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ The plugin also supports the following:
|
||||||
| `ZSH_TMUX_AUTOQUIT` | Automatically closes terminal once tmux exits (default: `ZSH_TMUX_AUTOSTART`) |
|
| `ZSH_TMUX_AUTOQUIT` | Automatically closes terminal once tmux exits (default: `ZSH_TMUX_AUTOSTART`) |
|
||||||
| `ZSH_TMUX_CONFIG` | Set the configuration path (default: `$HOME/.tmux.conf`, `$XDG_CONFIG_HOME/tmux/tmux.conf`) |
|
| `ZSH_TMUX_CONFIG` | Set the configuration path (default: `$HOME/.tmux.conf`, `$XDG_CONFIG_HOME/tmux/tmux.conf`) |
|
||||||
| `ZSH_TMUX_DEFAULT_SESSION_NAME` | Set tmux default session name when autostart is enabled |
|
| `ZSH_TMUX_DEFAULT_SESSION_NAME` | Set tmux default session name when autostart is enabled |
|
||||||
|
| `ZSH_TMUX_AUTONAME_SESSION` | Automatically name new sessions based on the basename of `$PWD` (default: `false`) |
|
||||||
| `ZSH_TMUX_DETACHED` | Set the detached mode (default: `false`) |
|
| `ZSH_TMUX_DETACHED` | Set the detached mode (default: `false`) |
|
||||||
| `ZSH_TMUX_FIXTERM` | Sets `$TERM` to 256-color term or not based on current terminal support |
|
| `ZSH_TMUX_FIXTERM` | Sets `$TERM` to 256-color term or not based on current terminal support |
|
||||||
| `ZSH_TMUX_FIXTERM_WITHOUT_256COLOR` | `$TERM` to use for non 256-color terminals (default: `tmux` if available, `screen` otherwise) |
|
| `ZSH_TMUX_FIXTERM_WITHOUT_256COLOR` | `$TERM` to use for non 256-color terminals (default: `tmux` if available, `screen` otherwise) |
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@ fi
|
||||||
: ${ZSH_TMUX_AUTOCONNECT:=true}
|
: ${ZSH_TMUX_AUTOCONNECT:=true}
|
||||||
# Automatically close the terminal when tmux exits
|
# Automatically close the terminal when tmux exits
|
||||||
: ${ZSH_TMUX_AUTOQUIT:=$ZSH_TMUX_AUTOSTART}
|
: ${ZSH_TMUX_AUTOQUIT:=$ZSH_TMUX_AUTOSTART}
|
||||||
|
# Automatically name the new session based on the basename of PWD
|
||||||
|
: ${ZSH_TMUX_AUTONAME_SESSION:=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
|
||||||
|
|
@ -102,9 +104,22 @@ function _zsh_tmux_plugin_run() {
|
||||||
|
|
||||||
local _detached=""
|
local _detached=""
|
||||||
[[ "$ZSH_TMUX_DETACHED" == "true" ]] && _detached="-d"
|
[[ "$ZSH_TMUX_DETACHED" == "true" ]] && _detached="-d"
|
||||||
|
|
||||||
|
local session_name
|
||||||
|
if [[ "$ZSH_TMUX_AUTONAME_SESSION" == "true" ]]; then
|
||||||
|
# Name the session after the basename of the current directory
|
||||||
|
session_name=${PWD##*/}
|
||||||
|
# If the current directory is the home directory, name it 'HOME'
|
||||||
|
[[ "$PWD" == "$HOME" ]] && session_name="HOME"
|
||||||
|
# If the current directory is the root directory, name it 'ROOT'
|
||||||
|
[[ "$PWD" == "/" ]] && session_name="ROOT"
|
||||||
|
else
|
||||||
|
session_name="$ZSH_TMUX_DEFAULT_SESSION_NAME"
|
||||||
|
fi
|
||||||
|
|
||||||
# Try to connect to an existing session.
|
# Try to connect to an existing session.
|
||||||
if [[ -n "$ZSH_TMUX_DEFAULT_SESSION_NAME" ]]; then
|
if [[ -n "$session_name" ]]; then
|
||||||
[[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach $_detached -t $ZSH_TMUX_DEFAULT_SESSION_NAME
|
[[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach $_detached -t "$session_name"
|
||||||
else
|
else
|
||||||
[[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach $_detached
|
[[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach $_detached
|
||||||
fi
|
fi
|
||||||
|
|
@ -116,8 +131,9 @@ function _zsh_tmux_plugin_run() {
|
||||||
elif [[ -e "$ZSH_TMUX_CONFIG" ]]; then
|
elif [[ -e "$ZSH_TMUX_CONFIG" ]]; then
|
||||||
tmux_cmd+=(-f "$ZSH_TMUX_CONFIG")
|
tmux_cmd+=(-f "$ZSH_TMUX_CONFIG")
|
||||||
fi
|
fi
|
||||||
if [[ -n "$ZSH_TMUX_DEFAULT_SESSION_NAME" ]]; then
|
|
||||||
$tmux_cmd new-session -s $ZSH_TMUX_DEFAULT_SESSION_NAME
|
if [[ -n "$session_name" ]]; then
|
||||||
|
$tmux_cmd new-session -s "$session_name"
|
||||||
else
|
else
|
||||||
$tmux_cmd new-session
|
$tmux_cmd new-session
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ _global_commands=(
|
||||||
)
|
)
|
||||||
|
|
||||||
_yarn_find_package_json() {
|
_yarn_find_package_json() {
|
||||||
local dir=$(cd "$1" && pwd)
|
local dir=$(builtin cd "$1" && pwd)
|
||||||
|
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
|
|
@ -109,7 +109,7 @@ _yarn_commands_scripts() {
|
||||||
|
|
||||||
if [[ -n $opt_args[--cwd] ]]; then
|
if [[ -n $opt_args[--cwd] ]]; then
|
||||||
packageJson=$(_yarn_find_package_json $opt_args[--cwd])
|
packageJson=$(_yarn_find_package_json $opt_args[--cwd])
|
||||||
binaries=($(cd $opt_args[--cwd] && echo node_modules/.bin/*(x:t)))
|
binaries=($(builtin cd $opt_args[--cwd] && echo node_modules/.bin/*(x:t)))
|
||||||
else
|
else
|
||||||
packageJson=$(_yarn_find_package_json $pwd)
|
packageJson=$(_yarn_find_package_json $pwd)
|
||||||
binaries=($(echo node_modules/.bin/*(x:t)))
|
binaries=($(echo node_modules/.bin/*(x:t)))
|
||||||
|
|
@ -130,9 +130,9 @@ _yarn_scripts() {
|
||||||
if [[ -n $_yarn_run_cwd ]]; then
|
if [[ -n $_yarn_run_cwd ]]; then
|
||||||
packageJson=$(_yarn_find_package_json $_yarn_run_cwd)
|
packageJson=$(_yarn_find_package_json $_yarn_run_cwd)
|
||||||
if [[ -d "${_yarn_run_cwd}/node_modules" ]]; then
|
if [[ -d "${_yarn_run_cwd}/node_modules" ]]; then
|
||||||
binaries=($(cd $_yarn_run_cwd && echo node_modules/.bin/*(x:t)))
|
binaries=($(builtin cd $_yarn_run_cwd && echo node_modules/.bin/*(x:t)))
|
||||||
else
|
else
|
||||||
binaries=($(cd $_yarn_run_cwd && yarn bin | perl -wln -e 'm{^[^:]+: (\S+)$} and print $1'))
|
binaries=($(builtin cd $_yarn_run_cwd && yarn bin | perl -wln -e 'm{^[^:]+: (\S+)$} and print $1'))
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
packageJson=$(_yarn_find_package_json $pwd)
|
packageJson=$(_yarn_find_package_json $pwd)
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ prompt_context() {
|
||||||
# Git: branch/detached head, dirty status
|
# Git: branch/detached head, dirty status
|
||||||
prompt_git() {
|
prompt_git() {
|
||||||
(( $+commands[git] )) || return
|
(( $+commands[git] )) || return
|
||||||
if [[ "$(git config --get oh-my-zsh.hide-status 2>/dev/null)" = 1 ]]; then
|
if [[ "$(command git config --get oh-my-zsh.hide-status 2>/dev/null)" = 1 ]]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
local PL_BRANCH_CHAR
|
local PL_BRANCH_CHAR
|
||||||
|
|
@ -106,12 +106,12 @@ prompt_git() {
|
||||||
}
|
}
|
||||||
local ref dirty mode repo_path
|
local ref dirty mode repo_path
|
||||||
|
|
||||||
if [[ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]]; then
|
if [[ "$(command git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]]; then
|
||||||
repo_path=$(git rev-parse --git-dir 2>/dev/null)
|
repo_path=$(command git rev-parse --git-dir 2>/dev/null)
|
||||||
dirty=$(parse_git_dirty)
|
dirty=$(parse_git_dirty)
|
||||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || \
|
ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
|
||||||
ref="◈ $(git describe --exact-match --tags HEAD 2> /dev/null)" || \
|
ref="◈ $(command git describe --exact-match --tags HEAD 2> /dev/null)" || \
|
||||||
ref="➦ $(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 yellow black
|
||||||
else
|
else
|
||||||
|
|
@ -119,8 +119,8 @@ prompt_git() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local ahead behind
|
local ahead behind
|
||||||
ahead=$(git log --oneline @{upstream}.. 2>/dev/null)
|
ahead=$(command git log --oneline @{upstream}.. 2>/dev/null)
|
||||||
behind=$(git log --oneline ..@{upstream} 2>/dev/null)
|
behind=$(command git log --oneline ..@{upstream} 2>/dev/null)
|
||||||
if [[ -n "$ahead" ]] && [[ -n "$behind" ]]; then
|
if [[ -n "$ahead" ]] && [[ -n "$behind" ]]; then
|
||||||
PL_BRANCH_CHAR=$'\u21c5'
|
PL_BRANCH_CHAR=$'\u21c5'
|
||||||
elif [[ -n "$ahead" ]]; then
|
elif [[ -n "$ahead" ]]; then
|
||||||
|
|
@ -163,10 +163,10 @@ prompt_bzr() {
|
||||||
done
|
done
|
||||||
|
|
||||||
local bzr_status status_mod status_all revision
|
local bzr_status status_mod status_all revision
|
||||||
if bzr_status=$(bzr status 2>&1); then
|
if bzr_status=$(command bzr status 2>&1); then
|
||||||
status_mod=$(echo -n "$bzr_status" | head -n1 | grep "modified" | wc -m)
|
status_mod=$(echo -n "$bzr_status" | head -n1 | grep "modified" | wc -m)
|
||||||
status_all=$(echo -n "$bzr_status" | head -n1 | wc -m)
|
status_all=$(echo -n "$bzr_status" | head -n1 | wc -m)
|
||||||
revision=${$(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 yellow black "bzr@$revision ✚"
|
||||||
else
|
else
|
||||||
|
|
@ -182,13 +182,13 @@ prompt_bzr() {
|
||||||
prompt_hg() {
|
prompt_hg() {
|
||||||
(( $+commands[hg] )) || return
|
(( $+commands[hg] )) || return
|
||||||
local rev st branch
|
local rev st branch
|
||||||
if $(hg id >/dev/null 2>&1); then
|
if $(command hg id >/dev/null 2>&1); then
|
||||||
if $(hg prompt >/dev/null 2>&1); then
|
if $(command hg prompt >/dev/null 2>&1); then
|
||||||
if [[ $(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 red white
|
||||||
st='±'
|
st='±'
|
||||||
elif [[ -n $(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 yellow black
|
||||||
st='±'
|
st='±'
|
||||||
|
|
@ -196,15 +196,15 @@ prompt_hg() {
|
||||||
# if working copy is clean
|
# if working copy is clean
|
||||||
prompt_segment green $CURRENT_FG
|
prompt_segment green $CURRENT_FG
|
||||||
fi
|
fi
|
||||||
echo -n ${$(hg prompt "☿ {rev}@{branch}"):gs/%/%%} $st
|
echo -n ${$(command hg prompt "☿ {rev}@{branch}"):gs/%/%%} $st
|
||||||
else
|
else
|
||||||
st=""
|
st=""
|
||||||
rev=$(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=$(hg id -b 2>/dev/null)
|
branch=$(command hg id -b 2>/dev/null)
|
||||||
if `hg st | grep -q "^\?"`; then
|
if command hg st | command grep -q "^\?"; then
|
||||||
prompt_segment red black
|
prompt_segment red black
|
||||||
st='±'
|
st='±'
|
||||||
elif `hg st | grep -q "^[MA]"`; then
|
elif command hg st | command grep -q "^[MA]"; then
|
||||||
prompt_segment yellow black
|
prompt_segment yellow black
|
||||||
st='±'
|
st='±'
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -20,14 +20,16 @@ zstyle -s ':omz:update' mode update_mode || {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Cancel update if:
|
# Cancel update if:
|
||||||
# - the automatic update is disabled.
|
# - the automatic update is disabled
|
||||||
# - the current user doesn't have write permissions nor owns the $ZSH directory.
|
# - the current user doesn't have write permissions nor owns the $ZSH directory
|
||||||
# - is not run from a tty
|
# - is not run from a tty
|
||||||
# - git is unavailable on the system.
|
# - git is unavailable on the system
|
||||||
|
# - $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 ]] \
|
||||||
|| ! command git --version 2>&1 >/dev/null; then
|
|| ! command git --version 2>&1 >/dev/null \
|
||||||
|
|| (builtin cd -q "$ZSH"; ! command git rev-parse --is-inside-work-tree &>/dev/null); then
|
||||||
unset update_mode
|
unset update_mode
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,14 @@ fi
|
||||||
|
|
||||||
# Protect against unwanted sourcing
|
# Protect against unwanted sourcing
|
||||||
case "$ZSH_EVAL_CONTEXT" in
|
case "$ZSH_EVAL_CONTEXT" in
|
||||||
*:file) echo "error: this file should not be sourced" && return ;;
|
*:file) echo "error: this file should not be sourced" && return 1 ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Define "$ZSH" if not defined -- in theory this should be `export`ed by the calling script
|
||||||
|
if [[ -z "$ZSH" ]]; then
|
||||||
|
ZSH="${0:a:h:h}"
|
||||||
|
fi
|
||||||
|
|
||||||
cd "$ZSH"
|
cd "$ZSH"
|
||||||
|
|
||||||
verbose_mode="default"
|
verbose_mode="default"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue