zsh: reorganize aliases + compdef's; remove compinit (zgen does this)
This commit is contained in:
parent
ba11030eae
commit
bb983ccbca
|
@ -12,15 +12,44 @@ alias ....='cd ../../..'
|
|||
alias -- -='cd -'
|
||||
|
||||
alias ln="${aliases[ln]:-ln} -v" # verbose ln
|
||||
alias ls="${aliases[ls]:-ls} --group-directories-first"
|
||||
alias l='ls -l'
|
||||
alias ll='ls -la'
|
||||
|
||||
alias pubkey='cat ~/.ssh/id_rsa.pub | y | echo "Public key copied to pasteboard."'
|
||||
# notify me before clobbering files
|
||||
alias rm='rm -i'
|
||||
alias cp='cp -i'
|
||||
alias mv='mv -i'
|
||||
|
||||
alias gurl='curl --compressed'
|
||||
alias mkdir='mkdir -p'
|
||||
alias rsyncd='rsync -va --delete' # Hard sync two directories
|
||||
alias wget='wget -c' # Resume dl if possible
|
||||
|
||||
alias pubkey='cat ~/.ssh/id_rsa.pub'
|
||||
|
||||
alias yd='youtube-dl'
|
||||
alias ydm='youtube-dl --extract-audio --audio-format aac'
|
||||
|
||||
# Always enable colored `grep` output
|
||||
# Note: `GREP_OPTIONS="--color=auto"` is deprecated, hence the alias usage.
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
|
||||
alias mk='make'
|
||||
alias exe='exercism'
|
||||
|
||||
# For example, to list all directories that contain a certain file: find . -name
|
||||
# .gitattributes | map dirname
|
||||
alias map="xargs -n1"
|
||||
|
||||
o() { open "${1:-.}" }
|
||||
c() { cd "$1" && ls -l; }
|
||||
take() { mkdir "$1" && cd "$1"; }
|
||||
hex() { echo -n $@ | xxd -psdu; }
|
||||
|
||||
if command -v compdef >/dev/null; then
|
||||
compdef o=open
|
||||
compdef c=cd
|
||||
compdef take=mkdir
|
||||
fi
|
||||
|
|
|
@ -1,49 +1,12 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
load shell/aliases.sh
|
||||
loadall shell/zsh aliases.zsh
|
||||
|
||||
#
|
||||
autoload -U zmv
|
||||
|
||||
zman() { PAGER="less -g -s '+/^ "$1"'" man zshall; }
|
||||
alias \?='since @$last'
|
||||
|
||||
## Compilers, interpretors 'n builders #######################################
|
||||
alias mk='make'
|
||||
alias exe='exercism'
|
||||
|
||||
## Redefined tools ###########################################################
|
||||
# Always enable colored `grep` output
|
||||
# Note: `GREP_OPTIONS="--color=auto"` is deprecated, hence the alias usage.
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
|
||||
alias ag='noglob ag'
|
||||
alias gurl='curl --compressed'
|
||||
alias mkdir='mkdir -p'
|
||||
alias rsyncd='rsync -va --delete' # Hard sync two directories
|
||||
alias ssh='ssh -C' # Compression for all ssh connections
|
||||
alias wget='wget -c' # Resume dl if possible
|
||||
alias ydl='youtube-dl'
|
||||
|
||||
## New tools #################################################################
|
||||
|
||||
# Canonical hex dump; some systems have this symlinked
|
||||
is-callable hd || alias hd="hexdump -C"
|
||||
|
||||
## Remote resources ##########################################################
|
||||
# URL-encode strings
|
||||
alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1]);"'
|
||||
# find conflicted dropbox files
|
||||
alias findc="find . -iname '*conflicted*' -type f -exec echo '\"{}\" ' \;"
|
||||
# Send to sprunge.us
|
||||
alias bin="curl -s -F 'sprunge=<-' http://sprunge.us | head -n 1 | tr -d '\r\n ' | y"
|
||||
# IP addresses
|
||||
alias publicip="dig +short myip.opendns.com @resolver1.opendns.com"
|
||||
alias ips="ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'"
|
||||
# View HTTP traffic
|
||||
alias sniff="sudo ngrep -d 'en0' -t '^(GET|POST) ' 'tcp and port 80'"
|
||||
alias httpdump="sudo tcpdump -i en0 -n -s 0 -w - | grep -a -o -E \"Host\: .*|GET \/.*\""
|
||||
# Make URL REQUEST shortcuts
|
||||
for method in GET HEAD POST PUT DELETE TRACE OPTIONS; do
|
||||
alias "$method"="lwp-request -m '$method'"
|
||||
done
|
||||
|
|
|
@ -116,12 +116,3 @@ zstyle ':completion:*:(ssh|scp|rsync):*:hosts-host' ignored-patterns '*(.|:)*' l
|
|||
zstyle ':completion:*:(ssh|scp|rsync):*:hosts-domain' ignored-patterns '<->.<->.<->.<->' '^[-[:alnum:]]##(.[-[:alnum:]]##)##' '*@*'
|
||||
zstyle ':completion:*:(ssh|scp|rsync):*:hosts-ipaddr' ignored-patterns '^(<->.<->.<->.<->|(|::)([[:xdigit:].]##:(#c,2))##(|%*))' '127.0.0.<->' '255.255.255.255' '::1' 'fe80::*'
|
||||
|
||||
|
||||
## Custom compdefs #######################
|
||||
|
||||
compdef g=hub
|
||||
compdef o=open
|
||||
compdef take=mkdir
|
||||
compdef t=tmux
|
||||
|
||||
autoload -U compinit && compinit
|
||||
|
|
Loading…
Reference in a new issue