common-aliases.plugin.zsh 2.3 KB

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