docs(zsh): include omz plugins

plugins:
* archlinux
* coloured man pages
* web search
This commit is contained in:
George Rawlinson 2017-05-16 07:09:49 +12:00
parent ec5dd6863b
commit e88c975220
4 changed files with 113 additions and 1 deletions

View file

@ -0,0 +1,42 @@
# pacaur aliases
if (( $+commands[pacaur] )); then
alias paupg='pacaur -Syua'
alias pasu='pacaur -Syua --noconfirm'
alias pain='pacaur -S'
alias pains='pacaur -U'
alias pare='pacaur -R'
alias parem='pacaur -Rns'
alias parep='pacaur -Si'
alias pareps='pacaur -Ss'
alias paloc='pacaur -Qi'
alias palocs='pacaur -Qs'
alias palst='pacaur -Qe'
alias paorph='pacaur -Qtd'
alias painsd='pacaur -S --asdeps'
alias pamir='pacaur -Syy'
fi
# pacman aliases
# source: https://wiki.archlinux.org/index.php/Pacman_Tips
alias pacupg='sudo pacman -Syu'
alias pacin='sudo pacman -S'
alias pacins='sudo pacman -U'
alias pacre='sudo pacman -R'
alias pacrem='sudo pacman -Rns'
alias pacrep='pacman -Si'
alias pacreps='pacman -Ss'
alias pacloc='pacman -Qi'
alias paclocs='pacman -Qs'
alias pacinsd='sudo pacman -S --asdeps'
alias pacmir='sudo pacman -Syy'
alias paclsorphans='sudo pacman -Qdt'
alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)'
alias pacfileupg='sudo pacman -Fy'
alias pacfiles='pacman tFs'
# list all explicitly installed packages
# source: https://bbs.archlinux.org/viewtopic.php?id=93683
paclist() {
LC_ALL=C pacman -Qei $(pacman -Qu | cut -d " " -f 1) | \
awk 'BEGIN {FS=":"} /^Name/{printf("\033[1;36m%s\033[1;37m", $2)} /^Description/{print $2}'
}

View file

@ -0,0 +1,11 @@
# colour output in man
# source: https://wiki.archlinux.org/index.php/Color_output_in_console#man
man() {
LESS_TERMCAP_md=$'\e[01;31m' \
LESS_TERMCAP_me=$'\e[0m' \
LESS_TERMCAP_se=$'\e[0m' \
LESS_TERMCAP_so=$'\e[01;44;33m' \
LESS_TERMCAP_ue=$'\e[0m' \
LESS_TERMCAP_us=$'\e[01;32m' \
command man "$@"
}

View file

@ -0,0 +1,59 @@
# web_search from terminal
function web_search() {
emulate -L zsh
# define search engine URLS
typeset -A urls
urls=(
google "https://www.google.com/search?q="
bing "https://www.bing.com/search?q="
yahoo "https://search.yahoo.com/search?p="
duckduckgo "https://www.duckduckgo.com/?q="
startpage "https://www.startpage.com/do/search?q="
yandex "https://yandex.ru/yandsearch?text="
github "https://github.com/search?q="
baidu "https://www.baidu.com/s?wd="
ecosia "https://www.ecosia.org/search?q="
goodreads "https://www.goodreads.com/search?q="
)
# check whether the search engine is supported
if [[ -z "$urls[$1]" ]]; then
echo "Search engine $1 not supported."
return 1
fi
# search or go to main page depending on number of arguments passed
if [[ $# -gt 1 ]]; then
# build search url:
# join arguments passed with '+', then append to search engine URL
url="${urls[$1]}${(j:+:)@[2,-1]}"
else
# build main page url:
# split by '/', then rejoin protocol (1) and domain (2) parts with '//'
url="${(j://:)${(s:/:)urls[$1]}[1,2]}"
fi
open_command "$url"
}
alias bing='web_search bing'
alias google='web_search google'
alias yahoo='web_search yahoo'
alias ddg='web_search duckduckgo'
alias sp='web_search startpage'
alias yandex='web_search yandex'
alias github='web_search github'
alias baidu='web_search baidu'
alias ecosia='web_search ecosia'
alias goodreads='web_search goodreads'
#add your own !bang searches here
alias wiki='web_search duckduckgo \!w'
alias news='web_search duckduckgo \!n'
alias youtube='web_search duckduckgo \!yt'
alias map='web_search duckduckgo \!m'
alias image='web_search duckduckgo \!i'
alias ducky='web_search duckduckgo \!'

View file

@ -9,7 +9,7 @@ DISABLE_UPDATE_PROMPT=true
DISABLE_AUTO_UPDATE=true
# plugins
plugins=(archlinux common-aliases git sudo ssh-agent rust colored-man-pages gpg-agent web-search)
plugins=(common-aliases git sudo ssh-agent gpg-agent)
# zsh-completions
autoload -U compinit && compinit