From e9d2eee6e31550a55b8250ccebda38264fcf2ff3 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 30 May 2011 18:39:04 -0400 Subject: [PATCH] Merged custom and lib. --- custom/aliases.zsh | 76 ------------------------ custom/directories.zsh | 1 - custom/functions.zsh | 47 --------------- custom/grep.zsh | 8 --- custom/history-substring-search.zsh | 4 -- custom/shortcuts.zsh | 5 -- lib/aliases.zsh | 89 ++++++++++++++++++++++++----- lib/functions.zsh | 47 +++++++++++++++ lib/grep.zsh | 8 ++- oh-my-zsh.sh | 10 +--- 10 files changed, 128 insertions(+), 167 deletions(-) delete mode 100644 custom/aliases.zsh delete mode 100644 custom/directories.zsh delete mode 100644 custom/functions.zsh delete mode 100644 custom/grep.zsh delete mode 100644 custom/history-substring-search.zsh delete mode 100644 custom/shortcuts.zsh diff --git a/custom/aliases.zsh b/custom/aliases.zsh deleted file mode 100644 index e2d743c5..00000000 --- a/custom/aliases.zsh +++ /dev/null @@ -1,76 +0,0 @@ -# The 'ls' family -# ------------------------------------------------------------------------------ -[[ "$DISABLE_COLOR" != 'true' ]] && { - [[ -x "${commands[gdircolors]}" ]] && use_color_gnu='true' || use_color_bsd='true' -} - -[[ "$use_color_gnu" == 'true' && -e "$HOME/.dir_colors" ]] && eval $(gdircolors $HOME/.dir_colors) -[[ "$use_color_bsd" == 'true' ]] && export CLICOLOR=1 -[[ "$use_color_bsd" == 'true' ]] && export LSCOLORS="exfxcxdxbxegedabagacad" - -# add colors for filetype recognition -[[ "$use_color_gnu" == 'true' ]] && alias ls='ls -hF --group-directories-first --color=auto' -[[ "$use_color_bsd" == 'true' ]] && alias ls='ls -G -F' - -alias la='ls -Ahl' # show hidden files -alias lx='ls -lhXB' # sort by extension -alias lk='ls -lhSr' # sort by size, biggest last -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 -ahl | more' # pipe through 'more' -alias lr='ls -lhR' # recursive ls -alias l='ls -lha' -alias ll='ls -lh' - -# General -# ------------------------------------------------------------------------------ -alias rm='nocorrect rm -i' -alias cp='nocorrect cp -i' -alias mv='nocorrect mv -i' -alias ln='nocorrect ln -i' -alias mkdir='nocorrect mkdir -p' -alias du='du -kh' -alias df='df -kh' -alias e="$EDITOR" -alias get='curl -C - -O' -alias q='exit' -alias ssh='ssh -X' -alias h='history' -alias j='jobs -l' -alias f='fg' -alias gr='grep -r' -alias type='type -a' -alias print-path='echo -e ${PATH//:/\\n}' -alias print-libpath='echo -e ${LD_LIBRARY_PATH//:/\\n}' -alias lsbom='lsbom -f -l -s -pf' -alias t="$HOME/.local/bin/t --task-dir ~/.tasks --list todo.txt --delete-if-empty" - -if [[ -x "${commands[htop]}" ]]; then - alias top=htop -else - alias topm='top -o vsize' - alias topc='top -o cpu' -fi - -[[ "$DISABLE_COLOR" != 'true' ]] && { - [[ -x "${commands[colordiff]}" ]] && alias diff='colordiff' - [[ -x "${commands[colormake]}" ]] && alias make='colormake' -} - -# Screen -# ------------------------------------------------------------------------------ -[[ "$TERM" == 'xterm-color' && -e "$HOME/.screenrc" ]] && screenrc="-c '$HOME/.screenrc'" -[[ "$TERM" == 'xterm-256color' && -e "$HOME/.screenrc256" ]] && screenrc="-c '$HOME/.screenrc256'" -alias screen="screen $screenrc" -alias sl="screen $screenrc -list" -alias sr="screen $screenrc -a -A -U -D -R" -alias S="screen $screenrc -U -S" - -# TMUX -# ------------------------------------------------------------------------------ -[[ "$TERM" == 'xterm-color' && -e "$HOME/.tmux.conf" ]] && tmuxconf="-f '$HOME/.tmux.conf'" -[[ "$TERM" == 'xterm-256color' && -e "$HOME/.tmux256.conf" ]] && tmuxconf="-f '$HOME/.tmux256.conf'" -alias tmux="tmux $tmuxconf" -alias tls="tmux list-sessions" - diff --git a/custom/directories.zsh b/custom/directories.zsh deleted file mode 100644 index 1237335b..00000000 --- a/custom/directories.zsh +++ /dev/null @@ -1 +0,0 @@ -unsetopt auto_pushd \ No newline at end of file diff --git a/custom/functions.zsh b/custom/functions.zsh deleted file mode 100644 index 91d624b5..00000000 --- a/custom/functions.zsh +++ /dev/null @@ -1,47 +0,0 @@ -function cdll() { - if [[ -n "$1" ]]; then - builtin cd "$1" - ls -lFhA - else - ls -lFhA - fi -} - -function pushdll() { - if [[ -n "$1" ]]; then - builtin pushd "$1" - ls -lFhA - else - ls -lFhA - fi -} - -function popdll() { - builtin popd - ls -lFhA -} - -function grab() { - sudo chown -R ${USER} ${1:-.} -} - -function reload() { - source "$HOME/.zshrc" -} - -function calc() { - echo "scale=4; $@" | bc -l -} - -function pmine() { - ps $@ -u $USER -o pid,%cpu,%mem,command -} - -function findexec() { - find . -type f -iname '*'${1:-}'*' -exec ${2:-file} {} \; -} - -function httpserve() { - python -m SimpleHTTPServer -} - diff --git a/custom/grep.zsh b/custom/grep.zsh deleted file mode 100644 index 23d9d55f..00000000 --- a/custom/grep.zsh +++ /dev/null @@ -1,8 +0,0 @@ -if [[ "$DISABLE_COLOR" != "true" ]]; then - export GREP_OPTIONS='--color=auto' - export GREP_COLOR='37;45' -else - export GREP_OPTIONS='--color=none' - export GREP_COLOR='' -fi - diff --git a/custom/history-substring-search.zsh b/custom/history-substring-search.zsh deleted file mode 100644 index 6c54f045..00000000 --- a/custom/history-substring-search.zsh +++ /dev/null @@ -1,4 +0,0 @@ -if [[ "$DISABLE_COLOR" == "true" ]]; then - F_ordinary_highlight="bg=none,fg=none" - F_out_of_matches_highlight="bg=none,fg=none" -fi diff --git a/custom/shortcuts.zsh b/custom/shortcuts.zsh deleted file mode 100644 index 28ffcae2..00000000 --- a/custom/shortcuts.zsh +++ /dev/null @@ -1,5 +0,0 @@ -# Add yourself some shortcuts to projects you often work on -# Example: -# -# brainstormr=/Users/robbyrussell/Projects/development/planetargon/brainstormr -# \ No newline at end of file diff --git a/lib/aliases.zsh b/lib/aliases.zsh index 0555be26..a529f816 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -1,24 +1,83 @@ -# Push and pop directories on directory stack -alias pu='pushd' -alias po='popd' +# The 'ls' family +# ------------------------------------------------------------------------------ +[[ "$DISABLE_COLOR" != 'true' ]] && { + [[ -x "${commands[gdircolors]}" ]] && use_color_gnu='true' || use_color_bsd='true' +} + +[[ "$use_color_gnu" == 'true' && -e "$HOME/.dir_colors" ]] && eval $(gdircolors $HOME/.dir_colors) +[[ "$use_color_bsd" == 'true' ]] && export CLICOLOR=1 +[[ "$use_color_bsd" == 'true' ]] && export LSCOLORS="exfxcxdxbxegedabagacad" -# Basic directory operations +# add colors for filetype recognition +[[ "$use_color_gnu" == 'true' ]] && alias ls='ls -hF --group-directories-first --color=auto' +[[ "$use_color_bsd" == 'true' ]] && alias ls='ls -G -F' + +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 +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' # often screw this up + +# General +# ------------------------------------------------------------------------------ alias ...='cd ../..' alias -- -='cd -' - -# Super user +alias rm='nocorrect rm -i' +alias cp='nocorrect cp -i' +alias mv='nocorrect mv -i' +alias ln='nocorrect ln -i' +alias mkdir='nocorrect mkdir -p' +alias du='du -kh' +alias df='df -kh' +alias pu='pushd' +alias po='popd' alias _='sudo' +alias e="$EDITOR" +alias q='exit' +alias history='fc -l 1' +alias h='history' +alias j='jobs -l' +alias f='fg' +alias gr='grep -r' +alias get='curl -C - -O' +alias afind='ack-grep -il' +alias type='type -a' +alias ssh='ssh -X' +alias print-path='echo -e ${PATH//:/\\n}' +alias print-libpath='echo -e ${LD_LIBRARY_PATH//:/\\n}' +alias lsbom='lsbom -f -l -s -pf' +alias t="$HOME/.local/bin/t --task-dir ~/.tasks --list todo.txt --delete-if-empty" -#alias g='grep -in' +if [[ -x "${commands[htop]}" ]]; then + alias top=htop +else + alias topm='top -o vsize' + alias topc='top -o cpu' +fi -# Show history -alias history='fc -l 1' +[[ "$DISABLE_COLOR" != 'true' ]] && { + [[ -x "${commands[colordiff]}" ]] && alias diff='colordiff' + [[ -x "${commands[colormake]}" ]] && alias make='colormake' +} -# List direcory contents -alias lsa='ls -lah' -alias l='ls -la' -alias ll='ls -l' -alias sl=ls # often screw this up +# Screen +# ------------------------------------------------------------------------------ +[[ "$TERM" == 'xterm-color' && -e "$HOME/.screenrc" ]] && screenrc="-c '$HOME/.screenrc'" +[[ "$TERM" == 'xterm-256color' && -e "$HOME/.screenrc256" ]] && screenrc="-c '$HOME/.screenrc256'" +alias screen="screen $screenrc" +alias sl="screen $screenrc -list" +alias sr="screen $screenrc -a -A -U -D -R" +alias S="screen $screenrc -U -S" -alias afind='ack-grep -il' +# TMUX +# ------------------------------------------------------------------------------ +[[ "$TERM" == 'xterm-color' && -e "$HOME/.tmux.conf" ]] && tmuxconf="-f '$HOME/.tmux.conf'" +[[ "$TERM" == 'xterm-256color' && -e "$HOME/.tmux256.conf" ]] && tmuxconf="-f '$HOME/.tmux256.conf'" +alias tmux="tmux $tmuxconf" +alias tls="tmux list-sessions" diff --git a/lib/functions.zsh b/lib/functions.zsh index ef7cc638..f26659ec 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -15,3 +15,50 @@ function take() { cd $1 } +function cdll() { + if [[ -n "$1" ]]; then + builtin cd "$1" + ls -lFhA + else + ls -lFhA + fi +} + +function pushdll() { + if [[ -n "$1" ]]; then + builtin pushd "$1" + ls -lFhA + else + ls -lFhA + fi +} + +function popdll() { + builtin popd + ls -lFhA +} + +function grab() { + sudo chown -R ${USER} ${1:-.} +} + +function reload() { + source "$HOME/.zshrc" +} + +function calc() { + echo "scale=4; $@" | bc -l +} + +function pmine() { + ps $@ -u $USER -o pid,%cpu,%mem,command +} + +function findexec() { + find . -type f -iname '*'${1:-}'*' -exec ${2:-file} {} \; +} + +function httpserve() { + python -m SimpleHTTPServer +} + diff --git a/lib/grep.zsh b/lib/grep.zsh index 714ac9cc..3e1f213e 100644 --- a/lib/grep.zsh +++ b/lib/grep.zsh @@ -1,4 +1,8 @@ if [[ "$DISABLE_COLOR" != "true" ]]; then - [[ -z "$GREP_OPTIONS" ]] && export GREP_OPTIONS='--color=auto' - [[ -z "$GREP_COLOR" ]] && export GREP_COLOR='1;32' + export GREP_OPTIONS='--color=auto' + export GREP_COLOR='37;45' +else + export GREP_OPTIONS='--color=none' + export GREP_COLOR='' fi + diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index bc6a9297..69b4b033 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -5,9 +5,6 @@ if [ "$TERM" = "dumb" ]; then DISABLE_COLOR="true" fi -# add a function path -fpath=($ZSH/functions $ZSH/completions $fpath) - # Load all of the config files in ~/oh-my-zsh that end in .zsh # TIP: Add files you don't want in git to .gitignore for config_file ($ZSH/lib/*.zsh) source $config_file @@ -22,9 +19,7 @@ compinit -i # Load all of the plugins that were defined in ~/.zshrc for plugin ($plugins); do - if [ -f $ZSH/custom/plugins/$plugin/$plugin.plugin.zsh ]; then - source $ZSH/custom/plugins/$plugin/$plugin.plugin.zsh - elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then + if [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then source $ZSH/plugins/$plugin/$plugin.plugin.zsh fi done @@ -43,9 +38,6 @@ else source "$ZSH/themes/$ZSH_THEME.zsh-theme" fi -# Load all of your custom configurations from custom/ -for config_file ($ZSH/custom/*.zsh) source $config_file - # Compile zcompdump, if modified, to increase startup speed. if [ "$HOME/.zcompdump" -nt "$HOME/.zcompdump.zwc" -o ! -e "$HOME/.zcompdump.zwc" ]; then zcompile "$HOME/.zcompdump"