# Building a habitable computing environment

## Introduction

Hi, I'm Tess.

I've been using computers for a very long time, and many of my configuration files have been around, in one form or another, for over twenty years. Many years ago, I often found myself making related changes to multiple dotfiles. It occurred to me that it might be easier to understand my configuration if I wrote it as a literate program. I believe history has demonstrated how very wrong I was, but I'm too lazy to undo the damage at this point. All of my dotfiles are interleaved in one very long literate program, and for some reason you're reading it now. I'm sorry.

## Concepts

Here's how I set $SYSNAME in Zsh, PowerShell, and Emacs: ## Home sweet home ### bin/ - shell scripts This directory should be in my shell's search path as well as Emacs'. Guard against adding duplicate entries to either fpath or path This add-to-path function prepends each directory passed to it to $path iff the dir exists.

And here's more or less the same thing in PowerShell.

### Local config files and XDG

I put local (machine-specific) config files in XDG Base Directory-style config directories. Only some systems come with XDG environment variables set, so I need to set them myself when they're missing.

#### Local config overrides

For my shell, I have a local config file that gets loaded at the end of .zshrc.

For Emacs and Gnus, it's simpler. Each only has one local file, which run after .emacs and .gnus, respectively.

## Shells and terminals

### Features common to all shells

#### Cursors

There is nothing worse than blinking cursors.

And here's how to disable a blinking cursor in vi.

#### ls

Set my preferred colors for ls to use. Directories should be yellow!

How to set your ls colors on Linux systems:

How to set your ls colors on FreeBSD and macOS:

And in newer PowerShells, there's experimental support for colors in Get-ChildItem, its ls equivalent. ls in PowerShell is very verbose by default. Here's an attempt at making it less so.

#### Path

When I have a separate data partition on Mac, make sure I set up my path appropriately.

#### Prompts

Here's how I include the current git branch and revision in my prompt if the current directory is in a git repo.

#### Shell aliases and functions

##### touch

Powershell doesn't have touch.

##### less

PowerShell doesn't have less, but Git for Windows comes with it.

##### rmb — remove Emacs backup files

I've made this a function in zsh because I don't want it to complain about no matches. There's probably a more elegant way to do this.

On macOS, I use oa to figure out additional aliases to set.

#### Shell completion

Turn on file completion.

Some Unix systems have a group per user, and some don't. Try to configure my umask to do the right thing on either kind of Unix.

Use Emacs key bindings for command line editing in zsh.

### zsh

I relatively recently switched my default shell to zsh.

Don't complain about patterns with no match unless none of them match. FIXME: explain why I changed this from csh_null_glob due to cdpath.

Display possible completions on second TAB

#### Zsh config files

What Zsh config files get loaded, and in which order:

. .zshenv
 -o login  && . .zprofile
 -o interactive  && . .zshrc
 -o login  && . .zlogin

##### .zshenv
##### .zprofile ##### .zshrc

### bash

Sometimes I find myself in bash.

### PowerShell

On Windows I use PowerShell.

When SSHed into a machine from Windows, C-SPC doesn't get correctly sent to the other side by Windows. Here's an alternate keybinding for set-mark-command I can use in such cases.

### ANSI colors

### don't echo passwords in comint

## Emacs

I've been a heavy Emacs user for over twenty years; my .emacs file has been continuously evolving that whole time.

### Key bindings

I have been typing M-o M-s to center the current line since time immemorial. Apparently some recent Emacsen have removed this keybinding. Here's how I restore it.

### generic x

### Browsers, browser engines, and their bug trackers

### HTML entities

### tess-run-executable

### Emacsclient

## Email & Gnus

### Abbrevs in mail

Here's how to make Emacs take a \texttt{-gnus} argument which starts Gnus:

### EUDC

#### EUDC integration with the macOS' Contacts.app

EUDC ships with a backend that knows how to talk to macOS' Contacts.app, though it relies on a command-line utility that doesn't come with macOS or Emacs to work.

## IRC

I used to be one of the maintainers of ERC, one of the IRC clients included with Emacs by default.

#### Public keys

## Operating Systems

Note to self: The following snippet (Configure ls colors) gets included in both .bashrc and .zshrc, so it needs to remain polyglot bash / zsh.

## Games

### Fortune

In college and for a few years after I maintained a pretty large fortune file. I gave up on that effort a long time ago, but recently I started making zsh print out fortunes at login, so I started over. The actual quotes are dispersed throughout this document. Here's where we pull them all together:

I run fortune at login time.

Some versions of fortune use a binary file to index into the text file containing all the fortunes. This is how I ensure that binary file is up-to-date at login time.

macOS doesn't ship with fortune by default so, instead of installing it, I wrote a drop-in replacement as a zsh function. Why, you might be asking. I honestly don't know. It seemed like a good idea at the time.

I also implemented it in PowerShell. It's a bit shorter.

### Nethack

export NETHACKOPTIONS='name:Tess, align:neutral, race:Elf, role:Rogue,
gender:female, fruit:apple, horsename:Ed, dogname:Maggie, catname:Ash,
color'


### paredit

#### Rust

## Generating this HTML file from source

### Noweb

I use noweb to generate all of my dotfiles from this source file.

I edit the single source file using noweb-mode in Emacs.