#!/bin/sh # Environment variables for X and all text-mode shells: both bash, # Xsession and scripts run by cron source this. So POSIX only. # We have calls to `which` which we expect to fail set +e # ---- SDF backspace fix from SDF .profile stty erase '^h' echoe # ---- choose editor depending on what's available if [ "$DESKTOP_SESSION" = "i3" ]; then ec_args="-c" else ec_args="-t" fi emacsclient=$(which emacsclient 2>/dev/null) mg=$(which mg 2>/dev/null) # best case: emacsclient and mg available if [ -x "$emacsclient" -a -x "$mg" ]; then EDITOR="emacsclient -amg $ec_args" ALTERNATE_EDITOR="mg" else # only emacsclient, so change alternate editor if [ -x "$emacsclient" ]; then EDITOR="emacsclient -avi $ec_args" ALTERNATE_EDITOR="vi" else # no emacsclient, so see if we can fall back to mg if [ -x "$mg" ]; then EDITOR="mg" ALTERNATE_EDITOR="vi" # worse case: assume vi is available else EDITOR="vi" fi fi fi unset ec_args unset emacsclient unset mg export EDITOR VISUAL=$EDITOR export VISUAL # ---- set $PATH # this function prepends $addition to $PATH iff $addition isn't # already in $PATH and $addition is a directory maybe_add_to_path () { if ! echo $PATH | grep -q "$addition"; then if [ -d "$addition" ]; then PATH="$addition:$PATH" fi fi } addition="/sbin"; maybe_add_to_path addition="/usr/sbin"; maybe_add_to_path addition="/usr/local/bin"; maybe_add_to_path addition="/usr/pkg/bin"; maybe_add_to_path addition="$HOME/local/pkg/bin"; maybe_add_to_path addition="$HOME/local/pkg/sbin"; maybe_add_to_path addition="$HOME/bin"; maybe_add_to_path addition="$HOME/local/bin"; maybe_add_to_path addition="$HOME/.cabal/bin"; maybe_add_to_path addition="$HOME/.local/bin"; maybe_add_to_path addition="/meta/s/spw/local/src/git-annex.linux"; maybe_add_to_path unset addition export PATH # ---- maybe add to $MANPATH # if [ -d "$HOME/pkg/man" ]; then # MANPATH="$HOME/local/pkg/man:$MANPATH" # export MAHPATH # fi # ---- package management by Nix: add to $PATH once more # # crude heuristic to determine if it's already been added # if ! echo $PATH | grep -q "$HOME/.nix-profile/bin"; then # if [ -e "/etc/profile.d/nix.sh" ]; then # . /etc/profile.d/nix.sh # fi # fi # ---- set language (snippet from joeyh's home-etc.git repo) # TODO: according to , I ought not to # be setting LC_ALL. Instead I could set most of LC_* to en_GB.UTF-8, # and some e.g. LC_PAPER to en_US.UTF-8. # disabled: propellor setting it system-wide on my machines and that's # enough # case " $(echo $(locale -a)) " in # *\ en_GB.utf8\ *) LANG=en_GB.utf8 ;; # *\ en_GB.UTF-8\ *) LANG=en_GB.UTF-8 ;; # *\ C.UTF-8\ *) LANG=C.UTF-8 ;; # *\ C.utf8\ *) LANG=C.utf8 ;; # *) unset LANG ;; # esac # LC_ALL=$LANG # export LC_ALL # export LANG # ---- further preferences GIT_PAGER= export GIT_PAGER GIT_MERGE_AUTOEDIT=no export GIT_MERGE_AUTOEDIT GPG_KEY_ID=0F56D0553B6D411B export GPG_KEY_ID MAILDIR="$HOME/.fmail/" export MAILDIR # LD_RUN_PATH="$HOME/local/lib/" # export LD_RUN_PATH # LD_LIBRARY_PATH="$HOME/local/lib/" # export LD_LIBRARY_PATH MAIL=/mail/${LOGNAME:?} export MAIL BROWSER="firefox" export BROWSER TERMCMD="xfce4-terminal" export TERMCMD TERMINAL="xfce4-terminal" export TERMINAL DEBFULLNAME="Sean Whitton" export DEBFULLNAME DEBEMAIL="spwhitton@spwhitton.name" export DEBEMAIL # "Setting the monitor port to 0 turns the monitoring function off, # and autossh will only restart ssh upon ssh's exit." # # We rely on ServerAliveInterval and ServerAliveCountMax set in ~/.ssh/config AUTOSSH_PORT=0 export AUTOSSH_PORT # ---- set pager lessf=$(which less) if [ -x "$lessf" ]; then PAGER=less export PAGER LESS="--ignore-case --long-prompt" export LESS fi unset lessf