Update 19.10.2022
This commit is contained in:
parent
b1a96daa15
commit
fcc904df1e
1
zsh/.github/CODEOWNERS
vendored
1
zsh/.github/CODEOWNERS
vendored
@ -4,6 +4,7 @@ plugins/aws/ @maksyms
|
||||
plugins/genpass/ @atoponce
|
||||
plugins/git-lfs/ @hellovietduc
|
||||
plugins/gitfast/ @felipec
|
||||
plugins/react-native @esthor
|
||||
plugins/sdk/ @rgoldberg
|
||||
plugins/shell-proxy/ @septs
|
||||
plugins/universalarchive/ @Konfekt
|
||||
|
1
zsh/.github/PULL_REQUEST_TEMPLATE.md
vendored
1
zsh/.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -9,6 +9,7 @@
|
||||
- [ ] The code is mine or it's from somewhere with an MIT-compatible license.
|
||||
- [ ] The code is efficient, to the best of my ability, and does not waste computer resources.
|
||||
- [ ] The code is stable and I have tested it myself, to the best of my abilities.
|
||||
- [ ] If the code introduces new aliases, I provide a valid use case for all plugin users down below.
|
||||
|
||||
## Changes:
|
||||
|
||||
|
3
zsh/.github/workflows/main.yml
vendored
3
zsh/.github/workflows/main.yml
vendored
@ -14,6 +14,9 @@ concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read # to fetch code (actions/checkout)
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
name: Run tests
|
||||
|
1
zsh/.github/workflows/project.yml
vendored
1
zsh/.github/workflows/project.yml
vendored
@ -9,6 +9,7 @@ concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions: {}
|
||||
jobs:
|
||||
add-to-project:
|
||||
name: Add to project
|
||||
|
3
zsh/.gitignore
vendored
3
zsh/.gitignore
vendored
@ -6,3 +6,6 @@ cache/
|
||||
log/
|
||||
*.swp
|
||||
.DS_Store
|
||||
|
||||
# editor configs
|
||||
.vscode
|
@ -104,6 +104,27 @@ maintainers) by mentioning their GitHub handle (starting with `@`) in your messa
|
||||
|
||||
For any extensive change, such as a new plugin, you will have to find testers to +1 your PR.
|
||||
|
||||
### New plugin aliases
|
||||
|
||||
We acknowledge that aliases are a core part of Oh My Zsh. There are plugins that have +100 aliases!
|
||||
|
||||
This has become an issue for two opposing reasons:
|
||||
|
||||
- Some users want to have their personal aliases in Oh My Zsh.
|
||||
- Some users don't want any aliases at all and feel that there are too many.
|
||||
|
||||
Because of this, from now on we're requiring that new aliases follow these conditions:
|
||||
|
||||
1. They will be used by many people, not just a few.
|
||||
2. The aliases will be used many times and for common tasks.
|
||||
3. Prefer one generic alias over many specific ones.
|
||||
4. When justifying the need for an alias, talk about workflows where you'll use it,
|
||||
preferably in combination with other aliases.
|
||||
5. If there exists a command with the same name, look for a different alias name.
|
||||
|
||||
This list is not exhaustive! Please remember that your alias will be in the machines of many people,
|
||||
so it should be justified why they should have it.
|
||||
|
||||
----
|
||||
|
||||
## Use the Search, Luke
|
||||
@ -212,7 +233,7 @@ type(scope)!: subject
|
||||
|
||||
Try to keep the first commit line short. This is harder to do using this commit style but try to be
|
||||
concise and if you need more space, you can use the commit body. Try to make sure that the commit
|
||||
subject is clear and precise enough that users will know what change by just looking at the changelog.
|
||||
subject is clear and precise enough that users will know what changed by just looking at the changelog.
|
||||
|
||||
----
|
||||
|
||||
|
@ -241,21 +241,21 @@ function _omz::plugin::disable {
|
||||
|
||||
# Remove plugins substitution awk script
|
||||
local awk_subst_plugins="\
|
||||
gsub(/\s+(${(j:|:)dis_plugins})/, \"\") # with spaces before
|
||||
gsub(/(${(j:|:)dis_plugins})\s+/, \"\") # with spaces after
|
||||
gsub(/[ \t]+(${(j:|:)dis_plugins})/, \"\") # with spaces before
|
||||
gsub(/(${(j:|:)dis_plugins})[ \t]+/, \"\") # with spaces after
|
||||
gsub(/\((${(j:|:)dis_plugins})\)/, \"\") # without spaces (only plugin)
|
||||
"
|
||||
# Disable plugins awk script
|
||||
local awk_script="
|
||||
# if plugins=() is in oneline form, substitute disabled plugins and go to next line
|
||||
/^\s*plugins=\([^#]+\).*\$/ {
|
||||
/^[ \t]*plugins=\([^#]+\).*\$/ {
|
||||
$awk_subst_plugins
|
||||
print \$0
|
||||
next
|
||||
}
|
||||
|
||||
# if plugins=() is in multiline form, enable multi flag and disable plugins if they're there
|
||||
/^\s*plugins=\(/ {
|
||||
/^[ \t]*plugins=\(/ {
|
||||
multi=1
|
||||
$awk_subst_plugins
|
||||
print \$0
|
||||
@ -280,9 +280,10 @@ multi == 1 && length(\$0) > 0 {
|
||||
"
|
||||
|
||||
local zdot="${ZDOTDIR:-$HOME}"
|
||||
awk "$awk_script" "$zdot/.zshrc" > "$zdot/.zshrc.new" \
|
||||
&& command mv -f "$zdot/.zshrc" "$zdot/.zshrc.bck" \
|
||||
&& command mv -f "$zdot/.zshrc.new" "$zdot/.zshrc"
|
||||
local zshrc="${${:-"${zdot}/.zshrc"}:A}"
|
||||
awk "$awk_script" "$zshrc" > "$zdot/.zshrc.new" \
|
||||
&& command cp -f "$zshrc" "$zdot/.zshrc.bck" \
|
||||
&& command mv -f "$zdot/.zshrc.new" "$zshrc"
|
||||
|
||||
# Exit if the new .zshrc file wasn't created correctly
|
||||
[[ $? -eq 0 ]] || {
|
||||
@ -294,8 +295,7 @@ multi == 1 && length(\$0) > 0 {
|
||||
# Exit if the new .zshrc file has syntax errors
|
||||
if ! command zsh -n "$zdot/.zshrc"; then
|
||||
_omz::log error "broken syntax in '"${zdot/#$HOME/\~}/.zshrc"'. Rolling back changes..."
|
||||
command mv -f "$zdot/.zshrc" "$zdot/.zshrc.new"
|
||||
command mv -f "$zdot/.zshrc.bck" "$zdot/.zshrc"
|
||||
command mv -f "$zdot/.zshrc.bck" "$zshrc"
|
||||
return 1
|
||||
fi
|
||||
|
||||
@ -330,14 +330,14 @@ function _omz::plugin::enable {
|
||||
# Enable plugins awk script
|
||||
local awk_script="
|
||||
# if plugins=() is in oneline form, substitute ) with new plugins and go to the next line
|
||||
/^\s*plugins=\([^#]+\).*\$/ {
|
||||
/^[ \t]*plugins=\([^#]+\).*\$/ {
|
||||
sub(/\)/, \" $add_plugins&\")
|
||||
print \$0
|
||||
next
|
||||
}
|
||||
|
||||
# if plugins=() is in multiline form, enable multi flag
|
||||
/^\s*plugins=\(/ {
|
||||
/^[ \t]*plugins=\(/ {
|
||||
multi=1
|
||||
}
|
||||
|
||||
@ -354,9 +354,10 @@ multi == 1 && /^[^#]*\)/ {
|
||||
"
|
||||
|
||||
local zdot="${ZDOTDIR:-$HOME}"
|
||||
awk "$awk_script" "$zdot/.zshrc" > "$zdot/.zshrc.new" \
|
||||
&& command mv -f "$zdot/.zshrc" "$zdot/.zshrc.bck" \
|
||||
&& command mv -f "$zdot/.zshrc.new" "$zdot/.zshrc"
|
||||
local zshrc="${${:-"${zdot}/.zshrc"}:A}"
|
||||
awk "$awk_script" "$zshrc" > "$zdot/.zshrc.new" \
|
||||
&& command cp -f "$zshrc" "$zdot/.zshrc.bck" \
|
||||
&& command mv -f "$zdot/.zshrc.new" "$zshrc"
|
||||
|
||||
# Exit if the new .zshrc file wasn't created correctly
|
||||
[[ $? -eq 0 ]] || {
|
||||
@ -368,8 +369,7 @@ multi == 1 && /^[^#]*\)/ {
|
||||
# Exit if the new .zshrc file has syntax errors
|
||||
if ! command zsh -n "$zdot/.zshrc"; then
|
||||
_omz::log error "broken syntax in '"${zdot/#$HOME/\~}/.zshrc"'. Rolling back changes..."
|
||||
command mv -f "$zdot/.zshrc" "$zdot/.zshrc.new"
|
||||
command mv -f "$zdot/.zshrc.bck" "$zdot/.zshrc"
|
||||
command mv -f "$zdot/.zshrc.bck" "$zshrc"
|
||||
return 1
|
||||
fi
|
||||
|
||||
@ -416,14 +416,14 @@ function _omz::plugin::list {
|
||||
|
||||
if (( ${#custom_plugins} )); then
|
||||
print -P "%U%BCustom plugins%b%u:"
|
||||
print -l ${(q-)custom_plugins} | column -x
|
||||
print -lac ${(q-)custom_plugins}
|
||||
fi
|
||||
|
||||
if (( ${#builtin_plugins} )); then
|
||||
(( ${#custom_plugins} )) && echo # add a line of separation
|
||||
|
||||
print -P "%U%BBuilt-in plugins%b%u:"
|
||||
print -l ${(q-)builtin_plugins} | column -x
|
||||
print -lac ${(q-)builtin_plugins}
|
||||
fi
|
||||
}
|
||||
|
||||
@ -674,13 +674,13 @@ function _omz::theme::list {
|
||||
# Print custom themes if there are any
|
||||
if (( ${#custom_themes} )); then
|
||||
print -P "%U%BCustom themes%b%u:"
|
||||
print -l ${(q-)custom_themes} | column -x
|
||||
print -lac ${(q-)custom_themes}
|
||||
echo
|
||||
fi
|
||||
|
||||
# Print built-in themes
|
||||
print -P "%U%BBuilt-in themes%b%u:"
|
||||
print -l ${(q-)builtin_themes} | column -x
|
||||
print -lac ${(q-)builtin_themes}
|
||||
}
|
||||
|
||||
function _omz::theme::set {
|
||||
@ -699,9 +699,9 @@ function _omz::theme::set {
|
||||
|
||||
# Enable theme in .zshrc
|
||||
local awk_script='
|
||||
!set && /^\s*ZSH_THEME=[^#]+.*$/ {
|
||||
!set && /^[ \t]*ZSH_THEME=[^#]+.*$/ {
|
||||
set=1
|
||||
sub(/^\s*ZSH_THEME=[^#]+.*$/, "ZSH_THEME=\"'$1'\" # set by `omz`")
|
||||
sub(/^[ \t]*ZSH_THEME=[^#]+.*$/, "ZSH_THEME=\"'$1'\" # set by `omz`")
|
||||
print $0
|
||||
next
|
||||
}
|
||||
@ -715,7 +715,8 @@ END {
|
||||
'
|
||||
|
||||
local zdot="${ZDOTDIR:-$HOME}"
|
||||
awk "$awk_script" "$zdot/.zshrc" > "$zdot/.zshrc.new" \
|
||||
local zshrc="${${:-"${zdot}/.zshrc"}:A}"
|
||||
awk "$awk_script" "$zshrc" > "$zdot/.zshrc.new" \
|
||||
|| {
|
||||
# Prepend ZSH_THEME= line to .zshrc if it doesn't exist
|
||||
cat <<EOF
|
||||
@ -724,8 +725,8 @@ ZSH_THEME="$1" # set by \`omz\`
|
||||
EOF
|
||||
cat "$zdot/.zshrc"
|
||||
} > "$zdot/.zshrc.new" \
|
||||
&& command mv -f "$zdot/.zshrc" "$zdot/.zshrc.bck" \
|
||||
&& command mv -f "$zdot/.zshrc.new" "$zdot/.zshrc"
|
||||
&& command cp -f "$zshrc" "$zdot/.zshrc.bck" \
|
||||
&& command mv -f "$zdot/.zshrc.new" "$zshrc"
|
||||
|
||||
# Exit if the new .zshrc file wasn't created correctly
|
||||
[[ $? -eq 0 ]] || {
|
||||
@ -737,8 +738,7 @@ EOF
|
||||
# Exit if the new .zshrc file has syntax errors
|
||||
if ! command zsh -n "$zdot/.zshrc"; then
|
||||
_omz::log error "broken syntax in '"${zdot/#$HOME/\~}/.zshrc"'. Rolling back changes..."
|
||||
command mv -f "$zdot/.zshrc" "$zdot/.zshrc.new"
|
||||
command mv -f "$zdot/.zshrc.bck" "$zdot/.zshrc"
|
||||
command mv -f "$zdot/.zshrc.bck" "$zshrc"
|
||||
return 1
|
||||
fi
|
||||
|
||||
|
@ -10,8 +10,8 @@
|
||||
# - pbcopy, pbpaste (macOS)
|
||||
# - cygwin (Windows running Cygwin)
|
||||
# - wl-copy, wl-paste (if $WAYLAND_DISPLAY is set)
|
||||
# - xclip (if $DISPLAY is set)
|
||||
# - xsel (if $DISPLAY is set)
|
||||
# - xclip (if $DISPLAY is set)
|
||||
# - lemonade (for SSH) https://github.com/pocke/lemonade
|
||||
# - doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/
|
||||
# - win32yank (Windows)
|
||||
@ -52,37 +52,37 @@ function detect-clipboard() {
|
||||
emulate -L zsh
|
||||
|
||||
if [[ "${OSTYPE}" == darwin* ]] && (( ${+commands[pbcopy]} )) && (( ${+commands[pbpaste]} )); then
|
||||
function clipcopy() { pbcopy < "${1:-/dev/stdin}"; }
|
||||
function clipcopy() { cat "${1:-/dev/stdin}" | pbcopy; }
|
||||
function clippaste() { pbpaste; }
|
||||
elif [[ "${OSTYPE}" == (cygwin|msys)* ]]; then
|
||||
function clipcopy() { cat "${1:-/dev/stdin}" > /dev/clipboard; }
|
||||
function clippaste() { cat /dev/clipboard; }
|
||||
elif [ -n "${WAYLAND_DISPLAY:-}" ] && (( ${+commands[wl-copy]} )) && (( ${+commands[wl-paste]} )); then
|
||||
function clipcopy() { wl-copy < "${1:-/dev/stdin}"; }
|
||||
function clipcopy() { cat "${1:-/dev/stdin}" | wl-copy &>/dev/null &|; }
|
||||
function clippaste() { wl-paste; }
|
||||
elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xclip]} )); then
|
||||
function clipcopy() { xclip -in -selection clipboard < "${1:-/dev/stdin}"; }
|
||||
function clippaste() { xclip -out -selection clipboard; }
|
||||
elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xsel]} )); then
|
||||
function clipcopy() { xsel --clipboard --input < "${1:-/dev/stdin}"; }
|
||||
function clipcopy() { cat "${1:-/dev/stdin}" | xsel --clipboard --input; }
|
||||
function clippaste() { xsel --clipboard --output; }
|
||||
elif [ -n "${DISPLAY:-}" ] && (( ${+commands[xclip]} )); then
|
||||
function clipcopy() { cat "${1:-/dev/stdin}" | xclip -selection clipboard -in &>/dev/null &|; }
|
||||
function clippaste() { xclip -out -selection clipboard; }
|
||||
elif (( ${+commands[lemonade]} )); then
|
||||
function clipcopy() { lemonade copy < "${1:-/dev/stdin}"; }
|
||||
function clipcopy() { cat "${1:-/dev/stdin}" | lemonade copy; }
|
||||
function clippaste() { lemonade paste; }
|
||||
elif (( ${+commands[doitclient]} )); then
|
||||
function clipcopy() { doitclient wclip < "${1:-/dev/stdin}"; }
|
||||
function clipcopy() { cat "${1:-/dev/stdin}" | doitclient wclip; }
|
||||
function clippaste() { doitclient wclip -r; }
|
||||
elif (( ${+commands[win32yank]} )); then
|
||||
function clipcopy() { win32yank -i < "${1:-/dev/stdin}"; }
|
||||
function clipcopy() { cat "${1:-/dev/stdin}" | win32yank -i; }
|
||||
function clippaste() { win32yank -o; }
|
||||
elif [[ $OSTYPE == linux-android* ]] && (( $+commands[termux-clipboard-set] )); then
|
||||
function clipcopy() { termux-clipboard-set < "${1:-/dev/stdin}"; }
|
||||
function clipcopy() { cat "${1:-/dev/stdin}" | termux-clipboard-set; }
|
||||
function clippaste() { termux-clipboard-get; }
|
||||
elif [ -n "${TMUX:-}" ] && (( ${+commands[tmux]} )); then
|
||||
function clipcopy() { tmux load-buffer "${1:--}"; }
|
||||
function clippaste() { tmux save-buffer -; }
|
||||
elif [[ $(uname -r) = *icrosoft* ]]; then
|
||||
function clipcopy() { clip.exe < "${1:-/dev/stdin}"; }
|
||||
function clipcopy() { cat "${1:-/dev/stdin}" | clip.exe; }
|
||||
function clippaste() { powershell.exe -noprofile -command Get-Clipboard; }
|
||||
else
|
||||
function _retry_clipboard_detection_or_fail() {
|
||||
|
@ -144,7 +144,7 @@ zmodload zsh/langinfo
|
||||
# Returns nonzero if encoding failed.
|
||||
#
|
||||
# Usage:
|
||||
# omz_urlencode [-r] [-m] [-P] <string>
|
||||
# omz_urlencode [-r] [-m] [-P] <string> [<string> ...]
|
||||
#
|
||||
# -r causes reserved characters (;/?:@&=+$,) to be escaped
|
||||
#
|
||||
@ -156,7 +156,7 @@ function omz_urlencode() {
|
||||
local -a opts
|
||||
zparseopts -D -E -a opts r m P
|
||||
|
||||
local in_str=$1
|
||||
local in_str="$@"
|
||||
local url_str=""
|
||||
local spaces_as_plus
|
||||
if [[ -z $opts[(r)-P] ]]; then spaces_as_plus=1; fi
|
||||
|
@ -24,8 +24,8 @@ else
|
||||
if [[ -n "$GREP_OPTIONS" ]]; then
|
||||
# export grep, egrep and fgrep settings
|
||||
alias grep="grep $GREP_OPTIONS"
|
||||
alias egrep="egrep $GREP_OPTIONS"
|
||||
alias fgrep="fgrep $GREP_OPTIONS"
|
||||
alias egrep="grep -E $GREP_OPTIONS"
|
||||
alias fgrep="grep -F $GREP_OPTIONS"
|
||||
|
||||
# write to cache file if cache directory is writable
|
||||
if [[ -w "$ZSH_CACHE_DIR" ]]; then
|
||||
|
@ -24,10 +24,10 @@ env_default 'LESS' '-R'
|
||||
## super user alias
|
||||
alias _='sudo '
|
||||
|
||||
## more intelligent acking for ubuntu users
|
||||
## more intelligent acking for ubuntu users and no alias for users without ack
|
||||
if (( $+commands[ack-grep] )); then
|
||||
alias afind='ack-grep -il'
|
||||
else
|
||||
elif (( $+commands[ack] )); then
|
||||
alias afind='ack -il'
|
||||
fi
|
||||
|
||||
|
@ -67,7 +67,7 @@ fi
|
||||
fpath=("$ZSH/functions" "$ZSH/completions" $fpath)
|
||||
|
||||
# Load all stock functions (from $fpath files) called below.
|
||||
autoload -U compaudit compinit
|
||||
autoload -U compaudit compinit zrecompile
|
||||
|
||||
# Set ZSH_CUSTOM to the path where your custom config files
|
||||
# and plugins exists, or else we will use the default custom/
|
||||
@ -142,6 +142,9 @@ EOF
|
||||
fi
|
||||
unset zcompdump_revision zcompdump_fpath zcompdump_refresh
|
||||
|
||||
# zcompile the completion dump file if the .zwc is older or missing.
|
||||
zrecompile -q -p "$ZSH_COMPDUMP" && command rm -f "$ZSH_COMPDUMP.zwc.old"
|
||||
|
||||
# Load all of the config files in ~/oh-my-zsh that end in .zsh
|
||||
# TIP: Add files you don't want in git to .gitignore
|
||||
for config_file ("$ZSH"/lib/*.zsh); do
|
||||
|
@ -17,6 +17,12 @@ Requirements: Python needs to be installed.
|
||||
|
||||
- `acs`: show all aliases by group.
|
||||
|
||||
- `acs -h/--help`: print help mesage.
|
||||
|
||||
- `acs <keyword>`: filter aliases by `<keyword>` and highlight.
|
||||
|
||||
- `acs -g <group>/--group <group`: show only aliases for group `<group>`. Multiple uses of the flag show all groups,
|
||||
|
||||
- `acs --groups-only`: show only group names
|
||||
|
||||

|
||||
|
@ -1,11 +1,14 @@
|
||||
# with lots of 3rd-party amazing aliases installed, just need something to explore it quickly.
|
||||
#
|
||||
# - acs: alias cheatsheet
|
||||
# group alias by command, pass addition argv to grep.
|
||||
function acs(){
|
||||
(( $+commands[python3] )) || {
|
||||
echo "[error] No python executable detected"
|
||||
return
|
||||
# Handle $0 according to the standard:
|
||||
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
|
||||
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
|
||||
0="${${(M)0:#/*}:-$PWD/$0}"
|
||||
|
||||
eval '
|
||||
function acs(){
|
||||
(( $+commands[python3] )) || {
|
||||
echo "[error] No python executable detected"
|
||||
return
|
||||
}
|
||||
alias | python3 "'"${0:h}"'/cheatsheet.py" "$@"
|
||||
}
|
||||
alias | python3 ${functions_source[$0]:h}/cheatsheet.py $@
|
||||
}
|
||||
'
|
||||
|
@ -2,6 +2,7 @@
|
||||
import sys
|
||||
import itertools
|
||||
import termcolor
|
||||
import argparse
|
||||
|
||||
def parse(line):
|
||||
left = line[0:line.find('=')].strip()
|
||||
@ -26,7 +27,7 @@ def cheatsheet(lines):
|
||||
target_aliases.extend(group_list)
|
||||
return cheatsheet
|
||||
|
||||
def pretty_print_group(key, aliases, highlight=None):
|
||||
def pretty_print_group(key, aliases, highlight=None, only_groupname=False):
|
||||
if len(aliases) == 0:
|
||||
return
|
||||
group_hl_formatter = lambda g, hl: termcolor.colored(hl, 'yellow').join([termcolor.colored(part, 'red') for part in ('[%s]' % g).split(hl)])
|
||||
@ -35,21 +36,33 @@ def pretty_print_group(key, aliases, highlight=None):
|
||||
alias_formatter = lambda alias: termcolor.colored('\t%s = %s' % alias[0:2], 'green')
|
||||
if highlight and len(highlight)>0:
|
||||
print (group_hl_formatter(key, highlight))
|
||||
print ('\n'.join([alias_hl_formatter(alias, highlight) for alias in aliases]))
|
||||
if not only_groupname:
|
||||
print ('\n'.join([alias_hl_formatter(alias, highlight) for alias in aliases]))
|
||||
else:
|
||||
print (group_formatter(key))
|
||||
print ('\n'.join([alias_formatter(alias) for alias in aliases]))
|
||||
if not only_groupname:
|
||||
print ('\n'.join([alias_formatter(alias) for alias in aliases]))
|
||||
print ('')
|
||||
|
||||
def pretty_print(cheatsheet, wfilter):
|
||||
def pretty_print(cheatsheet, wfilter, group_list=None, groups_only=False):
|
||||
sorted_key = sorted(cheatsheet.keys())
|
||||
for key in sorted_key:
|
||||
if group_list and key not in group_list:
|
||||
continue
|
||||
aliases = cheatsheet.get(key)
|
||||
if not wfilter:
|
||||
pretty_print_group(key, aliases, wfilter)
|
||||
pretty_print_group(key, aliases, wfilter, groups_only)
|
||||
else:
|
||||
pretty_print_group(key, [ alias for alias in aliases if alias[0].find(wfilter)>-1 or alias[1].find(wfilter)>-1], wfilter)
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description="Pretty print aliases.")
|
||||
parser.add_argument('filter', nargs="*", help="search aliases matching string")
|
||||
parser.add_argument('-g', '--group', dest="group_list", action='append', help="only print aliases in given groups")
|
||||
parser.add_argument('--groups', dest='groups_only', action='store_true', help="only print alias groups")
|
||||
args = parser.parse_args()
|
||||
|
||||
lines = sys.stdin.readlines()
|
||||
pretty_print(cheatsheet(lines), sys.argv[1] if len(sys.argv)>1 else None)
|
||||
group_list = args.group_list or None
|
||||
wfilter = " ".join(args.filter) or None
|
||||
pretty_print(cheatsheet(lines), wfilter, group_list, args.groups_only)
|
||||
|
@ -147,7 +147,7 @@ function aws_change_access_key() {
|
||||
|
||||
function aws_profiles() {
|
||||
[[ -r "${AWS_CONFIG_FILE:-$HOME/.aws/config}" ]] || return 1
|
||||
grep --color=never -Eo '\[.*\]' "${AWS_CONFIG_FILE:-$HOME/.aws/config}" | sed -E 's/^[[:space:]]*\[(profile)?[[:space:]]*([-_[:alnum:]\.@]+)\][[:space:]]*$/\2/g'
|
||||
grep --color=never -Eo '\[.*\]' "${AWS_CONFIG_FILE:-$HOME/.aws/config}" | sed -E 's/^[[:space:]]*\[(profile)?[[:space:]]*([^[:space:]]+)\][[:space:]]*$/\2/g'
|
||||
}
|
||||
|
||||
function _aws_profiles() {
|
||||
|
@ -8,19 +8,26 @@ To use it, add `brew` to the plugins array of your zshrc file:
|
||||
plugins=(... brew)
|
||||
```
|
||||
|
||||
## Shellenv
|
||||
|
||||
If `brew` is not found in the PATH, this plugin will attempt to find it in common
|
||||
locations, and execute `brew shellenv` to set the environment appropriately.
|
||||
This plugin will also export `HOMEBREW_PREFIX="$(brew --prefix)"` if not previously
|
||||
defined for convenience.
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
|----------|---------------------------------------|---------------------------------------------------------------------|
|
||||
| -------- | ------------------------------------- | ------------------------------------------------------------------- |
|
||||
| `bcubc` | `brew upgrade --cask && brew cleanup` | Update outdated casks, then run cleanup. |
|
||||
| `bcubo` | `brew update && brew outdated --cask` | Update Homebrew data, then list outdated casks. |
|
||||
| `brewp` | `brew pin` | Pin a specified formula so that it's not upgraded. |
|
||||
| `brews` | `brew list -1` | List installed formulae or the installed files for a given formula. |
|
||||
| `brewsp` | `brew list --pinned` | List pinned formulae, or show the version of a given formula. |
|
||||
| `bubo` | `brew update && brew outdated` | Update Homebrew data, then list outdated formulae and casks. |
|
||||
| `bubc` | `brew upgrade && brew cleanup` | Upgrade outdated formulae and casks, then run cleanup. |
|
||||
| `bubo` | `brew update && brew outdated` | Update Homebrew data, then list outdated formulae and casks. |
|
||||
| `bubu` | `bubo && bubc` | Do the last two operations above. |
|
||||
| `buf` | `brew upgrade --formula` | Upgrade only formulas (not casks). |
|
||||
| `bcubo` | `brew update && brew outdated --cask` | Update Homebrew data, then list outdated casks. |
|
||||
| `bcubc` | `brew upgrade --cask && brew cleanup` | Update outdated casks, then run cleanup. |
|
||||
|
||||
## Completion
|
||||
|
||||
|
@ -1,11 +1,38 @@
|
||||
if (( ! $+commands[brew] )); then
|
||||
if [[ -x /opt/homebrew/bin/brew ]]; then
|
||||
BREW_LOCATION="/opt/homebrew/bin/brew"
|
||||
elif [[ -x /usr/local/bin/brew ]]; then
|
||||
BREW_LOCATION="/usr/local/bin/brew"
|
||||
elif [[ -x /home/linuxbrew/.linuxbrew/bin/brew ]]; then
|
||||
BREW_LOCATION="/home/linuxbrew/.linuxbrew/bin/brew"
|
||||
elif [[ -x "$HOME/.linuxbrew/bin/brew" ]]; then
|
||||
BREW_LOCATION="$HOME/.linuxbrew/bin/brew"
|
||||
else
|
||||
return
|
||||
fi
|
||||
|
||||
# Only add Homebrew installation to PATH, MANPATH, and INFOPATH if brew is
|
||||
# not already on the path, to prevent duplicate entries. This aligns with
|
||||
# the behavior of the brew installer.sh post-install steps.
|
||||
eval "$("$BREW_LOCATION" shellenv)"
|
||||
unset BREW_LOCATION
|
||||
fi
|
||||
|
||||
if [[ -z "$HOMEBREW_PREFIX" ]]; then
|
||||
# Maintain compatability with potential custom user profiles, where we had
|
||||
# previously relied on always sourcing shellenv. OMZ plugins should not rely
|
||||
# on this to be defined due to out of order processing.
|
||||
export HOMEBREW_PREFIX="$(brew --prefix)"
|
||||
fi
|
||||
|
||||
alias bcubc='brew upgrade --cask && brew cleanup'
|
||||
alias bcubo='brew update && brew outdated --cask'
|
||||
alias brewp='brew pin'
|
||||
alias brewsp='brew list --pinned'
|
||||
alias bubo='brew update && brew outdated'
|
||||
alias bubc='brew upgrade && brew cleanup'
|
||||
alias bubo='brew update && brew outdated'
|
||||
alias bubu='bubo && bubc'
|
||||
alias buf='brew upgrade --formula'
|
||||
alias bcubo='brew update && brew outdated --cask'
|
||||
alias bcubc='brew upgrade --cask && brew cleanup'
|
||||
|
||||
function brews() {
|
||||
local formulae="$(brew leaves | xargs brew deps --installed --for-each)"
|
||||
|
@ -35,9 +35,11 @@ plugins=(... common-aliases)
|
||||
| mv | `mv -i` | Move a file |
|
||||
| zshrc | `${=EDITOR} ~/.zshrc` | Quickly access the ~/.zshrc file |
|
||||
| dud | `du -d 1 -h` | Display the size of files at depth 1 in current location in human-readable form |
|
||||
| duf | `du -sh` | Display the size of files in current location in human-readable form |
|
||||
| duf\* | `du -sh` | Display the size of files in current location in human-readable form |
|
||||
| t | `tail -f` | Shorthand for tail which outputs the last part of a file |
|
||||
|
||||
\* Only if the [`duf`](https://github.com/muesli/duf) command isn't installed.
|
||||
|
||||
### find and grep
|
||||
|
||||
| Alias | Command | Description |
|
||||
@ -66,12 +68,15 @@ These aliases are expanded in any position in the command line, meaning you can
|
||||
end of the command you've typed. Examples:
|
||||
|
||||
Quickly pipe to less:
|
||||
|
||||
```zsh
|
||||
$ ls -l /var/log L
|
||||
# will run
|
||||
$ ls -l /var/log | less
|
||||
```
|
||||
|
||||
Silences stderr output:
|
||||
|
||||
```zsh
|
||||
$ find . -type f NE
|
||||
# will run
|
||||
|
@ -35,7 +35,7 @@ alias -g NUL="> /dev/null 2>&1"
|
||||
alias -g P="2>&1| pygmentize -l pytb"
|
||||
|
||||
alias dud='du -d 1 -h'
|
||||
alias duf='du -sh *'
|
||||
(( $+commands[duf] )) || alias duf='du -sh *'
|
||||
(( $+commands[fd] )) || alias fd='find . -type d -name'
|
||||
alias ff='find . -type f -name'
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
# `copybuffer` plugin
|
||||
|
||||
This plugin binds the ctrl-o keyboard shortcut to a command that copies the text
|
||||
that is currently typed in the command line ($BUFFER) to the system clipboard.
|
||||
This plugin adds the <kbd>ctrl-o</kbd> keyboard shortcut to copy the current text
|
||||
in the command line to the system clipboard.
|
||||
|
||||
This is useful if you type a command - and before you hit enter to execute it - want
|
||||
to copy it maybe so you can paste it into a script, gist or whatnot.
|
||||
|
@ -30,26 +30,25 @@ Set `$apt_pref` and `$apt_upgr` to whatever command you want (before sourcing Oh
|
||||
|
||||
## Superuser Operations Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
| -------- | -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
|
||||
| `aac` | `sudo $apt_pref autoclean` | Clears out the local repository of retrieved package files |
|
||||
| `aar` | `sudo $apt_pref autoremove` | Removes packages installed automatically that are no longer needed |
|
||||
| `abd` | `sudo $apt_pref build-dep` | Installs all dependencies for building packages |
|
||||
| `ac` | `sudo $apt_pref clean` | Clears out the local repository of retrieved package files except lock files |
|
||||
| `ad` | `sudo $apt_pref update` | Updates the package lists for upgrades for packages |
|
||||
| `adg` | `sudo $apt_pref update && sudo $apt_pref $apt_upgr` | Update and upgrade packages |
|
||||
| `ads` | `sudo apt-get dselect-upgrade` | Installs packages from list and removes all not in the list |
|
||||
| `adu` | `sudo $apt_pref update && sudo $apt_pref dist-upgrade` | Smart upgrade that handles dependencies |
|
||||
| `afu` | `sudo apt-file update` | Update the files in packages |
|
||||
| `ai` | `sudo $apt_pref install` | Command-line tool to install package |
|
||||
| `ail` | `sed -e 's/ */ /g' -e 's/ *//' \| cut -s -d ' ' -f 1 \| xargs sudo $apt_pref install` | Install all packages given on the command line while using only the first word of each line |
|
||||
| `alu` | `sudo apt update && apt list -u && sudo apt upgrade` | Update, list and upgrade packages |
|
||||
| `ap` | `sudo $apt_pref purge` | Removes packages along with configuration files |
|
||||
| `ar` | `sudo $apt_pref remove` | Removes packages, keeps the configuration files |
|
||||
| `au` | `sudo $apt_pref $apt_upgr` | Install package upgrades |
|
||||
| `di` | `sudo dpkg -i` | Install all .deb files in the current directory |
|
||||
| `dia` | `sudo dpkg -i ./*.deb` | Install all .deb files in the current directory |
|
||||
| `kclean` | `sudo aptitude remove -P ?and(~i~nlinux-(ima\|hea) ?not(~n$(uname -r)))` | Remove ALL kernel images and headers EXCEPT the one in use |
|
||||
| Alias | Command | Description |
|
||||
| -------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
|
||||
| `aac` | `sudo $apt_pref autoclean` | Clears out the local repository of retrieved package files |
|
||||
| `aar` | `sudo $apt_pref autoremove` | Removes packages installed automatically that are no longer needed |
|
||||
| `abd` | `sudo $apt_pref build-dep` | Installs all dependencies for building packages |
|
||||
| `ac` | `sudo $apt_pref clean` | Clears out the local repository of retrieved package files except lock files |
|
||||
| `ad` | `sudo $apt_pref update` | Updates the package lists for upgrades for packages |
|
||||
| `adg` | `sudo $apt_pref update && sudo $apt_pref $apt_upgr` | Update and upgrade packages |
|
||||
| `ads` | `sudo apt-get dselect-upgrade` | Installs packages from list and removes all not in the list |
|
||||
| `adu` | `sudo $apt_pref update && sudo $apt_pref dist-upgrade` | Smart upgrade that handles dependencies |
|
||||
| `afu` | `sudo apt-file update` | Update the files in packages |
|
||||
| `ai` | `sudo $apt_pref install` | Command-line tool to install package |
|
||||
| `ail` | `sed -e 's/ */ /g' -e 's/ *//' \| cut -s -d ' ' -f 1 \| xargs sudo $apt_pref install` | Install all packages given on the command line while using only the first word of each line |
|
||||
| `alu` | `sudo apt update && apt list -u && sudo apt upgrade` | Update, list and upgrade packages |
|
||||
| `ap` | `sudo $apt_pref purge` | Removes packages along with configuration files |
|
||||
| `au` | `sudo $apt_pref $apt_upgr` | Install package upgrades |
|
||||
| `di` | `sudo dpkg -i` | Install all .deb files in the current directory |
|
||||
| `dia` | `sudo dpkg -i ./*.deb` | Install all .deb files in the current directory |
|
||||
| `kclean` | `sudo aptitude remove -P ?and(~i~nlinux-(ima\|hea) ?not(~n$(uname -r)))` | Remove ALL kernel images and headers EXCEPT the one in use |
|
||||
|
||||
## Aliases - Commands using `su`
|
||||
|
||||
|
@ -55,7 +55,6 @@ if [[ $use_sudo -eq 1 ]]; then
|
||||
|
||||
alias ail="sed -e 's/ */ /g' -e 's/ *//' | cut -s -d ' ' -f 1 | xargs sudo $apt_pref install"
|
||||
alias ap="sudo $apt_pref purge"
|
||||
alias ar="sudo $apt_pref remove"
|
||||
alias aar="sudo $apt_pref autoremove"
|
||||
|
||||
# apt-get only
|
||||
@ -89,22 +88,17 @@ else
|
||||
alias afu="su -lc '$apt-file update'"
|
||||
alias au="su -lc '$apt_pref $apt_upgr' root"
|
||||
function ai() {
|
||||
cmd="su -lc 'aptitude -P install $@' root"
|
||||
cmd="su -lc '$apt_pref install $@' root"
|
||||
print "$cmd"
|
||||
eval "$cmd"
|
||||
}
|
||||
function ap() {
|
||||
cmd="su -lc '$apt_pref -P purge $@' root"
|
||||
print "$cmd"
|
||||
eval "$cmd"
|
||||
}
|
||||
function ar() {
|
||||
cmd="su -lc '$apt_pref -P remove $@' root"
|
||||
cmd="su -lc '$apt_pref purge $@' root"
|
||||
print "$cmd"
|
||||
eval "$cmd"
|
||||
}
|
||||
function aar() {
|
||||
cmd="su -lc '$apt_pref -P autoremove $@' root"
|
||||
cmd="su -lc '$apt_pref autoremove $@' root"
|
||||
print "$cmd"
|
||||
eval "$cmd"
|
||||
}
|
||||
@ -147,7 +141,6 @@ apt_pref_compdef au "$apt_upgr"
|
||||
apt_pref_compdef ai "install"
|
||||
apt_pref_compdef ail "install"
|
||||
apt_pref_compdef ap "purge"
|
||||
apt_pref_compdef ar "remove"
|
||||
apt_pref_compdef aar "autoremove"
|
||||
apt_pref_compdef ads "dselect-upgrade"
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Dnote Plugin
|
||||
|
||||
This plugin adds auto-completion for [Dnote](https://dnote.io) project.
|
||||
This plugin adds auto-completion for [Dnote](https://www.getdnote.com/), a simple command line notebook.
|
||||
|
||||
To use it, add `dnote` to the plugins array in your zshrc file:
|
||||
|
||||
|
@ -57,7 +57,7 @@ the lines below to your zshrc file**, but be aware of the side effects:
|
||||
| dib | `docker image build` | Build an image from a Dockerfile (same as docker build) |
|
||||
| dii | `docker image inspect` | Display detailed information on one or more images |
|
||||
| dils | `docker image ls` | List docker images |
|
||||
| dip | `docker image push` | Push an image or repository to a remote registry |
|
||||
| dipu | `docker image push` | Push an image or repository to a remote registry |
|
||||
| dirm | `docker image rm` | Remove one or more images |
|
||||
| dit | `docker image tag` | Add a name and tag to a particular image |
|
||||
| | | **Docker Network** |
|
||||
|
@ -21,7 +21,7 @@ alias dxcit='docker container exec -it'
|
||||
alias dib='docker image build'
|
||||
alias dii='docker image inspect'
|
||||
alias dils='docker image ls'
|
||||
alias dip='docker image push'
|
||||
alias dipu='docker image push'
|
||||
alias dirm='docker image rm'
|
||||
alias dit='docker image tag'
|
||||
|
||||
|
@ -11,7 +11,7 @@ emacsfun() {
|
||||
esac
|
||||
|
||||
# Check if there are suitable frames
|
||||
frames="$(emacsclient -a '' -n -e "$cmd" 2>/dev/null)"
|
||||
frames="$(emacsclient -a '' -n -e "$cmd" 2>/dev/null |sed 's/.*\x07//g' )"
|
||||
|
||||
# Only create another X frame if there isn't one present
|
||||
if [ -z "$frames" -o "$frames" = nil ]; then
|
||||
|
@ -56,7 +56,7 @@ typeset -gAH emoji_groups
|
||||
|
||||
# def country_iso(_all_names, _omz_name):
|
||||
# """ Using the external library country_converter,
|
||||
# this funciton can detect the ISO2 and ISO3 codes
|
||||
# this function can detect the ISO2 and ISO3 codes
|
||||
# of the country. It takes as argument the array
|
||||
# with all the names of the emoji, and returns that array."""
|
||||
# omz_no_underscore = re.sub(r'_', r' ', _omz_name)
|
||||
@ -96,7 +96,7 @@ def name_to_omz(_name, _group, _subgroup, _status):
|
||||
# Special treatment by status
|
||||
# Enables us to have every emoji combination,
|
||||
# even the one that are not officially sanctionned
|
||||
# and are implemeted by, say, only one vendor
|
||||
# and are implemented by, say, only one vendor
|
||||
if _status == "unqualified":
|
||||
shortname += "_unqualified"
|
||||
elif _status == "minimally-qualified":
|
||||
|
@ -12,3 +12,18 @@ alias flrd="flutter run --debug"
|
||||
alias flrp="flutter run --profile"
|
||||
alias flrr="flutter run --release"
|
||||
alias flupgrd="flutter upgrade"
|
||||
|
||||
# COMPLETION FUNCTION
|
||||
if (( ! $+commands[flutter] )); then
|
||||
return
|
||||
fi
|
||||
|
||||
# If the completion file doesn't exist yet, we need to autoload it and
|
||||
# bind it to `flutter`. Otherwise, compinit will have already done that.
|
||||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_flutter" ]]; then
|
||||
typeset -g -A _comps
|
||||
autoload -Uz _flutter
|
||||
_comps[flutter]=_flutter
|
||||
fi
|
||||
|
||||
flutter zsh-completion >| "$ZSH_CACHE_DIR/completions/_flutter" &|
|
@ -13,12 +13,11 @@ ZSH_THEME_FOSSIL_PROMPT_DIRTY=" %{$fg_bold[red]%}✖"
|
||||
ZSH_THEME_FOSSIL_PROMPT_CLEAN=" %{$fg_bold[green]%}✔"
|
||||
|
||||
function fossil_prompt_info() {
|
||||
local info=$(fossil branch 2>&1)
|
||||
local branch=$(fossil branch current 2>&1)
|
||||
|
||||
# if we're not in a fossil repo, don't show anything
|
||||
! command grep -q "use --repo" <<< "$info" || return
|
||||
! command grep -q "use --repo" <<< "$branch" || return
|
||||
|
||||
local branch=$(echo $info | grep "* " | sed 's/* //g')
|
||||
local changes=$(fossil changes)
|
||||
local dirty="$ZSH_THEME_FOSSIL_PROMPT_CLEAN"
|
||||
|
||||
|
@ -10,8 +10,10 @@ if [[ -z "${CLOUDSDK_HOME}" ]]; then
|
||||
"/opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
|
||||
"/usr/share/google-cloud-sdk"
|
||||
"/snap/google-cloud-sdk/current"
|
||||
"/usr/lib64/google-cloud-sdk/"
|
||||
"/usr/lib/google-cloud-sdk"
|
||||
"/usr/lib64/google-cloud-sdk"
|
||||
"/opt/google-cloud-sdk"
|
||||
"/opt/local/libexec/google-cloud-sdk"
|
||||
)
|
||||
|
||||
for gcloud_sdk_location in $search_locations; do
|
||||
@ -20,15 +22,28 @@ if [[ -z "${CLOUDSDK_HOME}" ]]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
unset search_locations gcloud_sdk_location
|
||||
fi
|
||||
|
||||
if (( ${+CLOUDSDK_HOME} )); then
|
||||
# Only source this if gcloud isn't already on the path
|
||||
if (( ! $+commands[gcloud] )); then
|
||||
# Only source this if GCloud isn't already on the path
|
||||
if [[ -f "${CLOUDSDK_HOME}/path.zsh.inc" ]]; then
|
||||
source "${CLOUDSDK_HOME}/path.zsh.inc"
|
||||
fi
|
||||
fi
|
||||
source "${CLOUDSDK_HOME}/completion.zsh.inc"
|
||||
|
||||
# Look for completion file in different paths
|
||||
for comp_file (
|
||||
"${CLOUDSDK_HOME}/completion.zsh.inc" # default location
|
||||
"/usr/share/google-cloud-sdk/completion.zsh.inc" # apt-based location
|
||||
); do
|
||||
if [[ -f "${comp_file}" ]]; then
|
||||
source "${comp_file}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
unset comp_file
|
||||
|
||||
export CLOUDSDK_HOME
|
||||
fi
|
||||
|
@ -2,7 +2,8 @@
|
||||
: ${GIT_AUTO_FETCH_INTERVAL:=60}
|
||||
|
||||
# Necessary for the git-fetch-all function
|
||||
zmodload zsh/datetime zsh/stat
|
||||
zmodload zsh/datetime
|
||||
zmodload -F zsh/stat b:zstat # only zstat command, not stat command
|
||||
|
||||
function git-fetch-all {
|
||||
(
|
||||
@ -27,6 +28,7 @@ function git-fetch-all {
|
||||
# Fetch all remotes (avoid ssh passphrase prompt)
|
||||
date -R &>! "$gitdir/FETCH_LOG"
|
||||
GIT_SSH_COMMAND="command ssh -o BatchMode=yes" \
|
||||
GIT_TERMINAL_PROMPT=0 \
|
||||
command git fetch --all 2>/dev/null &>> "$gitdir/FETCH_LOG"
|
||||
) &|
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ plugins=(... git)
|
||||
| gb | git branch |
|
||||
| gba | git branch -a |
|
||||
| gbd | git branch -d |
|
||||
| gbda | git branch --no-color --merged \| grep -vE "^([+*]\|\s*($(git_main_branch)\|$(git_develop_branch))\s*$)" \| xargs git branch -d 2>/dev/null |
|
||||
| gbda | git branch --no-color --merged \| grep -vE "^([+*]\|\s*(<span>$</span>(git_main_branch)\|<span>$</span>(git_develop_branch))\s*<span>$</span>)" \| xargs git branch -d 2>/dev/null |
|
||||
| gbD | git branch -D |
|
||||
| gbl | git blame -b -w |
|
||||
| gbnm | git branch --no-merged |
|
||||
@ -42,12 +42,12 @@ plugins=(... git)
|
||||
| gcans! | git commit -v -a -s --no-edit --amend |
|
||||
| gcam | git commit -a -m |
|
||||
| gcas | git commit -a -s |
|
||||
| gcasm | git commit -a -s -m |
|
||||
| gcasm | git commit -a -s -m |
|
||||
| gcsm | git commit -s -m |
|
||||
| gcb | git checkout -b |
|
||||
| gcf | git config --list |
|
||||
| gcl | git clone --recurse-submodules |
|
||||
| gccd | git clone --recurse-submodules "$@" && cd "$(basename $_ .git)" |
|
||||
| gccd | git clone --recurse-submodules "<span>$</span>@" && cd "<span>$</span>(basename <span>$</span>_ .git)" |
|
||||
| gclean | git clean -id |
|
||||
| gpristine | git reset --hard && git clean -dffx |
|
||||
| gcm | git checkout $(git_main_branch) |
|
||||
@ -181,7 +181,10 @@ plugins=(... git)
|
||||
| gupv | git pull --rebase -v |
|
||||
| gupa | git pull --rebase --autostash |
|
||||
| gupav | git pull --rebase --autostash -v |
|
||||
| gupom | git pull --rebase origin $(git_main_branch) |
|
||||
| gupomi | git pull --rebase=interactive origin $(git_main_branch) |
|
||||
| glum | git pull upstream $(git_main_branch) |
|
||||
| gluc | git pull upstream $(git_current_branch) |
|
||||
| gwch | git whatchanged -p --abbrev-commit --pretty=medium |
|
||||
| gwip | git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]" |
|
||||
| gam | git am |
|
||||
|
@ -307,7 +307,10 @@ alias gup='git pull --rebase'
|
||||
alias gupv='git pull --rebase -v'
|
||||
alias gupa='git pull --rebase --autostash'
|
||||
alias gupav='git pull --rebase --autostash -v'
|
||||
alias gupom='git pull --rebase origin $(git_main_branch)'
|
||||
alias gupomi='git pull --rebase=interactive origin $(git_main_branch)'
|
||||
alias glum='git pull upstream $(git_main_branch)'
|
||||
alias gluc='git pull upstream $(git_current_branch)'
|
||||
|
||||
alias gwch='git whatchanged -p --abbrev-commit --pretty=medium'
|
||||
alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign -m "--wip-- [skip ci]"'
|
||||
|
@ -49,6 +49,11 @@
|
||||
# and git-switch completion (e.g., completing "foo" when "origin/foo"
|
||||
# exists).
|
||||
#
|
||||
# GIT_COMPLETION_SHOW_ALL_COMMANDS
|
||||
#
|
||||
# When set to "1" suggest all commands, including plumbing commands
|
||||
# which are hidden by default (e.g. "cat-file" on "git ca<TAB>").
|
||||
#
|
||||
# GIT_COMPLETION_SHOW_ALL
|
||||
#
|
||||
# When set to "1" suggest all options, including options which are
|
||||
@ -321,19 +326,19 @@ __gitcomp_builtin_apply_default=" --exclude= --include= --no-add --stat --numsta
|
||||
__gitcomp_builtin_archive_default=" --output= --remote= --exec= --no-output -- --no-remote --no-exec"
|
||||
__gitcomp_builtin_bisect__helper_default=" --bisect-reset --bisect-next-check --bisect-terms --bisect-start --bisect-next --bisect-state --bisect-log --bisect-replay --bisect-skip --bisect-visualize --bisect-run --no-log --log"
|
||||
__gitcomp_builtin_blame_default=" --incremental --root --show-stats --progress --score-debug --show-name --show-number --porcelain --line-porcelain --show-email --ignore-rev= --ignore-revs-file= --color-lines --color-by-age --minimal --contents= --abbrev --no-incremental -- --no-root --no-show-stats --no-progress --no-score-debug --no-show-name --no-show-number --no-porcelain --no-line-porcelain --no-show-email --no-ignore-rev --no-ignore-revs-file --no-color-lines --no-color-by-age --no-minimal --no-contents --no-abbrev"
|
||||
__gitcomp_builtin_branch_default=" --verbose --quiet --track --set-upstream-to= --unset-upstream --color --remotes --contains --no-contains --abbrev --all --delete --move --copy --list --show-current --create-reflog --edit-description --merged --no-merged --column --sort= --points-at= --ignore-case --format= -- --no-verbose --no-quiet --no-track --no-set-upstream-to --no-unset-upstream --no-color --no-remotes --no-abbrev --no-all --no-delete --no-move --no-copy --no-list --no-show-current --no-create-reflog --no-edit-description --no-column --no-sort --no-points-at --no-ignore-case --no-format"
|
||||
__gitcomp_builtin_branch_default=" --verbose --quiet --track --set-upstream-to= --unset-upstream --color --remotes --contains --no-contains --abbrev --all --delete --move --copy --list --show-current --create-reflog --edit-description --merged --no-merged --column --sort= --points-at= --ignore-case --recurse-submodules --format= -- --no-verbose --no-quiet --no-track --no-set-upstream-to --no-unset-upstream --no-color --no-remotes --no-abbrev --no-all --no-delete --no-move --no-copy --no-list --no-show-current --no-create-reflog --no-edit-description --no-column --no-sort --no-points-at --no-ignore-case --no-recurse-submodules --no-format"
|
||||
__gitcomp_builtin_bugreport_default=" --output-directory= --suffix= --no-output-directory -- --no-suffix"
|
||||
__gitcomp_builtin_cat_file_default=" --textconv --filters --path= --allow-unknown-type --buffer --batch --batch-check --follow-symlinks --batch-all-objects --unordered --no-path -- --no-allow-unknown-type --no-buffer --no-follow-symlinks --no-batch-all-objects --no-unordered"
|
||||
__gitcomp_builtin_cat_file_default=" --allow-unknown-type --batch --batch-check --batch-command --batch-all-objects --buffer --follow-symlinks --unordered --textconv --filters --path= --no-allow-unknown-type -- --no-buffer --no-follow-symlinks --no-unordered --no-path"
|
||||
__gitcomp_builtin_check_attr_default=" --all --cached --stdin --no-all -- --no-cached --no-stdin"
|
||||
__gitcomp_builtin_check_ignore_default=" --quiet --verbose --stdin --non-matching --no-index --index -- --no-quiet --no-verbose --no-stdin --no-non-matching"
|
||||
__gitcomp_builtin_check_mailmap_default=" --stdin --no-stdin"
|
||||
__gitcomp_builtin_checkout_default=" --guess --overlay --quiet --recurse-submodules --progress --merge --conflict= --detach --track --orphan= --ignore-other-worktrees --ours --theirs --patch --ignore-skip-worktree-bits --pathspec-from-file= --pathspec-file-nul --no-guess -- --no-overlay --no-quiet --no-recurse-submodules --no-progress --no-merge --no-conflict --no-detach --no-track --no-orphan --no-ignore-other-worktrees --no-patch --no-ignore-skip-worktree-bits --no-pathspec-from-file --no-pathspec-file-nul"
|
||||
__gitcomp_builtin_checkout__worker_default=" --prefix= --no-prefix"
|
||||
__gitcomp_builtin_checkout_index_default=" --all --force --quiet --no-create --index --stdin --temp --prefix= --stage= --create -- --no-all --no-force --no-quiet --no-index --no-stdin --no-temp --no-prefix"
|
||||
__gitcomp_builtin_checkout_index_default=" --all --ignore-skip-worktree-bits --force --quiet --no-create --index --stdin --temp --prefix= --stage= --create -- --no-all --no-ignore-skip-worktree-bits --no-force --no-quiet --no-index --no-stdin --no-temp --no-prefix"
|
||||
__gitcomp_builtin_cherry_default=" --abbrev --verbose --no-abbrev -- --no-verbose"
|
||||
__gitcomp_builtin_cherry_pick_default=" --quit --continue --abort --skip --cleanup= --no-commit --edit --signoff --mainline= --rerere-autoupdate --strategy= --strategy-option= --gpg-sign --ff --allow-empty --allow-empty-message --keep-redundant-commits --commit -- --no-cleanup --no-edit --no-signoff --no-mainline --no-rerere-autoupdate --no-strategy --no-strategy-option --no-gpg-sign --no-ff --no-allow-empty --no-allow-empty-message --no-keep-redundant-commits"
|
||||
__gitcomp_builtin_clean_default=" --quiet --dry-run --interactive --exclude= --no-quiet -- --no-dry-run --no-interactive"
|
||||
__gitcomp_builtin_clone_default=" --verbose --quiet --progress --reject-shallow --no-checkout --bare --mirror --local --no-hardlinks --shared --recurse-submodules --jobs= --template= --reference= --reference-if-able= --dissociate --origin= --branch= --upload-pack= --depth= --shallow-since= --shallow-exclude= --single-branch --no-tags --shallow-submodules --separate-git-dir= --config= --server-option= --ipv4 --ipv6 --filter= --remote-submodules --sparse --checkout --hardlinks --tags -- --no-verbose --no-quiet --no-progress --no-reject-shallow --no-bare --no-mirror --no-local --no-shared --no-recurse-submodules --no-recursive --no-jobs --no-template --no-reference --no-reference-if-able --no-dissociate --no-origin --no-branch --no-upload-pack --no-depth --no-shallow-since --no-shallow-exclude --no-single-branch --no-shallow-submodules --no-separate-git-dir --no-config --no-server-option --no-ipv4 --no-ipv6 --no-filter --no-remote-submodules --no-sparse"
|
||||
__gitcomp_builtin_clone_default=" --verbose --quiet --progress --reject-shallow --no-checkout --bare --mirror --local --no-hardlinks --shared --recurse-submodules --jobs= --template= --reference= --reference-if-able= --dissociate --origin= --branch= --upload-pack= --depth= --shallow-since= --shallow-exclude= --single-branch --no-tags --shallow-submodules --separate-git-dir= --config= --server-option= --ipv4 --ipv6 --filter= --also-filter-submodules --remote-submodules --sparse --checkout --hardlinks --tags -- --no-verbose --no-quiet --no-progress --no-reject-shallow --no-bare --no-mirror --no-local --no-shared --no-recurse-submodules --no-recursive --no-jobs --no-template --no-reference --no-reference-if-able --no-dissociate --no-origin --no-branch --no-upload-pack --no-depth --no-shallow-since --no-shallow-exclude --no-single-branch --no-shallow-submodules --no-separate-git-dir --no-config --no-server-option --no-ipv4 --no-ipv6 --no-filter --no-also-filter-submodules --no-remote-submodules --no-sparse"
|
||||
__gitcomp_builtin_column_default=" --command= --mode --raw-mode= --width= --indent= --nl= --padding= --no-command -- --no-mode --no-raw-mode --no-width --no-indent --no-nl --no-padding"
|
||||
__gitcomp_builtin_commit_default=" --quiet --verbose --file= --author= --date= --message= --reedit-message= --reuse-message= --fixup= --squash= --reset-author --trailer= --signoff --template= --edit --cleanup= --status --gpg-sign --all --include --interactive --patch --only --no-verify --dry-run --short --branch --ahead-behind --porcelain --long --null --amend --no-post-rewrite --untracked-files --pathspec-from-file= --pathspec-file-nul --verify --post-rewrite -- --no-quiet --no-verbose --no-file --no-author --no-date --no-message --no-reedit-message --no-reuse-message --no-fixup --no-squash --no-reset-author --no-signoff --no-template --no-edit --no-cleanup --no-status --no-gpg-sign --no-all --no-include --no-interactive --no-patch --no-only --no-dry-run --no-short --no-branch --no-ahead-behind --no-porcelain --no-long --no-null --no-amend --no-untracked-files --no-pathspec-from-file --no-pathspec-file-nul"
|
||||
__gitcomp_builtin_commit_graph_default=" --object-dir= --no-object-dir"
|
||||
@ -346,31 +351,33 @@ __gitcomp_builtin_describe_default=" --contains --debug --all --tags --long --fi
|
||||
__gitcomp_builtin_difftool_default=" --gui --dir-diff --no-prompt --symlinks --tool= --tool-help --trust-exit-code --extcmd= --no-index --index -- --no-gui --no-dir-diff --no-symlinks --no-tool --no-tool-help --no-trust-exit-code --no-extcmd"
|
||||
__gitcomp_builtin_env__helper_default=" --type= --default= --exit-code --no-default -- --no-exit-code"
|
||||
__gitcomp_builtin_fast_export_default=" --progress= --signed-tags= --tag-of-filtered-object= --reencode= --export-marks= --import-marks= --import-marks-if-exists= --fake-missing-tagger --full-tree --use-done-feature --no-data --refspec= --anonymize --anonymize-map= --reference-excluded-parents --show-original-ids --mark-tags --data -- --no-progress --no-signed-tags --no-tag-of-filtered-object --no-reencode --no-export-marks --no-import-marks --no-import-marks-if-exists --no-fake-missing-tagger --no-full-tree --no-use-done-feature --no-refspec --no-anonymize --no-reference-excluded-parents --no-show-original-ids --no-mark-tags"
|
||||
__gitcomp_builtin_fetch_default=" --verbose --quiet --all --set-upstream --append --atomic --upload-pack= --force --multiple --tags --jobs= --prefetch --prune --prune-tags --recurse-submodules --dry-run --write-fetch-head --keep --update-head-ok --progress --depth= --shallow-since= --shallow-exclude= --deepen= --unshallow --update-shallow --refmap= --server-option= --ipv4 --ipv6 --negotiation-tip= --negotiate-only --filter= --auto-maintenance --auto-gc --show-forced-updates --write-commit-graph --stdin --no-verbose -- --no-quiet --no-all --no-set-upstream --no-append --no-atomic --no-upload-pack --no-force --no-multiple --no-tags --no-jobs --no-prefetch --no-prune --no-prune-tags --no-recurse-submodules --no-dry-run --no-write-fetch-head --no-keep --no-update-head-ok --no-progress --no-depth --no-shallow-since --no-shallow-exclude --no-deepen --no-update-shallow --no-server-option --no-ipv4 --no-ipv6 --no-negotiation-tip --no-negotiate-only --no-filter --no-auto-maintenance --no-auto-gc --no-show-forced-updates --no-write-commit-graph --no-stdin"
|
||||
__gitcomp_builtin_fetch_default=" --verbose --quiet --all --set-upstream --append --atomic --upload-pack= --force --multiple --tags --jobs= --prefetch --prune --prune-tags --recurse-submodules --dry-run --write-fetch-head --keep --update-head-ok --progress --depth= --shallow-since= --shallow-exclude= --deepen= --unshallow --refetch --update-shallow --refmap= --server-option= --ipv4 --ipv6 --negotiation-tip= --negotiate-only --filter= --auto-maintenance --auto-gc --show-forced-updates --write-commit-graph --stdin --no-verbose -- --no-quiet --no-all --no-set-upstream --no-append --no-atomic --no-upload-pack --no-force --no-multiple --no-tags --no-jobs --no-prefetch --no-prune --no-prune-tags --no-recurse-submodules --no-dry-run --no-write-fetch-head --no-keep --no-update-head-ok --no-progress --no-depth --no-shallow-since --no-shallow-exclude --no-deepen --no-update-shallow --no-server-option --no-ipv4 --no-ipv6 --no-negotiation-tip --no-negotiate-only --no-filter --no-auto-maintenance --no-auto-gc --no-show-forced-updates --no-write-commit-graph --no-stdin"
|
||||
__gitcomp_builtin_fmt_merge_msg_default=" --log --message= --into-name= --file= --no-log -- --no-message --no-into-name --no-file"
|
||||
__gitcomp_builtin_for_each_ref_default=" --shell --perl --python --tcl --count= --format= --color --sort= --points-at= --merged --no-merged --contains --no-contains --ignore-case -- --no-shell --no-perl --no-python --no-tcl --no-count --no-format --no-color --no-sort --no-points-at --no-ignore-case"
|
||||
__gitcomp_builtin_for_each_repo_default=" --config= --no-config"
|
||||
__gitcomp_builtin_format_patch_default=" --numbered --no-numbered --signoff --stdout --cover-letter --numbered-files --suffix= --start-number= --reroll-count= --filename-max-length= --rfc --cover-from-description= --subject-prefix= --output-directory= --keep-subject --no-binary --zero-commit --ignore-if-in-upstream --no-stat --add-header= --to= --cc= --from --in-reply-to= --attach --inline --thread --signature= --base= --signature-file= --quiet --progress --interdiff= --range-diff= --creation-factor= --binary -- --no-numbered --no-signoff --no-stdout --no-cover-letter --no-numbered-files --no-suffix --no-start-number --no-reroll-count --no-filename-max-length --no-cover-from-description --no-zero-commit --no-ignore-if-in-upstream --no-add-header --no-to --no-cc --no-from --no-in-reply-to --no-attach --no-thread --no-signature --no-base --no-signature-file --no-quiet --no-progress --no-interdiff --no-range-diff --no-creation-factor"
|
||||
__gitcomp_builtin_fsck_default=" --verbose --unreachable --dangling --tags --root --cache --reflogs --full --connectivity-only --strict --lost-found --progress --name-objects --no-verbose -- --no-unreachable --no-dangling --no-tags --no-root --no-cache --no-reflogs --no-full --no-connectivity-only --no-strict --no-lost-found --no-progress --no-name-objects"
|
||||
__gitcomp_builtin_fsck_objects_default=" --verbose --unreachable --dangling --tags --root --cache --reflogs --full --connectivity-only --strict --lost-found --progress --name-objects --no-verbose -- --no-unreachable --no-dangling --no-tags --no-root --no-cache --no-reflogs --no-full --no-connectivity-only --no-strict --no-lost-found --no-progress --no-name-objects"
|
||||
__gitcomp_builtin_fsmonitor__daemon_default=""
|
||||
__gitcomp_builtin_gc_default=" --quiet --prune --aggressive --keep-largest-pack --no-quiet -- --no-prune --no-aggressive --no-keep-largest-pack"
|
||||
__gitcomp_builtin_grep_default=" --cached --no-index --untracked --exclude-standard --recurse-submodules --invert-match --ignore-case --word-regexp --text --textconv --recursive --max-depth= --extended-regexp --basic-regexp --fixed-strings --perl-regexp --line-number --column --full-name --files-with-matches --name-only --files-without-match --only-matching --count --color --break --heading --context= --before-context= --after-context= --threads= --show-function --function-context --and --or --not --quiet --all-match --index -- --no-cached --no-untracked --no-exclude-standard --no-recurse-submodules --no-invert-match --no-ignore-case --no-word-regexp --no-text --no-textconv --no-recursive --no-extended-regexp --no-basic-regexp --no-fixed-strings --no-perl-regexp --no-line-number --no-column --no-full-name --no-files-with-matches --no-name-only --no-files-without-match --no-only-matching --no-count --no-color --no-break --no-heading --no-context --no-before-context --no-after-context --no-threads --no-show-function --no-function-context --no-or --no-quiet --no-all-match"
|
||||
__gitcomp_builtin_hash_object_default=" --stdin --stdin-paths --no-filters --literally --path= --filters -- --no-stdin --no-stdin-paths --no-literally --no-path"
|
||||
__gitcomp_builtin_help_default=" --all --man --web --info --verbose --guides --config --no-man -- --no-web --no-info --no-verbose"
|
||||
__gitcomp_builtin_help_default=" --all --external-commands --aliases --man --web --info --verbose --guides --config --no-external-commands -- --no-aliases --no-man --no-web --no-info --no-verbose"
|
||||
__gitcomp_builtin_hook_default=""
|
||||
__gitcomp_builtin_init_default=" --template= --bare --shared --quiet --separate-git-dir= --initial-branch= --object-format= --no-template -- --no-bare --no-quiet --no-separate-git-dir --no-initial-branch --no-object-format"
|
||||
__gitcomp_builtin_init_db_default=" --template= --bare --shared --quiet --separate-git-dir= --initial-branch= --object-format= --no-template -- --no-bare --no-quiet --no-separate-git-dir --no-initial-branch --no-object-format"
|
||||
__gitcomp_builtin_interpret_trailers_default=" --in-place --trim-empty --where= --if-exists= --if-missing= --only-trailers --only-input --unfold --parse --no-divider --trailer= --divider -- --no-in-place --no-trim-empty --no-where --no-if-exists --no-if-missing --no-only-trailers --no-only-input --no-unfold --no-trailer"
|
||||
__gitcomp_builtin_log_default=" --quiet --source --use-mailmap --decorate-refs= --decorate-refs-exclude= --decorate --no-quiet -- --no-source --no-use-mailmap --no-mailmap --no-decorate-refs --no-decorate-refs-exclude --no-decorate"
|
||||
__gitcomp_builtin_ls_files_default=" --cached --deleted --modified --others --ignored --stage --killed --directory --eol --empty-directory --unmerged --resolve-undo --exclude= --exclude-from= --exclude-per-directory= --exclude-standard --full-name --recurse-submodules --error-unmatch --with-tree= --abbrev --debug --deduplicate --sparse --no-cached -- --no-deleted --no-modified --no-others --no-ignored --no-stage --no-killed --no-directory --no-eol --no-empty-directory --no-unmerged --no-resolve-undo --no-exclude-per-directory --no-recurse-submodules --no-error-unmatch --no-with-tree --no-abbrev --no-debug --no-deduplicate --no-sparse"
|
||||
__gitcomp_builtin_ls_remote_default=" --quiet --upload-pack= --tags --heads --refs --get-url --sort= --symref --server-option= --no-quiet -- --no-upload-pack --no-tags --no-heads --no-refs --no-get-url --no-sort --no-symref --no-server-option"
|
||||
__gitcomp_builtin_ls_tree_default=" --long --name-only --name-status --full-name --full-tree --abbrev --no-long -- --no-name-only --no-name-status --no-full-name --no-full-tree --no-abbrev"
|
||||
__gitcomp_builtin_ls_tree_default=" --long --name-only --name-status --object-only --full-name --full-tree --format= --abbrev --no-full-name -- --no-full-tree --no-abbrev"
|
||||
__gitcomp_builtin_merge_default=" --stat --summary --log --squash --commit --edit --cleanup= --ff --ff-only --rerere-autoupdate --verify-signatures --strategy= --strategy-option= --message= --file --into-name= --verbose --quiet --abort --quit --continue --allow-unrelated-histories --progress --gpg-sign --autostash --overwrite-ignore --signoff --no-verify --verify -- --no-stat --no-summary --no-log --no-squash --no-commit --no-edit --no-cleanup --no-ff --no-rerere-autoupdate --no-verify-signatures --no-strategy --no-strategy-option --no-message --no-into-name --no-verbose --no-quiet --no-abort --no-quit --no-continue --no-allow-unrelated-histories --no-progress --no-gpg-sign --no-autostash --no-overwrite-ignore --no-signoff"
|
||||
__gitcomp_builtin_merge_base_default=" --all --octopus --independent --is-ancestor --fork-point --no-all"
|
||||
__gitcomp_builtin_merge_file_default=" --stdout --diff3 --zdiff3 --ours --theirs --union --marker-size= --quiet --no-stdout -- --no-diff3 --no-zdiff3 --no-ours --no-theirs --no-union --no-marker-size --no-quiet"
|
||||
__gitcomp_builtin_mktree_default=" --missing --batch --no-missing -- --no-batch"
|
||||
__gitcomp_builtin_multi_pack_index_default=" --object-dir= --no-object-dir"
|
||||
__gitcomp_builtin_mv_default=" --verbose --dry-run --sparse --no-verbose -- --no-dry-run --no-sparse"
|
||||
__gitcomp_builtin_name_rev_default=" --name-only --tags --refs= --exclude= --all --stdin --undefined --always --no-name-only -- --no-tags --no-refs --no-exclude --no-all --no-stdin --no-undefined --no-always"
|
||||
__gitcomp_builtin_name_rev_default=" --name-only --tags --refs= --exclude= --all --stdin --annotate-stdin --undefined --always --no-name-only -- --no-tags --no-refs --no-exclude --no-all --no-stdin --no-annotate-stdin --no-undefined --no-always"
|
||||
__gitcomp_builtin_notes_default=" --ref= --no-ref"
|
||||
__gitcomp_builtin_pack_objects_default=" --quiet --progress --all-progress --all-progress-implied --index-version= --max-pack-size= --local --incremental --window= --window-memory= --depth= --reuse-delta --reuse-object --delta-base-offset --threads= --non-empty --revs --unpacked --all --reflog --indexed-objects --stdin-packs --stdout --include-tag --keep-unreachable --pack-loose-unreachable --unpack-unreachable --sparse --thin --shallow --honor-pack-keep --keep-pack= --compression= --keep-true-parents --use-bitmap-index --write-bitmap-index --filter= --missing= --exclude-promisor-objects --delta-islands --uri-protocol= --no-quiet -- --no-progress --no-all-progress --no-all-progress-implied --no-local --no-incremental --no-window --no-depth --no-reuse-delta --no-reuse-object --no-delta-base-offset --no-threads --no-non-empty --no-revs --no-stdin-packs --no-stdout --no-include-tag --no-keep-unreachable --no-pack-loose-unreachable --no-unpack-unreachable --no-sparse --no-thin --no-shallow --no-honor-pack-keep --no-keep-pack --no-compression --no-keep-true-parents --no-use-bitmap-index --no-write-bitmap-index --no-filter --no-exclude-promisor-objects --no-delta-islands --no-uri-protocol"
|
||||
__gitcomp_builtin_pack_refs_default=" --all --prune --no-all -- --no-prune"
|
||||
@ -383,12 +390,12 @@ __gitcomp_builtin_range_diff_default=" --creation-factor= --no-dual-color --note
|
||||
__gitcomp_builtin_read_tree_default=" --index-output= --empty --verbose --trivial --aggressive --reset --prefix= --exclude-per-directory= --dry-run --no-sparse-checkout --debug-unpack --recurse-submodules --quiet --sparse-checkout -- --no-empty --no-verbose --no-trivial --no-aggressive --no-reset --no-dry-run --no-debug-unpack --no-recurse-submodules --no-quiet"
|
||||
__gitcomp_builtin_rebase_default=" --onto= --keep-base --no-verify --quiet --verbose --no-stat --signoff --committer-date-is-author-date --reset-author-date --ignore-whitespace --whitespace= --force-rebase --no-ff --continue --skip --abort --quit --edit-todo --show-current-patch --apply --merge --interactive --rerere-autoupdate --empty= --autosquash --gpg-sign --autostash --exec= --rebase-merges --fork-point --strategy= --strategy-option= --root --reschedule-failed-exec --reapply-cherry-picks --verify --stat --ff -- --no-onto --no-keep-base --no-quiet --no-verbose --no-signoff --no-committer-date-is-author-date --no-reset-author-date --no-ignore-whitespace --no-whitespace --no-force-rebase --no-rerere-autoupdate --no-autosquash --no-gpg-sign --no-autostash --no-exec --no-rebase-merges --no-fork-point --no-strategy --no-strategy-option --no-root --no-reschedule-failed-exec --no-reapply-cherry-picks"
|
||||
__gitcomp_builtin_receive_pack_default=" --quiet --no-quiet"
|
||||
__gitcomp_builtin_reflog_default=" --quiet --source --use-mailmap --decorate-refs= --decorate-refs-exclude= --decorate --no-quiet -- --no-source --no-use-mailmap --no-mailmap --no-decorate-refs --no-decorate-refs-exclude --no-decorate"
|
||||
__gitcomp_builtin_reflog_default=""
|
||||
__gitcomp_builtin_remote_default=" --verbose --no-verbose"
|
||||
__gitcomp_builtin_repack_default=" --quiet --local --write-bitmap-index --delta-islands --unpack-unreachable= --keep-unreachable --window= --window-memory= --depth= --threads= --max-pack-size= --pack-kept-objects --keep-pack= --geometric= --write-midx --no-quiet -- --no-local --no-write-bitmap-index --no-delta-islands --no-unpack-unreachable --no-keep-unreachable --no-window --no-window-memory --no-depth --no-threads --no-max-pack-size --no-pack-kept-objects --no-keep-pack --no-geometric --no-write-midx"
|
||||
__gitcomp_builtin_replace_default=" --list --delete --edit --graft --convert-graft-file --raw --format= --no-raw -- --no-format"
|
||||
__gitcomp_builtin_rerere_default=" --rerere-autoupdate --no-rerere-autoupdate"
|
||||
__gitcomp_builtin_reset_default=" --quiet --mixed --soft --hard --merge --keep --recurse-submodules --patch --intent-to-add --pathspec-from-file= --pathspec-file-nul --no-quiet -- --no-mixed --no-soft --no-hard --no-merge --no-keep --no-recurse-submodules --no-patch --no-intent-to-add --no-pathspec-from-file --no-pathspec-file-nul"
|
||||
__gitcomp_builtin_reset_default=" --quiet --no-refresh --mixed --soft --hard --merge --keep --recurse-submodules --patch --intent-to-add --pathspec-from-file= --pathspec-file-nul --refresh -- --no-quiet --no-mixed --no-soft --no-hard --no-merge --no-keep --no-recurse-submodules --no-patch --no-intent-to-add --no-pathspec-from-file --no-pathspec-file-nul"
|
||||
__gitcomp_builtin_restore_default=" --source= --staged --worktree --ignore-unmerged --overlay --quiet --recurse-submodules --progress --merge --conflict= --ours --theirs --patch --ignore-skip-worktree-bits --pathspec-from-file= --pathspec-file-nul --no-source -- --no-staged --no-worktree --no-ignore-unmerged --no-overlay --no-quiet --no-recurse-submodules --no-progress --no-merge --no-conflict --no-patch --no-ignore-skip-worktree-bits --no-pathspec-from-file --no-pathspec-file-nul"
|
||||
__gitcomp_builtin_revert_default=" --quit --continue --abort --skip --cleanup= --no-commit --edit --signoff --mainline= --rerere-autoupdate --strategy= --strategy-option= --gpg-sign --commit -- --no-cleanup --no-edit --no-signoff --no-mainline --no-rerere-autoupdate --no-strategy --no-strategy-option --no-gpg-sign"
|
||||
__gitcomp_builtin_rm_default=" --dry-run --quiet --cached --ignore-unmatch --sparse --pathspec-from-file= --pathspec-file-nul --no-dry-run -- --no-quiet --no-cached --no-ignore-unmatch --no-sparse --no-pathspec-from-file --no-pathspec-file-nul"
|
||||
@ -416,7 +423,7 @@ __gitcomp_builtin_verify_tag_default=" --verbose --raw --format= --no-verbose --
|
||||
__gitcomp_builtin_version_default=" --build-options --no-build-options"
|
||||
__gitcomp_builtin_whatchanged_default=" --quiet --source --use-mailmap --decorate-refs= --decorate-refs-exclude= --decorate --no-quiet -- --no-source --no-use-mailmap --no-mailmap --no-decorate-refs --no-decorate-refs-exclude --no-decorate"
|
||||
__gitcomp_builtin_write_tree_default=" --missing-ok --prefix= --no-missing-ok -- --no-prefix"
|
||||
__gitcomp_builtin_send_email_default="--cc= --smtp-server= --identity= --smtp-ssl --sender= --from= --cc-cover --no-to-cover --sendmail-cmd= --signed-off-cc --signed-off-by-cc --in-reply-to= --no-cc --confirm= --no-bcc --to= --annotate --smtp-encryption= --relogin-delay= --to-cmd= --smtp-domain= --smtp-auth= --bcc= --quiet --subject= --chain-reply-to --cc-cmd= --no-format-patch --transfer-encoding= --smtp-user= --reply-to= --force --dry-run --no-identity --no-validate --8bit-encoding= --to-cover --compose --thread --format-patch --no-thread --smtp-server-option= --compose-encoding= --smtp-server-port= --no-smtp-auth --no-signed-off-cc --no-signed-off-by-cc --smtp-debug= --no-suppress-from --suppress-from --no-to --dump-aliases --xmailer --no-annotate --no-cc-cover --smtp-pass= --smtp-ssl-cert-path= --no-chain-reply-to --suppress-cc= --validate --batch-size= --envelope-sender= --no-xmailer --numbered --no-numbered --signoff --stdout --cover-letter --numbered-files --suffix= --start-number= --reroll-count= --filename-max-length= --rfc --cover-from-description= --subject-prefix= --output-directory= --keep-subject --no-binary --zero-commit --ignore-if-in-upstream --no-stat --add-header= --from --attach --inline --signature= --base= --signature-file= --progress --interdiff= --range-diff= --creation-factor= --binary -- --no-signoff --no-stdout --no-cover-letter --no-numbered-files --no-suffix --no-start-number --no-reroll-count --no-filename-max-length --no-cover-from-description --no-zero-commit --no-ignore-if-in-upstream --no-add-header --no-from --no-in-reply-to --no-attach --no-signature --no-base --no-signature-file --no-quiet --no-progress --no-interdiff --no-range-diff --no-creation-factor"
|
||||
__gitcomp_builtin_send_email_default="--sender= --from= --smtp-auth= --8bit-encoding= --no-format-patch --no-bcc --no-suppress-from --no-annotate --relogin-delay= --no-cc --no-signed-off-cc --no-signed-off-by-cc --no-chain-reply-to --smtp-debug= --smtp-domain= --chain-reply-to --dry-run --compose --bcc= --smtp-user= --thread --cc-cover --identity= --to= --reply-to= --no-cc-cover --suppress-cc= --to-cmd= --smtp-server= --smtp-ssl-cert-path= --no-thread --smtp-server-option= --quiet --batch-size= --envelope-sender= --smtp-ssl --no-to --validate --format-patch --suppress-from --cc= --compose-encoding= --to-cover --in-reply-to= --annotate --smtp-encryption= --cc-cmd= --smtp-server-port= --smtp-pass= --signed-off-cc --signed-off-by-cc --no-xmailer --subject= --no-to-cover --confirm= --transfer-encoding= --no-smtp-auth --sendmail-cmd= --no-validate --no-identity --dump-aliases --xmailer --force --numbered --no-numbered --signoff --stdout --cover-letter --numbered-files --suffix= --start-number= --reroll-count= --filename-max-length= --rfc --cover-from-description= --subject-prefix= --output-directory= --keep-subject --no-binary --zero-commit --ignore-if-in-upstream --no-stat --add-header= --from --attach --inline --signature= --base= --signature-file= --progress --interdiff= --range-diff= --creation-factor= --binary -- --no-signoff --no-stdout --no-cover-letter --no-numbered-files --no-suffix --no-start-number --no-reroll-count --no-filename-max-length --no-cover-from-description --no-zero-commit --no-ignore-if-in-upstream --no-add-header --no-from --no-in-reply-to --no-attach --no-signature --no-base --no-signature-file --no-quiet --no-progress --no-interdiff --no-range-diff --no-creation-factor"
|
||||
|
||||
__gitcomp_builtin_get_default ()
|
||||
{
|
||||
@ -2841,6 +2848,10 @@ _git_restore ()
|
||||
--*)
|
||||
__gitcomp_builtin restore
|
||||
;;
|
||||
*)
|
||||
if __git rev-parse --verify --quiet HEAD >/dev/null; then
|
||||
__git_complete_index_file "--modified"
|
||||
fi
|
||||
esac
|
||||
}
|
||||
|
||||
@ -2942,9 +2953,37 @@ _git_show_branch ()
|
||||
__git_complete_revlist
|
||||
}
|
||||
|
||||
__gitcomp_directories ()
|
||||
{
|
||||
local _tmp_dir _tmp_completions _found=0
|
||||
|
||||
# Get the directory of the current token; this differs from dirname
|
||||
# in that it keeps up to the final trailing slash. If no slash found
|
||||
# that's fine too.
|
||||
[[ "$cur" =~ .*/ ]]
|
||||
_tmp_dir=$BASH_REMATCH
|
||||
|
||||
# Find possible directory completions, adding trailing '/' characters,
|
||||
# de-quoting, and handling unusual characters.
|
||||
while IFS= read -r -d $'\0' c ; do
|
||||
# If there are directory completions, find ones that start
|
||||
# with "$cur", the current token, and put those in COMPREPLY
|
||||
if [[ $c == "$cur"* ]]; then
|
||||
COMPREPLY+=("$c/")
|
||||
_found=1
|
||||
fi
|
||||
done < <(git ls-tree -z -d --name-only HEAD $_tmp_dir)
|
||||
|
||||
if [[ $_found == 0 ]] && [[ "$cur" =~ /$ ]]; then
|
||||
# No possible further completions any deeper, so assume we're at
|
||||
# a leaf directory and just consider it complete
|
||||
__gitcomp_direct_append "$cur "
|
||||
fi
|
||||
}
|
||||
|
||||
_git_sparse_checkout ()
|
||||
{
|
||||
local subcommands="list init set disable"
|
||||
local subcommands="list init set disable add reapply"
|
||||
local subcommand="$(__git_find_on_cmdline "$subcommands")"
|
||||
if [ -z "$subcommand" ]; then
|
||||
__gitcomp "$subcommands"
|
||||
@ -2952,14 +2991,14 @@ _git_sparse_checkout ()
|
||||
fi
|
||||
|
||||
case "$subcommand,$cur" in
|
||||
init,--*)
|
||||
__gitcomp_opts "--cone"
|
||||
;;
|
||||
set,--*)
|
||||
__gitcomp_opts "--stdin"
|
||||
;;
|
||||
*)
|
||||
*,--*)
|
||||
__gitcomp_builtin sparse-checkout_$subcommand "" "--"
|
||||
;;
|
||||
set,*|add,*)
|
||||
if [ "$(__git config core.sparseCheckoutCone)" == "true" ] ||
|
||||
[ -n "$(__git_find_on_cmdline --cone)" ]; then
|
||||
__gitcomp_directories
|
||||
fi
|
||||
esac
|
||||
}
|
||||
|
||||
@ -3411,7 +3450,13 @@ __git_main ()
|
||||
then
|
||||
__gitcomp "$GIT_TESTING_PORCELAIN_COMMAND_LIST"
|
||||
else
|
||||
__gitcomp_nl "$(__git --list-cmds=list-mainporcelain,others,nohelpers,alias,list-complete,config)"
|
||||
local list_cmds=list-mainporcelain,others,nohelpers,alias,list-complete,config
|
||||
|
||||
if test "${GIT_COMPLETION_SHOW_ALL_COMMANDS-}" = "1"
|
||||
then
|
||||
list_cmds=builtins,$list_cmds
|
||||
fi
|
||||
__gitcomp_nl "$(__git --list-cmds=$list_cmds)"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
@ -3589,9 +3634,9 @@ if ! git --list-cmds=main >/dev/null 2>&1; then
|
||||
__git_cmds[list-complete]="apply blame cherry config difftool fsck help instaweb mergetool prune reflog remote repack replace request-pull send-email show-branch stage whatchanged"
|
||||
__git_cmds[list-guide]="attributes cli core-tutorial credentials cvs-migration diffcore everyday faq glossary hooks ignore mailmap modules namespaces remote-helpers repository-layout revisions submodules tutorial tutorial-2 workflows"
|
||||
__git_cmds[list-mainporcelain]="add am archive bisect branch bundle checkout cherry-pick citool clean clone commit describe diff fetch format-patch gc grep gui init log maintenance merge mv notes pull push range-diff rebase reset restore revert rm shortlog show sparse-checkout stash status submodule switch tag worktree gitk"
|
||||
__git_cmds[main]="add add--interactive am annotate apply archimport archive bisect bisect--helper blame branch bugreport bundle cat-file check-attr check-ignore check-mailmap check-ref-format checkout checkout--worker checkout-index cherry cherry-pick citool clean clone column commit commit-graph commit-tree config count-objects credential credential-cache credential-cache--daemon credential-gnome-keyring credential-libsecret credential-store cvsexportcommit cvsimport cvsserver daemon describe diff diff-files diff-index diff-tree difftool difftool--helper env--helper fast-export fast-import fetch fetch-pack filter-branch fmt-merge-msg for-each-ref for-each-repo format-patch fsck fsck-objects gc get-tar-commit-id grep gui gui--askpass hash-object help http-backend http-fetch http-push imap-send index-pack init init-db instaweb interpret-trailers log ls-files ls-remote ls-tree mailinfo mailsplit maintenance merge merge-base merge-file merge-index merge-octopus merge-one-file merge-ours merge-recursive merge-recursive-ours merge-recursive-theirs merge-resolve merge-subtree merge-tree mergetool mktag mktree multi-pack-index mv mw name-rev notes p4 pack-objects pack-redundant pack-refs patch-id pickaxe prune prune-packed pull push quiltimport range-diff read-tree rebase receive-pack reflog remote remote-ext remote-fd remote-ftp remote-ftps remote-http remote-https remote-mediawiki repack replace request-pull rerere reset restore rev-list rev-parse revert rm send-email send-pack sh-i18n--envsubst shell shortlog show show-branch show-index show-ref sparse-checkout stage stash status stripspace submodule submodule--helper subtree svn switch symbolic-ref tag unpack-file unpack-objects update-index update-ref update-server-info upload-archive upload-archive--writer upload-pack var verify-commit verify-pack verify-tag version web--browse whatchanged worktree write-tree"
|
||||
__git_cmds[main]="add add--interactive am annotate apply archimport archive bisect bisect--helper blame branch bugreport bundle cat-file check-attr check-ignore check-mailmap check-ref-format checkout checkout--worker checkout-index cherry cherry-pick citool clean clone column commit commit-graph commit-tree config count-objects credential credential-cache credential-cache--daemon credential-store cvsexportcommit cvsimport cvsserver daemon describe diff diff-files diff-index diff-tree difftool difftool--helper env--helper fast-export fast-import fetch fetch-pack filter-branch fmt-merge-msg for-each-ref for-each-repo format-patch fsck fsck-objects fsmonitor--daemon gc get-tar-commit-id grep gui gui--askpass hash-object help hook http-backend http-fetch http-push imap-send index-pack init init-db instaweb interpret-trailers legacy-rebase legacy-stash log ls-files ls-remote ls-tree mailinfo mailsplit maintenance merge merge-base merge-file merge-index merge-octopus merge-one-file merge-ours merge-recursive merge-recursive-ours merge-recursive-theirs merge-resolve merge-subtree merge-tree mergetool mktag mktree multi-pack-index mv name-rev notes p4 pack-objects pack-redundant pack-refs patch-id pickaxe prune prune-packed pull push quiltimport range-diff read-tree rebase rebase--helper receive-pack reflog relink remote remote-ext remote-fd remote-ftp remote-ftps remote-http remote-https remote-testsvn repack replace request-pull rerere reset restore rev-list rev-parse revert rm send-email send-pack serve sh-i18n--envsubst shell shortlog show show-branch show-index show-ref sparse-checkout stage stash status stripspace submodule submodule--helper svn switch symbolic-ref tag unpack-file unpack-objects update-index update-ref update-server-info upload-archive upload-archive--writer upload-pack var verify-commit verify-pack verify-tag version web--browse whatchanged worktree write-tree"
|
||||
__git_cmds[others]=""
|
||||
__git_cmds[parseopt]="add am apply archive bisect--helper blame branch bugreport cat-file check-attr check-ignore check-mailmap checkout checkout--worker checkout-index cherry cherry-pick clean clone column commit commit-graph config count-objects credential-cache credential-cache--daemon credential-store describe difftool env--helper fast-export fetch fmt-merge-msg for-each-ref for-each-repo format-patch fsck fsck-objects gc grep hash-object help init init-db interpret-trailers log ls-files ls-remote ls-tree merge merge-base merge-file mktree multi-pack-index mv name-rev notes pack-objects pack-refs pickaxe prune prune-packed pull push range-diff read-tree rebase receive-pack reflog remote repack replace rerere reset restore revert rm send-pack shortlog show show-branch show-index show-ref sparse-checkout stage stash status stripspace switch symbolic-ref tag update-index update-ref update-server-info upload-pack verify-commit verify-pack verify-tag version whatchanged write-tree "
|
||||
__git_cmds[parseopt]="add am apply archive bisect--helper blame branch bugreport cat-file check-attr check-ignore check-mailmap checkout checkout--worker checkout-index cherry cherry-pick clean clone column commit commit-graph config count-objects credential-cache credential-cache--daemon credential-store describe difftool env--helper fast-export fetch fmt-merge-msg for-each-ref for-each-repo format-patch fsck fsck-objects fsmonitor--daemon gc grep hash-object help hook init init-db interpret-trailers log ls-files ls-remote ls-tree merge merge-base merge-file mktree multi-pack-index mv name-rev notes pack-objects pack-refs pickaxe prune prune-packed pull push range-diff read-tree rebase receive-pack reflog remote repack replace rerere reset restore revert rm send-pack shortlog show show-branch show-index show-ref sparse-checkout stage stash status stripspace switch symbolic-ref tag update-index update-ref update-server-info upload-pack verify-commit verify-pack verify-tag version whatchanged write-tree "
|
||||
|
||||
# Override __git
|
||||
__git ()
|
||||
|
@ -66,6 +66,11 @@
|
||||
# git always compare HEAD to @{upstream}
|
||||
# svn always compare HEAD to your SVN upstream
|
||||
#
|
||||
# By default, __git_ps1 will compare HEAD to your SVN upstream if it can
|
||||
# find one, or @{upstream} otherwise. Once you have set
|
||||
# GIT_PS1_SHOWUPSTREAM, you can override it on a per-repository basis by
|
||||
# setting the bash.showUpstream config variable.
|
||||
#
|
||||
# You can change the separator between the branch name and the above
|
||||
# state symbols by setting GIT_PS1_STATESEPARATOR. The default separator
|
||||
# is SP.
|
||||
@ -79,11 +84,6 @@
|
||||
# single '?' character by setting GIT_PS1_COMPRESSSPARSESTATE, or omitted
|
||||
# by setting GIT_PS1_OMITSPARSESTATE.
|
||||
#
|
||||
# By default, __git_ps1 will compare HEAD to your SVN upstream if it can
|
||||
# find one, or @{upstream} otherwise. Once you have set
|
||||
# GIT_PS1_SHOWUPSTREAM, you can override it on a per-repository basis by
|
||||
# setting the bash.showUpstream config variable.
|
||||
#
|
||||
# If you would like to see more information about the identity of
|
||||
# commits checked out as a detached HEAD, set GIT_PS1_DESCRIBE_STYLE
|
||||
# to one of these values:
|
||||
@ -115,7 +115,7 @@ __git_ps1_show_upstream ()
|
||||
{
|
||||
local key value
|
||||
local svn_remote svn_url_pattern count n
|
||||
local upstream=git legacy="" verbose="" name=""
|
||||
local upstream_type=git legacy="" verbose="" name=""
|
||||
|
||||
svn_remote=()
|
||||
# get some config options from git-config
|
||||
@ -132,7 +132,7 @@ __git_ps1_show_upstream ()
|
||||
svn-remote.*.url)
|
||||
svn_remote[$((${#svn_remote[@]} + 1))]="$value"
|
||||
svn_url_pattern="$svn_url_pattern\\|$value"
|
||||
upstream=svn+git # default upstream is SVN if available, else git
|
||||
upstream_type=svn+git # default upstream type is SVN if available, else git
|
||||
;;
|
||||
esac
|
||||
done <<< "$output"
|
||||
@ -141,16 +141,16 @@ __git_ps1_show_upstream ()
|
||||
local option
|
||||
for option in ${GIT_PS1_SHOWUPSTREAM}; do
|
||||
case "$option" in
|
||||
git|svn) upstream="$option" ;;
|
||||
git|svn) upstream_type="$option" ;;
|
||||
verbose) verbose=1 ;;
|
||||
legacy) legacy=1 ;;
|
||||
name) name=1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Find our upstream
|
||||
case "$upstream" in
|
||||
git) upstream="@{upstream}" ;;
|
||||
# Find our upstream type
|
||||
case "$upstream_type" in
|
||||
git) upstream_type="@{upstream}" ;;
|
||||
svn*)
|
||||
# get the upstream from the "git-svn-id: ..." in a commit message
|
||||
# (git-svn uses essentially the same procedure internally)
|
||||
@ -167,12 +167,12 @@ __git_ps1_show_upstream ()
|
||||
|
||||
if [[ -z "$svn_upstream" ]]; then
|
||||
# default branch name for checkouts with no layout:
|
||||
upstream=${GIT_SVN_ID:-git-svn}
|
||||
upstream_type=${GIT_SVN_ID:-git-svn}
|
||||
else
|
||||
upstream=${svn_upstream#/}
|
||||
upstream_type=${svn_upstream#/}
|
||||
fi
|
||||
elif [[ "svn+git" = "$upstream" ]]; then
|
||||
upstream="@{upstream}"
|
||||
elif [[ "svn+git" = "$upstream_type" ]]; then
|
||||
upstream_type="@{upstream}"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
@ -180,11 +180,11 @@ __git_ps1_show_upstream ()
|
||||
# Find how many commits we are ahead/behind our upstream
|
||||
if [[ -z "$legacy" ]]; then
|
||||
count="$(git rev-list --count --left-right \
|
||||
"$upstream"...HEAD 2>/dev/null)"
|
||||
"$upstream_type"...HEAD 2>/dev/null)"
|
||||
else
|
||||
# produce equivalent output to --count for older versions of git
|
||||
local commits
|
||||
if commits="$(git rev-list --left-right "$upstream"...HEAD 2>/dev/null)"
|
||||
if commits="$(git rev-list --left-right "$upstream_type"...HEAD 2>/dev/null)"
|
||||
then
|
||||
local commit behind=0 ahead=0
|
||||
for commit in $commits
|
||||
@ -214,26 +214,26 @@ __git_ps1_show_upstream ()
|
||||
*) # diverged from upstream
|
||||
p="<>" ;;
|
||||
esac
|
||||
else
|
||||
else # verbose, set upstream instead of p
|
||||
case "$count" in
|
||||
"") # no upstream
|
||||
p="" ;;
|
||||
upstream="" ;;
|
||||
"0 0") # equal to upstream
|
||||
p=" u=" ;;
|
||||
upstream="|u=" ;;
|
||||
"0 "*) # ahead of upstream
|
||||
p=" u+${count#0 }" ;;
|
||||
upstream="|u+${count#0 }" ;;
|
||||
*" 0") # behind upstream
|
||||
p=" u-${count% 0}" ;;
|
||||
upstream="|u-${count% 0}" ;;
|
||||
*) # diverged from upstream
|
||||
p=" u+${count#* }-${count% *}" ;;
|
||||
upstream="|u+${count#* }-${count% *}" ;;
|
||||
esac
|
||||
if [[ -n "$count" && -n "$name" ]]; then
|
||||
__git_ps1_upstream_name=$(git rev-parse \
|
||||
--abbrev-ref "$upstream" 2>/dev/null)
|
||||
--abbrev-ref "$upstream_type" 2>/dev/null)
|
||||
if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then
|
||||
p="$p \${__git_ps1_upstream_name}"
|
||||
upstream="$upstream \${__git_ps1_upstream_name}"
|
||||
else
|
||||
p="$p ${__git_ps1_upstream_name}"
|
||||
upstream="$upstream ${__git_ps1_upstream_name}"
|
||||
# not needed anymore; keep user's
|
||||
# environment clean
|
||||
unset __git_ps1_upstream_name
|
||||
@ -245,7 +245,8 @@ __git_ps1_show_upstream ()
|
||||
|
||||
# Helper function that is meant to be called from __git_ps1. It
|
||||
# injects color codes into the appropriate gitstring variables used
|
||||
# to build a gitstring.
|
||||
# to build a gitstring. Colored variables are responsible for clearing
|
||||
# their own color.
|
||||
__git_ps1_colorize_gitstring ()
|
||||
{
|
||||
if [[ -n ${ZSH_VERSION-} ]]; then
|
||||
@ -271,22 +272,23 @@ __git_ps1_colorize_gitstring ()
|
||||
else
|
||||
branch_color="$bad_color"
|
||||
fi
|
||||
c="$branch_color$c"
|
||||
if [ -n "$c" ]; then
|
||||
c="$branch_color$c$c_clear"
|
||||
fi
|
||||
b="$branch_color$b$c_clear"
|
||||
|
||||
z="$c_clear$z"
|
||||
if [ "$w" = "*" ]; then
|
||||
w="$bad_color$w"
|
||||
if [ -n "$w" ]; then
|
||||
w="$bad_color$w$c_clear"
|
||||
fi
|
||||
if [ -n "$i" ]; then
|
||||
i="$ok_color$i"
|
||||
i="$ok_color$i$c_clear"
|
||||
fi
|
||||
if [ -n "$s" ]; then
|
||||
s="$flags_color$s"
|
||||
s="$flags_color$s$c_clear"
|
||||
fi
|
||||
if [ -n "$u" ]; then
|
||||
u="$bad_color$u"
|
||||
u="$bad_color$u$c_clear"
|
||||
fi
|
||||
r="$c_clear$r"
|
||||
}
|
||||
|
||||
# Helper function to read the first line of a file into a variable.
|
||||
@ -512,7 +514,8 @@ __git_ps1 ()
|
||||
local u=""
|
||||
local h=""
|
||||
local c=""
|
||||
local p=""
|
||||
local p="" # short version of upstream state indicator
|
||||
local upstream="" # verbose version of upstream state indicator
|
||||
|
||||
if [ "true" = "$inside_gitdir" ]; then
|
||||
if [ "true" = "$bare_repo" ]; then
|
||||
@ -555,6 +558,12 @@ __git_ps1 ()
|
||||
|
||||
local z="${GIT_PS1_STATESEPARATOR-" "}"
|
||||
|
||||
b=${b##refs/heads/}
|
||||
if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then
|
||||
__git_ps1_branch_name=$b
|
||||
b="\${__git_ps1_branch_name}"
|
||||
fi
|
||||
|
||||
# NO color option unless in PROMPT_COMMAND mode or it's Zsh
|
||||
if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then
|
||||
if [ $pcmode = yes ] || [ -n "${ZSH_VERSION-}" ]; then
|
||||
@ -562,14 +571,8 @@ __git_ps1 ()
|
||||
fi
|
||||
fi
|
||||
|
||||
b=${b##refs/heads/}
|
||||
if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then
|
||||
__git_ps1_branch_name=$b
|
||||
b="\${__git_ps1_branch_name}"
|
||||
fi
|
||||
|
||||
local f="$h$w$i$s$u"
|
||||
local gitstring="$c$b${f:+$z$f}${sparse}$r$p"
|
||||
local f="$h$w$i$s$u$p"
|
||||
local gitstring="$c$b${f:+$z$f}${sparse}$r${upstream}"
|
||||
|
||||
if [ $pcmode = yes ]; then
|
||||
if [ "${__git_printf_supports_v-}" != yes ]; then
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
url="https://raw.githubusercontent.com/felipec/git-completion"
|
||||
version="1.3.6"
|
||||
version="1.3.7"
|
||||
|
||||
curl -s -o _git "${url}/v${version}/git-completion.zsh" &&
|
||||
curl -s -o git-completion.bash "${url}/v${version}/git-completion.bash" &&
|
||||
|
@ -11,7 +11,6 @@ This plugin supports working with GitHub from the command line. It provides a fe
|
||||
* `empty_gh` - Creates a new empty repo (with a `README.md`) and pushes it to GitHub
|
||||
* `new_gh` - Initializes an existing directory as a repo and pushes it to GitHub
|
||||
* `exist_gh` - Takes an existing repo and pushes it to GitHub
|
||||
* `git.io` - Shortens a URL using [git.io](https://git.io)
|
||||
|
||||
|
||||
## Installation
|
||||
|
@ -68,8 +68,9 @@ exist_gh() { # [DIRECTORY]
|
||||
# documentation: https://github.com/blog/985-git-io-github-url-shortener
|
||||
#
|
||||
git.io() {
|
||||
emulate -L zsh
|
||||
curl -i -s https://git.io -F "url=$1" | grep "Location" | cut -f 2 -d " "
|
||||
# emulate -L zsh
|
||||
# curl -i -s https://git.io -F "url=$1" | grep "Location" | cut -f 2 -d " "
|
||||
print -u2 ${(%):-"%F{yellow}%BThe \`git.io\` is deprecated.%b\nView the announcement made by GitHub: https://github.blog/changelog/2022-01-11-git-io-no-longer-accepts-new-urls/%f"}
|
||||
}
|
||||
|
||||
# End Functions #############################################################
|
||||
|
@ -35,3 +35,4 @@ plugins=(... golang)
|
||||
| gotod | `go tool dist` | Utility to bootstrap, build and test go runtime |
|
||||
| gotofx | `go tool fix` | Fixes an application to use newer features |
|
||||
| gov | `go vet` | Vet examines Go source code and reports suspicious constructs |
|
||||
| gow | `go work` | Work provides access to operations on workspaces |
|
||||
|
@ -32,3 +32,4 @@ alias gotoc='go tool compile'
|
||||
alias gotod='go tool dist'
|
||||
alias gotofx='go tool fix'
|
||||
alias gov='go vet'
|
||||
alias gow='go work'
|
||||
|
@ -96,7 +96,7 @@ __gradle-generate-script-cache() {
|
||||
zle -R "Generating Gradle build script cache"
|
||||
# Cache all Gradle scripts
|
||||
local -a gradle_build_scripts
|
||||
gradle_build_scripts=( $(find $project_root_dir -type f -name "*.gradle" -o -name "*.gradle.kts" 2>/dev/null | egrep -v "$script_exclude_pattern") )
|
||||
gradle_build_scripts=( $(find $project_root_dir -type f -name "*.gradle" -o -name "*.gradle.kts" 2>/dev/null | grep -E -v "$script_exclude_pattern") )
|
||||
printf "%s\n" "${gradle_build_scripts[@]}" >| $cache_dir/$cache_name
|
||||
fi
|
||||
}
|
||||
|
@ -128,6 +128,7 @@ the following environment variables:
|
||||
| `KUBE_PS1_NS_ENABLE` | `true` | Display the namespace. If set to `false`, this will also disable `KUBE_PS1_DIVIDER` |
|
||||
| `KUBE_PS1_PREFIX` | `(` | Prompt opening character |
|
||||
| `KUBE_PS1_SYMBOL_ENABLE` | `true ` | Display the prompt Symbol. If set to `false`, this will also disable `KUBE_PS1_SEPARATOR` |
|
||||
| `KUBE_PS1_SYMBOL_PADDING` | `false` | Adds a space (padding) after the symbol to prevent clobbering prompt characters |
|
||||
| `KUBE_PS1_SYMBOL_DEFAULT` | `⎈ ` | Default prompt symbol. Unicode `\u2388` |
|
||||
| `KUBE_PS1_SYMBOL_USE_IMG` | `false` | ☸️ , Unicode `\u2638` as the prompt symbol |
|
||||
| `KUBE_PS1_SEPARATOR` | | | Separator between symbol and context name |
|
||||
@ -151,8 +152,10 @@ The default colors are set with the following environment variables:
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| :------- | :-----: | ------- |
|
||||
| `KUBE_PS1_PREFIX_COLOR` | `null` | Set default color of the prompt prefix |
|
||||
| `KUBE_PS1_SYMBOL_COLOR` | `blue` | Set default color of the Kubernetes symbol |
|
||||
| `KUBE_PS1_CTX_COLOR` | `red` | Set default color of the context |
|
||||
| `KUBE_PS1_SUFFIX_COLOR` | `null` | Set default color of the prompt suffix |
|
||||
| `KUBE_PS1_NS_COLOR` | `cyan` | Set default color of the namespace |
|
||||
| `KUBE_PS1_BG_COLOR` | `null` | Set default color of the prompt background |
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Kubernetes prompt helper for bash/zsh
|
||||
# Displays current context and namespace
|
||||
|
||||
# Copyright 2019 Jon Mosco
|
||||
# Copyright 2021 Jon Mosco
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@ -24,7 +24,8 @@
|
||||
# Override these values in ~/.zshrc or ~/.bashrc
|
||||
KUBE_PS1_BINARY="${KUBE_PS1_BINARY:-kubectl}"
|
||||
KUBE_PS1_SYMBOL_ENABLE="${KUBE_PS1_SYMBOL_ENABLE:-true}"
|
||||
KUBE_PS1_SYMBOL_DEFAULT=${KUBE_PS1_SYMBOL_DEFAULT:-$'\u2388 '}
|
||||
KUBE_PS1_SYMBOL_DEFAULT=${KUBE_PS1_SYMBOL_DEFAULT:-$'\u2388'}
|
||||
KUBE_PS1_SYMBOL_PADDING="${KUBE_PS1_SYMBOL_PADDING:-false}"
|
||||
KUBE_PS1_SYMBOL_USE_IMG="${KUBE_PS1_SYMBOL_USE_IMG:-false}"
|
||||
KUBE_PS1_NS_ENABLE="${KUBE_PS1_NS_ENABLE:-true}"
|
||||
KUBE_PS1_CONTEXT_ENABLE="${KUBE_PS1_CONTEXT_ENABLE:-true}"
|
||||
@ -32,10 +33,12 @@ KUBE_PS1_PREFIX="${KUBE_PS1_PREFIX-(}"
|
||||
KUBE_PS1_SEPARATOR="${KUBE_PS1_SEPARATOR-|}"
|
||||
KUBE_PS1_DIVIDER="${KUBE_PS1_DIVIDER-:}"
|
||||
KUBE_PS1_SUFFIX="${KUBE_PS1_SUFFIX-)}"
|
||||
|
||||
KUBE_PS1_SYMBOL_COLOR="${KUBE_PS1_SYMBOL_COLOR-blue}"
|
||||
KUBE_PS1_CTX_COLOR="${KUBE_PS1_CTX_COLOR-red}"
|
||||
KUBE_PS1_NS_COLOR="${KUBE_PS1_NS_COLOR-cyan}"
|
||||
KUBE_PS1_BG_COLOR="${KUBE_PS1_BG_COLOR}"
|
||||
|
||||
KUBE_PS1_KUBECONFIG_CACHE="${KUBECONFIG}"
|
||||
KUBE_PS1_DISABLE_PATH="${HOME}/.kube/kube-ps1/disabled"
|
||||
KUBE_PS1_LAST_TIME=0
|
||||
@ -149,18 +152,17 @@ _kube_ps1_symbol() {
|
||||
|
||||
case "${KUBE_PS1_SHELL}" in
|
||||
bash)
|
||||
if ((BASH_VERSINFO[0] >= 4)) && [[ $'\u2388 ' != "\\u2388 " ]]; then
|
||||
if ((BASH_VERSINFO[0] >= 4)) && [[ $'\u2388' != "\\u2388" ]]; then
|
||||
KUBE_PS1_SYMBOL="${KUBE_PS1_SYMBOL_DEFAULT}"
|
||||
# KUBE_PS1_SYMBOL=$'\u2388 '
|
||||
KUBE_PS1_SYMBOL_IMG=$'\u2638 '
|
||||
KUBE_PS1_SYMBOL_IMG=$'\u2638\ufe0f'
|
||||
else
|
||||
KUBE_PS1_SYMBOL=$'\xE2\x8E\x88 '
|
||||
KUBE_PS1_SYMBOL_IMG=$'\xE2\x98\xB8 '
|
||||
KUBE_PS1_SYMBOL=$'\xE2\x8E\x88'
|
||||
KUBE_PS1_SYMBOL_IMG=$'\xE2\x98\xB8'
|
||||
fi
|
||||
;;
|
||||
zsh)
|
||||
KUBE_PS1_SYMBOL="${KUBE_PS1_SYMBOL_DEFAULT}"
|
||||
KUBE_PS1_SYMBOL_IMG="\u2638 ";;
|
||||
KUBE_PS1_SYMBOL_IMG="\u2638";;
|
||||
*)
|
||||
KUBE_PS1_SYMBOL="k8s"
|
||||
esac
|
||||
@ -169,7 +171,12 @@ _kube_ps1_symbol() {
|
||||
KUBE_PS1_SYMBOL="${KUBE_PS1_SYMBOL_IMG}"
|
||||
fi
|
||||
|
||||
echo "${KUBE_PS1_SYMBOL}"
|
||||
if [[ "${KUBE_PS1_SYMBOL_PADDING}" == true ]]; then
|
||||
echo "${KUBE_PS1_SYMBOL} "
|
||||
else
|
||||
echo "${KUBE_PS1_SYMBOL}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
_kube_ps1_split() {
|
||||
@ -339,7 +346,11 @@ kube_ps1() {
|
||||
[[ -n "${KUBE_PS1_BG_COLOR}" ]] && KUBE_PS1+="$(_kube_ps1_color_bg ${KUBE_PS1_BG_COLOR})"
|
||||
|
||||
# Prefix
|
||||
[[ -n "${KUBE_PS1_PREFIX}" ]] && KUBE_PS1+="${KUBE_PS1_PREFIX}"
|
||||
if [[ -z "${KUBE_PS1_PREFIX_COLOR:-}" ]] && [[ -n "${KUBE_PS1_PREFIX}" ]]; then
|
||||
KUBE_PS1+="${KUBE_PS1_PREFIX}"
|
||||
else
|
||||
KUBE_PS1+="$(_kube_ps1_color_fg $KUBE_PS1_PREFIX_COLOR)${KUBE_PS1_PREFIX}${KUBE_PS1_RESET_COLOR}"
|
||||
fi
|
||||
|
||||
# Symbol
|
||||
KUBE_PS1+="$(_kube_ps1_color_fg $KUBE_PS1_SYMBOL_COLOR)$(_kube_ps1_symbol)${KUBE_PS1_RESET_COLOR}"
|
||||
@ -362,7 +373,11 @@ kube_ps1() {
|
||||
fi
|
||||
|
||||
# Suffix
|
||||
[[ -n "${KUBE_PS1_SUFFIX}" ]] && KUBE_PS1+="${KUBE_PS1_SUFFIX}"
|
||||
if [[ -z "${KUBE_PS1_SUFFIX_COLOR:-}" ]] && [[ -n "${KUBE_PS1_SUFFIX}" ]]; then
|
||||
KUBE_PS1+="${KUBE_PS1_SUFFIX}"
|
||||
else
|
||||
KUBE_PS1+="$(_kube_ps1_color_fg $KUBE_PS1_SUFFIX_COLOR)${KUBE_PS1_SUFFIX}${KUBE_PS1_RESET_COLOR}"
|
||||
fi
|
||||
|
||||
# Close Background color if defined
|
||||
[[ -n "${KUBE_PS1_BG_COLOR}" ]] && KUBE_PS1+="${_KUBE_PS1_OPEN_ESC}${_KUBE_PS1_DEFAULT_BG}${_KUBE_PS1_CLOSE_ESC}"
|
||||
|
@ -106,7 +106,7 @@ _lpass() {
|
||||
generic_options+=('--color=[Color: auto | never | always]')
|
||||
fi
|
||||
if [ "$has_interactive" -eq 1 ]; then
|
||||
generic_options+=("--non-interactive[Use stardard input instead of $EDITOR]")
|
||||
generic_options+=("--non-interactive[Use standard input instead of $EDITOR]")
|
||||
fi
|
||||
_arguments $generic_options
|
||||
fi
|
||||
|
@ -46,7 +46,7 @@ elif (( CURRENT == 3 )); then
|
||||
# ...
|
||||
# }
|
||||
# }
|
||||
# In abscence of a proper JSON parser, just grab the lines with
|
||||
# In absence of a proper JSON parser, just grab the lines with
|
||||
# a 2-space indentation and only the stuff inside quotes
|
||||
local -a projects
|
||||
projects=(${(@f)"$(ng config projects 2>/dev/null | sed -n 's/^ "\([^"]\+\)".*$/\1/p')"})
|
||||
|
@ -22,9 +22,9 @@ These settings should go in your zshrc file, before Oh My Zsh is sourced:
|
||||
nvm has been installed, regardless of chip architecture, use `NVM_HOMEBREW=$(brew --prefix nvm)`.
|
||||
|
||||
- **`NVM_LAZY`**: if you want the plugin to defer the load of nvm to speed-up the start of your zsh session,
|
||||
set `NVM_LAZY` to `1`. This will use the `--no-use` parameter when loading nvm, and will create a function
|
||||
for `node`, `npm`, `yarn`, and the command(s) specified by `NVM_LAZY_CMD`, so when you call either of them,
|
||||
nvm will load with `nvm use default`.
|
||||
set `NVM_LAZY` to `1`. This will source nvm script only when using it, and will create a function for `node`,
|
||||
`npm`, `pnpm`, `yarn`, and the command(s) specified by `NVM_LAZY_CMD`, so when you call either of them,
|
||||
nvm will be loaded and run with default version.
|
||||
|
||||
- **`NVM_LAZY_CMD`**: if you want additional command(s) to trigger lazy loading of nvm, set `NVM_LAZY_CMD` to
|
||||
the command or an array of the commands.
|
||||
|
@ -4,39 +4,33 @@ if [[ -z "$NVM_DIR" ]]; then
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
elif [[ -d "${XDG_CONFIG_HOME:-$HOME/.config}/nvm" ]]; then
|
||||
export NVM_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/nvm"
|
||||
elif (( $+commands[brew] )); then
|
||||
NVM_HOMEBREW="${NVM_HOMEBREW:-${HOMEBREW_PREFIX:-$(brew --prefix)}/opt/nvm}"
|
||||
if [[ -d "$NVM_HOMEBREW" ]]; then
|
||||
export NVM_DIR="$NVM_HOMEBREW"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Don't try to load nvm if command already available
|
||||
# Note: nvm is a function so we need to use `which`
|
||||
! which nvm &>/dev/null || return
|
||||
which nvm &>/dev/null && return
|
||||
|
||||
if [[ -f "$NVM_DIR/nvm.sh" ]]; then
|
||||
if (( $+NVM_LAZY )); then
|
||||
# Call nvm when first using nvm, node, npm, pnpm, yarn or $NVM_LAZY_CMD
|
||||
function nvm node npm pnpm yarn $NVM_LAZY_CMD {
|
||||
unfunction nvm node npm pnpm yarn $NVM_LAZY_CMD
|
||||
# Load nvm if it exists in $NVM_DIR
|
||||
[[ -f "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh"
|
||||
"$0" "$@"
|
||||
}
|
||||
elif [[ -f "$NVM_DIR/nvm.sh" ]]; then
|
||||
# Load nvm if it exists in $NVM_DIR
|
||||
source "$NVM_DIR/nvm.sh" ${NVM_LAZY+"--no-use"}
|
||||
elif (( $+commands[brew] )); then
|
||||
# Otherwise try to load nvm installed via Homebrew
|
||||
# User can set this if they have an unusual Homebrew setup
|
||||
NVM_HOMEBREW="${NVM_HOMEBREW:-${HOMEBREW_PREFIX:-$(brew --prefix)}/opt/nvm}"
|
||||
# Load nvm from Homebrew location if it exists
|
||||
if [[ -f "$NVM_HOMEBREW/nvm.sh" ]]; then
|
||||
source "$NVM_HOMEBREW/nvm.sh" ${NVM_LAZY+"--no-use"}
|
||||
else
|
||||
return
|
||||
fi
|
||||
source "$NVM_DIR/nvm.sh"
|
||||
else
|
||||
return
|
||||
fi
|
||||
|
||||
# Call nvm when first using node, npm or yarn
|
||||
if (( $+NVM_LAZY )); then
|
||||
function node npm yarn $NVM_LAZY_CMD {
|
||||
unfunction node npm yarn $NVM_LAZY_CMD
|
||||
nvm use default
|
||||
command "$0" "$@"
|
||||
}
|
||||
fi
|
||||
|
||||
# Autoload nvm when finding a .nvmrc file in the current directory
|
||||
# Adapted from: https://github.com/nvm-sh/nvm#zsh
|
||||
if (( $+NVM_AUTOLOAD )); then
|
||||
|
@ -4,4 +4,5 @@
|
||||
|
||||
if [ $commands[oc] ]; then
|
||||
source <(oc completion zsh)
|
||||
compdef _oc oc
|
||||
fi
|
||||
|
@ -118,7 +118,7 @@ start_options=(
|
||||
)
|
||||
logs_options=(
|
||||
'--json[json log output]'
|
||||
'--format[formated log output]'
|
||||
'--format[formatted log output]'
|
||||
'--raw[raw output]'
|
||||
'--err[only shows error output]'
|
||||
'--out[only shows standard output]'
|
||||
|
@ -11,66 +11,78 @@ plugins=(... react-native)
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | React Native command |
|
||||
| :------------ | :------------------------------------------------- |
|
||||
| **rn** | `react-native` |
|
||||
| **rns** | `react-native start` |
|
||||
| **rnlink** | `react-native link` |
|
||||
| _Logging_ | |
|
||||
| **rnland** | `react-native log-android` |
|
||||
| **rnlios** | `react-native log-ios` |
|
||||
| _App Testing_ | |
|
||||
| **rnand** | `react-native run-android` |
|
||||
| **rnios** | `react-native run-ios` |
|
||||
| _iPhone_ | |
|
||||
| **rnios4s** | `react-native run-ios --simulator "iPhone 4s"` |
|
||||
| **rnios5** | `react-native run-ios --simulator "iPhone 5"` |
|
||||
| **rnios5s** | `react-native run-ios --simulator "iPhone 5s"` |
|
||||
| **rnios6** | `react-native run-ios --simulator "iPhone 6"` |
|
||||
| **rnios6s** | `react-native run-ios --simulator "iPhone 6s"` |
|
||||
| **rnios6p** | `react-native run-ios --simulator "iPhone 6 Plus"` |
|
||||
| **rnios6sp** | `react-native run-ios --simulator "iPhone 6s Plus"` |
|
||||
| **rnios7** | `react-native run-ios --simulator "iPhone 7"` |
|
||||
| **rnios7p** | `react-native run-ios --simulator "iPhone 7 Plus"` |
|
||||
| **rnios8** | `react-native run-ios --simulator "iPhone 8"` |
|
||||
| **rnios8p** | `react-native run-ios --simulator "iPhone 8 Plus"` |
|
||||
| **rniosse** | `react-native run-ios --simulator "iPhone SE"` |
|
||||
| **rniosx** | `react-native run-ios --simulator "iPhone X"` |
|
||||
| **rniosxs** | `react-native run-ios --simulator "iPhone Xs"` |
|
||||
| **rniosxsm** | `react-native run-ios --simulator "iPhone Xs Max"` |
|
||||
| **rniosxr** | `react-native run-ios --simulator "iPhone Xʀ"` |
|
||||
| **rnios11** | `react-native run-ios --simulator "iPhone 11"` |
|
||||
| **rnios11p** | `react-native run-ios --simulator "iPhone 11 Pro"` |
|
||||
| **rnios11pm** | `react-native run-ios --simulator "iPhone 11 Pro Max"` |
|
||||
| _iPad_ | |
|
||||
| **rnipad2** | `react-native run-ios --simulator "iPad 2"` |
|
||||
| **rnipad5** | `react-native run-ios --simulator "iPad (5th generation)"` |
|
||||
| **rnipad6** | `react-native run-ios --simulator "iPad (6th generation)"` |
|
||||
| **rnipadr** | `react-native run-ios --simulator "iPad Retina"` |
|
||||
| **rnipada** | `react-native run-ios --simulator "iPad Air"` |
|
||||
| **rnipada2** | `react-native run-ios --simulator "iPad Air 2"` |
|
||||
| **rnipada3** | `react-native run-ios --simulator "iPad Air (3rd generation)"` |
|
||||
| **rnipadm2** | `react-native run-ios --simulator "iPad mini 2"` |
|
||||
| **rnipadm3** | `react-native run-ios --simulator "iPad mini 3"` |
|
||||
| **rnipadm4** | `react-native run-ios --simulator "iPad mini 4"` |
|
||||
| **rnipadm5** | `react-native run-ios --simulator "iPad mini (5th generation)"` |
|
||||
| **rnipadp9** | `react-native run-ios --simulator "iPad Pro (9.7-inch)"` |
|
||||
| **rnipadp12** | `react-native run-ios --simulator "iPad Pro (12.9-inch)"` |
|
||||
| **rnipadp122** | `react-native run-ios --simulator "iPad Pro (12.9-inch) (2nd generation)"` |
|
||||
| **rnipadp10** | `react-native run-ios --simulator "iPad Pro (10.5-inch)"` |
|
||||
| **rnipad11** | `react-native run-ios --simulator "iPad Pro (11-inch)"` |
|
||||
| **rnipad123** | `react-native run-ios --simulator "iPad Pro (12.9-inch) (3rd generation)"` |
|
||||
| _Apple TV_ | |
|
||||
| **rnatv** | `react-native run-ios --simulator "Apple TV"` |
|
||||
| **rnatv4k** | `react-native run-ios --simulator "Apple TV 4K"` |
|
||||
| **rnatv4k1080**| `react-native run-ios --simulator "Apple TV 4K (at 1080p)"` |
|
||||
| **rnipad123** | `react-native run-ios --simulator "iPad Pro (12.9-inch) (3rd generation)"` |
|
||||
| _Apple Watch_ | |
|
||||
| **rnaw38** | `react-native run-ios --simulator "Apple Watch - 38mm"` |
|
||||
| **rnaw42** | `react-native run-ios --simulator "Apple Watch - 42mm"` |
|
||||
| **rnaws238** | `react-native run-ios --simulator "Apple Watch Series 2 - 38mm"` |
|
||||
| **rnaws242** | `react-native run-ios --simulator "Apple Watch Series 2 - 42mm"` |
|
||||
| **rnaws338** | `react-native run-ios --simulator "Apple Watch Series 3 - 38mm"` |
|
||||
| **rnaws342** | `react-native run-ios --simulator "Apple Watch Series 3 - 42mm"` |
|
||||
| **rnaws440** | `react-native run-ios --simulator "Apple Watch Series 4 - 40mm"` |
|
||||
| **rnaws444** | `react-native run-ios --simulator "Apple Watch Series 4 - 44mm"` |
|
||||
| Alias | React Native command |
|
||||
| :-------------- | :------------------------------------------------------------------------- |
|
||||
| **rn** | `react-native` |
|
||||
| **rns** | `react-native start` |
|
||||
| **rnlink** | `react-native link` |
|
||||
| _Logging_ | |
|
||||
| **rnland** | `react-native log-android` |
|
||||
| **rnlios** | `react-native log-ios` |
|
||||
| _App Testing_ | |
|
||||
| **rnand** | `react-native run-android` |
|
||||
| **rnios** | `react-native run-ios` |
|
||||
| _iPhone_ | |
|
||||
| **rnios4s** | `react-native run-ios --simulator "iPhone 4s"` |
|
||||
| **rnios5** | `react-native run-ios --simulator "iPhone 5"` |
|
||||
| **rnios5s** | `react-native run-ios --simulator "iPhone 5s"` |
|
||||
| **rnios6** | `react-native run-ios --simulator "iPhone 6"` |
|
||||
| **rnios6s** | `react-native run-ios --simulator "iPhone 6s"` |
|
||||
| **rnios6p** | `react-native run-ios --simulator "iPhone 6 Plus"` |
|
||||
| **rnios6sp** | `react-native run-ios --simulator "iPhone 6s Plus"` |
|
||||
| **rnios7** | `react-native run-ios --simulator "iPhone 7"` |
|
||||
| **rnios7p** | `react-native run-ios --simulator "iPhone 7 Plus"` |
|
||||
| **rnios8** | `react-native run-ios --simulator "iPhone 8"` |
|
||||
| **rnios8p** | `react-native run-ios --simulator "iPhone 8 Plus"` |
|
||||
| **rniosse** | `react-native run-ios --simulator "iPhone SE"` |
|
||||
| **rniosx** | `react-native run-ios --simulator "iPhone X"` |
|
||||
| **rniosxs** | `react-native run-ios --simulator "iPhone Xs"` |
|
||||
| **rniosxsm** | `react-native run-ios --simulator "iPhone Xs Max"` |
|
||||
| **rniosxr** | `react-native run-ios --simulator "iPhone Xʀ"` |
|
||||
| **rnios11** | `react-native run-ios --simulator "iPhone 11"` |
|
||||
| **rnios11p** | `react-native run-ios --simulator "iPhone 11 Pro"` |
|
||||
| **rnios11pm** | `react-native run-ios --simulator "iPhone 11 Pro Max"` |
|
||||
| **rnios12** | `react-native run-ios --simulator "iPhone 12"` |
|
||||
| **rnios12m** | `react-native run-ios --simulator "iPhone 12 mini"` |
|
||||
| **rnios12p** | `react-native run-ios --simulator "iPhone 12 Pro"` |
|
||||
| **rnios12pm** | `react-native run-ios --simulator "iPhone 12 Pro Max"` |
|
||||
| **rnios13** | `react-native run-ios --simulator "iPhone 13"` |
|
||||
| **rnios13m** | `react-native run-ios --simulator "iPhone 13 mini"` |
|
||||
| **rnios13p** | `react-native run-ios --simulator "iPhone 13 Pro"` |
|
||||
| **rnios13pm** | `react-native run-ios --simulator "iPhone 13 Pro Max"` |
|
||||
| **rnios14** | `react-native run-ios --simulator "iPhone 14"` |
|
||||
| **rnios14pl** | `react-native run-ios --simulator "iPhone 14 Plus"` |
|
||||
| **rnios14p** | `react-native run-ios --simulator "iPhone 14 Pro"` |
|
||||
| **rnios14pm** | `react-native run-ios --simulator "iPhone 14 Pro Max"` |
|
||||
| _iPad_ | |
|
||||
| **rnipad2** | `react-native run-ios --simulator "iPad 2"` |
|
||||
| **rnipad5** | `react-native run-ios --simulator "iPad (5th generation)"` |
|
||||
| **rnipad6** | `react-native run-ios --simulator "iPad (6th generation)"` |
|
||||
| **rnipadr** | `react-native run-ios --simulator "iPad Retina"` |
|
||||
| **rnipada** | `react-native run-ios --simulator "iPad Air"` |
|
||||
| **rnipada2** | `react-native run-ios --simulator "iPad Air 2"` |
|
||||
| **rnipada3** | `react-native run-ios --simulator "iPad Air (3rd generation)"` |
|
||||
| **rnipadm2** | `react-native run-ios --simulator "iPad mini 2"` |
|
||||
| **rnipadm3** | `react-native run-ios --simulator "iPad mini 3"` |
|
||||
| **rnipadm4** | `react-native run-ios --simulator "iPad mini 4"` |
|
||||
| **rnipadm5** | `react-native run-ios --simulator "iPad mini (5th generation)"` |
|
||||
| **rnipadp9** | `react-native run-ios --simulator "iPad Pro (9.7-inch)"` |
|
||||
| **rnipadp12** | `react-native run-ios --simulator "iPad Pro (12.9-inch)"` |
|
||||
| **rnipadp122** | `react-native run-ios --simulator "iPad Pro (12.9-inch) (2nd generation)"` |
|
||||
| **rnipadp10** | `react-native run-ios --simulator "iPad Pro (10.5-inch)"` |
|
||||
| **rnipad11** | `react-native run-ios --simulator "iPad Pro (11-inch)"` |
|
||||
| **rnipad123** | `react-native run-ios --simulator "iPad Pro (12.9-inch) (3rd generation)"` |
|
||||
| _Apple TV_ | |
|
||||
| **rnatv** | `react-native run-ios --simulator "Apple TV"` |
|
||||
| **rnatv4k** | `react-native run-ios --simulator "Apple TV 4K"` |
|
||||
| **rnatv4k1080** | `react-native run-ios --simulator "Apple TV 4K (at 1080p)"` |
|
||||
| **rnipad123** | `react-native run-ios --simulator "iPad Pro (12.9-inch) (3rd generation)"` |
|
||||
| _Apple Watch_ | |
|
||||
| **rnaw38** | `react-native run-ios --simulator "Apple Watch - 38mm"` |
|
||||
| **rnaw42** | `react-native run-ios --simulator "Apple Watch - 42mm"` |
|
||||
| **rnaws238** | `react-native run-ios --simulator "Apple Watch Series 2 - 38mm"` |
|
||||
| **rnaws242** | `react-native run-ios --simulator "Apple Watch Series 2 - 42mm"` |
|
||||
| **rnaws338** | `react-native run-ios --simulator "Apple Watch Series 3 - 38mm"` |
|
||||
| **rnaws342** | `react-native run-ios --simulator "Apple Watch Series 3 - 42mm"` |
|
||||
| **rnaws440** | `react-native run-ios --simulator "Apple Watch Series 4 - 40mm"` |
|
||||
| **rnaws444** | `react-native run-ios --simulator "Apple Watch Series 4 - 44mm"` |
|
||||
|
@ -28,9 +28,17 @@ alias rnios11='react-native run-ios --simulator "iPhone 11"'
|
||||
alias rnios11p='react-native run-ios --simulator "iPhone 11 Pro"'
|
||||
alias rnios11pm='react-native run-ios --simulator "iPhone 11 Pro Max"'
|
||||
alias rnios12='react-native run-ios --simulator "iPhone 12"'
|
||||
alias rnios12m='react-native run-ios --simulator "iPhone 12 mini"'
|
||||
alias rnios12p='react-native run-ios --simulator "iPhone 12 Pro"'
|
||||
alias rnios12pm='react-native run-ios --simulator "iPhone 12 Pro Max"'
|
||||
|
||||
alias rnios13='react-native run-ios --simulator "iPhone 13"'
|
||||
alias rnios13m='react-native run-ios --simulator "iPhone 13 mini"'
|
||||
alias rnios13p='react-native run-ios --simulator "iPhone 13 Pro"'
|
||||
alias rnios13pm='react-native run-ios --simulator "iPhone 13 Pro Max"'
|
||||
alias rnios14='react-native run-ios --simulator "iPhone 14"'
|
||||
alias rnios14pl='react-native run-ios --simulator "iPhone 14 Plus"'
|
||||
alias rnios14p='react-native run-ios --simulator "iPhone 14 Pro"'
|
||||
alias rnios14pm='react-native run-ios --simulator "iPhone 14 Pro Max"'
|
||||
|
||||
# iPad
|
||||
alias rnipad2='react-native run-ios --simulator "iPad 2"'
|
||||
|
@ -9,7 +9,7 @@
|
||||
# zstyle ':completion::complete:salt(|-call):modules:' use-cache true
|
||||
# zstyle ':completion::complete:salt(|-cp|-call|-run|-key):salt_dir:' use-cache true
|
||||
#
|
||||
# cache validation can be controled with the style cache-ttl.
|
||||
# cache validation can be controlled with the style cache-ttl.
|
||||
# it expects two arguments: number (days|hours|weeks|months)
|
||||
# to invalidate the minion cache after four days:
|
||||
# zstyle ':completion::complete:salt(|-cp|-call):minions:' cache-ttl 4 days
|
||||
|
@ -1,32 +1,39 @@
|
||||
#!/usr/bin/bash
|
||||
# shellcheck disable=SC1090,SC2154
|
||||
|
||||
proxy() {
|
||||
# deprecate $DEFAULT_PROXY, use SHELLPROXY_URL instead
|
||||
if [[ -n "$DEFAULT_PROXY" && -z "$SHELLPROXY_URL" ]]; then
|
||||
echo >&2 "proxy: DEFAULT_PROXY is deprecated, use SHELLPROXY_URL instead"
|
||||
SHELLPROXY_URL="$DEFAULT_PROXY"
|
||||
unset DEFAULT_PROXY
|
||||
fi
|
||||
# Handle $0 according to the standard:
|
||||
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
|
||||
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
|
||||
0="${${(M)0:#/*}:-$PWD/$0}"
|
||||
|
||||
# deprecate CONFIG_PROXY, use SHELLPROXY_CONFIG instead
|
||||
if [[ -n "$CONFIG_PROXY" && -z "$SHELLPROXY_CONFIG" ]]; then
|
||||
echo >&2 "proxy: CONFIG_PROXY is deprecated, use SHELLPROXY_CONFIG instead"
|
||||
SHELLPROXY_CONFIG="$CONFIG_PROXY"
|
||||
unset CONFIG_PROXY
|
||||
fi
|
||||
eval '
|
||||
proxy() {
|
||||
# deprecate $DEFAULT_PROXY, use SHELLPROXY_URL instead
|
||||
if [[ -n "$DEFAULT_PROXY" && -z "$SHELLPROXY_URL" ]]; then
|
||||
echo >&2 "proxy: DEFAULT_PROXY is deprecated, use SHELLPROXY_URL instead"
|
||||
SHELLPROXY_URL="$DEFAULT_PROXY"
|
||||
unset DEFAULT_PROXY
|
||||
fi
|
||||
|
||||
# the proxy.py script is in the same directory as this function
|
||||
local proxy="${functions_source[$0]:A:h}/proxy.py"
|
||||
# deprecate CONFIG_PROXY, use SHELLPROXY_CONFIG instead
|
||||
if [[ -n "$CONFIG_PROXY" && -z "$SHELLPROXY_CONFIG" ]]; then
|
||||
echo >&2 "proxy: CONFIG_PROXY is deprecated, use SHELLPROXY_CONFIG instead"
|
||||
SHELLPROXY_CONFIG="$CONFIG_PROXY"
|
||||
unset CONFIG_PROXY
|
||||
fi
|
||||
|
||||
# capture the output of the proxy script and bail out if it fails
|
||||
local output
|
||||
output="$(SHELLPROXY_URL="$SHELLPROXY_URL" SHELLPROXY_CONFIG="$SHELLPROXY_CONFIG" "$proxy" "$1")" ||
|
||||
return $?
|
||||
# the proxy.py script is in the same directory as this function
|
||||
local proxy="'"${0:h}"'/proxy.py"
|
||||
|
||||
# evaluate the output generated by the proxy script
|
||||
source <(echo "$output")
|
||||
}
|
||||
# capture the output of the proxy script and bail out if it fails
|
||||
local output
|
||||
output="$(SHELLPROXY_URL="$SHELLPROXY_URL" SHELLPROXY_CONFIG="$SHELLPROXY_CONFIG" "$proxy" "$1")" ||
|
||||
return $?
|
||||
|
||||
# evaluate the output generated by the proxy script
|
||||
source <(echo "$output")
|
||||
}
|
||||
'
|
||||
|
||||
_proxy() {
|
||||
local -r commands=('enable' 'disable' 'status')
|
||||
|
@ -72,6 +72,9 @@ function _add_identities() {
|
||||
local args
|
||||
zstyle -a :omz:plugins:ssh-agent ssh-add-args args
|
||||
|
||||
# if ssh-agent quiet mode, pass -q to ssh-add
|
||||
zstyle -t :omz:plugins:ssh-agent quiet && args=(-q $args)
|
||||
|
||||
# use user specified helper to ask for password (ksshaskpass, etc)
|
||||
local helper
|
||||
zstyle -s :omz:plugins:ssh-agent helper helper
|
||||
|
@ -301,7 +301,7 @@ _swift_package_init() {
|
||||
_swift_package_unedit() {
|
||||
arguments=(
|
||||
":The name of the package to unedit:_swift_dependency"
|
||||
"--force[Unedit the package even if it has uncommited and unpushed changes.]"
|
||||
"--force[Unedit the package even if it has uncommitted and unpushed changes.]"
|
||||
)
|
||||
_arguments $arguments && return
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ plugins=(... systemadmin)
|
||||
| accessip10 | List the top 10 accesses to the ip address in the nginx/access.log file or another log file if specified |
|
||||
| visitpage20 | List the top 20 most visited files or pages in the nginx/access.log file or another log file if specified |
|
||||
| consume100 | List the 100 most time-consuming Page lists (more than 60 seconds) as well as the corresponding number of occurrences |
|
||||
| webtraffic | List website traffic statistics in GB from tne nginx/access.log file or another log file if specified |
|
||||
| webtraffic | List website traffic statistics in GB from the nginx/access.log file or another log file if specified |
|
||||
| c404 | List statistics on 404 connections in the nginx/access.log file or another log file if specified |
|
||||
| httpstatus | List statistics based on http status in the nginx/access.log file or another log file if specified |
|
||||
| d0 | Delete 0 byte files recursively in the current directory or another if specified |
|
||||
|
@ -47,7 +47,7 @@ __apply() {
|
||||
'-lock=[(true) Lock the state file when locking is supported.]:lock:(true false)' \
|
||||
'-lock-timeout=[(0s) Duration to retry a state lock.]' \
|
||||
'-input=[(true) Ask for input for variables if not directly set.]' \
|
||||
'-no-color[If specified, output wil be colorless.]' \
|
||||
'-no-color[If specified, output will be colorless.]' \
|
||||
'-parallelism=[(10) Limit the number of parallel resource operations.]' \
|
||||
'-refresh=[(true) Update state prior to checking for differences. This has no effect if a plan file is given to apply.]' \
|
||||
'-state=[(terraform.tfstate) Path to read and save state (unless state-out is specified).]:statefile:_files -g "*.tfstate"' \
|
||||
|
@ -17,3 +17,9 @@ You can use it by adding `$(toolbox_prompt_info)` to your `PROMPT` or `RPROMPT`
|
||||
```zsh
|
||||
RPROMPT='$(toolbox_prompt_info)'
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
|-------|----------------------|----------------------------------------|
|
||||
| tb | `toolbox enter` | Enters the toolbox environment |
|
||||
|
5
zsh/plugins/toolbox/toolbox.plugin.zsh
Normal file
5
zsh/plugins/toolbox/toolbox.plugin.zsh
Normal file
@ -0,0 +1,5 @@
|
||||
function toolbox_prompt_info() {
|
||||
[[ -f /run/.toolboxenv ]] && echo "⬢"
|
||||
}
|
||||
|
||||
alias tb="toolbox enter"
|
@ -25,9 +25,10 @@ $ google oh-my-zsh
|
||||
Available search contexts are:
|
||||
|
||||
| Context | URL |
|
||||
|-----------------------|------------------------------------------|
|
||||
| --------------------- | ---------------------------------------- |
|
||||
| `bing` | `https://www.bing.com/search?q=` |
|
||||
| `google` | `https://www.google.com/search?q=` |
|
||||
| `brs` or `brave` | `https://search.brave.com/search?q=` |
|
||||
| `yahoo` | `https://search.yahoo.com/search?p=` |
|
||||
| `ddg` or `duckduckgo` | `https://www.duckduckgo.com/?q=` |
|
||||
| `sp` or `startpage` | `https://www.startpage.com/do/search?q=` |
|
||||
|
@ -7,22 +7,23 @@ function web_search() {
|
||||
typeset -A urls
|
||||
urls=(
|
||||
$ZSH_WEB_SEARCH_ENGINES
|
||||
google "https://www.google.com/search?q="
|
||||
bing "https://www.bing.com/search?q="
|
||||
yahoo "https://search.yahoo.com/search?p="
|
||||
duckduckgo "https://www.duckduckgo.com/?q="
|
||||
startpage "https://www.startpage.com/do/search?q="
|
||||
yandex "https://yandex.ru/yandsearch?text="
|
||||
github "https://github.com/search?q="
|
||||
baidu "https://www.baidu.com/s?wd="
|
||||
ecosia "https://www.ecosia.org/search?q="
|
||||
goodreads "https://www.goodreads.com/search?q="
|
||||
qwant "https://www.qwant.com/?q="
|
||||
givero "https://www.givero.com/search?q="
|
||||
stackoverflow "https://stackoverflow.com/search?q="
|
||||
wolframalpha "https://www.wolframalpha.com/input/?i="
|
||||
archive "https://web.archive.org/web/*/"
|
||||
scholar "https://scholar.google.com/scholar?q="
|
||||
google "https://www.google.com/search?q="
|
||||
bing "https://www.bing.com/search?q="
|
||||
brave "https://search.brave.com/search?q="
|
||||
yahoo "https://search.yahoo.com/search?p="
|
||||
duckduckgo "https://www.duckduckgo.com/?q="
|
||||
startpage "https://www.startpage.com/do/search?q="
|
||||
yandex "https://yandex.ru/yandsearch?text="
|
||||
github "https://github.com/search?q="
|
||||
baidu "https://www.baidu.com/s?wd="
|
||||
ecosia "https://www.ecosia.org/search?q="
|
||||
goodreads "https://www.goodreads.com/search?q="
|
||||
qwant "https://www.qwant.com/?q="
|
||||
givero "https://www.givero.com/search?q="
|
||||
stackoverflow "https://stackoverflow.com/search?q="
|
||||
wolframalpha "https://www.wolframalpha.com/input/?i="
|
||||
archive "https://web.archive.org/web/*/"
|
||||
scholar "https://scholar.google.com/scholar?q="
|
||||
)
|
||||
|
||||
# check whether the search engine is supported
|
||||
@ -47,6 +48,7 @@ function web_search() {
|
||||
|
||||
|
||||
alias bing='web_search bing'
|
||||
alias brs='web_search brave'
|
||||
alias google='web_search google'
|
||||
alias yahoo='web_search yahoo'
|
||||
alias ddg='web_search duckduckgo'
|
||||
|
21
zsh/plugins/z/LICENSE
Normal file
21
zsh/plugins/z/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018-2022 Alexandros Kozak
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
343
zsh/plugins/z/MANUAL.md
Normal file
343
zsh/plugins/z/MANUAL.md
Normal file
@ -0,0 +1,343 @@
|
||||
# Zsh-z
|
||||
|
||||
Zsh-z is a command line tool that allows you to jump quickly to directories that you have visited frequently in the past, or recently -- but most often a combination of the two (a concept known as ["frecency"](https://en.wikipedia.org/wiki/Frecency)). It works by keeping track of when you go to directories and how much time you spend in them. It is then in the position to guess where you want to go when you type a partial string, e.g., `z src` might take you to `~/src/zsh`. `z zsh` might also get you there, and `z c/z` might prove to be even more specific -- it all depends on your habits and how much time you have been using Zsh-z to build up a database. After using Zsh-z for a little while, you will get to where you want to be by typing considerably less than you would need if you were using `cd`.
|
||||
|
||||
Zsh-z is a native Zsh port of [rupa/z](https://github.com/rupa/z), a tool written for `bash` and Zsh that uses embedded `awk` scripts to do the heavy lifting. It was quite possibly my most used command line tool for a couple of years. I decided to translate it, `awk` parts and all, into pure Zsh script, to see if by eliminating calls to external tools (`awk`, `sort`, `date`, `sed`, `mv`, `rm`, and `chown`) and reducing forking through subshells I could make it faster. The performance increase is impressive, particularly on systems where forking is slow, such as Cygwin, MSYS2, and WSL. I have found that, in those environments, switching directories using Zsh-z can be over 100% faster than it is using `rupa/z`.
|
||||
|
||||
There is a noteworthy stability increase as well. Race conditions have always been a problem with `rupa/z`, and users of that utility will occasionally lose their `.z` databases. By having Zsh-z only use Zsh (`rupa/z` uses a hybrid shell code that works on `bash` as well), I have been able to implement a `zsh/system`-based file-locking mechanism similar to [the one @mafredri once proposed for `rupa/z`](https://github.com/rupa/z/pull/199). It is now nearly impossible to crash the database, even through extreme testing.
|
||||
|
||||
There are other, smaller improvements which I try to document in [Improvements and Fixes](#improvements-and-fixes). These include the new default behavior of sorting your tab completions by frecency rather than just letting Zsh sort the raw results alphabetically (a behavior which can be restored if you like it -- [see below](#settings)).
|
||||
|
||||
Zsh-z is a drop-in replacement for `rupa/z` and will, by default, use the same database (`~/.z`), so you can go on using `rupa/z` when you launch `bash`.
|
||||
|
||||
## Table of Contents
|
||||
- [News](#news)
|
||||
- [Installation](#installation)
|
||||
- [Command Line Options](#command-line-options)
|
||||
- [Settings](#settings)
|
||||
- [Case Sensitivity](#case-sensitivity)
|
||||
- [`ZSHZ_UNCOMMON`](#zshz_uncommon)
|
||||
- [Making `--add` work for you](#making---add-work-for-you)
|
||||
- [Other Improvements and Fixes](#other-improvements-and-fixes)
|
||||
- [Migrating from Other Tools](#migrating-from-other-tools)
|
||||
- [`COMPLETE_ALIASES`](#complete_aliases)
|
||||
- [Known Bugs](#known-bugs)
|
||||
|
||||
## News
|
||||
|
||||
<details>
|
||||
<summary>Here are the latest features and updates.</summary>
|
||||
|
||||
- June 29, 2022
|
||||
+ Zsh-z is less likely to leave temporary files sitting around (props @mafredri).
|
||||
- June 27, 2022
|
||||
+ A bug was fixed which was preventing paths with spaces in them from being updated ([#61](https://github.com/agkozak/zsh-z/issues/61)).
|
||||
+ If writing to the temporary database file fails, the database will not be clobbered (props @mafredri).
|
||||
- December 19, 2021
|
||||
+ ZSH-z will now display tildes for `HOME` during completion when `ZSHZ_TILDE=1` has been set.
|
||||
- November 11, 2021
|
||||
+ A bug was fixed which was preventing ranks from being incremented.
|
||||
+ `--add` has been made to work with relative paths and has been documented for the user.
|
||||
- October 14, 2021
|
||||
+ Completions were being sorted alphabetically, rather than by rank; this error has been fixed.
|
||||
- September 25, 2021
|
||||
+ Orthographical change: "Zsh," not "ZSH."
|
||||
- September 23, 2021
|
||||
+ `z -xR` will now remove a directory *and its subdirectories* from the database.
|
||||
+ `z -x` and `z -xR` can now take an argument; without one, `PWD` is assumed.
|
||||
- September 7, 2021
|
||||
+ Fixed the unload function so that it removes the `$ZSHZ_CMD` alias (default: `z`).
|
||||
- August 27, 2021
|
||||
+ Using `print -v ... -f` instead of `print -v` to work around longstanding bug in Zsh involving `print -v` and multibyte strings.
|
||||
- August 13, 2021
|
||||
+ Fixed the explanation string printed during completion so that it may be formatted with `zstyle`.
|
||||
+ Zsh-z now declares `ZSHZ_EXCLUDE_DIRS` as an array with unique elements so that you do not have to.
|
||||
- July 29, 2021
|
||||
+ Temporarily disabling use of `print -v`, which seems to be mangling CJK multibyte strings.
|
||||
- July 27, 2021
|
||||
+ Internal escaping of path names now works with older versions of ZSH.
|
||||
+ Zsh-z now detects and discards any incomplete or incorrectly formattted database entries.
|
||||
- July 10, 2021
|
||||
+ Setting `ZSHZ_TRAILING_SLASH=1` makes it so that a search pattern ending in `/` can match the end of a path; e.g. `z foo/` can match `/path/to/foo`.
|
||||
- June 25, 2021
|
||||
+ Setting `ZSHZ_TILDE=1` displays the `HOME` directory as `~`.
|
||||
- May 7, 2021
|
||||
+ Setting `ZSHZ_ECHO=1` will cause Zsh-z to display the new path when you change directories.
|
||||
+ Better escaping of path names to deal paths containing the characters ``\`()[]``.
|
||||
- February 15, 2021
|
||||
+ Ranks are displayed the way `rupa/z` now displays them, i.e. as large integers. This should help Zsh-z to integrate with other tools.
|
||||
- January 31, 2021
|
||||
+ Zsh-z is now efficient enough that, on MSYS2 and Cygwin, it is faster to run it in the foreground than it is to fork a subshell for it.
|
||||
+ `_zshz_precmd` simply returns if `PWD` is `HOME` or in `ZSH_EXCLUDE_DIRS`, rather than waiting for `zshz` to do that.
|
||||
- January 17, 2021
|
||||
+ Made sure that the `PUSHD_IGNORE_DUPS` option is respected.
|
||||
- January 14, 2021
|
||||
+ The `z -h` help text now breaks at spaces.
|
||||
+ `z -l` was not working for Zsh version < 5.
|
||||
- January 11, 2021
|
||||
+ Major refactoring of the code.
|
||||
+ `z -lr` and `z -lt` work as expected.
|
||||
+ `EXTENDED_GLOB` has been disabled within the plugin to accomodate old-fashioned Windows directories with names such as `Progra~1`.
|
||||
+ Removed `zshelldoc` documentation.
|
||||
- January 6, 2021
|
||||
+ I have corrected the frecency routine so that it matches `rupa/z`'s math, but for the present, Zsh-z will continue to display ranks as 1/10000th of what they are in `rupa/z` -- [they had to multiply theirs by 10000](https://github.com/rupa/z/commit/f1f113d9bae9effaef6b1e15853b5eeb445e0712) to work around `bash`'s inadequacies at dealing with decimal fractions.
|
||||
- January 5, 2021
|
||||
+ If you try `z foo`, and `foo` is not in the database but `${PWD}/foo` is a valid directory, Zsh-z will `cd` to it.
|
||||
- December 22, 2020
|
||||
+ `ZSHZ_CASE`: when set to `ignore`, pattern matching is case-insensitive; when set to `smart`, patterns are matched case-insensitively when they are all lowercase and case-sensitively when they have uppercase characters in them (a behavior very much like Vim's `smartcase` setting).
|
||||
+ `ZSHZ_KEEP_DIRS` is an array of directory names that should not be removed from the database, even if they are not currently available (useful when a drive is not always mounted).
|
||||
+ Symlinked datafiles were having their symlinks overwritten; this bug has been fixed.
|
||||
|
||||
</details>
|
||||
|
||||
## Installation
|
||||
|
||||
### General observations
|
||||
|
||||
This script can be installed simply by downloading it and sourcing it from your `.zshrc`:
|
||||
|
||||
source /path/to/zsh-z.plugin.zsh
|
||||
|
||||
For tab completion to work, you will want to have loaded `compinit`. The frameworks handle this themselves. If you are not using a framework, put
|
||||
|
||||
autoload -U compinit && compinit
|
||||
|
||||
in your .zshrc somewhere below where you source `zsh-z.plugin.zsh`.
|
||||
|
||||
If you add
|
||||
|
||||
zstyle ':completion:*' menu select
|
||||
|
||||
to your `.zshrc`, your completion menus will look very nice. This `zstyle` invocation should work with any of the frameworks below as well.
|
||||
|
||||
### For [antigen](https://github.com/zsh-users/antigen) users
|
||||
|
||||
Add the line
|
||||
|
||||
antigen bundle agkozak/zsh-z
|
||||
|
||||
to your `.zshrc`, somewhere above the line that says `antigen apply`.
|
||||
|
||||
### For [oh-my-zsh](http://ohmyz.sh/) users
|
||||
|
||||
Execute the following command:
|
||||
|
||||
git clone https://github.com/agkozak/zsh-z ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-z
|
||||
|
||||
and add `zsh-z` to the line of your `.zshrc` that specifies `plugins=()`, e.g., `plugins=( git zsh-z )`.
|
||||
|
||||
### For [prezto](https://github.com/sorin-ionescu/prezto) users
|
||||
|
||||
Execute the following command:
|
||||
|
||||
git clone https://github.com/agkozak/zsh-z.git ~/.zprezto-contrib/zsh-z
|
||||
|
||||
Then edit your `~/.zpreztorc` file. Make sure the line that says
|
||||
|
||||
zstyle ':prezto:load' pmodule-dirs $HOME/.zprezto-contrib
|
||||
|
||||
is uncommented. Then find the section that specifies which modules are to be loaded; it should look something like this:
|
||||
|
||||
zstyle ':prezto:load' pmodule \
|
||||
'environment' \
|
||||
'terminal' \
|
||||
'editor' \
|
||||
'history' \
|
||||
'directory' \
|
||||
'spectrum' \
|
||||
'utility' \
|
||||
'completion' \
|
||||
'prompt'
|
||||
|
||||
Add a backslash to the end of the last line add `'zsh-z'` to the list, e.g.,
|
||||
|
||||
zstyle ':prezto:load' pmodule \
|
||||
'environment' \
|
||||
'terminal' \
|
||||
'editor' \
|
||||
'history' \
|
||||
'directory' \
|
||||
'spectrum' \
|
||||
'utility' \
|
||||
'completion' \
|
||||
'prompt' \
|
||||
'zsh-z'
|
||||
|
||||
Then relaunch `zsh`.
|
||||
|
||||
### For [zcomet](https://github.com/agkozak/zcomet) users
|
||||
|
||||
Simply add
|
||||
|
||||
zcomet load agkozak/zsh-z
|
||||
|
||||
to your `.zshrc` (below where you source `zcomet.zsh` and above where you run `zcomet compinit`).
|
||||
|
||||
### For [zgen](https://github.com/tarjoilija/zgen) users
|
||||
|
||||
Add the line
|
||||
|
||||
zgen load agkozak/zsh-z
|
||||
|
||||
somewhere above the line that says `zgen save`. Then run
|
||||
|
||||
zgen reset
|
||||
zsh
|
||||
|
||||
to refresh your init script.
|
||||
|
||||
### For [Zim](https://github.com/zimfw/zimfw)
|
||||
|
||||
Add the following line to your `.zimrc`:
|
||||
|
||||
zmodule https://github.com/agkozak/zsh-z
|
||||
|
||||
Then run
|
||||
|
||||
zimfw install
|
||||
|
||||
and restart your shell.
|
||||
|
||||
### For [Zinit](https://github.com/zdharma-continuum/zinit) users
|
||||
|
||||
Add the line
|
||||
|
||||
zinit load agkozak/zsh-z
|
||||
|
||||
to your `.zshrc`.
|
||||
|
||||
`zsh-z` supports `zinit`'s `unload` feature; just run `zinit unload agkozak/zshz` to restore the shell to its state before `zsh-z` was loaded.
|
||||
|
||||
### For [Znap](https://github.com/marlonrichert/zsh-snap) users
|
||||
|
||||
Add the line
|
||||
|
||||
znap source agkozak/zsh-z
|
||||
|
||||
somewhere below the line where you `source` Znap itself.
|
||||
|
||||
### For [zplug](https://github.com/zplug/zplug) users
|
||||
|
||||
Add the line
|
||||
|
||||
zplug "agkozak/zsh-z"
|
||||
|
||||
somewhere above the line that says `zplug load`. Then run
|
||||
|
||||
zplug install
|
||||
zplug load
|
||||
|
||||
to install `zsh-z`.
|
||||
|
||||
## Command Line Options
|
||||
|
||||
- `--add` Add a directory to the database
|
||||
- `-c` Only match subdirectories of the current directory
|
||||
- `-e` Echo the best match without going to it
|
||||
- `-h` Display help
|
||||
- `-l` List all matches without going to them
|
||||
- `-r` Match by rank (i.e. how much time you spend in directories)
|
||||
- `-t` Time -- match by how recently you have been to directories
|
||||
- `-x` Remove a directory (by default, the current directory) from the database
|
||||
- `-xR` Remove a directory (by default, the current directory) and its subdirectories from the database
|
||||
|
||||
# Settings
|
||||
|
||||
Zsh-z has environment variables (they all begin with `ZSHZ_`) that change its behavior if you set them; you can also keep your old ones if you have been using `rupa/z` (they begin with `_Z_`).
|
||||
|
||||
* `ZSHZ_CMD` changes the command name (default: `z`)
|
||||
* `ZSHZ_COMPLETION` can be `'frecent'` (default) or `'legacy'`, depending on whether you want your completion results sorted according to frecency or simply sorted alphabetically
|
||||
* `ZSHZ_DATA` changes the database file (default: `~/.z`)
|
||||
* `ZSHZ_ECHO` displays the new path name when changing directories (default: `0`)
|
||||
* `ZSHZ_EXCLUDE_DIRS` is an array of directories to keep out of the database (default: empty)
|
||||
* `ZSHZ_KEEP_DIRS` is an array of directories that should not be removed from the database, even if they are not currently available (useful when a drive is not always mounted) (default: empty)
|
||||
* `ZSHZ_MAX_SCORE` is the maximum combined score the database entries can have before they begin to age and potentially drop out of the database (default: 9000)
|
||||
* `ZSHZ_NO_RESOLVE_SYMLINKS` prevents symlink resolution (default: `0`)
|
||||
* `ZSHZ_OWNER` allows usage when in `sudo -s` mode (default: empty)
|
||||
* `ZSHZ_TILDE` displays the name of the `HOME` directory as a `~` (default: `0`)
|
||||
* `ZSHZ_TRAILING_SLASH` makes it so that a search pattern ending in `/` can match the final element in a path; e.g., `z foo/` can match `/path/to/foo` (default: `0`)
|
||||
* `ZSHZ_UNCOMMON` changes the logic used to calculate the directory jumped to; [see below](#zshz_uncommon`) (default: `0`)
|
||||
|
||||
## Case sensitivity
|
||||
|
||||
The default behavior of Zsh-z is to try to find a case-sensitive match. If there is none, then Zsh-z tries to find a case-insensitive match.
|
||||
|
||||
Some users prefer simple case-insensitivity; this behavior can be enabled by setting
|
||||
|
||||
ZSHZ_CASE=ignore
|
||||
|
||||
If you like Vim's `smartcase` setting, where lowercase patterns are case-insensitive while patterns with any uppercase characters are treated case-sensitively, try setting
|
||||
|
||||
ZSHZ_CASE=smart
|
||||
|
||||
## `ZSHZ_UNCOMMON`
|
||||
|
||||
A common complaint about the default behavior of `rupa/z` and Zsh-z involves "common prefixes." If you type `z code` and the best matches, in increasing order, are
|
||||
|
||||
/home/me/code/foo
|
||||
/home/me/code/bar
|
||||
/home/me/code/bat
|
||||
|
||||
Zsh-z will see that all possible matches share a common prefix and will send you to that directory -- `/home/me/code` -- which is often a desirable result. But if the possible matches are
|
||||
|
||||
/home/me/.vscode/foo
|
||||
/home/me/code/foo
|
||||
/home/me/code/bar
|
||||
/home/me/code/bat
|
||||
|
||||
then there is no common prefix. In this case, `z code` will simply send you to the highest-ranking match, `/home/me/code/bat`.
|
||||
|
||||
You may enable an alternate, experimental behavior by setting `ZSHZ_UNCOMMON=1`. If you do that, Zsh-z will not jump to a common prefix, even if one exists. Instead, it chooses the highest-ranking match -- but it drops any subdirectories that do not include the search term. So if you type `z bat` and `/home/me/code/bat` is the best match, that is exactly where you will end up. If, however, you had typed `z code` and the best match was also `/home/me/code/bat`, you would have ended up in `/home/me/code` (because `code` was what you had searched for). This feature is still in development, and feedback is welcome.
|
||||
|
||||
## Making `--add` Work for You
|
||||
|
||||
Zsh-z internally uses the `--add` option to add paths to its database. @zachriggle pointed out to me that users might want to use `--add` themselves, so I have altered it a little to make it more user-friendly.
|
||||
|
||||
A good example might involve a directory tree that has Git repositories within it. The working directories could be added to the Zsh-z database as a batch with
|
||||
|
||||
for i in $(find $PWD -maxdepth 3 -name .git -type d); do
|
||||
z --add ${i:h}
|
||||
done
|
||||
|
||||
(As a Zsh user, I tend to use `**` instead of `find`, but it is good to see how deep your directory trees go before doing that.)
|
||||
|
||||
|
||||
## Other Improvements and Fixes
|
||||
|
||||
* `z -x` works, with the help of `chpwd_functions`.
|
||||
* Zsh-z works on Solaris.
|
||||
* Zsh-z uses the "new" `zshcompsys` completion system instead of the old `compctl` one.
|
||||
* There is no error message when the database file has not yet been created.
|
||||
* There is support for special characters (e.g., `[`) in directory names.
|
||||
* If `z -l` only returns one match, a common root is not printed.
|
||||
* Exit status codes increasingly make sense.
|
||||
* Completions work with options `-c`, `-r`, and `-t`.
|
||||
* If `~/foo` and `~/foob` are matches, `~/foo` is *not* the common root. Only a common parent directory can be a common root.
|
||||
* `z -x` and the new, recursive `z -xR` can take an argument so that you can remove directories other than `PWD` from the database.
|
||||
|
||||
## Migrating from Other Tools
|
||||
|
||||
Zsh-z's database format is identical to that of `rupa/z`. You may switch freely between the two tools (I still use `rupa/z` for `bash`). `fasd` also uses that database format, but it stores it by default in `~/.fasd`, so you will have to `cp ~/.fasd ~/.z` if you want to use your old directory history.
|
||||
|
||||
If you are coming to Zsh-z (or even to the original `rupa/z`, for that matter) from `autojump`, try using my [`jumpstart-z`](https://github.com/agkozak/jumpstart-z/blob/master/jumpstart-z) tool to convert your old database to the Zsh-z format, or simply run
|
||||
|
||||
awk -F "\t" '{printf("%s|%0.f|%s\n", $2, $1, '"$(date +%s)"')}' < /path/to/autojump.txt > ~/.z
|
||||
|
||||
## `COMPLETE_ALIASES`
|
||||
|
||||
`z`, or any alternative you set up using `$ZSH_CMD` or `$_Z_CMD`, is an alias. `setopt COMPLETE_ALIASES` divorces the tab completion for aliases from the underlying commands they invoke, so if you enable `COMPLETE_ALIASES`, tab completion for Zsh-z will be broken. You can get it working again, however, by adding under
|
||||
|
||||
setopt COMPLETE_ALIASES
|
||||
|
||||
the line
|
||||
|
||||
compdef _zshz ${ZSHZ_CMD:-${_Z_CMD:-z}}
|
||||
|
||||
That will re-bind `z` or the command of your choice to the underlying Zsh-z function.
|
||||
|
||||
## Known Bugs
|
||||
It is possible to run a completion on a string with spaces in it, e.g., `z us bi<TAB>` might take you to `/usr/local/bin`. This works, but as things stand, after the completion the command line reads
|
||||
|
||||
z us /usr/local/bin.
|
||||
|
||||
You get where you want to go, but the detritus on the command line is annoying. This is also a problem in `rupa/z`, but I am keen on eventually eliminating this glitch. Advice is welcome.
|
@ -1,8 +1,9 @@
|
||||
# z - jump around
|
||||
|
||||
This plugin defines the [z command](https://github.com/rupa/z) that tracks your most visited directories and allows you to access them with very few keystrokes.
|
||||
This plugin defines the [z command](https://github.com/agkozak/zsh-z) that tracks your most visited directories and allows you to access them with very few keystrokes.
|
||||
|
||||
### Example
|
||||
|
||||
Assume that you have previously visited directory `~/.oh-my-zsh/plugins`. From any folder in your command line, you can quickly access it by using a regex match to this folder:
|
||||
|
||||
```bash
|
||||
@ -11,6 +12,7 @@ Assume that you have previously visited directory `~/.oh-my-zsh/plugins`. From a
|
||||
```
|
||||
|
||||
### Setup
|
||||
|
||||
To enable z, add `z` to your `plugins` array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
@ -19,5 +21,4 @@ plugins=(... z)
|
||||
|
||||
### Further reading
|
||||
|
||||
For advanced usage and details of z, see [README](./README) (in man page format, copied from [rupa/z](https://github.com/rupa/z)).
|
||||
|
||||
For advanced usage and details of z, see [MANUAL](./MANUAL.md) (copied from [agkozak/zsh-z](https://github.com/agkozak/zsh-z)).
|
||||
|
82
zsh/plugins/z/_z
Normal file
82
zsh/plugins/z/_z
Normal file
@ -0,0 +1,82 @@
|
||||
#compdef zshz ${ZSHZ_CMD:-${_Z_CMD:-z}}
|
||||
#
|
||||
# Zsh-z - jump around with Zsh - A native Zsh version of z without awk, sort,
|
||||
# date, or sed
|
||||
#
|
||||
# https://github.com/agkozak/zsh-z
|
||||
#
|
||||
# Copyright (c) 2018-2022 Alexandros Kozak
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
# z (https://github.com/rupa/z) is copyright (c) 2009 rupa deadwyler and
|
||||
# licensed under the WTFPL license, Version 2.a
|
||||
#
|
||||
# shellcheck shell=ksh
|
||||
|
||||
############################################################
|
||||
# Zsh-z COMPLETIONS
|
||||
############################################################
|
||||
emulate -L zsh
|
||||
(( ZSHZ_DEBUG )) &&
|
||||
setopt LOCAL_OPTIONS WARN_CREATE_GLOBAL NO_WARN_NESTED_VAR 2> /dev/null
|
||||
|
||||
# TODO: This routine currently reproduces z's feature of allowing spaces to be
|
||||
# used as wildcards in completions, so that
|
||||
#
|
||||
# z us lo bi
|
||||
#
|
||||
# can expand to
|
||||
#
|
||||
# z /usr/local/bin
|
||||
#
|
||||
# but it also reproduces z's buggy display on the commandline, viz.
|
||||
#
|
||||
# z us lo /usr/local/bin
|
||||
#
|
||||
# Address.
|
||||
|
||||
local completions expl completion
|
||||
local -a completion_list
|
||||
|
||||
completions=$(zshz --complete ${(@)words:1})
|
||||
[[ -z $completions ]] && return 1
|
||||
|
||||
for completion in ${(f)completions[@]}; do
|
||||
if (( ZSHZ_TILDE )) && [[ $completion == ${HOME}* ]]; then
|
||||
completion="~${(q)${completion#${HOME}}}"
|
||||
else
|
||||
completion="${(q)completion}"
|
||||
fi
|
||||
completion_list+=( $completion )
|
||||
done
|
||||
|
||||
_description -V completion_list expl 'directories'
|
||||
|
||||
if [[ $ZSHZ_COMPLETION == 'legacy' ]]; then
|
||||
compadd "${expl[@]}" -QU -- "${completion_list[@]}"
|
||||
else
|
||||
compadd "${expl[@]}" -QU -V zsh-z -- "${completion_list[@]}"
|
||||
fi
|
||||
|
||||
compstate[insert]=menu
|
||||
|
||||
return 0
|
||||
|
||||
# vim: ft=zsh:fdm=indent:ts=2:et:sts=2:sw=2:
|
@ -1,6 +1,968 @@
|
||||
# Handle $0 according to the standard:
|
||||
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
|
||||
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
|
||||
0="${${(M)0:#/*}:-$PWD/$0}"
|
||||
################################################################################
|
||||
# Zsh-z - jump around with Zsh - A native Zsh version of z without awk, sort,
|
||||
# date, or sed
|
||||
#
|
||||
# https://github.com/agkozak/zsh-z
|
||||
#
|
||||
# Copyright (c) 2018-2022 Alexandros Kozak
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
# z (https://github.com/rupa/z) is copyright (c) 2009 rupa deadwyler and
|
||||
# licensed under the WTFPL license, Version 2.
|
||||
#
|
||||
# Zsh-z maintains a jump-list of the directories you actually use.
|
||||
#
|
||||
# INSTALL:
|
||||
# * put something like this in your .zshrc:
|
||||
# source /path/to/zsh-z.plugin.zsh
|
||||
# * cd around for a while to build up the database
|
||||
#
|
||||
# USAGE:
|
||||
# * z foo cd to the most frecent directory matching foo
|
||||
# * z foo bar cd to the most frecent directory matching both foo and bar
|
||||
# (e.g. /foo/bat/bar/quux)
|
||||
# * z -r foo cd to the highest ranked directory matching foo
|
||||
# * z -t foo cd to most recently accessed directory matching foo
|
||||
# * z -l foo List matches instead of changing directories
|
||||
# * z -e foo Echo the best match without changing directories
|
||||
# * z -c foo Restrict matches to subdirectories of PWD
|
||||
# * z -x Remove a directory (default: PWD) from the database
|
||||
# * z -xR Remove a directory (default: PWD) and its subdirectories from
|
||||
# the database
|
||||
#
|
||||
# ENVIRONMENT VARIABLES:
|
||||
#
|
||||
# ZSHZ_CASE -> if `ignore', pattern matching is case-insensitive; if `smart',
|
||||
# pattern matching is case-insensitive only when the pattern is all
|
||||
# lowercase
|
||||
# ZSHZ_CMD -> name of command (default: z)
|
||||
# ZSHZ_COMPLETION -> completion method (default: 'frecent'; 'legacy' for
|
||||
# alphabetic sorting)
|
||||
# ZSHZ_DATA -> name of datafile (default: ~/.z)
|
||||
# ZSHZ_EXCLUDE_DIRS -> array of directories to exclude from your database
|
||||
# (default: empty)
|
||||
# ZSHZ_KEEP_DIRS -> array of directories that should not be removed from the
|
||||
# database, even if they are not currently available (default: empty)
|
||||
# ZSHZ_MAX_SCORE -> maximum combined score the database entries can have
|
||||
# before beginning to age (default: 9000)
|
||||
# ZSHZ_NO_RESOLVE_SYMLINKS -> '1' prevents symlink resolution
|
||||
# ZSHZ_OWNER -> your username (if you want use Zsh-z while using sudo -s)
|
||||
# ZSHZ_UNCOMMON -> if 1, do not jump to "common directories," but rather drop
|
||||
# subdirectories based on what the search string was (default: 0)
|
||||
################################################################################
|
||||
|
||||
source "${0:h}/z.sh"
|
||||
autoload -U is-at-least
|
||||
|
||||
if ! is-at-least 4.3.11; then
|
||||
print "Zsh-z requires Zsh v4.3.11 or higher." >&2 && exit
|
||||
fi
|
||||
|
||||
############################################################
|
||||
# The help message
|
||||
#
|
||||
# Globals:
|
||||
# ZSHZ_CMD
|
||||
############################################################
|
||||
_zshz_usage() {
|
||||
print "Usage: ${ZSHZ_CMD:-${_Z_CMD:-z}} [OPTION]... [ARGUMENT]
|
||||
Jump to a directory that you have visited frequently or recently, or a bit of both, based on the partial string ARGUMENT.
|
||||
|
||||
With no ARGUMENT, list the directory history in ascending rank.
|
||||
|
||||
--add Add a directory to the database
|
||||
-c Only match subdirectories of the current directory
|
||||
-e Echo the best match without going to it
|
||||
-h Display this help and exit
|
||||
-l List all matches without going to them
|
||||
-r Match by rank
|
||||
-t Match by recent access
|
||||
-x Remove a directory from the database (by default, the current directory)
|
||||
-xR Remove a directory and its subdirectories from the database (by default, the current directory)" |
|
||||
fold -s -w $COLUMNS >&2
|
||||
}
|
||||
|
||||
# Load zsh/datetime module, if necessary
|
||||
(( $+EPOCHSECONDS )) || zmodload zsh/datetime
|
||||
|
||||
# Load zsh/files, if necessary
|
||||
[[ ${builtins[zf_chown]} == 'defined' &&
|
||||
${builtins[zf_mv]} == 'defined' &&
|
||||
${builtins[zf_rm]} == 'defined' ]] ||
|
||||
zmodload -F zsh/files b:zf_chown b:zf_mv b:zf_rm
|
||||
|
||||
# Load zsh/system, if necessary
|
||||
[[ ${modules[zsh/system]} == 'loaded' ]] || zmodload zsh/system &> /dev/null
|
||||
|
||||
# Global associative array for internal use
|
||||
typeset -gA ZSHZ
|
||||
|
||||
# Make sure ZSHZ_EXCLUDE_DIRS has been declared so that other scripts can
|
||||
# simply append to it
|
||||
(( ${+ZSHZ_EXCLUDE_DIRS} )) || typeset -gUa ZSHZ_EXCLUDE_DIRS
|
||||
|
||||
# Determine if zsystem flock is available
|
||||
zsystem supports flock &> /dev/null && ZSHZ[USE_FLOCK]=1
|
||||
|
||||
# Determine if `print -v' is supported
|
||||
is-at-least 5.3.0 && ZSHZ[PRINTV]=1
|
||||
|
||||
############################################################
|
||||
# The Zsh-z Command
|
||||
#
|
||||
# Globals:
|
||||
# ZSHZ
|
||||
# ZSHZ_CASE
|
||||
# ZSHZ_COMPLETION
|
||||
# ZSHZ_DATA
|
||||
# ZSHZ_DEBUG
|
||||
# ZSHZ_EXCLUDE_DIRS
|
||||
# ZSHZ_KEEP_DIRS
|
||||
# ZSHZ_MAX_SCORE
|
||||
# ZSHZ_OWNER
|
||||
#
|
||||
# Arguments:
|
||||
# $* Command options and arguments
|
||||
############################################################
|
||||
zshz() {
|
||||
|
||||
# Don't use `emulate -L zsh' - it breaks PUSHD_IGNORE_DUPS
|
||||
setopt LOCAL_OPTIONS NO_KSH_ARRAYS NO_SH_WORD_SPLIT EXTENDED_GLOB
|
||||
(( ZSHZ_DEBUG )) && setopt LOCAL_OPTIONS WARN_CREATE_GLOBAL
|
||||
|
||||
local REPLY
|
||||
local -a lines
|
||||
|
||||
# Allow the user to specify the datafile name in $ZSHZ_DATA (default: ~/.z)
|
||||
# If the datafile is a symlink, it gets dereferenced
|
||||
local datafile=${${ZSHZ_DATA:-${_Z_DATA:-${HOME}/.z}}:A}
|
||||
|
||||
# If the datafile is a directory, print a warning and exit
|
||||
if [[ -d $datafile ]]; then
|
||||
print "ERROR: Zsh-z's datafile (${datafile}) is a directory." >&2
|
||||
exit
|
||||
fi
|
||||
|
||||
# Make sure that the datafile exists before attempting to read it or lock it
|
||||
# for writing
|
||||
[[ -f $datafile ]] || touch "$datafile"
|
||||
|
||||
# Bail if we don't own the datafile and $ZSHZ_OWNER is not set
|
||||
[[ -z ${ZSHZ_OWNER:-${_Z_OWNER}} && -f $datafile && ! -O $datafile ]] &&
|
||||
return
|
||||
|
||||
# Load the datafile into an array and parse it
|
||||
lines=( ${(f)"$(< $datafile)"} )
|
||||
# Discard entries that are incomplete or incorrectly formatted
|
||||
lines=( ${(M)lines:#/*\|[[:digit:]]##[.,]#[[:digit:]]#\|[[:digit:]]##} )
|
||||
|
||||
############################################################
|
||||
# Add a path to or remove one from the datafile
|
||||
#
|
||||
# Globals:
|
||||
# ZSHZ
|
||||
# ZSHZ_EXCLUDE_DIRS
|
||||
# ZSHZ_OWNER
|
||||
#
|
||||
# Arguments:
|
||||
# $1 Which action to perform (--add/--remove)
|
||||
# $2 The path to add
|
||||
############################################################
|
||||
_zshz_add_or_remove_path() {
|
||||
local action=${1}
|
||||
shift
|
||||
|
||||
if [[ $action == '--add' ]]; then
|
||||
|
||||
# TODO: The following tasks are now handled by _agkozak_precmd. Dead code?
|
||||
|
||||
# Don't add $HOME
|
||||
[[ $* == $HOME ]] && return
|
||||
|
||||
# Don't track directory trees excluded in ZSHZ_EXCLUDE_DIRS
|
||||
local exclude
|
||||
for exclude in ${(@)ZSHZ_EXCLUDE_DIRS:-${(@)_Z_EXCLUDE_DIRS}}; do
|
||||
case $* in
|
||||
${exclude}|${exclude}/*) return ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
# A temporary file that gets copied over the datafile if all goes well
|
||||
local tempfile="${datafile}.${RANDOM}"
|
||||
|
||||
# See https://github.com/rupa/z/pull/199/commits/ed6eeed9b70d27c1582e3dd050e72ebfe246341c
|
||||
if (( ZSHZ[USE_FLOCK] )); then
|
||||
|
||||
local lockfd
|
||||
|
||||
# Grab exclusive lock (released when function exits)
|
||||
zsystem flock -f lockfd "$datafile" 2> /dev/null || return
|
||||
|
||||
fi
|
||||
|
||||
integer tmpfd
|
||||
case $action in
|
||||
--add)
|
||||
exec {tmpfd}>|"$tempfile" # Open up tempfile for writing
|
||||
_zshz_update_datafile $tmpfd "$*"
|
||||
local ret=$?
|
||||
;;
|
||||
--remove)
|
||||
local xdir # Directory to be removed
|
||||
|
||||
if (( ${ZSHZ_NO_RESOLVE_SYMLINKS:-${_Z_NO_RESOLVE_SYMLINKS}} )); then
|
||||
[[ -d ${${*:-${PWD}}:a} ]] && xdir=${${*:-${PWD}}:a}
|
||||
else
|
||||
[[ -d ${${*:-${PWD}}:A} ]] && xdir=${${*:-${PWD}}:a}
|
||||
fi
|
||||
|
||||
local -a lines_to_keep
|
||||
if (( ${+opts[-R]} )); then
|
||||
# Prompt user before deleting entire database
|
||||
if [[ $xdir == '/' ]] && ! read -q "?Delete entire Zsh-z database? "; then
|
||||
print && return 1
|
||||
fi
|
||||
# All of the lines that don't match the directory to be deleted
|
||||
lines_to_keep=( ${lines:#${xdir}\|*} )
|
||||
# Or its subdirectories
|
||||
lines_to_keep=( ${lines_to_keep:#${xdir%/}/**} )
|
||||
else
|
||||
# All of the lines that don't match the directory to be deleted
|
||||
lines_to_keep=( ${lines:#${xdir}\|*} )
|
||||
fi
|
||||
if [[ $lines != "$lines_to_keep" ]]; then
|
||||
lines=( $lines_to_keep )
|
||||
else
|
||||
return 1 # The $PWD isn't in the datafile
|
||||
fi
|
||||
exec {tmpfd}>|"$tempfile" # Open up tempfile for writing
|
||||
print -u $tmpfd -l -- $lines
|
||||
local ret=$?
|
||||
;;
|
||||
esac
|
||||
|
||||
if (( tmpfd != 0 )); then
|
||||
# Close tempfile
|
||||
exec {tmpfd}>&-
|
||||
fi
|
||||
|
||||
if (( ret != 0 )); then
|
||||
# Avoid clobbering the datafile if the write to tempfile failed
|
||||
zf_rm -f "$tempfile"
|
||||
return $ret
|
||||
fi
|
||||
|
||||
local owner
|
||||
owner=${ZSHZ_OWNER:-${_Z_OWNER}}
|
||||
|
||||
if (( ZSHZ[USE_FLOCK] )); then
|
||||
zf_mv "$tempfile" "$datafile" 2> /dev/null || zf_rm -f "$tempfile"
|
||||
|
||||
if [[ -n $owner ]]; then
|
||||
zf_chown ${owner}:"$(id -ng ${owner})" "$datafile"
|
||||
fi
|
||||
else
|
||||
if [[ -n $owner ]]; then
|
||||
zf_chown "${owner}":"$(id -ng "${owner}")" "$tempfile"
|
||||
fi
|
||||
zf_mv -f "$tempfile" "$datafile" 2> /dev/null || zf_rm -f "$tempfile"
|
||||
fi
|
||||
|
||||
# In order to make z -x work, we have to disable zsh-z's adding
|
||||
# to the database until the user changes directory and the
|
||||
# chpwd_functions are run
|
||||
if [[ $action == '--remove' ]]; then
|
||||
ZSHZ[DIRECTORY_REMOVED]=1
|
||||
fi
|
||||
}
|
||||
|
||||
############################################################
|
||||
# Read the curent datafile contents, update them, "age" them
|
||||
# when the total rank gets high enough, and print the new
|
||||
# contents to STDOUT.
|
||||
#
|
||||
# Globals:
|
||||
# ZSHZ_KEEP_DIRS
|
||||
# ZSHZ_MAX_SCORE
|
||||
#
|
||||
# Arguments:
|
||||
# $1 File descriptor linked to tempfile
|
||||
# $2 Path to be added to datafile
|
||||
############################################################
|
||||
_zshz_update_datafile() {
|
||||
|
||||
integer fd=$1
|
||||
local -A rank time
|
||||
|
||||
# Characters special to the shell (such as '[]') are quoted with backslashes
|
||||
# See https://github.com/rupa/z/issues/246
|
||||
local add_path=${(q)2}
|
||||
|
||||
local -a existing_paths
|
||||
local now=$EPOCHSECONDS line dir
|
||||
local path_field rank_field time_field count x
|
||||
|
||||
rank[$add_path]=1
|
||||
time[$add_path]=$now
|
||||
|
||||
# Remove paths from database if they no longer exist
|
||||
for line in $lines; do
|
||||
if [[ ! -d ${line%%\|*} ]]; then
|
||||
for dir in ${(@)ZSHZ_KEEP_DIRS}; do
|
||||
if [[ ${line%%\|*} == ${dir}/* ||
|
||||
${line%%\|*} == $dir ||
|
||||
$dir == '/' ]]; then
|
||||
existing_paths+=( $line )
|
||||
fi
|
||||
done
|
||||
else
|
||||
existing_paths+=( $line )
|
||||
fi
|
||||
done
|
||||
lines=( $existing_paths )
|
||||
|
||||
for line in $lines; do
|
||||
path_field=${(q)line%%\|*}
|
||||
rank_field=${${line%\|*}#*\|}
|
||||
time_field=${line##*\|}
|
||||
|
||||
# When a rank drops below 1, drop the path from the database
|
||||
(( rank_field < 1 )) && continue
|
||||
|
||||
if [[ $path_field == $add_path ]]; then
|
||||
rank[$path_field]=$rank_field
|
||||
(( rank[$path_field]++ ))
|
||||
time[$path_field]=$now
|
||||
else
|
||||
rank[$path_field]=$rank_field
|
||||
time[$path_field]=$time_field
|
||||
fi
|
||||
(( count += rank_field ))
|
||||
done
|
||||
if (( count > ${ZSHZ_MAX_SCORE:-${_Z_MAX_SCORE:-9000}} )); then
|
||||
# Aging
|
||||
for x in ${(k)rank}; do
|
||||
print -u $fd -- "$x|$(( 0.99 * rank[$x] ))|${time[$x]}" || return 1
|
||||
done
|
||||
else
|
||||
for x in ${(k)rank}; do
|
||||
print -u $fd -- "$x|${rank[$x]}|${time[$x]}" || return 1
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
############################################################
|
||||
# The original tab completion method
|
||||
#
|
||||
# String processing is smartcase -- case-insensitive if the
|
||||
# search string is lowercase, case-sensitive if there are
|
||||
# any uppercase letters. Spaces in the search string are
|
||||
# treated as *'s in globbing. Read the contents of the
|
||||
# datafile and print matches to STDOUT.
|
||||
#
|
||||
# Arguments:
|
||||
# $1 The string to be completed
|
||||
############################################################
|
||||
_zshz_legacy_complete() {
|
||||
|
||||
local line path_field path_field_normalized
|
||||
|
||||
# Replace spaces in the search string with asterisks for globbing
|
||||
1=${1//[[:space:]]/*}
|
||||
|
||||
for line in $lines; do
|
||||
|
||||
path_field=${line%%\|*}
|
||||
|
||||
path_field_normalized=$path_field
|
||||
if (( ZSHZ_TRAILING_SLASH )); then
|
||||
path_field_normalized=${path_field%/}/
|
||||
fi
|
||||
|
||||
# If the search string is all lowercase, the search will be case-insensitive
|
||||
if [[ $1 == "${1:l}" && ${path_field_normalized:l} == *${~1}* ]]; then
|
||||
print -- $path_field
|
||||
# Otherwise, case-sensitive
|
||||
elif [[ $path_field_normalized == *${~1}* ]]; then
|
||||
print -- $path_field
|
||||
fi
|
||||
|
||||
done
|
||||
# TODO: Search strings with spaces in them are currently treated case-
|
||||
# insensitively.
|
||||
}
|
||||
|
||||
############################################################
|
||||
# `print' or `printf' to REPLY
|
||||
#
|
||||
# Variable assignment through command substitution, of the
|
||||
# form
|
||||
#
|
||||
# foo=$( bar )
|
||||
#
|
||||
# requires forking a subshell; on Cygwin/MSYS2/WSL1 that can
|
||||
# be surprisingly slow. Zsh-z avoids doing that by printing
|
||||
# values to the variable REPLY. Since Zsh v5.3.0 that has
|
||||
# been possible with `print -v'; for earlier versions of the
|
||||
# shell, the values are placed on the editing buffer stack
|
||||
# and then `read' into REPLY.
|
||||
#
|
||||
# Globals:
|
||||
# ZSHZ
|
||||
#
|
||||
# Arguments:
|
||||
# Options and parameters for `print'
|
||||
############################################################
|
||||
_zshz_printv() {
|
||||
# NOTE: For a long time, ZSH's `print -v' had a tendency
|
||||
# to mangle multibyte strings:
|
||||
#
|
||||
# https://www.zsh.org/mla/workers/2020/msg00307.html
|
||||
#
|
||||
# The bug was fixed in late 2020:
|
||||
#
|
||||
# https://github.com/zsh-users/zsh/commit/b6ba74cd4eaec2b6cb515748cf1b74a19133d4a4#diff-32bbef18e126b837c87b06f11bfc61fafdaa0ed99fcb009ec53f4767e246b129
|
||||
#
|
||||
# In order to support shells with the bug, we must use a form of `printf`,
|
||||
# which does not exhibit the undesired behavior. See
|
||||
#
|
||||
# https://www.zsh.org/mla/workers/2020/msg00308.html
|
||||
|
||||
if (( ZSHZ[PRINTV] )); then
|
||||
builtin print -v REPLY -f %s $@
|
||||
else
|
||||
builtin print -z $@
|
||||
builtin read -rz REPLY
|
||||
fi
|
||||
}
|
||||
|
||||
############################################################
|
||||
# If matches share a common root, find it, and put it in
|
||||
# REPLY for _zshz_output to use.
|
||||
#
|
||||
# Arguments:
|
||||
# $1 Name of associative array of matches and ranks
|
||||
############################################################
|
||||
_zshz_find_common_root() {
|
||||
local -a common_matches
|
||||
local x short
|
||||
|
||||
common_matches=( ${(@Pk)1} )
|
||||
|
||||
for x in ${(@)common_matches}; do
|
||||
if [[ -z $short ]] || (( $#x < $#short )) || [[ $x != ${short}/* ]]; then
|
||||
short=$x
|
||||
fi
|
||||
done
|
||||
|
||||
[[ $short == '/' ]] && return
|
||||
|
||||
for x in ${(@)common_matches}; do
|
||||
[[ $x != $short* ]] && return
|
||||
done
|
||||
|
||||
_zshz_printv -- $short
|
||||
}
|
||||
|
||||
############################################################
|
||||
# Calculate a common root, if there is one. Then do one of
|
||||
# the following:
|
||||
#
|
||||
# 1) Print a list of completions in frecent order;
|
||||
# 2) List them (z -l) to STDOUT; or
|
||||
# 3) Put a common root or best match into REPLY
|
||||
#
|
||||
# Globals:
|
||||
# ZSHZ_UNCOMMON
|
||||
#
|
||||
# Arguments:
|
||||
# $1 Name of an associative array of matches and ranks
|
||||
# $2 The best match or best case-insensitive match
|
||||
# $3 Whether to produce a completion, a list, or a root or
|
||||
# match
|
||||
############################################################
|
||||
_zshz_output() {
|
||||
|
||||
local match_array=$1 match=$2 format=$3
|
||||
local common k x
|
||||
local -a descending_list output
|
||||
local -A output_matches
|
||||
|
||||
output_matches=( ${(Pkv)match_array} )
|
||||
|
||||
_zshz_find_common_root $match_array
|
||||
common=$REPLY
|
||||
|
||||
case $format in
|
||||
|
||||
completion)
|
||||
for k in ${(@k)output_matches}; do
|
||||
_zshz_printv -f "%.2f|%s" ${output_matches[$k]} $k
|
||||
descending_list+=( ${(f)REPLY} )
|
||||
REPLY=''
|
||||
done
|
||||
descending_list=( ${${(@On)descending_list}#*\|} )
|
||||
print -l $descending_list
|
||||
;;
|
||||
|
||||
list)
|
||||
local path_to_display
|
||||
for x in ${(k)output_matches}; do
|
||||
if (( ${output_matches[$x]} )); then
|
||||
path_to_display=$x
|
||||
(( ZSHZ_TILDE )) &&
|
||||
path_to_display=${path_to_display/#${HOME}/\~}
|
||||
_zshz_printv -f "%-10d %s\n" ${output_matches[$x]} $path_to_display
|
||||
output+=( ${(f)REPLY} )
|
||||
REPLY=''
|
||||
fi
|
||||
done
|
||||
if [[ -n $common ]]; then
|
||||
(( ZSHZ_TILDE )) && common=${common/#${HOME}/\~}
|
||||
(( $#output > 1 )) && printf "%-10s %s\n" 'common:' $common
|
||||
fi
|
||||
# -lt
|
||||
if (( $+opts[-t] )); then
|
||||
for x in ${(@On)output}; do
|
||||
print -- $x
|
||||
done
|
||||
# -lr
|
||||
elif (( $+opts[-r] )); then
|
||||
for x in ${(@on)output}; do
|
||||
print -- $x
|
||||
done
|
||||
# -l
|
||||
else
|
||||
for x in ${(@on)output}; do
|
||||
print $x
|
||||
done
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
if (( ! ZSHZ_UNCOMMON )) && [[ -n $common ]]; then
|
||||
_zshz_printv -- $common
|
||||
else
|
||||
_zshz_printv -- ${(P)match}
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
############################################################
|
||||
# Match a pattern by rank, time, or a combination of the
|
||||
# two, and output the results as completions, a list, or a
|
||||
# best match.
|
||||
#
|
||||
# Globals:
|
||||
# ZSHZ
|
||||
# ZSHZ_CASE
|
||||
# ZSHZ_KEEP_DIRS
|
||||
# ZSHZ_OWNER
|
||||
#
|
||||
# Arguments:
|
||||
# #1 Pattern to match
|
||||
# $2 Matching method (rank, time, or [default] frecency)
|
||||
# $3 Output format (completion, list, or [default] store
|
||||
# in REPLY
|
||||
############################################################
|
||||
_zshz_find_matches() {
|
||||
setopt LOCAL_OPTIONS NO_EXTENDED_GLOB
|
||||
|
||||
local fnd=$1 method=$2 format=$3
|
||||
|
||||
local -a existing_paths
|
||||
local line dir path_field rank_field time_field rank dx escaped_path_field
|
||||
local -A matches imatches
|
||||
local best_match ibest_match hi_rank=-9999999999 ihi_rank=-9999999999
|
||||
|
||||
# Remove paths from database if they no longer exist
|
||||
for line in $lines; do
|
||||
if [[ ! -d ${line%%\|*} ]]; then
|
||||
for dir in ${(@)ZSHZ_KEEP_DIRS}; do
|
||||
if [[ ${line%%\|*} == ${dir}/* ||
|
||||
${line%%\|*} == $dir ||
|
||||
$dir == '/' ]]; then
|
||||
existing_paths+=( $line )
|
||||
fi
|
||||
done
|
||||
else
|
||||
existing_paths+=( $line )
|
||||
fi
|
||||
done
|
||||
lines=( $existing_paths )
|
||||
|
||||
for line in $lines; do
|
||||
path_field=${line%%\|*}
|
||||
rank_field=${${line%\|*}#*\|}
|
||||
time_field=${line##*\|}
|
||||
|
||||
case $method in
|
||||
rank) rank=$rank_field ;;
|
||||
time) (( rank = time_field - EPOCHSECONDS )) ;;
|
||||
*)
|
||||
# Frecency routine
|
||||
(( dx = EPOCHSECONDS - time_field ))
|
||||
rank=$(( 10000 * rank_field * (3.75/((0.0001 * dx + 1) + 0.25)) ))
|
||||
;;
|
||||
esac
|
||||
|
||||
# Use spaces as wildcards
|
||||
local q=${fnd//[[:space:]]/\*}
|
||||
|
||||
# If $ZSHZ_TRAILING_SLASH is set, use path_field with a trailing slash for matching.
|
||||
local path_field_normalized=$path_field
|
||||
if (( ZSHZ_TRAILING_SLASH )); then
|
||||
path_field_normalized=${path_field%/}/
|
||||
fi
|
||||
|
||||
# If $ZSHZ_CASE is 'ignore', be case-insensitive.
|
||||
#
|
||||
# If it's 'smart', be case-insensitive unless the string to be matched
|
||||
# includes capital letters.
|
||||
#
|
||||
# Otherwise, the default behavior of Zsh-z is to match case-sensitively if
|
||||
# possible, then to fall back on a case-insensitive match if possible.
|
||||
if [[ $ZSHZ_CASE == 'smart' && ${1:l} == $1 &&
|
||||
${path_field_normalized:l} == ${~q:l} ]]; then
|
||||
imatches[$path_field]=$rank
|
||||
elif [[ $ZSHZ_CASE != 'ignore' && $path_field_normalized == ${~q} ]]; then
|
||||
matches[$path_field]=$rank
|
||||
elif [[ $ZSHZ_CASE != 'smart' && ${path_field_normalized:l} == ${~q:l} ]]; then
|
||||
imatches[$path_field]=$rank
|
||||
fi
|
||||
|
||||
# Escape characters that would cause "invalid subscript" errors
|
||||
# when accessing the associative array.
|
||||
escaped_path_field=${path_field//'\'/'\\'}
|
||||
escaped_path_field=${escaped_path_field//'`'/'\`'}
|
||||
escaped_path_field=${escaped_path_field//'('/'\('}
|
||||
escaped_path_field=${escaped_path_field//')'/'\)'}
|
||||
escaped_path_field=${escaped_path_field//'['/'\['}
|
||||
escaped_path_field=${escaped_path_field//']'/'\]'}
|
||||
|
||||
if (( matches[$escaped_path_field] )) &&
|
||||
(( matches[$escaped_path_field] > hi_rank )); then
|
||||
best_match=$path_field
|
||||
hi_rank=${matches[$escaped_path_field]}
|
||||
elif (( imatches[$escaped_path_field] )) &&
|
||||
(( imatches[$escaped_path_field] > ihi_rank )); then
|
||||
ibest_match=$path_field
|
||||
ihi_rank=${imatches[$escaped_path_field]}
|
||||
ZSHZ[CASE_INSENSITIVE]=1
|
||||
fi
|
||||
done
|
||||
|
||||
# Return 1 when there are no matches
|
||||
[[ -z $best_match && -z $ibest_match ]] && return 1
|
||||
|
||||
if [[ -n $best_match ]]; then
|
||||
_zshz_output matches best_match $format
|
||||
elif [[ -n $ibest_match ]]; then
|
||||
_zshz_output imatches ibest_match $format
|
||||
fi
|
||||
}
|
||||
|
||||
# THE MAIN ROUTINE
|
||||
|
||||
local -A opts
|
||||
|
||||
zparseopts -E -D -A opts -- \
|
||||
-add \
|
||||
-complete \
|
||||
c \
|
||||
e \
|
||||
h \
|
||||
-help \
|
||||
l \
|
||||
r \
|
||||
R \
|
||||
t \
|
||||
x
|
||||
|
||||
if [[ $1 == '--' ]]; then
|
||||
shift
|
||||
elif [[ -n ${(M)@:#-*} && -z $compstate ]]; then
|
||||
print "Improper option(s) given."
|
||||
_zshz_usage
|
||||
return 1
|
||||
fi
|
||||
|
||||
local opt output_format method='frecency' fnd prefix req
|
||||
|
||||
for opt in ${(k)opts}; do
|
||||
case $opt in
|
||||
--add)
|
||||
[[ ! -d $* ]] && return 1
|
||||
local dir
|
||||
# Cygwin and MSYS2 have a hard time with relative paths expressed from /
|
||||
if [[ $OSTYPE == (cygwin|msys) && $PWD == '/' && $* != /* ]]; then
|
||||
set -- "/$*"
|
||||
fi
|
||||
if (( ${ZSHZ_NO_RESOLVE_SYMLINKS:-${_Z_NO_RESOLVE_SYMLINKS}} )); then
|
||||
dir=${*:a}
|
||||
else
|
||||
dir=${*:A}
|
||||
fi
|
||||
_zshz_add_or_remove_path --add "$dir"
|
||||
return
|
||||
;;
|
||||
--complete)
|
||||
if [[ -s $datafile && ${ZSHZ_COMPLETION:-frecent} == 'legacy' ]]; then
|
||||
_zshz_legacy_complete "$1"
|
||||
return
|
||||
fi
|
||||
output_format='completion'
|
||||
;;
|
||||
-c) [[ $* == ${PWD}/* || $PWD == '/' ]] || prefix="$PWD " ;;
|
||||
-h|--help)
|
||||
_zshz_usage
|
||||
return
|
||||
;;
|
||||
-l) output_format='list' ;;
|
||||
-r) method='rank' ;;
|
||||
-t) method='time' ;;
|
||||
-x)
|
||||
# Cygwin and MSYS2 have a hard time with relative paths expressed from /
|
||||
if [[ $OSTYPE == (cygwin|msys) && $PWD == '/' && $* != /* ]]; then
|
||||
set -- "/$*"
|
||||
fi
|
||||
_zshz_add_or_remove_path --remove $*
|
||||
return
|
||||
;;
|
||||
esac
|
||||
done
|
||||
req="$*"
|
||||
fnd="$prefix$*"
|
||||
|
||||
[[ -n $fnd && $fnd != "$PWD " ]] || {
|
||||
[[ $output_format != 'completion' ]] && output_format='list'
|
||||
}
|
||||
|
||||
#########################################################
|
||||
# If $ZSHZ_ECHO == 1, display paths as you jump to them.
|
||||
# If it is also the case that $ZSHZ_TILDE == 1, display
|
||||
# the home directory as a tilde.
|
||||
#########################################################
|
||||
_zshz_echo() {
|
||||
if (( ZSHZ_ECHO )); then
|
||||
if (( ZSHZ_TILDE )); then
|
||||
print ${PWD/#${HOME}/\~}
|
||||
else
|
||||
print $PWD
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ ${@: -1} == /* ]] && (( ! $+opts[-e] && ! $+opts[-l] )); then
|
||||
# cd if possible; echo the new path if $ZSHZ_ECHO == 1
|
||||
[[ -d ${@: -1} ]] && builtin cd ${@: -1} && _zshz_echo && return
|
||||
fi
|
||||
|
||||
# With option -c, make sure query string matches beginning of matches;
|
||||
# otherwise look for matches anywhere in paths
|
||||
|
||||
# zpm-zsh/colors has a global $c, so we'll avoid math expressions here
|
||||
if [[ ! -z ${(tP)opts[-c]} ]]; then
|
||||
_zshz_find_matches "$fnd*" $method $output_format
|
||||
else
|
||||
_zshz_find_matches "*$fnd*" $method $output_format
|
||||
fi
|
||||
|
||||
local ret2=$?
|
||||
|
||||
local cd
|
||||
cd=$REPLY
|
||||
|
||||
# New experimental "uncommon" behavior
|
||||
#
|
||||
# If the best choice at this point is something like /foo/bar/foo/bar, and the # search pattern is `bar', go to /foo/bar/foo/bar; but if the search pattern
|
||||
# is `foo', go to /foo/bar/foo
|
||||
if (( ZSHZ_UNCOMMON )) && [[ -n $cd ]]; then
|
||||
if [[ -n $cd ]]; then
|
||||
|
||||
# In the search pattern, replace spaces with *
|
||||
local q=${fnd//[[:space:]]/\*}
|
||||
q=${q%/} # Trailing slash has to be removed
|
||||
|
||||
# As long as the best match is not case-insensitive
|
||||
if (( ! ZSHZ[CASE_INSENSITIVE] )); then
|
||||
# Count the number of characters in $cd that $q matches
|
||||
local q_chars=$(( ${#cd} - ${#${cd//${~q}/}} ))
|
||||
# Try dropping directory elements from the right; stop when it affects
|
||||
# how many times the search pattern appears
|
||||
until (( ( ${#cd:h} - ${#${${cd:h}//${~q}/}} ) != q_chars )); do
|
||||
cd=${cd:h}
|
||||
done
|
||||
|
||||
# If the best match is case-insensitive
|
||||
else
|
||||
local q_chars=$(( ${#cd} - ${#${${cd:l}//${~${q:l}}/}} ))
|
||||
until (( ( ${#cd:h} - ${#${${${cd:h}:l}//${~${q:l}}/}} ) != q_chars )); do
|
||||
cd=${cd:h}
|
||||
done
|
||||
fi
|
||||
|
||||
ZSHZ[CASE_INSENSITIVE]=0
|
||||
fi
|
||||
fi
|
||||
|
||||
if (( ret2 == 0 )) && [[ -n $cd ]]; then
|
||||
if (( $+opts[-e] )); then # echo
|
||||
(( ZSHZ_TILDE )) && cd=${cd/#${HOME}/\~}
|
||||
print -- "$cd"
|
||||
else
|
||||
# cd if possible; echo the new path if $ZSHZ_ECHO == 1
|
||||
[[ -d $cd ]] && builtin cd "$cd" && _zshz_echo
|
||||
fi
|
||||
else
|
||||
# if $req is a valid path, cd to it; echo the new path if $ZSHZ_ECHO == 1
|
||||
if ! (( $+opts[-e] || $+opts[-l] )) && [[ -d $req ]]; then
|
||||
builtin cd "$req" && _zshz_echo
|
||||
else
|
||||
return $ret2
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
alias ${ZSHZ_CMD:-${_Z_CMD:-z}}='zshz 2>&1'
|
||||
|
||||
############################################################
|
||||
# precmd - add path to datafile unless `z -x' has just been
|
||||
# run
|
||||
#
|
||||
# Globals:
|
||||
# ZSHZ
|
||||
############################################################
|
||||
_zshz_precmd() {
|
||||
# Do not add PWD to datafile when in HOME directory, or
|
||||
# if `z -x' has just been run
|
||||
[[ $PWD == "$HOME" ]] || (( ZSHZ[DIRECTORY_REMOVED] )) && return
|
||||
|
||||
# Don't track directory trees excluded in ZSHZ_EXCLUDE_DIRS
|
||||
local exclude
|
||||
for exclude in ${(@)ZSHZ_EXCLUDE_DIRS:-${(@)_Z_EXCLUDE_DIRS}}; do
|
||||
case $PWD in
|
||||
${exclude}|${exclude}/*) return ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# It appears that forking a subshell is so slow in Windows that it is better
|
||||
# just to add the PWD to the datafile in the foreground
|
||||
if [[ $OSTYPE == (cygwin|msys) ]]; then
|
||||
zshz --add "$PWD"
|
||||
else
|
||||
(zshz --add "$PWD" &)
|
||||
fi
|
||||
|
||||
# See https://github.com/rupa/z/pull/247/commits/081406117ea42ccb8d159f7630cfc7658db054b6
|
||||
: $RANDOM
|
||||
}
|
||||
|
||||
############################################################
|
||||
# chpwd
|
||||
#
|
||||
# When the $PWD is removed from the datafile with `z -x',
|
||||
# Zsh-z refrains from adding it again until the user has
|
||||
# left the directory.
|
||||
#
|
||||
# Globals:
|
||||
# ZSHZ
|
||||
############################################################
|
||||
_zshz_chpwd() {
|
||||
ZSHZ[DIRECTORY_REMOVED]=0
|
||||
}
|
||||
|
||||
autoload -Uz add-zsh-hook
|
||||
|
||||
add-zsh-hook precmd _zshz_precmd
|
||||
add-zsh-hook chpwd _zshz_chpwd
|
||||
|
||||
############################################################
|
||||
# Completion
|
||||
############################################################
|
||||
|
||||
# Standarized $0 handling
|
||||
# (See https://github.com/agkozak/Zsh-100-Commits-Club/blob/master/Zsh-Plugin-Standard.adoc)
|
||||
0=${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}
|
||||
0=${${(M)0:#/*}:-$PWD/$0}
|
||||
|
||||
(( ${fpath[(ie)${0:A:h}]} <= ${#fpath} )) || fpath=( "${0:A:h}" "${fpath[@]}" )
|
||||
|
||||
############################################################
|
||||
# zsh-z functions
|
||||
############################################################
|
||||
ZSHZ[FUNCTIONS]='_zshz_usage
|
||||
_zshz_add_or_remove_path
|
||||
_zshz_update_datafile
|
||||
_zshz_legacy_complete
|
||||
_zshz_printv
|
||||
_zshz_find_common_root
|
||||
_zshz_output
|
||||
_zshz_find_matches
|
||||
zshz
|
||||
_zshz_precmd
|
||||
_zshz_chpwd
|
||||
_zshz'
|
||||
|
||||
############################################################
|
||||
# Enable WARN_NESTED_VAR for functions listed in
|
||||
# ZSHZ[FUNCTIONS]
|
||||
############################################################
|
||||
(( ZSHZ_DEBUG )) && () {
|
||||
if is-at-least 5.4.0; then
|
||||
local x
|
||||
for x in ${=ZSHZ[FUNCTIONS]}; do
|
||||
functions -W $x
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
############################################################
|
||||
# Unload function
|
||||
#
|
||||
# See https://github.com/agkozak/Zsh-100-Commits-Club/blob/master/Zsh-Plugin-Standard.adoc#unload-fun
|
||||
#
|
||||
# Globals:
|
||||
# ZSHZ
|
||||
# ZSHZ_CMD
|
||||
############################################################
|
||||
zsh-z_plugin_unload() {
|
||||
emulate -L zsh
|
||||
|
||||
add-zsh-hook -D precmd _zshz_precmd
|
||||
add-zsh-hook -d chpwd _zshz_chpwd
|
||||
|
||||
local x
|
||||
for x in ${=ZSHZ[FUNCTIONS]}; do
|
||||
(( ${+functions[$x]} )) && unfunction $x
|
||||
done
|
||||
|
||||
unset ZSHZ
|
||||
|
||||
fpath=( "${(@)fpath:#${0:A:h}}" )
|
||||
|
||||
(( ${+aliases[${ZSHZ_CMD:-${_Z_CMD:-z}}]} )) &&
|
||||
unalias ${ZSHZ_CMD:-${_Z_CMD:-z}}
|
||||
|
||||
unfunction $0
|
||||
}
|
||||
|
||||
# vim: fdm=indent:ts=2:et:sts=2:sw=2:
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
PROMPT='
|
||||
%{$fg_bold[gray]%}%~%{$fg_bold[blue]%}%{$fg_bold[blue]%} % %{$reset_color%}
|
||||
%{$fg[green]%}➞ %{$reset_color%'
|
||||
%{$fg[green]%}➞ %{$reset_color%}'
|
||||
|
||||
RPROMPT='$(git_prompt_info) $(ruby_prompt_info)'
|
||||
|
||||
|
@ -65,7 +65,7 @@ function is_update_available() {
|
||||
local remote_head
|
||||
remote_head=$(
|
||||
if (( ${+commands[curl]} )); then
|
||||
curl -m 2 -fsSL -H 'Accept: application/vnd.github.v3.sha' $api_url 2>/dev/null
|
||||
curl --connect-timeout 2 -fsSL -H 'Accept: application/vnd.github.v3.sha' $api_url 2>/dev/null
|
||||
elif (( ${+commands[wget]} )); then
|
||||
wget -T 2 -O- --header='Accept: application/vnd.github.v3.sha' $api_url 2>/dev/null
|
||||
elif (( ${+commands[fetch]} )); then
|
||||
|
@ -156,11 +156,17 @@ supports_hyperlinks() {
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Windows Terminal or Konsole also support hyperlinks
|
||||
if [ -n "$WT_SESSION" ] || [ -n "$KONSOLE_VERSION" ]; then
|
||||
# Windows Terminal also supports hyperlinks
|
||||
if [ -n "$WT_SESSION" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Konsole supports hyperlinks, but it's an opt-in setting that can't be detected
|
||||
# https://github.com/ohmyzsh/ohmyzsh/issues/10964
|
||||
# if [ -n "$KONSOLE_VERSION" ]; then
|
||||
# return 0
|
||||
# fi
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
@ -185,7 +191,7 @@ supports_truecolor() {
|
||||
fmt_link() {
|
||||
# $1: text, $2: url, $3: fallback mode
|
||||
if supports_hyperlinks; then
|
||||
printf '\033]8;;%s\a%s\033]8;;\a\n' "$2" "$1"
|
||||
printf '\033]8;;%s\033\\%s\033]8;;\033\\\n' "$2" "$1"
|
||||
return
|
||||
fi
|
||||
|
||||
@ -267,7 +273,7 @@ setup_ohmyzsh() {
|
||||
}
|
||||
|
||||
ostype=$(uname)
|
||||
if [ -z "${ostype%CYGWIN*}" ] && git --version | grep -q msysgit; then
|
||||
if [ -z "${ostype%CYGWIN*}" ] && git --version | grep -Eq 'msysgit|windows'; then
|
||||
fmt_error "Windows/MSYS Git is not supported on Cygwin"
|
||||
fmt_error "Make sure the Cygwin git package is installed and is first on the \$PATH"
|
||||
exit 1
|
||||
|
@ -107,7 +107,7 @@ usage() {
|
||||
NAME
|
||||
require_tool.sh - Ensure version of a tool is greater than the one expected
|
||||
|
||||
SYNOPSYS
|
||||
SYNOPSIS
|
||||
require_tool.sh [ -h ]
|
||||
[ --help ]
|
||||
[ TOOL MIN_VERSION ]
|
||||
|
@ -78,11 +78,17 @@ supports_hyperlinks() {
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Windows Terminal or Konsole also support hyperlinks
|
||||
if [ -n "$WT_SESSION" ] || [ -n "$KONSOLE_VERSION" ]; then
|
||||
# Windows Terminal also supports hyperlinks
|
||||
if [ -n "$WT_SESSION" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Konsole supports hyperlinks, but it's an opt-in setting that can't be detected
|
||||
# https://github.com/ohmyzsh/ohmyzsh/issues/10964
|
||||
# if [ -n "$KONSOLE_VERSION" ]; then
|
||||
# return 0
|
||||
# fi
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
@ -107,7 +113,7 @@ supports_truecolor() {
|
||||
fmt_link() {
|
||||
# $1: text, $2: url, $3: fallback mode
|
||||
if supports_hyperlinks; then
|
||||
printf '\033]8;;%s\a%s\033]8;;\a\n' "$2" "$1"
|
||||
printf '\033]8;;%s\033\\%s\033]8;;\033\\\n' "$2" "$1"
|
||||
return
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user