]> ruderich.org/simon Gitweb - config/dotfiles.git/blob - shell/aliases.in
shell/aliases,setup.sh: Move ls color detection to setup.sh.
[config/dotfiles.git] / shell / aliases.in
1 # Aliases and similar functions which can be used by all shells (supporting
2 # them).
3
4 # Copyright (C) 2011-2012  Simon Ruderich
5 #
6 # This file is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # This file is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this file.  If not, see <http://www.gnu.org/licenses/>.
18
19
20 # Shortcuts for often used programs.
21 alias c=clear
22 alias d=cd
23 alias e=elinks
24 alias g=git
25 alias l=ls
26 alias m=mutt
27 alias p=less # p for pager
28 alias s=mpc  # s for sound, m is already used
29 alias v=vim
30
31
32 # Make sure there is no alias named ls as it causes problems with the
33 # following ls function on (at least) bash 4.0.35.
34 unalias ls 2> /dev/null
35 # Improved ls which displays the files in columns (-C), visualizes
36 # directories, links and other special files (-F) and pages everything through
37 # less.
38 #
39 # If available use GNU ls with colorized output. If it isn't available try
40 # normal ls which needs CLICOLOR_FORCE so it displays colors when used with a
41 # pager. If none work no colors are used.
42 #
43 # See `setup.sh` for details. LS_ENV, LS_PATH, LS_COLOR are replaced with the
44 # correct values when this file is generated.
45 ls() {
46     LS_ENV LS_PATH LS_COLOR -C -F "$@" 2>&1 | less
47 }
48
49 # Helper function to list all files.
50 la() {
51     ls -a "$@"
52 }
53 # Helper function to list the files in list format with access rights, etc.
54 ll() {
55     ls -l "$@"
56 }
57 # Helper function to list all files in list format with access rights, etc.
58 lal() {
59     la -l "$@"
60 }
61
62
63 # Make going up directories simple.
64 alias ..='cd ..'
65 alias ...='cd ../..'
66 alias ....='cd ../../..'
67 alias .....='cd ../../../..'
68
69 # I sometimes confuse editor and shell, print a warning to prevent I exit the
70 # shell.
71 alias :q='echo "This is not Vim!" >&2'
72
73 # Automatically use unified diffs.
74 alias diff='diff -u'
75
76 # Display all files and use human readable sizes.
77 alias du='du -sh'
78 # Use human readable sizes.
79 alias df='df -h'
80
81 # Edit the mercurial patch queue series file for the current mercurial
82 # repository in Vim. Also change Vim's pwd to the patches directory so other
83 # patches can easily be opened.
84 alias vqs='vim -c "cd `hg root`/.hg/patches/" "`hg root`/.hg/patches/series"'
85
86 # vim: ft=sh