You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
142 lines
3.7 KiB
142 lines
3.7 KiB
13 years ago
|
#
|
||
|
# Defines general aliases.
|
||
|
#
|
||
|
# Authors:
|
||
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||
|
#
|
||
|
|
||
13 years ago
|
setopt CORRECT # Correct commands.
|
||
14 years ago
|
|
||
14 years ago
|
# The 'ls' Family
|
||
13 years ago
|
if (( $+commands[dircolors] )); then
|
||
|
# GNU core utilities.
|
||
|
alias ls='ls --group-directories-first'
|
||
|
|
||
|
if zstyle -t ':omz:alias:ls' color; then
|
||
|
if [[ -f "$HOME/.dir_colors" ]]; then
|
||
|
eval $(dircolors "$HOME/.dir_colors")
|
||
|
fi
|
||
|
alias ls="$aliases[ls] --color=auto"
|
||
14 years ago
|
else
|
||
13 years ago
|
alias ls="$aliases[ls] -F"
|
||
|
fi
|
||
|
else
|
||
|
# BSD core utilities.
|
||
|
if zstyle -t ':omz:alias:ls' color; then
|
||
14 years ago
|
export LSCOLORS="exfxcxdxbxegedabagacad"
|
||
13 years ago
|
alias ls="ls -G"
|
||
|
else
|
||
|
alias ls='ls -F'
|
||
14 years ago
|
fi
|
||
|
fi
|
||
14 years ago
|
|
||
13 years ago
|
alias l='ls -1A' # List in one column.
|
||
|
alias ll='ls -lh' # List human readable sizes.
|
||
|
alias lr='ll -R' # List recursively.
|
||
|
alias la='ll -A' # List hidden files.
|
||
|
alias lp='la | "$PAGER"' # List through pager.
|
||
|
alias lx='ll -XB' # List sorted by extension.
|
||
|
alias lk='ll -Sr' # List sorted by size, largest last.
|
||
|
alias lt='ll -tr' # List sorted by date, most recent last.
|
||
|
alias lc='lt -c' # List sorted by date, most recent last, show change time.
|
||
|
alias lu='lt -u' # List sorted by date, most recent last, show access time.
|
||
|
alias sl='ls' # I often screw this up.
|
||
14 years ago
|
|
||
|
# General
|
||
14 years ago
|
alias _='sudo'
|
||
|
alias b="$BROWSER"
|
||
14 years ago
|
alias cd='nocorrect cd'
|
||
14 years ago
|
alias cp='nocorrect cp -i'
|
||
14 years ago
|
alias df='df -kh'
|
||
|
alias du='du -kh'
|
||
|
alias e="$EDITOR"
|
||
14 years ago
|
alias find='noglob find'
|
||
13 years ago
|
alias fc='noglob fc'
|
||
14 years ago
|
alias gcc='nocorrect gcc'
|
||
13 years ago
|
alias history='noglob history'
|
||
14 years ago
|
alias ln='nocorrect ln -i'
|
||
14 years ago
|
alias locate='noglob locate'
|
||
14 years ago
|
alias man='nocorrect man'
|
||
14 years ago
|
alias mkdir='nocorrect mkdir -p'
|
||
14 years ago
|
alias mv='nocorrect mv -i'
|
||
13 years ago
|
alias p="$PAGER"
|
||
14 years ago
|
alias po='popd'
|
||
|
alias pu='pushd'
|
||
|
alias rake='noglob rake'
|
||
14 years ago
|
alias rm='nocorrect rm -i'
|
||
|
alias scp='nocorrect scp'
|
||
14 years ago
|
alias type='type -a'
|
||
14 years ago
|
|
||
|
# Mac OS X
|
||
13 years ago
|
if [[ "$OSTYPE" == darwin* ]]; then
|
||
|
alias o='open'
|
||
|
alias get='curl --continue-at - --location --progress-bar --remote-name'
|
||
|
else
|
||
|
alias o='xdg-open'
|
||
14 years ago
|
alias get='wget --continue --progress=bar'
|
||
|
|
||
|
if (( $+commands[xclip] )); then
|
||
|
alias pbcopy='xclip -selection clipboard -in'
|
||
|
alias pbpaste='xclip -selection clipboard -out'
|
||
|
fi
|
||
|
|
||
|
if (( $+commands[xsel] )); then
|
||
|
alias pbcopy='xsel --clipboard --input'
|
||
|
alias pbpaste='xsel --clipboard --output'
|
||
|
fi
|
||
|
fi
|
||
|
|
||
14 years ago
|
alias pbc='pbcopy'
|
||
|
alias pbp='pbpaste'
|
||
16 years ago
|
|
||
14 years ago
|
# Top
|
||
|
if (( $+commands[htop] )); then
|
||
14 years ago
|
alias top=htop
|
||
|
else
|
||
|
alias topm='top -o vsize'
|
||
|
alias topc='top -o cpu'
|
||
|
fi
|
||
16 years ago
|
|
||
14 years ago
|
# Diff/Make
|
||
13 years ago
|
if zstyle -t ':omz:alias:diff' color; then
|
||
13 years ago
|
function diff {
|
||
13 years ago
|
if (( $+commands[colordiff] )); then
|
||
|
"$commands[diff]" --unified "$@" | colordiff --difftype diffu
|
||
|
elif (( $+commands[git] )); then
|
||
|
git --no-pager diff --color=auto --no-ext-diff --no-index "$@"
|
||
|
else
|
||
|
"$commands[diff]" --unified "$@"
|
||
|
fi
|
||
|
}
|
||
|
|
||
13 years ago
|
function wdiff {
|
||
13 years ago
|
if (( $+commands[wdiff] )); then
|
||
|
"$commands[wdiff]" \
|
||
|
--avoid-wraps \
|
||
|
--start-delete="$(print -n $FG[red])" \
|
||
|
--end-delete="$(print -n $FG[none])" \
|
||
|
--start-insert="$(print -n $FG[green])" \
|
||
|
--end-insert="$(print -n $FG[none])" \
|
||
|
"$@" \
|
||
|
| sed 's/^\(@@\( [+-][[:digit:]]*,[[:digit:]]*\)\{2\} @@\)$/;5;6m\10m/g'
|
||
13 years ago
|
elif (( $+commands[git] )); then
|
||
13 years ago
|
git --no-pager diff --color=auto --no-ext-diff --no-index --color-words "$@"
|
||
13 years ago
|
else
|
||
|
print "zsh: command not found: $0" >&2
|
||
|
fi
|
||
|
}
|
||
14 years ago
|
|
||
14 years ago
|
if (( $+commands[colormake] )); then
|
||
14 years ago
|
alias make='colormake'
|
||
14 years ago
|
compdef colormake=make
|
||
14 years ago
|
fi
|
||
|
fi
|
||
16 years ago
|
|
||
14 years ago
|
# Miscellaneous
|
||
13 years ago
|
(( $+commands[ack] )) && alias afind='nocorrect ack'
|
||
14 years ago
|
(( $+commands[ebuild] )) && alias ebuild='nocorrect ebuild'
|
||
|
(( $+commands[gist] )) && alias gist='nocorrect gist'
|
||
|
(( $+commands[heroku] )) && alias heroku='nocorrect heroku'
|
||
|
(( $+commands[mysql] )) && alias mysql='nocorrect mysql'
|
||
14 years ago
|
|