common-aliases.plugin.zsh 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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='${=EDITOR} ${ZDOTDIR:-$HOME}/.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 rm='rm -i'
  40. alias cp='cp -i'
  41. alias mv='mv -i'
  42. # zsh is able to auto-do some kungfoo
  43. # depends on the SUFFIX :)
  44. autoload -Uz is-at-least
  45. if is-at-least 4.2.0; then
  46. # open browser on urls
  47. if [[ -n "$BROWSER" ]]; then
  48. _browser_fts=(htm html de org net com at cx nl se dk)
  49. for ft in $_browser_fts; do alias -s $ft=$BROWSER; done
  50. fi
  51. _editor_fts=(cpp cxx cc c hh h inl asc txt TXT tex)
  52. for ft in $_editor_fts; do alias -s $ft=$EDITOR; done
  53. if [[ -n "$XIVIEWER" ]]; then
  54. _image_fts=(jpg jpeg png gif mng tiff tif xpm)
  55. for ft in $_image_fts; do alias -s $ft=$XIVIEWER; done
  56. fi
  57. _media_fts=(ape avi flv m4a mkv mov mp3 mpeg mpg ogg ogm rm wav webm)
  58. for ft in $_media_fts; do alias -s $ft=mplayer; done
  59. #read documents
  60. alias -s pdf=acroread
  61. alias -s ps=gv
  62. alias -s dvi=xdvi
  63. alias -s chm=xchm
  64. alias -s djvu=djview
  65. #list whats inside packed file
  66. alias -s zip="unzip -l"
  67. alias -s rar="unrar l"
  68. alias -s tar="tar tf"
  69. alias -s tar.gz="echo "
  70. alias -s ace="unace l"
  71. fi
  72. # Make zsh know about hosts already accessed by SSH
  73. zstyle -e ':completion:*:(ssh|scp|sftp|rsh|rsync):hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })'