From 6921a387f3a2521e8edda573399833ec64615e90 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 19 Apr 2011 21:58:02 -0400 Subject: [PATCH] Populated custom. --- .gitignore | 2 - custom/aliases.zsh | 74 +++++++++++++++++++++++++++ custom/directories.zsh | 1 + custom/functions.zsh | 47 +++++++++++++++++ custom/grep.zsh | 8 +++ custom/{example.zsh => shortcuts.zsh} | 0 6 files changed, 130 insertions(+), 2 deletions(-) create mode 100644 custom/aliases.zsh create mode 100644 custom/directories.zsh create mode 100644 custom/functions.zsh create mode 100644 custom/grep.zsh rename custom/{example.zsh => shortcuts.zsh} (100%) diff --git a/.gitignore b/.gitignore index 8d19d100..e8074095 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ locals.zsh log/.zsh_history projects.zsh -custom/* -!custom/example.zsh \ No newline at end of file diff --git a/custom/aliases.zsh b/custom/aliases.zsh new file mode 100644 index 00000000..bd7632ab --- /dev/null +++ b/custom/aliases.zsh @@ -0,0 +1,74 @@ +# The 'ls' family +# ------------------------------------------------------------------------------ +[[ "$DISABLE_COLOR" != 'true' ]] && { + [[ -x "${commands[gdircolors]}" ]] && use_color_gnu='true' || use_color_bsd='true' +} + +[[ "$use_color_gnu" == 'true' ]] && 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 du='du -kh' +alias df='df -kh' +alias e="$EDITOR" +alias get='curl -C - -O' +alias mkdir='nocorrect mkdir -p' +alias q='exit' +alias ssh='ssh -X' +alias h='history' +alias j='jobs -l' +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' ]] && screenrc="$HOME/.screenrc" +[[ "$TERM" == 'xterm-256color' ]] && screenrc="$HOME/.screenrc256" +alias screen="screen -c '$screenrc'" +alias sls="screen -c '$screenrc' -list" +alias surd="screen -c '$screenrc' -aAURD" +alias sus="screen -c '$screenrc' -US" + +# TMUX +# ------------------------------------------------------------------------------ +[[ "$TERM" == 'xterm-color' ]] && tmuxconf="$HOME/.tmux.conf" +[[ "$TERM" == 'xterm-256color' ]] && tmuxconf="$HOME/.tmux256.conf" +alias tmux="tmux -f '$tmuxconf'" +alias tls="tmux list-sessions" + diff --git a/custom/directories.zsh b/custom/directories.zsh new file mode 100644 index 00000000..1237335b --- /dev/null +++ b/custom/directories.zsh @@ -0,0 +1 @@ +unsetopt auto_pushd \ No newline at end of file diff --git a/custom/functions.zsh b/custom/functions.zsh new file mode 100644 index 00000000..91d624b5 --- /dev/null +++ b/custom/functions.zsh @@ -0,0 +1,47 @@ +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 new file mode 100644 index 00000000..23d9d55f --- /dev/null +++ b/custom/grep.zsh @@ -0,0 +1,8 @@ +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/example.zsh b/custom/shortcuts.zsh similarity index 100% rename from custom/example.zsh rename to custom/shortcuts.zsh