1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2024-11-20 06:21:12 +00:00
prezto/functions/alias.zsh

120 lines
3.3 KiB
Bash
Raw Normal View History

2011-07-28 19:43:26 +00:00
setopt correct # Correct commands.
setopt correct_all # Correct all arguments.
2011-07-14 20:16:22 +00:00
# The 'ls' Family
2011-07-28 20:41:39 +00:00
if ! check-bool "$DISABLE_COLOR"; then
2011-07-28 20:16:27 +00:00
if [[ -f "$HOME/.dir_colors" ]] && ( (( $+commands[dircolors] )) || ( (( $+plugins[(er)gnu-utils] )) && (( $+commands[gdircolors] )) ) ); then
eval $("${commands[dircolors]:-$commands[gdircolors]}" "$HOME/.dir_colors")
alias ls='ls -hF --group-directories-first --color=auto'
else
export CLICOLOR=1
export LSCOLORS="exfxcxdxbxegedabagacad"
alias ls='ls -G -F'
fi
fi
2011-07-28 20:16:27 +00:00
alias l='ls -1A' # Show files in one column.
alias ll='ls -lh' # Show human readable.
alias la='ls -lhA' # Show hidden files.
alias lx='ls -lhXB' # Sort by extension.
alias lk='ls -lhSr' # Sort by size, biggest last.
2011-07-14 20:16:22 +00:00
alias lc='ls -lhtcr' # Sort by and show change time, most recent last.
alias lu='ls -lhtur' # Sort by and show access time, most recent last.
alias lt='ls -lhtr' # Sort by date, most recent last.
alias lm='ls -lha | more' # Pipe through 'more'.
alias lr='ls -lhR' # Recursive ls.
alias sl='ls' # I often screw this up.
# General
2011-07-28 20:16:27 +00:00
alias _='sudo'
alias b="$BROWSER"
2011-07-28 19:43:26 +00:00
alias cd='nocorrect cd'
alias cp='nocorrect cp -i'
2011-07-28 20:16:27 +00:00
alias df='df -kh'
alias du='du -kh'
alias e="$EDITOR"
2011-07-28 19:43:26 +00:00
alias find='noglob find'
alias gcc='nocorrect gcc'
2011-07-28 20:16:27 +00:00
alias history='fc -l 1'
alias ln='nocorrect ln -i'
2011-07-28 20:16:27 +00:00
alias locate='noglob locate'
2011-07-28 19:43:26 +00:00
alias man='nocorrect man'
alias mkdir='nocorrect mkdir -p'
2011-07-28 19:43:26 +00:00
alias mv='nocorrect mv -i'
2011-07-28 20:16:27 +00:00
alias po='popd'
alias pu='pushd'
alias rake='noglob rake'
2011-07-28 19:43:26 +00:00
alias rm='nocorrect rm -i'
alias scp='nocorrect scp'
alias type='type -a'
2011-07-28 20:16:27 +00:00
alias v="$PAGER"
# Mac OS X
if [[ "$OSTYPE" != darwin* ]]; then
alias open='xdg-open'
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
else
alias get='curl --continue-at - --location --progress-bar --remote-name'
fi
alias o='open'
2011-07-14 20:16:22 +00:00
alias pbc='pbcopy'
alias pbp='pbpaste'
2011-07-28 20:16:27 +00:00
# Top
if (( $+commands[htop] )); then
alias top=htop
else
alias topm='top -o vsize'
alias topc='top -o cpu'
fi
2009-09-03 18:45:23 +00:00
2011-07-28 20:16:27 +00:00
# Diff/Make
2011-07-28 20:41:39 +00:00
if ! check-bool "$DISABLE_COLOR"; then
2011-07-28 20:16:27 +00:00
if (( $+commands[colordiff] )); then
alias diff='colordiff -u'
compdef colordiff=diff
2011-07-28 20:16:27 +00:00
elif (( $+commands[git] )); then
function diff() {
git --no-pager diff --color=always --no-ext-diff --no-index "$@";
}
compdef _git diff=git-diff
else
alias diff='diff -u'
fi
2011-07-28 20:16:27 +00:00
if (( $+commands[colormake] )); then
alias make='colormake'
compdef colormake=make
fi
fi
# Terminal Multiplexer
alias sl="screen -list"
alias sn="screen -U -S"
2011-07-28 20:16:27 +00:00
alias sr="screen -a -A -U -D -R"
if (( $+commands[tmux] )); then
alias ta="tmux attach-session"
alias tl="tmux list-sessions"
fi
# Miscellaneous
(( $+commands[ack] )) && alias afind='ack -il'
(( $+commands[ebuild] )) && alias ebuild='nocorrect ebuild'
(( $+commands[gist] )) && alias gist='nocorrect gist'
(( $+commands[heroku] )) && alias heroku='nocorrect heroku'
(( $+commands[hpodder] )) && alias hpodder='nocorrect hpodder'
(( $+commands[mysql] )) && alias mysql='nocorrect mysql'