b832ec92086df4648e270b3d44a10fe058ffd8f4

Author
Gaetan Semet <gaetan@xeberon.net>
Committer
Gaetan Semet <gaetan@xeberon.net>
Date

Message

New plugin 'common-aliases' for optional cutting edge zsh aliases

Signed-off-by: Gaetan Semet <gaetan@xeberon.net>

Diff

  1diff --git a/plugins/common-aliases/common-aliases.plugin.zsh b/plugins/common-aliases/common-aliases.plugin.zsh
  2new file mode 100644
  3index 0000000000000000000000000000000000000000..4ac8178b60053834aea5ce2238f24d21ab3d4ffc
  4--- /dev/null
  5+++ b/plugins/common-aliases/common-aliases.plugin.zsh
  6@@ -0,0 +1,94 @@
  7+# Advanced Aliases.
  8+# Use with caution
  9+#
 10+
 11+# ls, the common ones I use a lot shortened for rapid fire usage
 12+alias ls='ls --color' #I like color
 13+alias l='ls -lFh'     #size,show type,human readable
 14+alias la='ls -lAFh'   #long list,show almost all,show type,human readable
 15+alias lr='ls -tRFh'   #sorted by date,recursive,show type,human readable
 16+alias lt='ls -ltFh'   #long list,sorted by date,show type,human readable
 17+alias ll='ls -l'      #long list
 18+alias ldot='ls -ld .*'
 19+alias lS='ls -1FSsh'
 20+alias lart='ls -1Fcart'
 21+alias lrt='ls -1Fcrt'
 22+
 23+alias zshrc='vim ~/.zshrc' # Quick access to the ~/.zshrc file
 24+
 25+alias grep='grep --color'
 26+alias sgrep='grep -R -n -H -C 5'
 27+
 28+alias t='tail -f'
 29+
 30+# because typing 'cd' is A LOT of work!!
 31+alias ..='cd ../'
 32+alias ...='cd ../../'
 33+alias ....='cd ../../../'
 34+alias .....='cd ../../../../'
 35+
 36+# Command line head / tail shortcuts
 37+alias -g H='| head'
 38+alias -g T='| tail'
 39+alias -g G='| grep'
 40+alias -g L="| less"
 41+alias -g M="| most"
 42+alias -g LL="2>&1 | less"
 43+alias -g CA="2>&1 | cat -A"
 44+alias -g NE="2> /dev/null"
 45+alias -g NUL="> /dev/null 2>&1"
 46+alias -g P="2>&1| pygmentize -l pytb"
 47+
 48+alias dud='du --max-depth=1 -h'
 49+alias duf='du -sh *'
 50+alias fd='find . -type d -name'
 51+alias ff='find . -type f -name'
 52+
 53+alias h='history'
 54+alias hgrep="fc -El 0 | grep"
 55+alias help='man'
 56+alias j='jobs'
 57+alias p='ps -f'
 58+alias sortnr='sort -n -r'
 59+alias unexport='unset'
 60+
 61+alias whereami=display_info
 62+
 63+alias rm='rm -i'
 64+alias cp='cp -i'
 65+alias mv='mv -i'
 66+
 67+# zsh is able to auto-do some kungfoo
 68+# depends on the SUFFIX :)
 69+if [ ${ZSH_VERSION//\./} -ge 420 ]; then
 70+  # open browser on urls
 71+  _browser_fts=(htm html de org net com at cx nl se dk dk php)
 72+  for ft in $_browser_fts ; do alias -s $ft=$BROWSER ; done
 73+
 74+  _editor_fts=(cpp cxx cc c hh h inl asc txt TXT tex)
 75+  for ft in $_editor_fts ; do alias -s $ft=$EDITOR ; done
 76+
 77+  _image_fts=(jpg jpeg png gif mng tiff tif xpm)
 78+  for ft in $_image_fts ; do alias -s $ft=$XIVIEWER; done
 79+
 80+  _media_fts=(avi mpg mpeg ogm mp3 wav ogg ape rm mov mkv)
 81+  for ft in $_media_fts ; do alias -s $ft=mplayer ; done
 82+
 83+  #read documents
 84+  alias -s pdf=acroread
 85+  alias -s ps=gv
 86+  alias -s dvi=xdvi
 87+  alias -s chm=xchm
 88+  alias -s djvu=djview
 89+
 90+  #list whats inside packed file
 91+  alias -s zip="unzip -l"
 92+  alias -s rar="unrar l"
 93+  alias -s tar="tar tf"
 94+  alias -s tar.gz="echo "
 95+  alias -s ace="unace l"
 96+fi
 97+
 98+# Make zsh know about hosts already accessed by SSH
 99+zstyle -e ':completion:*:(ssh|scp|sftp|rsh|rsync):hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })'
100+