1 # Aliases and similar functions which can be used by all shells (supporting
4 # Copyright (C) 2011-2012 Simon Ruderich
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.
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.
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/>.
20 # Shortcuts for often used programs.
27 alias p=less # p for pager
28 alias s=mpc # s for sound, m is already used
32 # Improved ls which displays the files in columns (-C), visualizes
33 # directories, links and other special files (-F) and pages everything through
36 # If available use GNU ls with colorized output. If it isn't available try
37 # normal ls which needs CLICOLOR_FORCE so it displays colors when used with a
38 # pager. If none work no colors are used.
40 # Check if colors are available.
41 ls --color > /dev/null 2>&1
45 ls -G > /dev/null 2>&1
53 # Main ls function, separated to prevent code duplication.
56 "$ls_path" -C -F "$@" 2>&1 | less
58 # Make sure there is no alias named ls as it causes problems with the
59 # following ls function on (at least) bash 4.0.35.
60 unalias ls 2> /dev/null
62 if [ x$ls_color = xgnu ]; then
66 # Normal ls with colors.
67 elif [ x$ls_color = xcli ]; then
69 CLICOLOR_FORCE=1 my_ls -G "$@"
71 # Simple ls with no colors.
78 # Helper function to list all files.
82 # Helper function to list the files in list format with access rights, etc.
86 # Helper function to list all files in list format with access rights, etc.
92 # Make going up directories simple.
95 alias ....='cd ../../..'
96 alias .....='cd ../../../..'
98 # I sometimes confuse editor and shell, print a warning to prevent I exit the
100 alias :q='echo "This is not Vim!" >&2'
102 # Automatically use unified diffs.
105 # Display all files and use human readable sizes.
107 # Use human readable sizes.
110 # Edit the mercurial patch queue series file for the current mercurial
111 # repository in Vim. Also change Vim's pwd to the patches directory so other
112 # patches can easily be opened.
113 alias vqs='vim -c "cd `hg root`/.hg/patches/" "`hg root`/.hg/patches/series"'