common-aliases.plugin.zsh 2.5 KB

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