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