common-aliases.plugin.zsh 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 lsr='ls -lARFh' #Recursive list of files and directories
  15. alias lsn='ls -1' #A column contains name of files and directories
  16. alias zshrc='${=EDITOR} ${ZDOTDIR:-$HOME}/.zshrc' # Quick access to the .zshrc file
  17. alias grep='grep --color'
  18. alias sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} '
  19. alias t='tail -f'
  20. # Command line head / tail shortcuts
  21. alias -g H='| head'
  22. alias -g T='| tail'
  23. alias -g G='| grep'
  24. alias -g L="| less"
  25. alias -g M="| most"
  26. alias -g LL="2>&1 | less"
  27. alias -g CA="2>&1 | cat -A"
  28. alias -g NE="2> /dev/null"
  29. alias -g NUL="> /dev/null 2>&1"
  30. alias -g P="2>&1| pygmentize -l pytb"
  31. alias dud='du -d 1 -h'
  32. (( $+commands[duf] )) || alias duf='du -sh *'
  33. (( $+commands[fd] )) || alias fd='find . -type d -name'
  34. alias ff='find . -type f -name'
  35. alias h='history'
  36. alias hgrep="fc -El 0 | grep"
  37. alias help='man'
  38. alias p='ps -f'
  39. alias sortnr='sort -n -r'
  40. alias unexport='unset'
  41. alias rm='rm -i'
  42. alias cp='cp -i'
  43. alias mv='mv -i'
  44. # zsh is able to auto-do some kungfoo
  45. # depends on the SUFFIX :)
  46. autoload -Uz is-at-least
  47. if is-at-least 4.2.0; then
  48. # open browser on urls
  49. if [[ -n "$BROWSER" ]]; then
  50. _browser_fts=(htm html de org net com at cx nl se dk)
  51. for ft in $_browser_fts; do alias -s $ft='$BROWSER'; done
  52. fi
  53. _editor_fts=(cpp cxx cc c hh h inl asc txt TXT tex)
  54. for ft in $_editor_fts; do alias -s $ft='$EDITOR'; done
  55. if [[ -n "$XIVIEWER" ]]; then
  56. _image_fts=(jpg jpeg png gif mng tiff tif xpm)
  57. for ft in $_image_fts; do alias -s $ft='$XIVIEWER'; done
  58. fi
  59. _media_fts=(ape avi flv m4a mkv mov mp3 mpeg mpg ogg ogm rm wav webm)
  60. for ft in $_media_fts; do alias -s $ft=mplayer; done
  61. #read documents
  62. alias -s pdf=acroread
  63. alias -s ps=gv
  64. alias -s dvi=xdvi
  65. alias -s chm=xchm
  66. alias -s djvu=djview
  67. #list whats inside packed file
  68. alias -s zip="unzip -l"
  69. alias -s rar="unrar l"
  70. alias -s tar="tar tf"
  71. alias -s tar.gz="echo "
  72. alias -s ace="unace l"
  73. fi
  74. # Make zsh know about hosts already accessed by SSH
  75. zstyle -e ':completion:*:(ssh|scp|sftp|rsh|rsync):hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })'