]> ruderich.org/simon Gitweb - config/dotfiles.git/blob - shell/env
shell/aliases: add h alias for htop
[config/dotfiles.git] / shell / env
1 # Configuration file for environment related options for all shells.
2
3 # Copyright (C) 2011-2014  Simon Ruderich
4 #
5 # This file is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # This file is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this file.  If not, see <http://www.gnu.org/licenses/>.
17
18
19 # Use UTF-8 encoding in the terminal. Don't use LC_ALL as it's used for
20 # debugging purposes. Thanks to twb in #screen on Freenode (2009-10-02 10:25
21 # CET).
22 LANG=en_US.UTF-8
23 export LANG
24 # Use C locale when sorting.
25 LC_COLLATE=C
26 export LC_COLLATE
27
28 # Just in case a nice administrator tries to force LC_ALL on us ...
29 unset LC_ALL
30 # Also reset the rest just in case.
31 unset LC_ADDRESS
32 unset LC_CTYPE
33 unset LC_IDENTIFICATION
34 unset LC_MEASUREMENT
35 unset LC_MESSAGES
36 unset LC_MONETARY
37 unset LC_NAME
38 unset LC_NUMERIC
39 unset LC_PAPER
40 unset LC_TELEPHONE
41 unset LC_TIME
42
43 # Make sure $LANGUAGE is not set. It's a GNU extension which can overwrite
44 # variables like $LANG or $LC_ALL.
45 unset LANGUAGE
46
47 # Add ~/bin and ~/.bin and ~/.shell/bin to PATH if available.
48 if test -d "$HOME/.shell/bin"; then
49     PATH="$HOME/.shell/bin:$PATH"
50 fi
51 if test -d "$HOME/bin"; then
52     PATH="$HOME/bin:$PATH"
53 fi
54 if test -d "$HOME/.bin"; then
55     PATH="$HOME/.bin:$PATH"
56 fi
57
58 # Use Vim as editor.
59 EDITOR=vim
60 export EDITOR
61
62 # Set less as pager, its configuration is done through the ~/.less file.
63 PAGER=less
64 export PAGER
65
66 escape=`printf '\033'`
67 # Color man pages viewed with less, thanks to [1].
68 #
69 # [1]: http://nion.modprobe.de/blog/archives/572-less-colors-for-man-pages.html
70 #
71 # Color bold strings in bold blue.
72 LESS_TERMCAP_md="${escape}[01;34m"
73 LESS_TERMCAP_me="${escape}[0m"
74 export LESS_TERMCAP_md LESS_TERMCAP_me
75 # Color underlined strings in bold yellow and underlined.
76 LESS_TERMCAP_us="${escape}[01;4;33m"
77 LESS_TERMCAP_ue="${escape}[0m"
78 export LESS_TERMCAP_us LESS_TERMCAP_ue
79 # Color standout mode in bold black with yellow background.
80 LESS_TERMCAP_so="${escape}[01;30;43m"
81 LESS_TERMCAP_se="${escape}[0m"
82 export LESS_TERMCAP_so LESS_TERMCAP_se
83
84 # Use ~/.tmp as directory for temporary files if available to reduce security
85 # problems on multi-user systems.
86 if test -O "$HOME/.tmp" && test -d "$HOME/.tmp"; then
87     TMP=$HOME/.tmp
88     TEMP=$TMP
89     TMPDIR=$TMP
90     export TMP TEMP TMPDIR
91 # Also try ~/tmp as fallback.
92 elif test -O "$HOME/tmp" && test -d "$HOME/tmp"; then
93     TMP=$HOME/tmp
94     TEMP=$TMP
95     TMPDIR=$TMP
96     export TMP TEMP TMPDIR
97 fi
98
99 # Change rlwrap's home directory to prevent cluttering ~/.
100 RLWRAP_HOME="$HOME/.shell/rlwrap"
101 export RLWRAP_HOME
102
103 # Set colors for GNU ls (and Zsh completions).
104 if test -f "$HOME/.shell/dircolors"; then
105     . "$HOME/.shell/dircolors"
106 fi
107 # Set the same colors for non GNU ls, except for special cases which aren't
108 # supported.
109 LSCOLORS='ExgxxxxxBxxxxxBdBdExEb'
110 #         ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
111 #         | | | | | | | | | | |
112 #         | | | | | | | | | | *- directory writable to others, without sticky bit
113 #         | | | | | | | | | *--- directory writable to others, with sticky bit
114 #         | | | | | | | | *----- executable with setgid bit set
115 #         | | | | | | | *------- executable with setuid bit set
116 #         | | | | | | *--------- character special
117 #         | | | | | *----------- block special
118 #         | | | | *------------- executable
119 #         | | | *--------------- pipe
120 #         | | *----------------- socket
121 #         | *------------------- symbolic link
122 #         *--------------------- directory
123 export LSCOLORS
124
125 # Setup lesspipe to view multiple file-types (like .gz, .zip, etc.) with less.
126 # Useful in combination with the "p" alias. Inspired by Debian's default bash
127 # files. Thanks.
128 if test -x /usr/bin/lesspipe; then
129     # Don't use eval $(lesspipe) which breaks on a few systems (e.g. Gentoo)
130     # due to a different lesspipe implementation.
131     LESSOPEN='| /usr/bin/lesspipe %s'
132     LESSCLOSE='/usr/bin/lesspipe %s %s'
133     export LESSOPEN LESSCLOSE
134 fi
135
136 # vim: ft=sh