1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2024-12-23 03:27:59 +00:00

[Fix #149] Restructure utility

This commit is contained in:
Sorin Ionescu 2012-06-10 19:35:15 -04:00
parent 218081becd
commit cbdf8122a6
2 changed files with 111 additions and 88 deletions

View File

@ -11,8 +11,8 @@ Settings
If you have enabled color globally in *zshrc*, you may disable it for certain If you have enabled color globally in *zshrc*, you may disable it for certain
commands. commands.
To disable `ls` color, add the following line to *zshrc*. If coloring is To disable `ls` color, add the following line to *zshrc*; when coloring is
disabled, type indicators (*, /, =>, @, |) will be appended to entries. disabled, type indicators (\*, /, =>, @, =, |, %) will be appended to entries.
zstyle ':omz:module:utility:ls' color 'no' zstyle ':omz:module:utility:ls' color 'no'
@ -31,32 +31,7 @@ To disable `make` highlighting, add the following line to *zshrc*:
Aliases Aliases
------- -------
### The ls Family ### Disabled Spelling Correction
- `ls` lists with directories grouped first (GNU only).
- `l` lists in one column, hidden files.
- `ll` lists human readable sizes.
- `lr` lists recursively.
- `la` lists hidden files.
- `lp` lists through pager.
- `lx` lists sorted by extension (GNU only).
- `lk` lists sorted by size, largest last.
- `lt` lists sorted by date, most recent last.
- `lc` lists sorted by date, most recent last, shows change time.
- `lu` lists sorted by date, most recent last, shows access time.
- `sl` is aliased to ls.
### General
- `_` is aliased to sudo.
- `b` opens the default web browser.
- `e` opens the default editor.
- `p` opens the default pager.
- `po` removes a directory from the stack and changes to it.
- `pu` adds the current directory to the stack and changes to a directory.
- `type` displays all attribute values of a shell parameter.
### Spelling Correction Disabled
- `ack` - `ack`
- `cd` - `cd`
@ -64,6 +39,7 @@ Aliases
- `ebuild` - `ebuild`
- `gcc` - `gcc`
- `gist` - `gist`
- `grep`
- `heroku` - `heroku`
- `ln` - `ln`
- `man` - `man`
@ -73,7 +49,7 @@ Aliases
- `rm` - `rm`
- `scp` - `scp`
### File Globbing Disabled ### Disabled File Globbing
- `fc` - `fc`
- `find` - `find`
@ -81,14 +57,45 @@ Aliases
- `locate` - `locate`
- `rake` - `rake`
### Mac OS X ### General
- `o` is alised to `open` on Mac OS X and `xdg-open` on non Mac OS X. - `_` executes a command as another user (`sudo`).
- `get` downloads a file using `curl` or `wget`. - `b` opens the default web browser.
- `pbcopy` uses xclip or xsel on non Mac OS X. - `cp` copies files and directories interactively.
- `pbpaste` uses xclip or xsel on non Mac OS X. - `e` opens the default editor.
- `pbc` is alised to `pbcopy`. - `ln` links files and directories interactively.
- `pbp` is alised to `pbpaste`. - `mkdir` creates directories, including itermediery directories.
- `mv` moves files and directories interactively.
- `p` opens the default pager.
- `po` removes a directory from the stack and changes to it (`popd`).
- `pu` changes the directory and pushes the old directory onto the stack
(`pushd`).
- `rm` removes files and directories interactively.
- `type` displays all the attribute values of a shell parameter.
### Files and Directories
- `ls` lists with directories grouped first (GNU only).
- `l` lists in one column, hidden files.
- `ll` lists human readable sizes.
- `lr` lists human readable sizes, recursively.
- `la` lists human readable sizes, hidden files.
- `lp` lists human readable sizes, hidden files through pager.
- `lx` lists sorted by extension (GNU only).
- `lk` lists sorted by size, largest last.
- `lt` lists sorted by date, most recent last.
- `lc` lists sorted by date, most recent last, shows change time.
- `lu` lists sorted by date, most recent last, shows access time.
- `sl` lists directory contents (`ls`).
### Mac OS X Everywhere
- `o` opens files and directories (`open` or `xdg-open`).
- `get` downloads files (`curl` or `wget`).
- `pbcopy` copies to the pasteboard (`pbcopy`, `xclip` or `xsel`).
- `pbpaste` pastes from the pasteboard (`pbcopy`, `xclip` or `xsel`).
- `pbc` copies to the pasteboard (`pbcopy`).
- `pbp` pastes from the pasteboard (`pbpaste`).
### Resource Usage ### Resource Usage
@ -103,19 +110,18 @@ Aliases
### Misecellaneous ### Misecellaneous
- `http-serve` serves a directory via HTTP. - `http-serve` serves a directory via HTTP.
- `pmine` displays user owned processes status.
Functions Functions
--------- ---------
### General ### General
- `slit` prints columns 1 2 3 ... n. - `slit` prints columns *1, 2, 3 ... n*.
### Files and Directories ### Files and Directories
- `cdls` changes to a directory and lists its contents. - `cdls` changes to a directory and lists its contents.
- `duh` displays human readable disk usage. - `dut` displays the grand total disk usage using human readable units.
- `find-exec` finds files and executes a command on them. - `find-exec` finds files and executes a command on them.
- `mkdcd` makes a directory and changes to it. - `mkdcd` makes a directory and changes to it.
- `popdls` pops an entry off the directory stack and lists its contents. - `popdls` pops an entry off the directory stack and lists its contents.
@ -127,6 +133,10 @@ Functions
- `make` highlights make output (requires `colormake`). - `make` highlights make output (requires `colormake`).
- `wdiff` highlights wdiff output (requires `wdiff `or `Git`). - `wdiff` highlights wdiff output (requires `wdiff `or `Git`).
### Resource usage
- `psu` displays user owned processes status.
Authors Authors
------- -------

View File

@ -15,9 +15,47 @@ setopt CORRECT
# Aliases # Aliases
# The 'ls' Family # Disable correction.
alias ack='nocorrect ack'
alias cd='nocorrect cd'
alias cp='nocorrect cp'
alias ebuild='nocorrect ebuild'
alias gcc='nocorrect gcc'
alias gist='nocorrect gist'
alias grep='nocorrect grep'
alias heroku='nocorrect heroku'
alias ln='nocorrect ln'
alias man='nocorrect man'
alias mkdir='nocorrect mkdir'
alias mv='nocorrect mv'
alias mysql='nocorrect mysql'
alias rm='nocorrect rm'
alias scp='nocorrect scp'
# Disable globbing.
alias fc='noglob fc'
alias find='noglob find'
alias history='noglob history'
alias locate='noglob locate'
alias rake='noglob rake'
# Define general aliases.
alias _='sudo'
alias b='${(z)BROWSER}'
alias cp="${aliases[cp]:-cp} -i"
alias e='${(z)EDITOR}'
alias ln="${aliases[ln]:-ln} -i"
alias mkdir="${aliases[mkdir]:-mkdir} -p"
alias mv="${aliases[mv]:-mv} -i"
alias p='${(z)PAGER}'
alias po='popd'
alias pu='pushd'
alias rm="${aliases[rm]:-rm} -i"
alias type='type -a'
# ls
if is-callable 'dircolors'; then if is-callable 'dircolors'; then
# GNU core utilities. # GNU Core Utilities
alias ls='ls --group-directories-first' alias ls='ls --group-directories-first'
if zstyle -t ':omz:module:utility:ls' color; then if zstyle -t ':omz:module:utility:ls' color; then
@ -31,7 +69,7 @@ if is-callable 'dircolors'; then
alias ls="$aliases[ls] -F" alias ls="$aliases[ls] -F"
fi fi
else else
# BSD core utilities. # BSD Core Utilities
if zstyle -t ':omz:module:utility:ls' color; then if zstyle -t ':omz:module:utility:ls' color; then
export LSCOLORS="exfxcxdxbxegedabagacad" export LSCOLORS="exfxcxdxbxegedabagacad"
alias ls="ls -G" alias ls="ls -G"
@ -40,44 +78,19 @@ else
fi fi
fi fi
alias l='ls -1A' # List in one column. alias l='ls -1A' # Lists in one column, hidden files.
alias ll='ls -lh' # List human readable sizes. alias ll='ls -lh' # Lists human readable sizes.
alias lr='ll -R' # List recursively. alias lr='ll -R' # Lists human readable sizes, recursively.
alias la='ll -A' # List hidden files. alias la='ll -A' # Lists human readable sizes, hidden files.
alias lp='la | "$PAGER"' # List through pager. alias lp='la | "$PAGER"' # Lists human readable sizes, hidden files through pager.
alias lx='ll -XB' # List sorted by extension. alias lx='ll -XB' # Lists sorted by extension (GNU only).
alias lk='ll -Sr' # List sorted by size, largest last. alias lk='ll -Sr' # Lists sorted by size, largest last.
alias lt='ll -tr' # List sorted by date, most recent last. alias lt='ll -tr' # Lists sorted by date, most recent last.
alias lc='lt -c' # List sorted by date, most recent last, show change time. alias lc='lt -c' # Lists sorted by date, most recent last, shows change time.
alias lu='lt -u' # List sorted by date, most recent last, show access time. alias lu='lt -u' # Lists sorted by date, most recent last, shows access time.
alias sl='ls' # I often screw this up. alias sl='ls' # I often screw this up.
# General # Mac OS X Everywhere
alias _='sudo'
alias b='${(z)BROWSER}'
alias cd='nocorrect cd'
alias cp='nocorrect cp -i'
alias df='df -kh'
alias du='du -kh'
alias e='${(z)EDITOR}'
alias find='noglob find'
alias fc='noglob fc'
alias gcc='nocorrect gcc'
alias history='noglob history'
alias ln='nocorrect ln -i'
alias locate='noglob locate'
alias man='nocorrect man'
alias mkdir='nocorrect mkdir -p'
alias mv='nocorrect mv -i'
alias p='${(z)PAGER}'
alias po='popd'
alias pu='pushd'
alias rake='noglob rake'
alias rm='nocorrect rm -i'
alias scp='nocorrect scp'
alias type='type -a'
# Mac OS X
if [[ "$OSTYPE" == darwin* ]]; then if [[ "$OSTYPE" == darwin* ]]; then
alias o='open' alias o='open'
alias get='curl --continue-at - --location --progress-bar --remote-name --remote-time' alias get='curl --continue-at - --location --progress-bar --remote-name --remote-time'
@ -99,27 +112,22 @@ fi
alias pbc='pbcopy' alias pbc='pbcopy'
alias pbp='pbpaste' alias pbp='pbpaste'
# Top # Resource Usage
alias df='df -kh'
alias du='du -kh'
if (( $+commands[htop] )); then if (( $+commands[htop] )); then
alias top=htop alias top=htop
else else
alias topm='top -o vsize'
alias topc='top -o cpu' alias topc='top -o cpu'
alias topm='top -o vsize'
fi fi
# Miscellaneous # Miscellaneous
alias afind='nocorrect ack'
alias ebuild='nocorrect ebuild'
alias gist='nocorrect gist'
alias heroku='nocorrect heroku'
alias mysql='nocorrect mysql'
# Serves a directory via HTTP. # Serves a directory via HTTP.
alias http-serve='python -m SimpleHTTPServer' alias http-serve='python -m SimpleHTTPServer'
# Displays user owned processes status.
alias pmine='ps -U "$USER" -o pid,%cpu,%mem,command'
# Functions # Functions
# Makes a directory and changes to it. # Makes a directory and changes to it.
@ -152,3 +160,8 @@ function find-exec {
find . -type f -iname "*${1:-}*" -exec "${2:-file}" '{}' \; find . -type f -iname "*${1:-}*" -exec "${2:-file}" '{}' \;
} }
# Displays user owned processes status.
function psu {
ps -{U,u}" ${1:-$USER}" -o 'pid,%cpu,%mem,command' "${(@)argv[2,-1]}"
}