At the OSL we have shared workstations, most of which are named after colors. In the NOC, I usually work at emerald.workstation.osuosl.bak (Figure 1). I use tmux (Figure *) to multiplex so I can have multiple terminals open in a single ssh connection and connect to my session from anywhere. When splitting the terminal vertically, the prompt can get so long that it's hard to see the command that I'm entering (Figure 2). I'd like my prompt to automatically shorten itself in narrow windows. Fortunately, my terminal already knows how much space it has available: $COLUMNS is an environment variable which stores how wide your current terminal is, and the default unixism is 80. So in order to save space, I'd like to shorten my prompt to only a directory listing and a colored character replacing the normal $ or >.
Behold! (Figure 3, 4)