mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2026-09-28 14:06:12 +02:00
Compare commits
23
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b20d95c390 | ||
|
|
74965c9609 | ||
|
|
1b2d741f19 | ||
|
|
4ccc63333c | ||
|
|
40bddc3c1a | ||
|
|
8d421b6309 | ||
|
|
7d1b2a25ca | ||
|
|
86ef6555e0 | ||
|
|
32d7277ac3 | ||
|
|
e0d3557e14 | ||
|
|
b6830a53d5 | ||
|
|
fa82d8a3eb | ||
|
|
6421f8e104 | ||
|
|
0b50afdbfd | ||
|
|
157eb033f2 | ||
|
|
e7852049a5 | ||
|
|
7ce781ea37 | ||
|
|
def0f255c5 | ||
|
|
0ee67f0428 | ||
|
|
ec2901b7d0 | ||
|
|
1396cdd674 | ||
|
|
2ea948e05b | ||
|
|
6cd3a0baf6 |
@@ -5,6 +5,7 @@ plugins/eza/ @pepoluan
|
|||||||
plugins/genpass/ @atoponce
|
plugins/genpass/ @atoponce
|
||||||
plugins/git-lfs/ @hellovietduc
|
plugins/git-lfs/ @hellovietduc
|
||||||
plugins/gitfast/ @felipec
|
plugins/gitfast/ @felipec
|
||||||
|
plugins/hermes/ @Uhm-why
|
||||||
plugins/kube-ps1/ @mcornella
|
plugins/kube-ps1/ @mcornella
|
||||||
plugins/kubectl/ @mcornella
|
plugins/kubectl/ @mcornella
|
||||||
plugins/kubectx/ @mcornella
|
plugins/kubectx/ @mcornella
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ dependencies:
|
|||||||
plugins/history-substring-search:
|
plugins/history-substring-search:
|
||||||
repo: zsh-users/zsh-history-substring-search
|
repo: zsh-users/zsh-history-substring-search
|
||||||
branch: master
|
branch: master
|
||||||
version: 14c8d2e0ffaee98f2df9850b19944f32546fdea5
|
version: a0bdb0d47dbaba31dba2db7af8c48a5d9c74049a
|
||||||
precopy: |
|
precopy: |
|
||||||
set -e
|
set -e
|
||||||
rm -f zsh-history-substring-search.plugin.zsh
|
rm -f zsh-history-substring-search.plugin.zsh
|
||||||
|
|||||||
@@ -3,5 +3,5 @@ charset-normalizer==3.5.1
|
|||||||
idna==3.19
|
idna==3.19
|
||||||
PyYAML==6.0.3
|
PyYAML==6.0.3
|
||||||
requests==2.34.2
|
requests==2.34.2
|
||||||
semver==3.0.4
|
semver==3.1.0
|
||||||
urllib3==2.7.0
|
urllib3==2.8.0
|
||||||
|
|||||||
@@ -738,6 +738,9 @@ function _omz::reload {
|
|||||||
|
|
||||||
# Old zsh versions don't have ZSH_ARGZERO
|
# Old zsh versions don't have ZSH_ARGZERO
|
||||||
local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}"
|
local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}"
|
||||||
|
# ZSH_ARGZERO is how zsh was invoked, not the path to it, so re-resolve
|
||||||
|
# anything that is not absolute via $PATH at exec time (see #13919)
|
||||||
|
[[ "${zsh#-}" != /* ]] && (( $+commands[zsh] )) && zsh="zsh"
|
||||||
# Check whether to run a login shell
|
# Check whether to run a login shell
|
||||||
[[ "$zsh" = -* || -o login ]] && exec -l "${zsh#-}" || exec "$zsh"
|
[[ "$zsh" = -* || -o login ]] && exec -l "${zsh#-}" || exec "$zsh"
|
||||||
}
|
}
|
||||||
@@ -919,6 +922,9 @@ function _omz::update {
|
|||||||
if [[ "$(builtin cd -q "$ZSH"; git rev-parse HEAD)" != "$last_commit" ]]; then
|
if [[ "$(builtin cd -q "$ZSH"; git rev-parse HEAD)" != "$last_commit" ]]; then
|
||||||
# Old zsh versions don't have ZSH_ARGZERO
|
# Old zsh versions don't have ZSH_ARGZERO
|
||||||
local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}"
|
local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}"
|
||||||
|
# ZSH_ARGZERO is how zsh was invoked, not the path to it, so re-resolve
|
||||||
|
# anything that is not absolute via $PATH at exec time (see #13919)
|
||||||
|
[[ "${zsh#-}" != /* ]] && (( $+commands[zsh] )) && zsh="zsh"
|
||||||
# Check whether to run a login shell
|
# Check whether to run a login shell
|
||||||
[[ "$zsh" = -* || -o login ]] && exec -l "${zsh#-}" || exec "$zsh"
|
[[ "$zsh" = -* || -o login ]] && exec -l "${zsh#-}" || exec "$zsh"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -13,69 +13,92 @@ ZSH_THEME_RUBY_PROMPT_PREFIX="("
|
|||||||
ZSH_THEME_RUBY_PROMPT_SUFFIX=")"
|
ZSH_THEME_RUBY_PROMPT_SUFFIX=")"
|
||||||
|
|
||||||
|
|
||||||
|
# The command probes below fork a process each, and their result doesn't change
|
||||||
|
# from one shell to the next, so they're cached for a day (like lib/grep.zsh).
|
||||||
|
typeset -A __omz_probes
|
||||||
|
__omz_probe_cache="$ZSH_CACHE_DIR/appearance-probes"
|
||||||
|
__omz_probe_cached=("$__omz_probe_cache"(Nm-1))
|
||||||
|
[[ -z "$__omz_probe_cached" ]] || source "$__omz_probe_cache"
|
||||||
|
|
||||||
|
function __omz_test_cmd_args {
|
||||||
|
# Usage: __omz_test_cmd_args cmd args...
|
||||||
|
# Runs `cmd args... /dev/null` and remembers whether it succeeded, so a
|
||||||
|
# command needing two operands passes the first one itself:
|
||||||
|
# e.g. __omz_test_cmd_args gls --color -> gls --color /dev/null
|
||||||
|
# __omz_test_cmd_args diff --color /dev/null -> diff --color /dev/null /dev/null
|
||||||
|
local key="$*"
|
||||||
|
if (( ! ${+__omz_probes[$key]} )); then
|
||||||
|
command "$@" /dev/null &>/dev/null
|
||||||
|
__omz_probes[$key]=$?
|
||||||
|
if [[ -w "$ZSH_CACHE_DIR" ]]; then
|
||||||
|
print -r -- "__omz_probes=(" "${(@qqkv)__omz_probes}" ")" >| "$__omz_probe_cache"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
return $__omz_probes[$key]
|
||||||
|
}
|
||||||
|
|
||||||
# Use diff --color if available
|
# Use diff --color if available
|
||||||
if command diff --color /dev/null{,} &>/dev/null; then
|
if __omz_test_cmd_args diff --color /dev/null; then
|
||||||
function diff {
|
function diff {
|
||||||
command diff --color "$@"
|
command diff --color "$@"
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Don't set ls coloring if disabled
|
# Set up ls coloring. Done in a function so the early return below still
|
||||||
[[ "$DISABLE_LS_COLORS" != true ]] || return 0
|
# reaches the cleanup at the end of this file.
|
||||||
|
() {
|
||||||
|
# Don't set ls coloring if disabled
|
||||||
|
[[ "$DISABLE_LS_COLORS" != true ]] || return 0
|
||||||
|
|
||||||
# Default coloring for BSD-based ls
|
# Default coloring for BSD-based ls
|
||||||
export LSCOLORS="Gxfxcxdxbxegedabagacad"
|
export LSCOLORS="Gxfxcxdxbxegedabagacad"
|
||||||
|
|
||||||
# Default coloring for GNU-based ls
|
# Default coloring for GNU-based ls
|
||||||
if [[ -z "$LS_COLORS" ]]; then
|
if [[ -z "$LS_COLORS" ]]; then
|
||||||
# Define LS_COLORS via dircolors if available. Otherwise, set a default
|
# Define LS_COLORS via dircolors if available. Otherwise, set a default
|
||||||
# equivalent to LSCOLORS (generated via https://geoff.greer.fm/lscolors)
|
# equivalent to LSCOLORS (generated via https://geoff.greer.fm/lscolors)
|
||||||
if (( $+commands[dircolors] )); then
|
if (( $+commands[dircolors] )); then
|
||||||
[[ -f "$HOME/.dircolors" ]] \
|
[[ -f "$HOME/.dircolors" ]] \
|
||||||
&& source <(dircolors -b "$HOME/.dircolors") \
|
&& source <(dircolors -b "$HOME/.dircolors") \
|
||||||
|| source <(dircolors -b)
|
|| source <(dircolors -b)
|
||||||
else
|
else
|
||||||
export LS_COLORS="di=1;36:ln=35:so=32:pi=33:ex=31:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43"
|
export LS_COLORS="di=1;36:ln=35:so=32:pi=33:ex=31:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
function test-ls-args {
|
# Find the option for using colors in ls, depending on the version
|
||||||
# Usage: test-ls-args cmd args...
|
case "$OSTYPE" in
|
||||||
# e.g. test-ls-args gls --color
|
netbsd*)
|
||||||
command "$@" /dev/null &>/dev/null
|
# On NetBSD, test if `gls` (GNU ls) is installed (this one supports colors);
|
||||||
|
# otherwise, leave ls as is, because NetBSD's ls doesn't support -G
|
||||||
|
__omz_test_cmd_args gls --color && alias ls='gls --color=tty'
|
||||||
|
;;
|
||||||
|
openbsd*)
|
||||||
|
# On OpenBSD, `gls` (ls from GNU coreutils) and `colorls` (ls from base,
|
||||||
|
# with color and multibyte support) are available from ports.
|
||||||
|
# `colorls` will be installed on purpose and can't be pulled in by installing
|
||||||
|
# coreutils (which might be installed for ), so prefer it to `gls`.
|
||||||
|
__omz_test_cmd_args gls --color && alias ls='gls --color=tty'
|
||||||
|
__omz_test_cmd_args colorls -G && alias ls='colorls -G'
|
||||||
|
;;
|
||||||
|
(darwin|freebsd)*)
|
||||||
|
# This alias works by default just using $LSCOLORS
|
||||||
|
__omz_test_cmd_args ls -G && alias ls='ls -G'
|
||||||
|
# Only use GNU ls if installed and there are user defaults for $LS_COLORS,
|
||||||
|
# as the default coloring scheme is not very pretty
|
||||||
|
zstyle -t ':omz:lib:theme-and-appearance' gnu-ls \
|
||||||
|
&& __omz_test_cmd_args gls --color \
|
||||||
|
&& alias ls='gls --color=tty'
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if __omz_test_cmd_args ls --color; then
|
||||||
|
alias ls='ls --color=tty'
|
||||||
|
elif __omz_test_cmd_args ls -G; then
|
||||||
|
alias ls='ls -G'
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# Find the option for using colors in ls, depending on the version
|
unfunction __omz_test_cmd_args
|
||||||
case "$OSTYPE" in
|
unset __omz_probes __omz_probe_cache __omz_probe_cached
|
||||||
netbsd*)
|
|
||||||
# On NetBSD, test if `gls` (GNU ls) is installed (this one supports colors);
|
|
||||||
# otherwise, leave ls as is, because NetBSD's ls doesn't support -G
|
|
||||||
test-ls-args gls --color && alias ls='gls --color=tty'
|
|
||||||
;;
|
|
||||||
openbsd*)
|
|
||||||
# On OpenBSD, `gls` (ls from GNU coreutils) and `colorls` (ls from base,
|
|
||||||
# with color and multibyte support) are available from ports.
|
|
||||||
# `colorls` will be installed on purpose and can't be pulled in by installing
|
|
||||||
# coreutils (which might be installed for ), so prefer it to `gls`.
|
|
||||||
test-ls-args gls --color && alias ls='gls --color=tty'
|
|
||||||
test-ls-args colorls -G && alias ls='colorls -G'
|
|
||||||
;;
|
|
||||||
(darwin|freebsd)*)
|
|
||||||
# This alias works by default just using $LSCOLORS
|
|
||||||
test-ls-args ls -G && alias ls='ls -G'
|
|
||||||
# Only use GNU ls if installed and there are user defaults for $LS_COLORS,
|
|
||||||
# as the default coloring scheme is not very pretty
|
|
||||||
zstyle -t ':omz:lib:theme-and-appearance' gnu-ls \
|
|
||||||
&& test-ls-args gls --color \
|
|
||||||
&& alias ls='gls --color=tty'
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
if test-ls-args ls --color; then
|
|
||||||
alias ls='ls --color=tty'
|
|
||||||
elif test-ls-args ls -G; then
|
|
||||||
alias ls='ls -G'
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
unfunction test-ls-args
|
|
||||||
|
|||||||
+104
-3
@@ -100,7 +100,28 @@ done
|
|||||||
# Figure out the SHORT hostname
|
# Figure out the SHORT hostname
|
||||||
if [[ "$OSTYPE" = darwin* ]]; then
|
if [[ "$OSTYPE" = darwin* ]]; then
|
||||||
# macOS's $HOST changes with dhcp, etc. Use LocalHostName if possible.
|
# macOS's $HOST changes with dhcp, etc. Use LocalHostName if possible.
|
||||||
SHORT_HOST=$(scutil --get LocalHostName 2>/dev/null) || SHORT_HOST="${HOST/.*/}"
|
# scutil costs a fork on every start, so remember its answer for a day
|
||||||
|
# (like lib/grep.zsh) and re-check sooner if $HOST changes.
|
||||||
|
__omz_host_cache="$ZSH_CACHE_DIR/localhostname"
|
||||||
|
__omz_host_cached=("$__omz_host_cache"(Nm-1))
|
||||||
|
__omz_host_key=
|
||||||
|
SHORT_HOST=
|
||||||
|
if [[ -n "$__omz_host_cached" ]]; then
|
||||||
|
if ! { read -r __omz_host_key && read -r SHORT_HOST } < "$__omz_host_cache"; then
|
||||||
|
__omz_host_key=
|
||||||
|
SHORT_HOST=
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [[ "$__omz_host_key" != "$HOST" || -z "$SHORT_HOST" ]]; then
|
||||||
|
# only cache what scutil actually answered, so a transient failure
|
||||||
|
# doesn't pin the fallback name for a day
|
||||||
|
if SHORT_HOST=$(scutil --get LocalHostName 2>/dev/null) && [[ -n "$SHORT_HOST" ]]; then
|
||||||
|
[[ ! -w "$ZSH_CACHE_DIR" ]] || print -rl -- "$HOST" "$SHORT_HOST" >| "$__omz_host_cache"
|
||||||
|
else
|
||||||
|
SHORT_HOST="${HOST/.*/}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
unset __omz_host_cache __omz_host_cached __omz_host_key
|
||||||
else
|
else
|
||||||
SHORT_HOST="${HOST/.*/}"
|
SHORT_HOST="${HOST/.*/}"
|
||||||
fi
|
fi
|
||||||
@@ -110,9 +131,89 @@ if [[ -z "$ZSH_COMPDUMP" ]]; then
|
|||||||
ZSH_COMPDUMP="${ZDOTDIR:-$HOME}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
|
ZSH_COMPDUMP="${ZDOTDIR:-$HOME}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Construct zcompdump OMZ metadata
|
# Resolve the commit $ZSH is checked out at into $REPLY by reading the git
|
||||||
zcompdump_revision="#omz revision: $(builtin cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null)"
|
# directory, so that no git process is forked on every startup.
|
||||||
|
# Handles .git files (worktrees, submodules), worktree common dirs, detached
|
||||||
|
# HEADs and packed refs. Returns 1 if anything is unexpected.
|
||||||
|
_omz_git_head() {
|
||||||
|
local gitdir="$ZSH/.git" common head ref
|
||||||
|
local -a lines
|
||||||
|
REPLY=
|
||||||
|
|
||||||
|
# .git may be a file pointing at the real git dir
|
||||||
|
if [[ -f "$gitdir" ]]; then
|
||||||
|
read -r head 2>/dev/null < "$gitdir" || return 1
|
||||||
|
[[ "$head" = "gitdir: "* ]] || return 1
|
||||||
|
gitdir="${head#gitdir: }"
|
||||||
|
[[ -n "$gitdir" ]] || return 1
|
||||||
|
[[ "$gitdir" = /* ]] || gitdir="$ZSH/$gitdir"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# worktrees keep their refs in the common git dir
|
||||||
|
common="$gitdir"
|
||||||
|
if [[ -f "$gitdir/commondir" ]]; then
|
||||||
|
read -r common 2>/dev/null < "$gitdir/commondir" || return 1
|
||||||
|
[[ "$common" = /* ]] || common="$gitdir/$common"
|
||||||
|
fi
|
||||||
|
|
||||||
|
[[ -r "$gitdir/HEAD" ]] || return 1
|
||||||
|
read -r head 2>/dev/null < "$gitdir/HEAD" || return 1
|
||||||
|
|
||||||
|
if [[ "$head" = ref:\ * ]]; then
|
||||||
|
ref="${head#ref: }"
|
||||||
|
|
||||||
|
# Only use well-formed full ref names as paths. Besides matching Git's ref
|
||||||
|
# rules, this prevents a malformed HEAD from escaping the git directory.
|
||||||
|
[[ "$ref" = refs/?* \
|
||||||
|
&& "$ref" != *..* \
|
||||||
|
&& "$ref" != *//* \
|
||||||
|
&& "$ref" != */ \
|
||||||
|
&& "$ref" != */.* \
|
||||||
|
&& "$ref" != *.lock \
|
||||||
|
&& "$ref" != *.lock/* \
|
||||||
|
&& "$ref" != *. \
|
||||||
|
&& "$ref" != *'@{'* \
|
||||||
|
&& "$ref" != *[[:cntrl:]\ \~\^\:\?\*\[\\]* \
|
||||||
|
]] || return 1
|
||||||
|
|
||||||
|
case "$ref" in
|
||||||
|
# These namespaces are private to each worktree and are never resolved
|
||||||
|
# from the common directory or its packed-refs file.
|
||||||
|
refs/bisect/*|refs/worktree/*|refs/rewritten/*)
|
||||||
|
[[ -r "$gitdir/$ref" ]] || return 1
|
||||||
|
read -r REPLY 2>/dev/null < "$gitdir/$ref" || return 1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if [[ -r "$common/$ref" ]]; then
|
||||||
|
read -r REPLY 2>/dev/null < "$common/$ref" || return 1
|
||||||
|
elif [[ -r "$common/packed-refs" ]]; then
|
||||||
|
lines=("${(@f)$(<"$common/packed-refs")}")
|
||||||
|
REPLY="${lines[(r)* ${(b)ref}]%% *}"
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
# detached HEAD: the file holds the commit itself
|
||||||
|
REPLY="$head"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# only an object ID is a usable answer: a symbolic ref, a malformed file or
|
||||||
|
# a missed packed entry all fall through to the git fallback instead
|
||||||
|
[[ -n "$REPLY" && -z "${REPLY//[0-9a-f]/}" ]] \
|
||||||
|
&& (( ${#REPLY} == 40 || ${#REPLY} == 64 ))
|
||||||
|
}
|
||||||
|
|
||||||
|
# Construct zcompdump OMZ metadata. The helper reports through $REPLY, so
|
||||||
|
# call it in a scope that keeps that out of the global namespace.
|
||||||
|
() {
|
||||||
|
local REPLY
|
||||||
|
_omz_git_head || REPLY="$(builtin cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null)"
|
||||||
|
typeset -g zcompdump_revision="#omz revision: $REPLY"
|
||||||
|
}
|
||||||
zcompdump_fpath="#omz fpath: $fpath"
|
zcompdump_fpath="#omz fpath: $fpath"
|
||||||
|
unset -f _omz_git_head
|
||||||
|
|
||||||
# Check whether the zcompdump file carries the current OMZ metadata lines
|
# Check whether the zcompdump file carries the current OMZ metadata lines
|
||||||
_omz_compdump_has_metadata() {
|
_omz_compdump_has_metadata() {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ plugins=(... docker-compose)
|
|||||||
|-----------|----------------------------------|----------------------------------------------------------------------------------|
|
|-----------|----------------------------------|----------------------------------------------------------------------------------|
|
||||||
| dco | `docker-compose` | Docker-compose main command |
|
| dco | `docker-compose` | Docker-compose main command |
|
||||||
| dcb | `docker-compose build` | Build containers |
|
| dcb | `docker-compose build` | Build containers |
|
||||||
| dcc | `docker-compose config` | Parse, resolve and render compose file in canonical format |
|
| dcc | `docker-compose config` | Parse, resolve and render compose file in canonical format |
|
||||||
| dce | `docker-compose exec` | Execute command inside a container |
|
| dce | `docker-compose exec` | Execute command inside a container |
|
||||||
| dcps | `docker-compose ps` | List containers |
|
| dcps | `docker-compose ps` | List containers |
|
||||||
| dcrestart | `docker-compose restart` | Restart container |
|
| dcrestart | `docker-compose restart` | Restart container |
|
||||||
@@ -35,3 +35,6 @@ plugins=(... docker-compose)
|
|||||||
| dcpull | `docker-compose pull` | Pull image of a service |
|
| dcpull | `docker-compose pull` | Pull image of a service |
|
||||||
| dcstart | `docker-compose start` | Start a container |
|
| dcstart | `docker-compose start` | Start a container |
|
||||||
| dck | `docker-compose kill` | Kills containers |
|
| dck | `docker-compose kill` | Kills containers |
|
||||||
|
| dcv | `docker-compose version` | Show version information |
|
||||||
|
| dcsts | `docker-compose stats` | Show stats of containers |
|
||||||
|
| dci | `docker-compose images` | List images |
|
||||||
|
|||||||
@@ -24,5 +24,8 @@ alias dclF="$dccmd logs -f --tail 0"
|
|||||||
alias dcpull="$dccmd pull"
|
alias dcpull="$dccmd pull"
|
||||||
alias dcstart="$dccmd start"
|
alias dcstart="$dccmd start"
|
||||||
alias dck="$dccmd kill"
|
alias dck="$dccmd kill"
|
||||||
|
alias dcv="$dccmd version"
|
||||||
|
alias dcsts="$dccmd stats"
|
||||||
|
alias dci="$dccmd images"
|
||||||
|
|
||||||
unset dccmd
|
unset dccmd
|
||||||
|
|||||||
@@ -45,6 +45,36 @@ If `yes`, always add `-h` flag to add a header row for each column.
|
|||||||
|
|
||||||
Default: `no`
|
Default: `no`
|
||||||
|
|
||||||
|
### `links`
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
zstyle ':omz:plugins:eza' 'links' yes|no
|
||||||
|
```
|
||||||
|
|
||||||
|
If `yes`, always add `-H` flag to show hard links for each file.
|
||||||
|
|
||||||
|
Default: `no`
|
||||||
|
|
||||||
|
### `octal`
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
zstyle ':omz:plugins:eza' 'octal' yes|no
|
||||||
|
```
|
||||||
|
|
||||||
|
If `yes`, always add `-o` flag to show file permissions as octal numbers.
|
||||||
|
|
||||||
|
Default: `no`
|
||||||
|
|
||||||
|
### `inodes`
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
zstyle ':omz:plugins:eza' 'inodes' yes|no
|
||||||
|
```
|
||||||
|
|
||||||
|
If `yes`, always add `-i` flag to show the inode for each file.
|
||||||
|
|
||||||
|
Default: `no`
|
||||||
|
|
||||||
### `show-group`
|
### `show-group`
|
||||||
|
|
||||||
```zsh
|
```zsh
|
||||||
|
|||||||
@@ -21,6 +21,15 @@ function _configure_eza() {
|
|||||||
if zstyle -t ':omz:plugins:eza' 'header'; then
|
if zstyle -t ':omz:plugins:eza' 'header'; then
|
||||||
_EZA_HEAD+=("h")
|
_EZA_HEAD+=("h")
|
||||||
fi
|
fi
|
||||||
|
if zstyle -t ':omz:plugins:eza' 'links'; then
|
||||||
|
_EZA_HEAD+=("H")
|
||||||
|
fi
|
||||||
|
if zstyle -t ':omz:plugins:eza' 'octal'; then
|
||||||
|
_EZA_HEAD+=("o")
|
||||||
|
fi
|
||||||
|
if zstyle -t ':omz:plugins:eza' 'inodes'; then
|
||||||
|
_EZA_HEAD+=("i")
|
||||||
|
fi
|
||||||
zstyle -s ':omz:plugins:eza' 'size-prefix' _val
|
zstyle -s ':omz:plugins:eza' 'size-prefix' _val
|
||||||
case "${_val:l}" in
|
case "${_val:l}" in
|
||||||
binary)
|
binary)
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ function frontend() {
|
|||||||
codepen 'https://codepen.io/search/pens?q='
|
codepen 'https://codepen.io/search/pens?q='
|
||||||
compassdoc 'http://compass-style.org/search?q='
|
compassdoc 'http://compass-style.org/search?q='
|
||||||
cssflow 'http://www.cssflow.com/search?q='
|
cssflow 'http://www.cssflow.com/search?q='
|
||||||
dartlang 'https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:'
|
dartlang $(_frontend_fallback 'dart.dev')
|
||||||
emberjs $(_frontend_fallback 'emberjs.com/')
|
emberjs $(_frontend_fallback 'emberjs.com/')
|
||||||
flowtype $(_frontend_fallback 'flow.org/en/docs/')
|
flowtype $(_frontend_fallback 'flow.org/en/docs/')
|
||||||
fontello 'http://fontello.com/#search='
|
fontello 'http://fontello.com/#search='
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ plugin is loaded, which is usually when you start up a new terminal emulator.
|
|||||||
|
|
||||||
The cache is stored at:
|
The cache is stored at:
|
||||||
|
|
||||||
- `$ZSH/plugins/gh/_gh` completions script
|
- `$ZSH_CACHE_DIR/completions/_gh` completions script
|
||||||
|
|
||||||
- `$ZSH_CACHE_DIR/gh_version` version of GitHub CLI, used to invalidate
|
If an update fails, the last successfully generated completion script is kept.
|
||||||
the cache.
|
|
||||||
|
|||||||
@@ -13,6 +13,12 @@ fi
|
|||||||
|
|
||||||
zmodload -F zsh/files b:zf_mv
|
zmodload -F zsh/files b:zf_mv
|
||||||
() {
|
() {
|
||||||
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_gh"
|
local completion_file="$ZSH_CACHE_DIR/completions/_gh"
|
||||||
zf_mv -f -- =( gh completion --shell zsh ) "$TMPPREFIX"
|
local completion_tmp="${completion_file}.$$.${RANDOM}"
|
||||||
|
|
||||||
|
if gh completion --shell zsh >| "$completion_tmp" && [[ -s "$completion_tmp" ]]; then
|
||||||
|
zf_mv -f -- "$completion_tmp" "$completion_file"
|
||||||
|
fi
|
||||||
|
|
||||||
|
command rm -f -- "$completion_tmp"
|
||||||
} &|
|
} &|
|
||||||
|
|||||||
@@ -255,6 +255,7 @@ receive further support.
|
|||||||
| `git_current_user_name` | Returns the `user.name` config value (Lives in `lib/git.zsh`) |
|
| `git_current_user_name` | Returns the `user.name` config value (Lives in `lib/git.zsh`) |
|
||||||
| `git_develop_branch` | Returns the name of the “development” branch: `dev`, `devel`, `development` if they exist, `develop` otherwise |
|
| `git_develop_branch` | Returns the name of the “development” branch: `dev`, `devel`, `development` if they exist, `develop` otherwise |
|
||||||
| `git_main_branch` | Returns the name of the main branch: `main` if it exists, `master` otherwise |
|
| `git_main_branch` | Returns the name of the main branch: `main` if it exists, `master` otherwise |
|
||||||
|
| `gbcopy` | Copies current branch name to clipboard |
|
||||||
| `grename <old> <new>` | Renames branch `<old>` to `<new>`, including on the origin remote |
|
| `grename <old> <new>` | Renames branch `<old>` to `<new>`, including on the origin remote |
|
||||||
| `gbda` | Deletes all merged branches |
|
| `gbda` | Deletes all merged branches |
|
||||||
| `gbds` | Deletes all squash-merged branches (**Note: performance degrades with number of branches**) |
|
| `gbds` | Deletes all squash-merged branches (**Note: performance degrades with number of branches**) |
|
||||||
|
|||||||
@@ -49,6 +49,16 @@ function git_main_branch() {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function gbcopy() {
|
||||||
|
command git rev-parse --git-dir &>/dev/null || return
|
||||||
|
|
||||||
|
local branch
|
||||||
|
branch="$(git_current_branch)" || return
|
||||||
|
[[ -n "$branch" ]] || return 1
|
||||||
|
|
||||||
|
print -rn -- "$branch" | clipcopy
|
||||||
|
}
|
||||||
|
|
||||||
function grename() {
|
function grename() {
|
||||||
if [[ -z "$1" || -z "$2" ]]; then
|
if [[ -z "$1" || -z "$2" ]]; then
|
||||||
echo "Usage: $0 old_branch new_branch"
|
echo "Usage: $0 old_branch new_branch"
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# GitLab CLI plugin
|
||||||
|
|
||||||
|
This plugin adds completion for the [GitLab CLI](https://docs.gitlab.com/cli/).
|
||||||
|
|
||||||
|
To use it, add `glab` to the plugins array in your zshrc file:
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
plugins=(... glab)
|
||||||
|
```
|
||||||
|
|
||||||
|
This plugin does not add any aliases.
|
||||||
|
|
||||||
|
## Cache
|
||||||
|
|
||||||
|
This plugin caches the completion script at `$ZSH_CACHE_DIR/completions/_glab`.
|
||||||
|
|
||||||
|
The cache is regenerated in the background whenever the plugin is loaded, which
|
||||||
|
usually happens when you start a new Zsh session.
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# Autocompletion for the GitLab CLI (glab).
|
||||||
|
if (( ! $+commands[glab] )); then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If the completion file doesn't exist yet, we need to autoload it and
|
||||||
|
# bind it to `glab`. Otherwise, compinit will have already done that.
|
||||||
|
if [[ ! -f "$ZSH_CACHE_DIR/completions/_glab" ]]; then
|
||||||
|
typeset -g -A _comps
|
||||||
|
autoload -Uz _glab
|
||||||
|
_comps[glab]=_glab
|
||||||
|
fi
|
||||||
|
|
||||||
|
zmodload -F zsh/files b:zf_mv
|
||||||
|
() {
|
||||||
|
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_glab"
|
||||||
|
zf_mv -f -- =( glab completion -s zsh ) "$TMPPREFIX"
|
||||||
|
} &|
|
||||||
+95
-11
@@ -81,6 +81,7 @@ _go() {
|
|||||||
'tool[run specified go tool]'
|
'tool[run specified go tool]'
|
||||||
'version[print Go version]'
|
'version[print Go version]'
|
||||||
'vet[run go tool vet on packages]'
|
'vet[run go tool vet on packages]'
|
||||||
|
'work[workspace maintenance]'
|
||||||
)
|
)
|
||||||
if (( CURRENT == 2 )); then
|
if (( CURRENT == 2 )); then
|
||||||
# explain go commands
|
# explain go commands
|
||||||
@@ -88,19 +89,38 @@ _go() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
build_flags=(
|
build_flags=(
|
||||||
'-a[force reinstallation of packages that are already up to date]'
|
'-C[change to dir before running the command]:directory:_path_files -/'
|
||||||
|
'-a[force rebuilding of packages that are already up-to-date]'
|
||||||
'-n[print the commands but do not run them]'
|
'-n[print the commands but do not run them]'
|
||||||
'-p[number of parallel builds]:number'
|
'-p[number of parallel builds]:number'
|
||||||
'-race[enable data race detection]'
|
'-race[enable data race detection]'
|
||||||
'-x[print the commands]'
|
'-msan[enable interoperation with memory sanitizer]'
|
||||||
|
'-asan[enable interoperation with address sanitizer]'
|
||||||
|
'-cover[enable code coverage instrumentation]'
|
||||||
|
'-covermode[set the mode for coverage analysis]:mode:(set count atomic)'
|
||||||
|
'-coverpkg[apply coverage analysis to matching packages]:pattern'
|
||||||
|
'-v[print the names of packages as they are compiled]'
|
||||||
'-work[print temporary directory name and keep it]'
|
'-work[print temporary directory name and keep it]'
|
||||||
'-ccflags[flags for 5c/6c/8c]:flags'
|
'-x[print the commands]'
|
||||||
'-gcflags[flags for 5g/6g/8g]:flags'
|
'-asmflags[arguments to pass on each go tool asm invocation]:flags'
|
||||||
'-ldflags[flags for 5l/6l/8l]:flags'
|
'-buildmode[build mode to use]:mode:(archive c-archive c-shared default shared exe pie plugin)'
|
||||||
'-gccgoflags[flags for gccgo]:flags'
|
'-buildvcs[stamp binaries with version control information]:mode:(true false auto)'
|
||||||
'-compiler[name of compiler to use]:name'
|
'-compiler[name of compiler to use]:name:(gccgo gc)'
|
||||||
'-installsuffix[suffix to add to package directory]:suffix'
|
'-gccgoflags[arguments to pass on each gccgo compiler/linker invocation]:flags'
|
||||||
|
'-gcflags[arguments to pass on each go tool compile invocation]:flags'
|
||||||
|
'-installsuffix[suffix to use in the package installation directory]:suffix'
|
||||||
|
'-json[emit build output in JSON suitable for automated processing]'
|
||||||
|
'-ldflags[arguments to pass on each go tool link invocation]:flags'
|
||||||
|
'-linkshared[build code that will be linked against shared libraries]'
|
||||||
|
'-mod[module download mode to use]:mode:(readonly vendor mod)'
|
||||||
|
'-modcacherw[leave newly-created directories in the module cache read-write]'
|
||||||
|
'-modfile[read and write an alternate go.mod file]:file:_files -g "*.mod"'
|
||||||
|
'-overlay[read a JSON config file that provides an overlay for build operations]:file:_files -g "*.json"'
|
||||||
|
'-pgo[specify the file path of a profile for profile-guided optimization]:file:_files'
|
||||||
|
'-pkgdir[install and load all packages from dir]:directory:_path_files -/'
|
||||||
'-tags[list of build tags to consider satisfied]:tags'
|
'-tags[list of build tags to consider satisfied]:tags'
|
||||||
|
'-trimpath[remove all file system paths from the resulting executable]'
|
||||||
|
'-toolexec[program to use to invoke toolchain programs]:command'
|
||||||
)
|
)
|
||||||
|
|
||||||
case ${words[2]} in
|
case ${words[2]} in
|
||||||
@@ -125,17 +145,20 @@ _go() {
|
|||||||
;;
|
;;
|
||||||
install)
|
install)
|
||||||
_arguments -s -w : ${build_flags[@]} \
|
_arguments -s -w : ${build_flags[@]} \
|
||||||
"-v[show package names]" \
|
|
||||||
'*:importpaths:__go_packages'
|
'*:importpaths:__go_packages'
|
||||||
;;
|
;;
|
||||||
get)
|
get)
|
||||||
_arguments -s -w : \
|
_arguments -s -w : \
|
||||||
${build_flags[@]}
|
${build_flags[@]} \
|
||||||
|
"-t[consider modules needed to build tests of packages]" \
|
||||||
|
"-u[update modules providing dependencies to newer minor or patch releases]" \
|
||||||
|
"-u=[update modules providing dependencies to patch releases]:mode:(patch)" \
|
||||||
|
"-tool[add a matching tool line to go.mod for each listed package]" \
|
||||||
|
"*:importpaths:__go_packages"
|
||||||
;;
|
;;
|
||||||
build)
|
build)
|
||||||
_arguments -s -w : \
|
_arguments -s -w : \
|
||||||
${build_flags[@]} \
|
${build_flags[@]} \
|
||||||
"-v[show package names]" \
|
|
||||||
"-o[output file]:file:_files" \
|
"-o[output file]:file:_files" \
|
||||||
"*:args:{ _alternative ':importpaths:__go_packages' ':files:_path_files -g \"*.go\"' }"
|
"*:args:{ _alternative ':importpaths:__go_packages' ':files:_path_files -g \"*.go\"' }"
|
||||||
;;
|
;;
|
||||||
@@ -238,6 +261,60 @@ _go() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
work)
|
||||||
|
local -a work_commands
|
||||||
|
work_commands+=(
|
||||||
|
'edit[edit go.work from tools or scripts]'
|
||||||
|
'init[initialize workspace file]'
|
||||||
|
'sync[sync workspace build list to modules]'
|
||||||
|
'use[add modules to workspace file]'
|
||||||
|
'vendor[make vendored copy of dependencies]'
|
||||||
|
)
|
||||||
|
|
||||||
|
if (( CURRENT == 3 )); then
|
||||||
|
_values 'go work commands' ${work_commands[@]} "help[display help]"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
case ${words[3]} in
|
||||||
|
help)
|
||||||
|
_values 'go work commands' ${work_commands[@]}
|
||||||
|
;;
|
||||||
|
edit)
|
||||||
|
_arguments -s -w : \
|
||||||
|
"-fmt[reformat the go.work file]" \
|
||||||
|
"-godebug[=key=value add a godebug key=value line]:key=value" \
|
||||||
|
"-dropgodebug[=key drop an existing godebug line]:key" \
|
||||||
|
"-use[=path add a use directive]:directory:_path_files -/" \
|
||||||
|
"-dropuse[=path drop a use directive]:directory:_path_files -/" \
|
||||||
|
"-replace[=old{@v}=new{@v} add a replacement of the given module path and version pair]:name" \
|
||||||
|
"-dropreplace[=old{@v} drop a replacement of the given module path and version pair]:name" \
|
||||||
|
"-go[={version} set the expected Go language version]:number" \
|
||||||
|
"-toolchain[=name set the Go toolchain to use]:name" \
|
||||||
|
"-print[print the final go.work in its text format]" \
|
||||||
|
"-json[print the final go.work file in JSON format]" \
|
||||||
|
"1:go.work file:_files -g 'go.work'"
|
||||||
|
;;
|
||||||
|
init)
|
||||||
|
_arguments -s -w : \
|
||||||
|
"*:module directories:_path_files -/"
|
||||||
|
;;
|
||||||
|
sync)
|
||||||
|
;;
|
||||||
|
use)
|
||||||
|
_arguments -s -w : \
|
||||||
|
"-r[search recursively for modules in the argument directories]" \
|
||||||
|
"*:module directories:_path_files -/"
|
||||||
|
;;
|
||||||
|
vendor)
|
||||||
|
_arguments -s -w : \
|
||||||
|
"-e[attempt to proceed despite errors encountered while loading packages]" \
|
||||||
|
"-v[print the names of vendored modules and packages]" \
|
||||||
|
"-o[create the vendor directory at the given path]:output directory:_path_files -/" \
|
||||||
|
"*:flags"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
help)
|
help)
|
||||||
_values "${commands[@]}" \
|
_values "${commands[@]}" \
|
||||||
'environment[show Go environment variables available]' \
|
'environment[show Go environment variables available]' \
|
||||||
@@ -247,6 +324,13 @@ _go() {
|
|||||||
'testflag[description of testing flags]' \
|
'testflag[description of testing flags]' \
|
||||||
'testfunc[description of testing functions]'
|
'testfunc[description of testing functions]'
|
||||||
;;
|
;;
|
||||||
|
version)
|
||||||
|
_arguments -s -w : \
|
||||||
|
"-m[print module version information]" \
|
||||||
|
"-v[report unrecognized files]" \
|
||||||
|
"-json[print module version information in JSON format]" \
|
||||||
|
"*:file:_files"
|
||||||
|
;;
|
||||||
run)
|
run)
|
||||||
_arguments -s -w : \
|
_arguments -s -w : \
|
||||||
${build_flags[@]} \
|
${build_flags[@]} \
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ function gradle-or-gradlew() {
|
|||||||
|
|
||||||
# if gradlew found, run it instead of gradle
|
# if gradlew found, run it instead of gradle
|
||||||
if [[ -f "$project_root/gradlew" ]]; then
|
if [[ -f "$project_root/gradlew" ]]; then
|
||||||
echo "executing gradlew instead of gradle"
|
|
||||||
"$project_root/gradlew" "$@"
|
"$project_root/gradlew" "$@"
|
||||||
else
|
else
|
||||||
command gradle "$@"
|
command gradle "$@"
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
# hermes plugin
|
||||||
|
|
||||||
|
This plugin adds completions for the Hermes AI agent.
|
||||||
|
|
||||||
|
To use it, add `hermes` to the plugin array in your zshrc file:
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
plugins=(... hermes)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
hermes <TAB>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Common Workflows
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
# First time setup/updating overall config
|
||||||
|
hermes setup
|
||||||
|
|
||||||
|
# Starting the tui chat
|
||||||
|
hermes
|
||||||
|
|
||||||
|
# Changing default model
|
||||||
|
hermes model
|
||||||
|
```
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
if (( ! $+commands[hermes] )); then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -f "$ZSH_CACHE_DIR/completions/_hermes" ]]; then
|
||||||
|
typeset -g -A _comps
|
||||||
|
autoload -Uz _hermes
|
||||||
|
_comps[hermes]=_hermes
|
||||||
|
fi
|
||||||
|
|
||||||
|
zmodload -F zsh/files b:zf_mv
|
||||||
|
() {
|
||||||
|
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_hermes"
|
||||||
|
zf_mv -f -- =( hermes completion zsh < /dev/null 2> /dev/null ) "$TMPPREFIX"
|
||||||
|
} &|
|
||||||
@@ -20,7 +20,7 @@ Requirements
|
|||||||
Install
|
Install
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
|
|
||||||
Using the [Homebrew](https://brew.sh) package manager:
|
Using the [Homebrew]( https://brew.sh ) package manager:
|
||||||
|
|
||||||
brew install zsh-history-substring-search
|
brew install zsh-history-substring-search
|
||||||
echo 'source $(brew --prefix)/share/zsh-history-substring-search/zsh-history-substring-search.zsh' >> ~/.zshrc
|
echo 'source $(brew --prefix)/share/zsh-history-substring-search/zsh-history-substring-search.zsh' >> ~/.zshrc
|
||||||
@@ -51,7 +51,7 @@ Using [zplug](https://github.com/zplug/zplug):
|
|||||||
|
|
||||||
1. Add this repo to `~/.zshrc`:
|
1. Add this repo to `~/.zshrc`:
|
||||||
|
|
||||||
zplug "zsh-users/zsh-history-substring-search", as: plugin
|
zplug "zsh-users/zsh-history-substring-search", as:plugin
|
||||||
|
|
||||||
Using [antigen](https://github.com/zsh-users/antigen):
|
Using [antigen](https://github.com/zsh-users/antigen):
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ Using [Zinit](https://github.com/zdharma-continuum/zinit):
|
|||||||
|
|
||||||
1. Use the `Oh-my-zsh` Zinit snippet in `~/.zshrc`:
|
1. Use the `Oh-my-zsh` Zinit snippet in `~/.zshrc`:
|
||||||
|
|
||||||
zinit snippet OMZ::plugins/git/git.plugin.zsh`
|
zinit snippet OMZ::plugins/git/git.plugin.zsh
|
||||||
|
|
||||||
2. Load the plugin in `~/.zshrc`:
|
2. Load the plugin in `~/.zshrc`:
|
||||||
|
|
||||||
|
|||||||
@@ -295,8 +295,8 @@ _history-substring-search-begin() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Escape and join query parts with wildcard character '*' as separator
|
# Escape and join query parts with wildcard character '*' as seperator
|
||||||
# `(j:CHAR:)` join array to string with CHAR as separator
|
# `(j:CHAR:)` join array to string with CHAR as seperator
|
||||||
#
|
#
|
||||||
local search_pattern="${(j:*:)_history_substring_search_query_parts[@]//(#m)[\][()|\\*?#<>~^]/\\$MATCH}*"
|
local search_pattern="${(j:*:)_history_substring_search_query_parts[@]//(#m)[\][()|\\*?#<>~^]/\\$MATCH}*"
|
||||||
|
|
||||||
|
|||||||
@@ -19,4 +19,6 @@ Provided aliases:
|
|||||||
- `ot`: generates a MFA code based on the given key and copies it to the clipboard
|
- `ot`: generates a MFA code based on the given key and copies it to the clipboard
|
||||||
(on Linux it relies on xsel, on MacOS X it uses pbcopy instead).
|
(on Linux it relies on xsel, on MacOS X it uses pbcopy instead).
|
||||||
|
|
||||||
The plugin uses `$HOME/.otp` to store its internal files.
|
The plugin stores its internal files in `$OTP_HOME`, which can be set in your zshrc.
|
||||||
|
If `$OTP_HOME` is not set it defaults to either `$HOME/.otp` or `$XDG_DATA_HOME/otp`,
|
||||||
|
depending on whether `~/.otp` already exists, or whether `$XDG_DATA_HOME` is set.
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
export OTP_HOME=~/.otp
|
if [[ -z "$OTP_HOME" ]]; then
|
||||||
|
if [[ ! -d "$HOME/.otp" ]] && [[ -n "$XDG_DATA_HOME" ]]; then
|
||||||
|
export OTP_HOME="$XDG_DATA_HOME/otp"
|
||||||
|
else
|
||||||
|
export OTP_HOME=~/.otp
|
||||||
|
fi
|
||||||
|
fi
|
||||||
mkdir -p $OTP_HOME
|
mkdir -p $OTP_HOME
|
||||||
|
|
||||||
function ot () {
|
function ot () {
|
||||||
|
|||||||
@@ -23,6 +23,16 @@ plugins=(... podman)
|
|||||||
| pirm | `podman image rm` | Remove one or more images |
|
| pirm | `podman image rm` | Remove one or more images |
|
||||||
| pit | `podman image tag` | Add a name and tag to a particular image |
|
| pit | `podman image tag` | Add a name and tag to a particular image |
|
||||||
| plo | `podman container logs` | Fetch the logs of a podman container |
|
| plo | `podman container logs` | Fetch the logs of a podman container |
|
||||||
|
| pmif | `podman machine info` | Display machine host info |
|
||||||
|
| pmit | `podman machine init` | Initialize a virtual machine |
|
||||||
|
| pmis | `podman machine inspect` | Inspect an existing machine |
|
||||||
|
| pml | `podman machine list` | List machines |
|
||||||
|
| pmo | `podman machine os` | Manage a Podman virtual machine's OS |
|
||||||
|
| pmrm | `podman machine rm` | Remove an existing machine |
|
||||||
|
| pms | `podman machine set` | Set a virtual machine setting |
|
||||||
|
| pmss | `podman machine ssh` | SSH into an existing machine |
|
||||||
|
| pmst | `podman machine start` | Start an existing machine |
|
||||||
|
| pmsp | `podman machine stop` | Stop an existing machine |
|
||||||
| pnc | `podman network create` | Create a new network |
|
| pnc | `podman network create` | Create a new network |
|
||||||
| pncn | `podman network connect` | Connect a container to a network |
|
| pncn | `podman network connect` | Connect a container to a network |
|
||||||
| pndcn | `podman network disconnect` | Disconnect a container from a network |
|
| pndcn | `podman network disconnect` | Disconnect a container from a network |
|
||||||
|
|||||||
@@ -26,6 +26,16 @@ alias pils='podman image ls'
|
|||||||
alias pipu='podman image push'
|
alias pipu='podman image push'
|
||||||
alias pirm='podman image rm'
|
alias pirm='podman image rm'
|
||||||
alias pit='podman image tag'
|
alias pit='podman image tag'
|
||||||
|
alias pmif='podman machine info'
|
||||||
|
alias pmit='podman machine init'
|
||||||
|
alias pmis='podman machine inspect'
|
||||||
|
alias pml='podman machine list'
|
||||||
|
alias pmo='podman machine os'
|
||||||
|
alias pmrm='podman machine rm'
|
||||||
|
alias pms='podman machine set'
|
||||||
|
alias pmss='podman machine ssh'
|
||||||
|
alias pmst='podman machine start'
|
||||||
|
alias pmsp='podman machine stop'
|
||||||
alias plo='podman container logs'
|
alias plo='podman container logs'
|
||||||
alias pnc='podman network create'
|
alias pnc='podman network create'
|
||||||
alias pncn='podman network connect'
|
alias pncn='podman network connect'
|
||||||
|
|||||||
@@ -33,10 +33,10 @@ plugins=(... systemadmin)
|
|||||||
| killit | Kills any process that matches a regular expression passed to it |
|
| killit | Kills any process that matches a regular expression passed to it |
|
||||||
| tree | List contents of directories in a tree-like format (if tree isn't installed) |
|
| tree | List contents of directories in a tree-like format (if tree isn't installed) |
|
||||||
| sortcons | Sort connections by state |
|
| sortcons | Sort connections by state |
|
||||||
| con80 | View all 80 Port Connections |
|
| con80 | View all connections on ports 80 and 443, or on the ports given as arguments (`con80 8080`) |
|
||||||
| sortconip | On the connected IP sorted by the number of connections |
|
| sortconip | On the connected IP sorted by the number of connections |
|
||||||
| req20 | List the top 20 requests on port 80 |
|
| req20 | List the top 20 requests on ports 80 and 443, or on the ports given as arguments (`req20 8080`) |
|
||||||
| http20 | List the top 20 connections to port 80 based on tcpdump data |
|
| http20 | List the top 20 connections to ports 80 and 443 based on tcpdump data, or to the ports given as arguments |
|
||||||
| timewait20 | List the top 20 time_wait connections |
|
| timewait20 | List the top 20 time_wait connections |
|
||||||
| syn20 | List the top 20 SYN connections |
|
| syn20 | List the top 20 SYN connections |
|
||||||
| port_pro | Output all processes according to the port number |
|
| port_pro | Output all processes according to the port number |
|
||||||
|
|||||||
@@ -65,60 +65,90 @@ fi
|
|||||||
|
|
||||||
# Sort connection state
|
# Sort connection state
|
||||||
function sortcons() {
|
function sortcons() {
|
||||||
{
|
if (( $+commands[ss] )); then
|
||||||
LANG= ss -nat | awk 'NR > 1 {print $1}' \
|
LANG= ss -nat | awk 'NR > 1 {print $1}'
|
||||||
|| LANG= netstat -nat | awk 'NR > 2 {print $6}'
|
else
|
||||||
} | sort | uniq -c | sort -rn
|
LANG= netstat -nat | awk 'NR > 2 {print $6}'
|
||||||
|
fi | sort | uniq -c | sort -rn
|
||||||
}
|
}
|
||||||
|
|
||||||
# View all 80 Port Connections
|
function _systemadmin_validate_ports() {
|
||||||
|
local port
|
||||||
|
for port in "$@"; do
|
||||||
|
if [[ $port != <0-65535> || ( $port == 0* && $port != 0 ) ]]; then
|
||||||
|
print -u2 "systemadmin: invalid port '$port' (expected 0 to 65535 without leading zeros)"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# View all connections on the given ports (default 80 and 443)
|
||||||
function con80() {
|
function con80() {
|
||||||
{
|
local -a ports=("$@")
|
||||||
LANG= ss -nat || LANG= netstat -nat
|
(( $# )) || ports=(80 443)
|
||||||
} | grep -E ":80[^0-9]" | wc -l
|
_systemadmin_validate_ports "${ports[@]}" || return
|
||||||
|
if (( $+commands[ss] )); then
|
||||||
|
LANG= ss -nat
|
||||||
|
else
|
||||||
|
LANG= netstat -nat
|
||||||
|
fi | grep -E ":(${(j:|:)ports})([[:space:]]|$)" | wc -l
|
||||||
}
|
}
|
||||||
|
|
||||||
# On the connected IP sorted by the number of connections
|
# On the connected IP sorted by the number of connections
|
||||||
function sortconip() {
|
function sortconip() {
|
||||||
{
|
if (( $+commands[ss] )); then
|
||||||
LANG= ss -ntu | awk 'NR > 1 {print $6}' \
|
LANG= ss -ntu | awk 'NR > 1 {print $6}'
|
||||||
|| LANG= netstat -ntu | awk 'NR > 2 {print $5}'
|
else
|
||||||
} | cut -d: -f1 | sort | uniq -c | sort -n
|
LANG= netstat -ntu | awk 'NR > 2 {print $5}'
|
||||||
|
fi | cut -d: -f1 | sort | uniq -c | sort -n
|
||||||
}
|
}
|
||||||
|
|
||||||
# top20 of Find the number of requests on 80 port
|
# top20 of Find the number of requests on the given ports (default 80 and 443)
|
||||||
function req20() {
|
function req20() {
|
||||||
{
|
local -a ports=("$@")
|
||||||
LANG= ss -tn | awk '$4 ~ /:80$/ {print $5}' \
|
(( $# )) || ports=(80 443)
|
||||||
|| LANG= netstat -tn | awk '$4 ~ /:80$/ {print $5}'
|
_systemadmin_validate_ports "${ports[@]}" || return
|
||||||
} | awk -F: '{print $1}' | sort | uniq -c | sort -nr | head -n 20
|
if (( $+commands[ss] )); then
|
||||||
|
LANG= ss -tn
|
||||||
|
else
|
||||||
|
LANG= netstat -tn
|
||||||
|
fi | awk -v ports="${(j:|:)ports}" '$4 ~ ":("ports")$" {print $5}' \
|
||||||
|
| awk -F: '{print $1}' | sort | uniq -c | sort -nr | head -n 20
|
||||||
}
|
}
|
||||||
|
|
||||||
# top20 of Using tcpdump port 80 access to view
|
# top20 of Using tcpdump to view access to the given ports (default 80 and 443)
|
||||||
function http20() {
|
function http20() {
|
||||||
sudo tcpdump -i eth0 -tnn dst port 80 -c 1000 | awk -F"." '{print $1"."$2"."$3"."$4}' | sort | uniq -c | sort -nr | head -n 20
|
local -a ports=("$@")
|
||||||
|
(( $# )) || ports=(80 443)
|
||||||
|
_systemadmin_validate_ports "${ports[@]}" || return
|
||||||
|
sudo tcpdump -i eth0 -tnn -c 1000 "dst port ${(j: or :)ports}" | awk -F"." '{print $1"."$2"."$3"."$4}' | sort | uniq -c | sort -nr | head -n 20
|
||||||
}
|
}
|
||||||
|
|
||||||
# top20 of Find time_wait connection
|
# top20 of Find time_wait connection
|
||||||
function timewait20() {
|
function timewait20() {
|
||||||
{
|
if (( $+commands[ss] )); then
|
||||||
LANG= ss -nat | awk 'NR > 1 && /TIME-WAIT/ {print $5}' \
|
LANG= ss -nat
|
||||||
|| LANG= netstat -nat | awk 'NR > 2 && /TIME_WAIT/ {print $5}'
|
else
|
||||||
} | sort | uniq -c | sort -rn | head -n 20
|
LANG= netstat -nat
|
||||||
|
fi | awk '/TIME[-_]WAIT/ {print $5}' | sort | uniq -c | sort -rn | head -n 20
|
||||||
}
|
}
|
||||||
|
|
||||||
# top20 of Find SYN connection
|
# top20 of Find SYN connection
|
||||||
function syn20() {
|
function syn20() {
|
||||||
{
|
if (( $+commands[ss] )); then
|
||||||
LANG= ss -an | awk '/SYN/ {print $5}' \
|
LANG= ss -an
|
||||||
|| LANG= netstat -an | awk '/SYN/ {print $5}'
|
else
|
||||||
} | awk -F: '{print $1}' | sort | uniq -c | sort -nr | head -n20
|
LANG= netstat -an
|
||||||
|
fi | awk '/SYN/ {print $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -nr | head -n20
|
||||||
}
|
}
|
||||||
|
|
||||||
# Printing process according to the port number
|
# Printing process according to the port number
|
||||||
function port_pro() {
|
function port_pro() {
|
||||||
LANG= ss -ntlp | awk "NR > 1 && /:${1:-}/ {print \$6}" | sed 's/.*pid=\([^,]*\).*/\1/' \
|
if (( $+commands[ss] )); then
|
||||||
|| LANG= netstat -ntlp | awk "NR > 2 && /:${1:-}/ {print \$7}" | cut -d/ -f1
|
LANG= ss -ntlp | awk "NR > 1 && /:${1:-}/ {print \$6}" | sed 's/.*pid=\([^,]*\).*/\1/'
|
||||||
|
else
|
||||||
|
LANG= netstat -ntlp | awk "NR > 2 && /:${1:-}/ {print \$7}" | cut -d/ -f1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# top10 of gain access to the ip address
|
# top10 of gain access to the ip address
|
||||||
|
|||||||
@@ -178,6 +178,11 @@ alias tmux=_zsh_tmux_plugin_run
|
|||||||
function _tmux_directory_session() {
|
function _tmux_directory_session() {
|
||||||
# current directory without leading path
|
# current directory without leading path
|
||||||
local dir=${PWD##*/}
|
local dir=${PWD##*/}
|
||||||
|
# tmux target syntax treats '.' and ':' as separators, a leading '$', '@' or '%'
|
||||||
|
# as an id and a leading '=' as an exact-match prefix, so a session named after
|
||||||
|
# such a directory can't be found on reattach
|
||||||
|
dir=${dir//[.:]/_}
|
||||||
|
dir=${dir/#[\$@%=]/_}
|
||||||
# md5 hash for the full working directory path
|
# md5 hash for the full working directory path
|
||||||
local md5=$(printf '%s' "$PWD" | md5sum | cut -d ' ' -f 1)
|
local md5=$(printf '%s' "$PWD" | md5sum | cut -d ' ' -f 1)
|
||||||
# human friendly unique session name for this directory
|
# human friendly unique session name for this directory
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
PROMPT="${FG[117]}%~%{$reset_color%}\$(git_prompt_info)\$(virtualenv_prompt_info)${FG[133]}\$(git_prompt_status) ${FG[077]}ᐅ%{$reset_color%} "
|
PROMPT="${FG[117]}%~%{$reset_color%}\$(git_prompt_info)\$(virtualenv_prompt_info)${FG[133]}\$(git_prompt_status) ${FG[077]}%(?..${FG[160]}[%?] )ᐅ%{$reset_color%} "
|
||||||
|
|
||||||
ZSH_THEME_GIT_PROMPT_PREFIX=" ${FG[012]}("
|
ZSH_THEME_GIT_PROMPT_PREFIX=" ${FG[012]}("
|
||||||
ZSH_THEME_GIT_PROMPT_SUFFIX="${FG[012]})%{$reset_color%}"
|
ZSH_THEME_GIT_PROMPT_SUFFIX="${FG[012]})%{$reset_color%}"
|
||||||
|
|||||||
Reference in New Issue
Block a user