summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-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
23 files changed, 148 insertions, 152 deletions
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 '//'