summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2022-05-23 12:25:11 -0600
committerTuowen Zhao <ztuowen@gmail.com>2022-05-23 12:25:11 -0600
commit901674e84756d64024cdc70f9590c3557c6d92d6 (patch)
treed3b90c50a39f4a7f220b0a19718dc305fe1c7af4
parent2023d3ab658fe8ed4dd4ca33cd5974ab8f0ad945 (diff)
parent39b600e9e564db3dec265fcf2e3db4b5568dd93a (diff)
downloadzsh-901674e84756d64024cdc70f9590c3557c6d92d6.tar.gz
zsh-901674e84756d64024cdc70f9590c3557c6d92d6.tar.bz2
zsh-901674e84756d64024cdc70f9590c3557c6d92d6.zip
Merge remote-tracking branch 'github/master'
-rw-r--r--.github/workflows/project.yml4
-rw-r--r--CONTRIBUTING.md8
-rw-r--r--README.md14
-rw-r--r--lib/cli.zsh6
-rw-r--r--lib/functions.zsh4
-rw-r--r--oh-my-zsh.sh11
-rw-r--r--plugins/aliases/aliases.plugin.zsh4
-rw-r--r--plugins/aliases/cheatsheet.py2
-rw-r--r--plugins/boot2docker/README.md6
-rw-r--r--plugins/boot2docker/_boot2docker73
-rw-r--r--plugins/docker/README.md43
-rw-r--r--plugins/docker/docker.plugin.zsh39
-rw-r--r--plugins/frontend-search/frontend-search.plugin.zsh3
-rw-r--r--plugins/git-prompt/README.md2
-rw-r--r--plugins/git-prompt/git-prompt.plugin.zsh2
-rw-r--r--plugins/git-prompt/gitstatus.py2
-rw-r--r--plugins/gnu-utils/gnu-utils.plugin.zsh3
-rw-r--r--plugins/httpie/README.md6
-rw-r--r--plugins/httpie/httpie.plugin.zsh7
-rw-r--r--plugins/jsontools/jsontools.plugin.zsh12
-rw-r--r--plugins/nvm/nvm.plugin.zsh10
-rw-r--r--plugins/pyenv/pyenv.plugin.zsh2
-rw-r--r--plugins/python/README.md2
-rw-r--r--plugins/python/python.plugin.zsh6
-rw-r--r--plugins/shell-proxy/.editorconfig3
-rwxr-xr-xplugins/shell-proxy/ssh-proxy.py23
-rw-r--r--plugins/systemadmin/systemadmin.plugin.zsh46
-rw-r--r--plugins/vi-mode/vi-mode.plugin.zsh2
-rw-r--r--plugins/web-search/web-search.plugin.zsh2
-rw-r--r--themes/frisk.zsh-theme2
-rw-r--r--tools/check_for_upgrade.sh20
31 files changed, 180 insertions, 189 deletions
diff --git a/.github/workflows/project.yml b/.github/workflows/project.yml
index 4b671d449..b2219893d 100644
--- a/.github/workflows/project.yml
+++ b/.github/workflows/project.yml
@@ -1,9 +1,9 @@
name: Project tracking
on:
issues:
- types: [opened]
+ types: [opened, reopened]
pull_request_target:
- types: [opened, synchronize]
+ types: [opened, reopened, synchronize]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 605142845..2bd877892 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -47,7 +47,7 @@ It should include the data gathered as indicated above, along with:
2. What the correct behavior should be
3. What the actual behavior is
-Please copy to anyone relevant (_eg_ plugin maintainers) by mentioning their GitHub handle
+Please copy to anyone relevant (e.g. plugin maintainers) by mentioning their GitHub handle
(starting with `@`) in your message.
We will do our very best to help you.
@@ -59,7 +59,7 @@ your suggestion.
If you find one, comment on it so we can know there are more people supporting it.
-If not, you can go ahead and create an issue. Please copy to anyone relevant (_eg_ plugin
+If not, you can go ahead and create an issue. Please copy to anyone relevant (e.g. plugin
maintainers) by mentioning their GitHub handle (starting with `@`) in your message.
## Submitting Pull Requests
@@ -99,10 +99,10 @@ covering or related to what you want to add.
If you find one, try it out and work with the author on a common solution.
-If not, then go ahead and submit a PR. Please copy to anyone relevant (_eg_ plugin
+If not, then go ahead and submit a PR. Please copy to anyone relevant (e.g. plugin
maintainers) by mentioning their GitHub handle (starting with `@`) in your message.
-For any extensive change, _eg_ a new plugin, you will have to find testers to +1 your PR.
+For any extensive change, such as a new plugin, you will have to find testers to +1 your PR.
----
diff --git a/README.md b/README.md
index 4c41fad81..1e4b7ff70 100644
--- a/README.md
+++ b/README.md
@@ -72,7 +72,7 @@ Oh My Zsh is installed by running one of the following commands in your terminal
| **wget** | `sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` |
| **fetch** | `sh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` |
-_Note that previous configuration in `.zshrc` will be placed in `.pre-oh-my-zsh`. After installation you can move configuration you want to preserve into `.zshrc`._
+_Note that any previous `.zshrc` will be renamed to `.zshrc.pre-oh-my-zsh`. After installation, you can move the configuration you want to preserve into the new `.zshrc`._
#### Manual inspection
@@ -117,7 +117,7 @@ _Note that the plugins are separated by whitespace (spaces, tabs, new lines...).
#### Using Plugins
-Each plugin includes a **README**, documenting it. This README should show the aliases (if the plugin adds any) and extra goodies that are included in that particular plugin.
+Each built-in plugin includes a **README**, documenting it. This README should show the aliases (if the plugin adds any) and extra goodies that are included in that particular plugin.
### Themes
@@ -140,7 +140,7 @@ ZSH_THEME="agnoster" # (this is one of the fancy ones)
# see https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#agnoster
```
-_Note: many themes require installing the [Powerline Fonts](https://github.com/powerline/fonts) in order to render properly._
+_Note: many themes require installing a [Powerline Font](https://github.com/powerline/fonts) or a [Nerd Font](https://github.com/ryanoasis/nerd-fonts) in order to render properly. Without them, these themes will render [weird prompt symbols](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ#i-have-a-weird-character-in-my-prompt)_
Open up a new terminal window and your prompt should look something like this:
@@ -196,9 +196,9 @@ ZSH="$HOME/.dotfiles/oh-my-zsh" sh install.sh
#### Unattended install
-If you're running the Oh My Zsh install script as part of an automated install, you can pass the
-flag `--unattended` to the `install.sh` script. This will have the effect of not trying to change
-the default shell, and also won't run `zsh` when the installation has finished.
+If you're running the Oh My Zsh install script as part of an automated install, you can pass the `--unattended`
+flag to the `install.sh` script. This will have the effect of not trying to change
+the default shell, and it also won't run `zsh` when the installation has finished.
```sh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
@@ -329,7 +329,7 @@ Before you participate in our delightful community, please read the [code of con
I'm far from being a [Zsh](https://www.zsh.org/) expert and suspect there are many ways to improve – if you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests!
-We also need people to test out pull-requests. So take a look through [the open issues](https://github.com/ohmyzsh/ohmyzsh/issues) and help where you can.
+We also need people to test out pull requests. So take a look through [the open issues](https://github.com/ohmyzsh/ohmyzsh/issues) and help where you can.
See [Contributing](CONTRIBUTING.md) for more details.
diff --git a/lib/cli.zsh b/lib/cli.zsh
index bf783d9f3..b71f6d9ce 100644
--- a/lib/cli.zsh
+++ b/lib/cli.zsh
@@ -573,13 +573,13 @@ function _omz::pr::test {
# Rebase pull request branch against the current master
_omz::log info "rebasing PR #$1..."
- local gpgsign
+ local ret gpgsign
{
# Back up commit.gpgsign setting: use --local to get the current repository
# setting, not the global one. If --local is not a known option, it will
# exit with a 129 status code.
- gpgsign=$(command git config --local commit.gpgsign 2>/dev/null)
- [[ $? -ne 129 ]] || gpgsign=$(command git config commit.gpgsign 2>/dev/null)
+ gpgsign=$(command git config --local commit.gpgsign 2>/dev/null) || ret=$?
+ [[ $ret -ne 129 ]] || gpgsign=$(command git config commit.gpgsign 2>/dev/null)
command git config commit.gpgsign false
command git rebase master ohmyzsh/pull-$1 || {
diff --git a/lib/functions.zsh b/lib/functions.zsh
index 61f4dd49e..dfcc4d961 100644
--- a/lib/functions.zsh
+++ b/lib/functions.zsh
@@ -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
diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
index ab32ee9d3..925ee46aa 100644
--- a/oh-my-zsh.sh
+++ b/oh-my-zsh.sh
@@ -120,17 +120,18 @@ fi
if [[ "$ZSH_DISABLE_COMPFIX" != true ]]; then
source "$ZSH/lib/compfix.zsh"
- # If completion insecurities exist, warn the user
- handle_completion_insecurities
# Load only from secure directories
- compinit -i -C -d "$ZSH_COMPDUMP"
+ compinit -i -d "$ZSH_COMPDUMP"
+ # If completion insecurities exist, warn the user
+ handle_completion_insecurities &|
else
# If the user wants it, load from all found directories
- compinit -u -C -d "$ZSH_COMPDUMP"
+ compinit -u -d "$ZSH_COMPDUMP"
fi
# Append zcompdump metadata if missing
-if (( $zcompdump_refresh )); then
+if (( $zcompdump_refresh )) \
+ || ! command grep -q -Fx "$zcompdump_revision" "$ZSH_COMPDUMP" 2>/dev/null; then
# Use `tee` in case the $ZSH_COMPDUMP filename is invalid, to silence the error
# See https://github.com/ohmyzsh/ohmyzsh/commit/dd1a7269#commitcomment-39003489
tee -a "$ZSH_COMPDUMP" &>/dev/null <<EOF
diff --git a/plugins/aliases/aliases.plugin.zsh b/plugins/aliases/aliases.plugin.zsh
index b3d9340f0..4e1e0558e 100644
--- a/plugins/aliases/aliases.plugin.zsh
+++ b/plugins/aliases/aliases.plugin.zsh
@@ -3,9 +3,9 @@
# - acs: alias cheatsheet
# group alias by command, pass addition argv to grep.
function acs(){
- (( $+commands[python] )) || {
+ (( $+commands[python3] )) || {
echo "[error] No python executable detected"
return
}
- alias | python ${functions_source[$0]:h}/cheatsheet.py $@
+ alias | python3 ${functions_source[$0]:h}/cheatsheet.py $@
}
diff --git a/plugins/aliases/cheatsheet.py b/plugins/aliases/cheatsheet.py
index 694afd31c..a7e3968b0 100644
--- a/plugins/aliases/cheatsheet.py
+++ b/plugins/aliases/cheatsheet.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import sys
import itertools
import termcolor
diff --git a/plugins/boot2docker/README.md b/plugins/boot2docker/README.md
deleted file mode 100644
index 9551e2351..000000000
--- a/plugins/boot2docker/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## Boot2docker autocomplete plugin
-
-- Adds autocomplete options for all boot2docker commands.
-
-
-Maintainer : Manfred Touron ([@moul](https://github.com/moul))
diff --git a/plugins/boot2docker/_boot2docker b/plugins/boot2docker/_boot2docker
deleted file mode 100644
index 3116bd14c..000000000
--- a/plugins/boot2docker/_boot2docker
+++ /dev/null
@@ -1,73 +0,0 @@
-#compdef boot2docker
-
-# Boot2docker autocompletion for oh-my-zsh
-# Requires: Boot2docker installed
-# Author: Manfred Touron (@moul)
-
-local -a _1st_arguments
-_1st_arguments=(
- "init":"Create a new Boot2Docker VM."
- "up":"Start VM from any states."
- "start":"Start VM from any states."
- "boot":"Start VM from any states."
- "ssh":"[ssh-command] Login to VM via SSH."
- "save":"Suspend VM and save state to disk."
- "suspend":"Suspend VM and save state to disk."
- "down":"Gracefully shutdown the VM."
- "stop":"Gracefully shutdown the VM."
- "halt":"Gracefully shutdown the VM."
- "restart":"Gracefully reboot the VM."
- "poweroff":"Forcefully power off the VM (may corrupt disk image)."
- "reset":"Forcefully power cycle the VM (may corrupt disk image)."
- "delete":"Delete Boot2Docker VM and its disk image."
- "destroy":"Delete Boot2Docker VM and its disk image."
- "config":"Show selected profile file settings."
- "cfg":"Show selected profile file settings."
- "info":"Display detailed information of VM."
- "ip":"Display the IP address of the VM's Host-only network."
- "socket":"Display the DOCKER_HOST socket to connect to."
- "shellinit":"Display the shell command to set up the Docker client."
- "status":"Display current state of VM."
- "download":"Download Boot2Docker ISO image."
- "upgrade":"Upgrade the Boot2Docker ISO image (restart if running)."
- "version":"Display version information."
-)
-
-_arguments \
- '(--basevmdk)--basevmdk[Path to VMDK to use as base for persistent partition]' \
- '(--cpus)'{-c,--cpus}'[number of CPUs for boot2docker.]' \
- '(--clobber)--clobber[overwrite Docker client binary on boot2docker upgrade]' \
- '(--dhcp)--dhcp[enable VirtualBox host-only network DHCP.]' \
- '(--dhcpip)--dhcpip[VirtualBox host-only network DHCP server address.]' \
- '(-s --disksize)'{-s,--disksize}'[boot2docker disk image size (in MB).]' \
- '(--dockerport)--dockerport[host Docker port (forward to port 2376 in VM). (deprecated - use with care)]' \
- '(--driver)--driver[hypervisor driver.]' \
- '(--force-upgrade-download)--force-upgrade-download[always download on boot2docker upgrade, never skip.]' \
- '(--hostip)--hostip[VirtualBox host-only network IP address.]' \
- '(--iso)--iso[path to boot2docker ISO image.]' \
- '(--iso-url)--iso-url[/api.github.com/repos/boot2docker/boot2docker/releases": source URL to provision the boot2docker ISO image.]' \
- '(--lowerip)--lowerip[VirtualBox host-only network DHCP lower bound.]' \
- '(--memory)'{-m,--memory}'[virtual machine memory size (in MB).]' \
- '(--netmask)--netmask[VirtualBox host-only network mask.]' \
- '(--no-dummy)--no-dummy[Example parameter for the dummy driver.]' \
- '(--retries)--retries[number of port knocking retries during 'start']' \
- '(--serial)--serial[try serial console to get IP address (experimental)]' \
- '(--serialfile)--serialfile[path to the serial socket/pipe.]' \
- '(--ssh)--ssh[path to SSH client utility.]' \
- '(--ssh-keygen)--ssh-keygen[path to ssh-keygen utility.]' \
- '(--sshkey)--sshkey[path to SSH key to use.]' \
- '(--sshport)--sshport[host SSH port (forward to port 22 in VM).]' \
- '(--upperip)--upperip[VirtualBox host-only network DHCP upper bound.]' \
- '(--vbm)--vbm[path to VirtualBox management utility.]' \
- '(--vbox-share)--vbox-share[(defaults to "/Users=Users" if no shares are specified; use "disable" to explicitly prevent any shares from being created) List of directories to share during "up|start|boot" via VirtualBox Guest Additions, with optional labels]' \
- '(--verbose)'{-v,--verbose}'[display verbose command invocations.]' \
- '(--vm)--vm[virtual machine name.]' \
- '(--waittime)--waittime[Time in milliseconds to wait between port knocking retries during 'start']' \
- '*:: :->subcmds' && return 0
-
-#_arguments '*:: :->command'
-
-if (( CURRENT == 1 )); then
- _describe -t commands "boot2docker command" _1st_arguments
- return
-fi
diff --git a/plugins/docker/README.md b/plugins/docker/README.md
index fab7aa8f1..2b721c770 100644
--- a/plugins/docker/README.md
+++ b/plugins/docker/README.md
@@ -1,6 +1,6 @@
# Docker plugin
-This plugin adds auto-completion for [docker](https://www.docker.com/).
+This plugin adds auto-completion and aliases for [docker](https://www.docker.com/).
To use it add `docker` to the plugins array in your zshrc file.
@@ -28,7 +28,46 @@ the lines below to your zshrc file**, but be aware of the side effects:
>
> Therefore, this behavior is disabled by default. To enable it:
>
-> ```
+> ```sh
> zstyle ':completion:*:*:docker:*' option-stacking yes
> zstyle ':completion:*:*:docker-*:*' option-stacking yes
> ```
+
+## Aliases
+
+| Alias | Command | Description |
+| :------ | :-------------------------- | :--------------------------------------------------------------------------------------- |
+| dbl | `docker build` | Build an image from a Dockerfile |
+| dcin | `docker container inspect` | Display detailed information on one or more containers |
+| dlo | `docker container logs` | Fetch the logs of a docker container |
+| dcls | `docker container ls` | List all the running docker containers |
+| dclsa | `docker container ls -a` | List all running and stopped containers |
+| dpo | `docker container port` | List port mappings or a specific mapping for the container |
+| dpu | `docker pull` | Pull an image or a repository from a registry |
+| dr | `docker container run` | Create a new container and start it using the specified command |
+| drit | `docker container run -it` | Create a new container and start it in an interactive shell |
+| drm | `docker container rm` | Remove the specified container(s) |
+| drm! | `docker container rm -f` | Force the removal of a running container (uses SIGKILL) |
+| dst | `docker container start` | Start one or more stopped containers |
+| dstp | `docker container stop` | Stop one or more running containers |
+| dtop | `docker top` | Display the running processes of a container |
+| dxc | `docker container exec` | Run a new command in a running container |
+| dxcit | `docker container exec -it` | Run a new command in a running container in an interactive shell |
+| | | **Docker Images** |
+| 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 |
+| dirm | `docker image rm` | Remove one or more images |
+| dit | `docker image tag` | Add a name and tag to a particular image |
+| | | **Docker Network** |
+| dnc | `docker network create` | Create a new network |
+| dncn | `docker network connect` | Connect a container to a network |
+| dndcn | `docker network disconnect` | Disconnect a container from a network |
+| dni | `docker network inspect` | Return information about one or more networks |
+| dnls | `docker network ls` | List all networks the engine daemon knows about, including those spanning multiple hosts |
+| dnrm | `docker network rm` | Remove one or more networks |
+| | | **Docker Volume** |
+| dvi | `docker volume inspect` | Display detailed information about one or more volumes |
+| dvls | `docker volume ls` | List all the volumes known to docker |
+| dvprune | `docker volume prune` | Cleanup dangling volumes |
diff --git a/plugins/docker/docker.plugin.zsh b/plugins/docker/docker.plugin.zsh
new file mode 100644
index 000000000..843c8e241
--- /dev/null
+++ b/plugins/docker/docker.plugin.zsh
@@ -0,0 +1,39 @@
+alias dbl='docker build'
+alias dpu='docker pull'
+alias dtop='docker top'
+
+# docker containers
+alias dcin='docker container inspect'
+alias dlo='docker container logs'
+alias dcls='docker container ls'
+alias dclsa='docker container ls -a'
+alias dpo='docker container port'
+alias dr='docker container run'
+alias drit='docker container run -it'
+alias drm='docker container rm'
+alias 'drm!'='docker container rm -f'
+alias dst='docker container start'
+alias dstp='docker container stop'
+alias dxc='docker container exec'
+alias dxcit='docker container exec -it'
+
+# docker images
+alias dib='docker image build'
+alias dii='docker image inspect'
+alias dils='docker image ls'
+alias dip='docker image push'
+alias dirm='docker image rm'
+alias dit='docker image tag'
+
+# docker network
+alias dnc='docker network create'
+alias dncn='docker network connect'
+alias dndcn='docker network disconnect'
+alias dni='docker network inspect'
+alias dnls='docker network ls'
+alias dnrm='docker network rm'
+
+# docker volume
+alias dvi='docker volume inspect'
+alias dvls='docker volume ls'
+alias dvprune='docker volume prune'
diff --git a/plugins/frontend-search/frontend-search.plugin.zsh b/plugins/frontend-search/frontend-search.plugin.zsh
index 7f8d5c90c..b9e2fe95d 100644
--- a/plugins/frontend-search/frontend-search.plugin.zsh
+++ b/plugins/frontend-search/frontend-search.plugin.zsh
@@ -103,8 +103,7 @@ function frontend() {
# build search url:
# join arguments passed with '%20', then append to search context URL
- # TODO substitute for proper urlencode method
- url="${urls[$1]}${(j:%20:)@[2,-1]}"
+ url="${urls[$1]}$(omz_urlencode -P ${@[2,-1]})"
echo "Opening $url ..."
diff --git a/plugins/git-prompt/README.md b/plugins/git-prompt/README.md
index 83d365c84..8775af893 100644
--- a/plugins/git-prompt/README.md
+++ b/plugins/git-prompt/README.md
@@ -13,7 +13,7 @@ See the [original repository](https://github.com/olivierverdier/zsh-git-prompt).
## Requirements
-This plugin uses `python`, so your host needs to have it installed
+This plugin uses `python3`, so your host needs to have it installed.
## Examples
diff --git a/plugins/git-prompt/git-prompt.plugin.zsh b/plugins/git-prompt/git-prompt.plugin.zsh
index c86c1f59b..0485e317c 100644
--- a/plugins/git-prompt/git-prompt.plugin.zsh
+++ b/plugins/git-prompt/git-prompt.plugin.zsh
@@ -36,7 +36,7 @@ function update_current_git_vars() {
unset __CURRENT_GIT_STATUS
local gitstatus="$__GIT_PROMPT_DIR/gitstatus.py"
- _GIT_STATUS=$(python ${gitstatus} 2>/dev/null)
+ _GIT_STATUS=$(python3 ${gitstatus} 2>/dev/null)
__CURRENT_GIT_STATUS=("${(@s: :)_GIT_STATUS}")
GIT_BRANCH=$__CURRENT_GIT_STATUS[1]
GIT_AHEAD=$__CURRENT_GIT_STATUS[2]
diff --git a/plugins/git-prompt/gitstatus.py b/plugins/git-prompt/gitstatus.py
index 4dea8000f..b5c3c9a0c 100644
--- a/plugins/git-prompt/gitstatus.py
+++ b/plugins/git-prompt/gitstatus.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
from __future__ import print_function
import os
diff --git a/plugins/gnu-utils/gnu-utils.plugin.zsh b/plugins/gnu-utils/gnu-utils.plugin.zsh
index 6ede9e3a7..9419127d8 100644
--- a/plugins/gnu-utils/gnu-utils.plugin.zsh
+++ b/plugins/gnu-utils/gnu-utils.plugin.zsh
@@ -35,6 +35,9 @@ __gnu_utils() {
# Not part of either coreutils or findutils, installed separately.
gcmds+=('gsed' 'gtar' 'gtime' 'gmake' 'ggrep')
+ # can be built optionally
+ gcmds+=('ghostname')
+
for gcmd in "${gcmds[@]}"; do
# Do nothing if the command isn't found
(( ${+commands[$gcmd]} )) || continue
diff --git a/plugins/httpie/README.md b/plugins/httpie/README.md
index 40d60c47d..25bdd0c7d 100644
--- a/plugins/httpie/README.md
+++ b/plugins/httpie/README.md
@@ -11,10 +11,4 @@ plugins=(... httpie)
It uses completion from [zsh-completions](https://github.com/zsh-users/zsh-completions).
-## Aliases
-
-| Alias | Command |
-| ------------ | ---------------------------------------------------------------- |
-| `https` | `http --default-scheme=https` |
-
**Maintainer:** [lululau](https://github.com/lululau)
diff --git a/plugins/httpie/httpie.plugin.zsh b/plugins/httpie/httpie.plugin.zsh
deleted file mode 100644
index 088a1f1cf..000000000
--- a/plugins/httpie/httpie.plugin.zsh
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-# Aliases
-# (sorted alphabetically)
-#
-
-alias https='http --default-scheme=https'
-
diff --git a/plugins/jsontools/jsontools.plugin.zsh b/plugins/jsontools/jsontools.plugin.zsh
index 857ca0ec9..49828d32d 100644
--- a/plugins/jsontools/jsontools.plugin.zsh
+++ b/plugins/jsontools/jsontools.plugin.zsh
@@ -8,7 +8,7 @@ fi
# If method undefined, find the first one that is installed
if [[ -z "$JSONTOOLS_METHOD" ]]; then
- for JSONTOOLS_METHOD in node python ruby; do
+ for JSONTOOLS_METHOD in node python3 ruby; do
# If method found, break out of loop
(( $+commands[$JSONTOOLS_METHOD] )) && break
# Otherwise unset the variable
@@ -45,12 +45,12 @@ case "$JSONTOOLS_METHOD" in
xargs -0 node -e "console.log(decodeURIComponent(process.argv[1]))"
}
;;
- python)
+ python3)
function pp_json() {
- python -c 'import sys; del sys.path[0]; import runpy; runpy._run_module_as_main("json.tool")'
+ python3 -c 'import sys; del sys.path[0]; import runpy; runpy._run_module_as_main("json.tool")'
}
function is_json() {
- python -c '
+ python3 -c '
import sys; del sys.path[0];
import json
try:
@@ -61,14 +61,14 @@ except ValueError:
'
}
function urlencode_json() {
- python -c '
+ python3 -c '
import sys; del sys.path[0];
from urllib.parse import quote_plus
print(quote_plus(sys.stdin.read()))
'
}
function urldecode_json() {
- python -c '
+ python3 -c '
import sys; del sys.path[0];
from urllib.parse import unquote_plus
print(unquote_plus(sys.stdin.read()))
diff --git a/plugins/nvm/nvm.plugin.zsh b/plugins/nvm/nvm.plugin.zsh
index 3ef8cc1d8..630854a71 100644
--- a/plugins/nvm/nvm.plugin.zsh
+++ b/plugins/nvm/nvm.plugin.zsh
@@ -8,22 +8,24 @@ if [[ -z "$NVM_DIR" ]]; then
fi
# Don't try to load nvm if command already available
-which nvm &> /dev/null && return
+# Note: nvm is a function so we need to use `which`
+! which nvm &>/dev/null || return
if [[ -f "$NVM_DIR/nvm.sh" ]]; then
# Load nvm if it exists in $NVM_DIR
source "$NVM_DIR/nvm.sh" ${NVM_LAZY+"--no-use"}
-else
+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:-/usr/local/opt/nvm}"
+ 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
- # Exit the plugin if we couldn't find nvm
return
fi
+else
+ return
fi
# Call nvm when first using node, npm or yarn
diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh
index ebb1a708a..7fbd1589e 100644
--- a/plugins/pyenv/pyenv.plugin.zsh
+++ b/plugins/pyenv/pyenv.plugin.zsh
@@ -89,7 +89,7 @@ if [[ $FOUND_PYENV -eq 1 ]]; then
else
# Fall back to system python
function pyenv_prompt_info() {
- local version="$(python -V 2>&1 | cut -d' ' -f2)"
+ local version="$(python3 -V 2>&1 | cut -d' ' -f2)"
echo "system: ${version:gs/%/%%}"
}
fi
diff --git a/plugins/python/README.md b/plugins/python/README.md
index c1f0adef8..97c1a34ee 100644
--- a/plugins/python/README.md
+++ b/plugins/python/README.md
@@ -12,7 +12,7 @@ plugins=(... python)
| Command | Description |
| ---------------- | -------------------------------------------------------------------------------------- |
-| `py` | Runs `python` |
+| `py` | Runs `python3` |
| `ipython` | Runs the appropriate `ipython` version according to the activated virtualenv |
| `pyfind` | Finds .py files recursively in the current directory |
| `pyclean [dirs]` | Deletes byte-code and cache files from a list of directories or the current one |
diff --git a/plugins/python/python.plugin.zsh b/plugins/python/python.plugin.zsh
index 7a73ab92a..2fbb59577 100644
--- a/plugins/python/python.plugin.zsh
+++ b/plugins/python/python.plugin.zsh
@@ -1,5 +1,5 @@
# python command
-alias py='python'
+alias py='python3'
# Find python file
alias pyfind='find . -name "*.py"'
@@ -44,10 +44,10 @@ function pyuserpaths() {
alias pygrep='grep -nr --include="*.py"'
# Run proper IPython regarding current virtualenv (if any)
-alias ipython="python -c 'import IPython; IPython.terminal.ipapp.launch_new_instance()'"
+alias ipython="python3 -c 'import IPython; IPython.terminal.ipapp.launch_new_instance()'"
# Share local directory as a HTTP server
-alias pyserver="python -m http.server"
+alias pyserver="python3 -m http.server"
## venv utilities
diff --git a/plugins/shell-proxy/.editorconfig b/plugins/shell-proxy/.editorconfig
new file mode 100644
index 000000000..b7c70d16d
--- /dev/null
+++ b/plugins/shell-proxy/.editorconfig
@@ -0,0 +1,3 @@
+[*.py]
+indent_size = 4
+indent_style = space
diff --git a/plugins/shell-proxy/ssh-proxy.py b/plugins/shell-proxy/ssh-proxy.py
index 6773a77bc..a498c84bc 100755
--- a/plugins/shell-proxy/ssh-proxy.py
+++ b/plugins/shell-proxy/ssh-proxy.py
@@ -20,14 +20,17 @@ proxy_protocols = {
if parsed.scheme not in proxy_protocols:
raise TypeError('unsupported proxy protocol: "{}"'.format(parsed.scheme))
-argv = [
- "nc",
- "-X",
- proxy_protocols[parsed.scheme], # Supported protocols are 4 (SOCKS v4), 5 (SOCKS v5) and connect (HTTP proxy). Default SOCKS v5 is used.
- "-x",
- parsed.netloc, # proxy-host:proxy-port
- sys.argv[1], # host
- sys.argv[2], # port
-]
+def make_argv():
+ yield "nc"
+ if sys.platform == 'linux':
+ # caveats: macOS built-in netcat command not supported proxy-type
+ yield "-X" # --proxy-type
+ # Supported protocols are 4 (SOCKS v4), 5 (SOCKS v5) and connect (HTTP proxy).
+ # Default SOCKS v5 is used.
+ yield proxy_protocols[parsed.scheme]
+ yield "-x" # --proxy
+ yield parsed.netloc # proxy-host:proxy-port
+ yield sys.argv[1] # host
+ yield sys.argv[2] # port
-subprocess.call(argv)
+subprocess.call(make_argv())
diff --git a/plugins/systemadmin/systemadmin.plugin.zsh b/plugins/systemadmin/systemadmin.plugin.zsh
index 9a2129060..8e5e0af71 100644
--- a/plugins/systemadmin/systemadmin.plugin.zsh
+++ b/plugins/systemadmin/systemadmin.plugin.zsh
@@ -34,109 +34,109 @@ alias pscpu10='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1,1n -nr | head
alias hist10='print -l ${(o)history%% *} | uniq -c | sort -nr | head -n 10'
# directory LS
-dls () {
+function dls() {
print -l *(/)
}
-psgrep() {
+function psgrep() {
ps aux | grep "${1:-.}" | grep -v grep
}
# Kills any process that matches a regexp passed to it
-killit() {
+function killit() {
ps aux | grep -v "grep" | grep "$@" | awk '{print $2}' | xargs sudo kill
}
# list contents of directories in a tree-like format
if ! (( $+commands[tree] )); then
- tree () {
+ function tree() {
find $@ -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
}
fi
# Sort connection state
-sortcons() {
+function sortcons() {
netstat -nat |awk '{print $6}'|sort|uniq -c|sort -rn
}
# View all 80 Port Connections
-con80() {
+function con80() {
netstat -nat|grep -i ":80"|wc -l
}
# On the connected IP sorted by the number of connections
-sortconip() {
+function sortconip() {
netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
}
# top20 of Find the number of requests on 80 port
-req20() {
+function req20() {
netstat -anlp|grep 80|grep tcp|awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -nr|head -n20
}
# top20 of Using tcpdump port 80 access to view
-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
}
# top20 of Find time_wait connection
-timewait20() {
+function timewait20() {
netstat -n|grep TIME_WAIT|awk '{print $5}'|sort|uniq -c|sort -rn|head -n20
}
# top20 of Find SYN connection
-syn20() {
+function syn20() {
netstat -an | grep SYN | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -nr|head -n20
}
# Printing process according to the port number
-port_pro() {
+function port_pro() {
netstat -ntlp | grep "${1:-.}" | awk '{print $7}' | cut -d/ -f1
}
# top10 of gain access to the ip address
-accessip10() {
+function accessip10() {
awk '{counts[$(11)]+=1}; END {for(url in counts) print counts[url], url}' "$(retlog)"
}
# top20 of Most Visited file or page
-visitpage20() {
+function visitpage20() {
awk '{print $11}' "$(retlog)"|sort|uniq -c|sort -nr|head -n 20
}
# top100 of Page lists the most time-consuming (more than 60 seconds) as well as the corresponding page number of occurrences
-consume100() {
+function consume100() {
awk '($NF > 60 && $7~/\.php/){print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -n 100
# if django website or other website make by no suffix language
# awk '{print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -n 100
}
# Website traffic statistics (G)
-webtraffic() {
+function webtraffic() {
awk "{sum+=$10} END {print sum/1024/1024/1024}" "$(retlog)"
}
# Statistical connections 404
-c404() {
+function c404() {
awk '($9 ~/404/)' "$(retlog)" | awk '{print $9,$7}' | sort
}
# Statistical http status.
-httpstatus() {
+function httpstatus() {
awk '{counts[$(9)]+=1}; END {for(code in counts) print code, counts[code]}' "$(retlog)"
}
# Delete 0 byte file
-d0() {
+function d0() {
find "${1:-.}" -type f -size 0 -exec rm -rf {} \;
}
# gather external ip address
-geteip() {
+function geteip() {
curl -s -S -4 https://icanhazip.com
curl -s -S -6 https://icanhazip.com
}
# determine local IP address(es)
-getip() {
+function getip() {
if (( ${+commands[ip]} )); then
ip addr | awk '/inet /{print $2}' | command grep -v 127.0.0.1
else
@@ -145,11 +145,11 @@ getip() {
}
# Clear zombie processes
-clrz() {
+function clrz() {
ps -eal | awk '{ if ($2 == "Z") {print $4}}' | kill -9
}
# Second concurrent
-conssec() {
+function conssec() {
awk '{if($9~/200|30|404/)COUNT[$4]++}END{for( a in COUNT) print a,COUNT[a]}' "$(retlog)"|sort -k 2 -nr|head -n10
}
diff --git a/plugins/vi-mode/vi-mode.plugin.zsh b/plugins/vi-mode/vi-mode.plugin.zsh
index b40b29961..149d6bbd5 100644
--- a/plugins/vi-mode/vi-mode.plugin.zsh
+++ b/plugins/vi-mode/vi-mode.plugin.zsh
@@ -119,7 +119,7 @@ function wrap_clipboard_widgets() {
done
}
-wrap_clipboard_widgets copy vi-yank vi-yank-eol vi-backward-kill-word vi-change-whole-line vi-delete
+wrap_clipboard_widgets copy vi-yank vi-yank-eol vi-backward-kill-word vi-change-whole-line vi-delete vi-delete-char
wrap_clipboard_widgets paste vi-put-{before,after}
unfunction wrap_clipboard_widgets
diff --git a/plugins/web-search/web-search.plugin.zsh b/plugins/web-search/web-search.plugin.zsh
index 0a2b8809e..229948894 100644
--- a/plugins/web-search/web-search.plugin.zsh
+++ b/plugins/web-search/web-search.plugin.zsh
@@ -35,7 +35,7 @@ function web_search() {
if [[ $# -gt 1 ]]; then
# build search url:
# join arguments passed with '+', then append to search engine URL
- url="${urls[$1]}${(j:+:)@[2,-1]}"
+ url="${urls[$1]}$(omz_urlencode ${@[2,-1]})"
else
# build main page url:
# split by '/', then rejoin protocol (1) and domain (2) parts with '//'
diff --git a/themes/frisk.zsh-theme b/themes/frisk.zsh-theme
index 653c7461f..f4f934d05 100644
--- a/themes/frisk.zsh-theme
+++ b/themes/frisk.zsh-theme
@@ -2,7 +2,7 @@ PROMPT=$'
%{$fg[blue]%}%/%{$reset_color%} $(git_prompt_info)$(bzr_prompt_info)%{$fg[white]%}[%n@%m]%{$reset_color%} %{$fg[white]%}[%T]%{$reset_color%}
%{$fg_bold[black]%}>%{$reset_color%} '
-PROMPT2="%{$fg_blod[black]%}%_> %{$reset_color%}"
+PROMPT2="%{$fg_bold[black]%}%_> %{$reset_color%}"
GIT_CB="git::"
ZSH_THEME_SCM_PROMPT_PREFIX="%{$fg[green]%}["
diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh
index d3ad7582c..149500aa9 100644
--- a/tools/check_for_upgrade.sh
+++ b/tools/check_for_upgrade.sh
@@ -180,23 +180,17 @@ function has_typed_input() {
return
fi
- # Don't ask for confirmation before updating if in auto mode
- if [[ "$update_mode" = auto ]]; then
- update_ohmyzsh
- return $?
- fi
-
- # If in reminder mode show reminder and exit
- if [[ "$update_mode" = reminder ]]; then
+ # If in reminder mode or user has typed input, show reminder and exit
+ if [[ "$update_mode" = reminder ]] || has_typed_input; then
+ printf '\r\e[0K' # move cursor to first column and clear whole line
echo "[oh-my-zsh] It's time to update! You can do that by running \`omz update\`"
return 0
fi
- # If user has typed input, show reminder and exit
- if has_typed_input; then
- echo
- echo "[oh-my-zsh] It's time to update! You can do that by running \`omz update\`"
- return 0
+ # Don't ask for confirmation before updating if in auto mode
+ if [[ "$update_mode" = auto ]]; then
+ update_ohmyzsh
+ return $?
fi
# Ask for confirmation and only update on 'y', 'Y' or Enter