]> ruderich.org/simon Gitweb - config/dotfiles.git/blob - shell/aliases
shell/aliases: Remove unnecessary quotes.
[config/dotfiles.git] / shell / aliases
1 # Aliases and similar functions which can be used by all shells (supporting
2 # them).
3
4
5 # Shortcuts for often used programs.
6 alias c=clear
7 alias e=elinks
8 alias g=git
9 alias m=mutt
10 alias p=less # p for pager
11 alias s=mpc  # s for sound, m is already used
12 alias v=vim
13
14
15 # Improved ls which displays the files in columns (-C), visualizes
16 # directories, links and other special files (-F) and pages everything through
17 # less.
18 #
19 # If available use GNU ls with colorized output. If it isn't available try
20 # normal ls which needs CLICOLOR_FORCE so it displays colors when used with a
21 # pager. If none work no colors are used.
22
23 # Check if colors are available.
24 ls --color > /dev/null 2>&1
25 if [ $? -eq 0 ]; then
26     ls_color=gnu
27 else
28     ls -G > /dev/null 2>&1
29     if [ $? -eq 0 ]; then
30         ls_color=cli
31     else
32         ls_color=
33     fi
34 fi
35
36 # Main ls function, separated to prevent code duplication.
37 ls_path=`which ls`
38 my_ls() {
39     "$ls_path" -C -F $* 2>&1 | less
40 }
41 # Make sure there is no alias named ls as it causes problems with the
42 # following ls function on (at least) bash 4.0.35.
43 unalias ls 2> /dev/null
44 # GNU ls with colors.
45 if [ x$ls_color = xgnu ]; then
46     ls() {
47         my_ls --color $*
48     }
49 # Normal ls with colors.
50 elif [ x$ls_color = xcli ]; then
51     ls() {
52         CLICOLOR_FORCE=1 my_ls -G $*
53     }
54 # Simple ls with no colors.
55 else
56     ls() {
57         my_ls $*
58     }
59 fi
60 unset ls_color
61 # Helper function to list all files.
62 la() {
63     ls -a $*
64 }
65 # Helper function to list the files in list format with access rights, etc.
66 ll() {
67     ls -l $*
68 }
69 # Helper function to list all files in list format with access rights, etc.
70 lal() {
71     la -l $*
72 }
73
74
75 # Make going up directories simple.
76 alias ..='cd ..'
77 alias ...='cd ../..'
78 alias ....='cd ../../..'
79 alias .....='cd ../../../..'
80
81 # I sometimes confuse editor and shell, print a warning to prevent I exit the
82 # shell.
83 alias :q='echo "This is not Vim!" >&2'
84
85 # Automatically use unified diffs.
86 alias diff='diff -u'
87
88 # Display all files and use human readable sizes.
89 alias du='du -sh'
90 # Use human readable sizes.
91 alias df='df -h'
92
93 # Edit the mercurial patch queue series file for the current mercurial
94 # repository in Vim. Also change Vim's pwd to the patches directory so other
95 # patches can easily be opened.
96 alias vqs='vim -c "cd `hg root`/.hg/patches/" "`hg root`/.hg/patches/series"'
97
98 # vim: ft=sh