Revisiting my Linux box

My Mac Pro gave up the ghost last week, so while I wait for that thing to be repaired, I’ve been spending more time on my Lenovo X220 running Ubuntu. While I do use it for writing fairly often, that doesn’t even require me to start X. Using it a bit more full-time essentially means firing up a web browser alongside whatever else I’m doing, which has led to some additional mucking around. For starters, I went ahead and updated the system to 16.04, which (touch wood) went very smoothly as has every Linux upgrade I’ve performed in the past couple of years. This used to be a terrifying prospect.

Updating things meant that the package list in apt also got refreshed, and I was a wee bit shocked to find that Hugo, the platform I use to generate this very blog, was horribly out of date. Onward to their website, and they recommend installing via Snapcraft, which feels like a completely inexplicable reinventing of the package management wheel1. Snapcraft is supposedly installed with Ubuntu 16.04, but not on a minimal system apparently, so I went and did that myself. Of course it has its own bin/ to track down and add to the ol’ $PATH, but whatever – Hugo was up to date. I think I sudoed a bit recklessly at one point, since some stuff ended up owned by root that shouldn’t have been, but that was an easy enough fix.

I run uzbl as a minimalist web browser, and have Chromium installed for something a bit more full-featured. I decided to install Firefox, since it is far less miserable of a browser than ever, and its keyboard navigation is far better than Chromium’s. Firefox runs well, and definitely fits better into my keyboard-focused setup, but there is one snag: PulseAudio. At some point, the Firefox team decided not to support ALSA directly, and it now relies on PulseAudio exclusively for audio. I can see small projects using PulseAudio as a crutch, but for a major product like Firefox it just feels lazy. PulseAudio is too heavy and battery-hungry, and I will not install it, so for the time being I’m just not watching videos and the like in Firefox. I did stumble upon the apulse project, but so far haven’t had luck with it.

I use i3 as my window manager, and I love it so much – when I’m not using this laptop as a regular machine, I forget how wonderful tiling window managers are. When I move to my cluttered Windows workspace at the office, I miss i3. Of course, I tend to have far more tasks to manage at work, but there’s just something to be said for the minimalist, keyboard-centric approach.

I had some issues with uxterm reporting $TERM as xterm and not xterm-256color, which I sorted out. A nice reminder that fiddling with .Xresources is a colossal pain. I’m used to mounting and unmounting things on darwin, and it took me a while to remember that udisksctl was the utility I was looking for. Either I hadn’t hopped on wireless since upgrading my router2, or the Ubuntu upgrade wiped out some settings, but I had to reconnect. wicd-curses is really kind of an ideal manager for wireless, no regrets in having opted for that path. I never got around to getting bluetooth set up, and a cursory glance suggests that there isn’t a curses-based solution out there. What else… oh, SDL is still a colossal pain.

All in all, this setup still suits a certain subset of my needs very well. Linux seems to be getting less fiddly over time, though I still can’t imagine that the ‘year of desktop Linux’ is any closer to the horizon. I wouldn’t mind living in this environment, though I would still need software that’s only available on Mac/Win (like CC), and the idea of my main computer being a dual-boot that largely keeps me stuck in Windows is a bit of a downer. Perhaps my next experiment will be virtualization under this minimal install.

  1. I get what Snapcraft is and why Canonical is doing it. It definitely feels like it’s trying to accomplish too much, and there is no world in which I want my package manager running a daemon. ↩︎
  2. A while back, I upgraded my aging TP-Link to a Peplink Balance One. It is a phenomenal router that I cannot recommend enough. It’s small-business grade, and Peplink takes security and firmware updates very seriously. With all the router exploits out in the wild over the past year or so, they’ve been very quick to release statements as they investigate potential threats to their devices. ↩︎

The deceitful panacea of alt text

One of my favorite1 accessibility myths is this pervasive idea that alternate text is some kind of accessibility panacea. I get it – it’s theoretically2 a thing that content creators of any skill level can do to make their content more accessible. Because of these things (and because it is technically a required attribute on <img> tags in HTML), it seems to be one of the first things people learn about accessibility. For the uninitiated, alternate text (from here on out, alt text) is metadata attached to an image that assistive tech (such as a screen reader) will use to present a description of an image (since we don’t all have neural network coprocessors to do deep machine-learning and describe images for us).

This is all very good, if we have a raster-based image with no other information to work with. The problem is, we should almost never have that image to begin with. Very few accessibility problems are actually solved with alt text. For starters, raster images have a fixed resolution. And when users with limited vision (but not enough-so to warrant use of a screen reader) attempt to zoom in on these as they are wont to do, that ability is limited. Best case scenario, the image is at print resolution, 300dpi. This affords maybe a 300% zoom, and even then there may be artifacting. Another common pitfall is that images (particularly of charts and the like) are often used as a crutch when a user can’t figure out a clean way to present their information. Often this means color is used as a means of communicating information (explicitly prohibited by §508), or it means that the information is such a jumble that users with learning disabilities are going to have incredible difficulty navigating it.

Information often wants to fall into a particular structure. When I’m given a bar chart at work, in its original, non-rasterized form, I just structure it back into a table behind the scenes (in PDF). If you’re trying to communicate a message (particularly data), often part of the problem is that there’s a lot of information to communicate. This requires further structuring, and alt text is ‘flat’. By this, I mean, it lacks the capability to be structured – it’s generally restricted to paragraph breaks, if that.

An anecdote: in my professional life, I requested a customer provide original or recreated (but non-rasterized) versions of infographics in a document, and ended up with one that, when pasted into Word, yielded two pages worth of text. I explained to the customer that this was far too much content for alt text, for the reasons already mentioned. She responded that her ex-husband was blind, and how she had written it was exactly how he would have wanted to hear her read it. She failed to understand that if he knew what he was hearing was irrelevant to what he wanted to hear, he could ask her to skip ahead to the relevant bits. She failed to understand that if he missed how this piece of information related to the bigger picture (think, header row and column in a table), he could ask her. She failed to understand that she was not a robot and he probably enjoyed listening to her talk more than NVDA.

And it is here that we come to a major pitfall of accessibility work in general. Folks think that it’s enough to provide information, without any consideration for how that information is structured (or not). Pages worth of descriptions of a table are not a suitable replacement for an actual table where data always has context available if necessary. Data always has a sense of where it exists in two dimensions. Navigating among sections is a godsend when you’re trying to get through massive amounts of complex data, and fluffy tangential details are simply a waste of time when you’re listening to a robot. This is all on top of the issues that exist for folks struggling with poorly-rendered or poorly-designed images despite not using a screen reader.

Alt text is not a panacea. If it is to be used, it should be concise and clear, while presenting all of the relevant information a sighted user would grasp. If this is not possible, the image should not be rendered as a raster image, period. Listen to your alt text in a screen reader. Try to find a specific data point. If you get lost, find another way to present the information. If you stick with your rasterized image, drop the highest resolution version in that you possibly can. Print resolution is a minimum; 72dpi is for abled folks. Don’t use color as an exclusive means to communicate or associate data with meaning. Learn to resist images, and when you use them, learn to embed them in inherently machine-friendly ways.

  1. I do so hate playing favorites with my enemies. ↩︎
  2. There’s still a lot of nuance here. Encouraging concision and avoiding fluff at all cost, including whether or not an image even needs alt text. So many images are just there to fill whitespace; no reader needs to know that you just plonked a photo of a tree down for the hell of it. I am always sure to make note of logos and the like, because they express the same message to a blind user as to a sighted user – a sense of official approval. ↩︎


The ‘screenshots’ in this post are just styled code blocks. There are likely some weird visual artifacts (like background colors not extending the whole width of the block), but the point is to show off the colors.

I’ve been using a hastily-thrown-together color scheme for vim, cleverly named ‘bcustom.vim’ for years now. It’s a dark scheme, peppered heavily with syntax highlighting. While slightly softer than most, it’s still a pretty typical, masculine scheme. I recently realized two things – I would like to use a more feminine, light scheme based on my general sense of pinkness1, and I actually find myself a lot more distracted by extensive syntax highlighting than I find myself aided by it. So I decided to start from the ground up, and build a minimalist, light pink colorscheme, ‘decolletage.vim’.

Again, part of the design decision was to keep the total number of colors used to a minimum. So, to start, here’s the basic scheme. You can see the line numbers, the basic scheme, a comment, an uncapitalized word (‘colors’), a misspelled word (‘matchTypo’), a fold, a search result (‘cterm’), an error (‘#123456’), a visual selection (‘Decolletage’), and matched parentheses:

193 194 195 “Adjust things re: markdown. colors only matchTypo if decolletage loads 196 if g:colors_name==“decolletage” 197 +— 5 lines: hi! link markdownBlockQuote CursorColumn―――――――――――――――――――――― 198 199 hi markdownBlockQuote ctermfg=none ctermbg=#123456 200 call DecolletageDiff(1)

It… looks a lot like this blog, I know. That truly wasn’t how I set out to do things, it’s just my aesthetic. Let’s examine a little -- More --, like that right there, which is how the more/mode message lines appear. Or these status lines:

2:~/.vim/colors/decolletage.vim [RO] [vim][utf-8] 74,1 71% 2:~/.vim/colors/decolletage.vim [RO] [vim][utf-8] 74,1 71% 2:~/.vim/colors/decolletage.vim [RO] [vim][utf-8] 74,1 71%

…Active, inactive, and insert, in that order. Yes, it may be weird, but I like having a blunt, obvious indication of which mode I’m in. And I associate blue with insertion, so that’s my choice for insert. This was a feature of my hacked-together ‘bcustom.vim’ as well – it’s pretty nice to have.

There are two variants for diffs in decolletage.vim. One is more traditional, very obvious with highlighted backgrounds and the like; and the other is fittingly minimal. Here’s the standard version (you also get to see a split line here; it’s predictable) (oh, and non-printing characters):

1 if this { │ 1 if this { 2 that │ 2 that 3 → the other↲ ---------------------------------- 4 print “goodbye” │ 3 print “goodbye” 5 → return true↲ │ 4 → return false↲ 6 } │ 5 }

…and here’s the more jarring, less obviously-a-diff minimal version:

1 if this { │ 1 if this { 2 that │ 2 that 3 → the other↲ --------------------------------- 4 print “goodbye” │ 3 print “goodbye” 5 → return true↲ │ 4 → return false↲ 6 } │ 5 }

I’m fully on board with the minimal version, but it doesn’t seem right to have as a default, so it isn’t. Add call DecolletageDiff(1) to your .vimrc to use it. Alternatively, you can choose it as a default, and call DecolletageDiff(0) for filetypes that seem to desire a more blatant diff.

:set cursorline in decolletage.vim looks like this:

254 255 this is the line that the cursor is on _ 256

I’m not a huge fan of cursorline, but I do see value in being able to quickly find the current line, so for a more subtle cursorline, we can call DecolletageNecklace(0):

254 255 this is the line that the cursor is on _ 256

Finally, there is an option to actually add some syntax highlighting, via call DecolletageFreckles(1). It’s rudimentary so far, and based on the default colors that vim would use in a 16-color terminal.

317 Constant 318 Identifier 319 Statement 320 PreProc 321 Type 322 Special 323 Number 324 Boolean

…this probably needs tweaking, but it is there if you want it. And again, implementing it as a function call means you can pop it on and off at will as you’re flipping through a file. So, that should be adjusted, I’d like to add some color for netrw, and I need to implement it as GUI colors as well2. But, for the time being (and particularly for my own specific needs), decolletage.vim looks pretty good, and is available for preliminary testing here.

  1. This is my meatspace aesthetic as well, my work desk has several pink tablets and pens with deep purple ink. ↩︎
  2. With the prevalence of termguicolors, not sure why I didn’t just start with GUI colors scraped from the 256-color list, but here we are. ↩︎

Examining 'my .vimrc'

I realized the other day that, as much as I’ve read through the vim documentation and sought out solutions to specific problems, I’m still constantly learning things about it almost accidentally as I stumble across how person x or y approached some specific task. It occurred to me that a lot of people post their .vimrc files online1, and flipping through a bunch of these could prove insightful. So I googled ‘my vimrc,’ I searched github, I poked around… a lot. It’s worth noting that some of my observations here are biased in that my vim use is primarily prose (generally in markdown), followed by HTML/CSS/JS, followed by recreational code. I don’t deal in major coding projects consisting of tens of thousands of SLOC for production systems. What works for me is almost certainly atypical.

Something that I’ve been meaning to write about is my aversion to things that make any given setup of mine less portable – and that includes things like keyboard mappings that simply give me muscle memory that only works on my configuration. I see a lot of this sort of stuff in the .vimrc files of others, and for the most part it’s just stuff where I’d rather take the efficiency hit but know how to do it in a portable way. For example, a lot of people map something to the ‘oh shit I forgot to sudo vim’ sequence, !sudo tee % > /dev/null. I fully understand how that sequence works, but to me it’s such an oddball use of tee that I feel like if I got too accustomed to not typing it, I might accidentally do something really weird on a system that isn’t my own2. Similarly, I see a lot of mappings like Ctrlh to jump left a window instead of Ctrlwh. This sort of thing saves you one keystroke, while completely demolishing one of the key points of using vim – that of context and modality. Ctrlw means ‘get ready to do some stuff to some windows’, be it moving, resizing, closing, whatever. It’s not a ‘mode’, per se, but it fits vim’s modal model.

I know there’s a huge community of vim plugin development, but I was still a little surprised to see so much reliance on plugins (and plugin managers3). There are a few plugins that I consider rather essential, like surround.vim, but again I largely try to do things the native way when possible, so I try not to extend vim too heavily.

I don’t strictly adhere to the aforementioned policy, particularly for things that I know I won’t forget how to do in a portable way (like autocd in the shell), or things that are purely conveniences (like mapping CtrlL such that it works in insert mode). One clever idea that I saw along these lines was remapping Enter to clear the search highlight before doing its thing. Which, I don’t think I’ll adopt, but it is a handy idea – those highlights can get a little distracting.

I see a lot of mappings of j to gj which again just feels so un-vimlike. Up/down movements corresponding to screen lines instead of content lines is something that actually bugs me in other editors. Worse, this mapping makes counts tricky to use in a . or macro situation, which is particularly weird when a lot of the same people use :set relativenumber. Another common mapping is to do gv after > or <, so that you can repeatedly hit it and have the same visual block selected. But… the vim way would be to use a count instead of mashing the button four or five times.

People remap <Leader> to , a lot, which to me feels even more awkward than \. I’ve seen weird insert-mode mappings to jump back to normal mode, like jj, which is fair – Esc is kind of a ways away. But the real trick to that is twofold: first, remap your useless Caps Lock to Ctrl system-wide, and then train yourself to use Ctrl[ instead of Esc.

Doug Black’s post about his .vimrc has two good pieces of advice: don’t add things to your .vimrc that you don’t understand, and don’t use the abbreviated forms of settings/commands4. I see a lot of files that don’t seem to conform to this rather basic advice. Things like hardcoding t_Co without performing any checks – at best it’s merely not portable, but it reads like ‘a thing that I did that solved a problem’ vs. a setting that the user actually understands.

I did have some positive takeaways from this little journey. While I don’t use macros much (I opt for :normal more often), I learned about :set lazyredraw which speeds up macro execution by waiting until the end to redraw the screen. I had somehow forgotten that vim supports encryption, and that it defaults to the laughable pkzip scheme, so :set cryptmethod=blowfish2 is making its way into my .vimrc. Someone added syntax for two spaces after a period, which is a smart idea – I would link that right to Error. It would be better (perhaps) to add that as a wrong/bad spell, but I think a highlight would work.

Curious to me was the number of people who put things in their .vimrc files that are specific to filetypes (etc.). This is stuff that I generally relegate to .vim/ftplugin/ and .vim/ftdetect/. For instance, I have some folding rules in place for markdown files used in my blog. I add the filetype hugo with a ftdetect script, and then lay out some syntax rules in .vim/ftplugin/hugo_folds.vim. I don’t know if my approach is better or worse – it definitely makes for a big pile of files. Is this more or less organized than just maintaining it in a tidy .vimrc? Something to think about.

This adventure down the dotfile rabbit hole taught me more than anything, I suppose, about how other vim users twist vim’s arm to make it less vimlike. Interestingly, I ran into a couple of files that were updated over the years, and the users seemingly adapted to more vimmy ways. I suspect a lot of these things come of a sort of feedback loop – a vim beginner sees a .vimrc file online with map <C-K> <C-W>k and thinks ‘why not shave off a keystroke?!’ They end up posting their .vimrc file a year down the road when they feel they’ve perfected it, and another novice stumbles across it, thinking ‘why not shave off…’ Regardless, it’s pretty neat just how many .vimrc files are floating around there, given how customizable and extensible vim is. Even approaches that are totally opposite one’s own likely have something previously unknown or unthought of.

  1. In no order, a handful of the .vimrc files that I looked at: amix, JeffreyWay, Chris Yeh, sts10 and sts10, Doug Black, vinchi777, Jake Gordon, Jay Pipes, MisoF, Taylor Hornby, Janis Miezitis, abbood, Isaac Sloan, Steve Francia ↩︎
  2. I guess this is a pretty out-there hypothetical, a system in which I’m on the sudoers list but cannot or have not swapped in my own .vimrc. Still, I’d rather just know how to do this vs. mapping it to a single keystroke. It really shouldn’t come up often enough that such convenience is necessary anyway. ↩︎
  3. I really don’t understand vim plugin managers. You have to use way too many plugins for this to even approach necessity, and even then… When people distribute vim plugins, they lay everything out in the appropriate structure to just drop in your .vim/ folders. ↩︎
  4. The weirdest is when people do something like :set scs "smartcase. Just… use the descriptive name instead of using the short name and a descriptive comment? ↩︎

Reversing Markdown

Most writing that I do, I do in vim using Markdown. Either for applications that support it natively (like Hugo, which powers this blog), via pandoc, or directly into Word via Writage. Going from Markdown is never really a problem, but trying to convert from pretty much any format to Markdown is pretty much always frustrating.

The reason for this is baked into the format — the format is designed to be flexible. It’s designed to be human-readable, and therefore most structural elements can be reached via several paths. For example, italics can be reached either by _this_ or *this*, and bold is achieved via either __this__ or **this**1. This allows a variety of personal styles. Since _this_ is a universal fallback for communications that don’t afford italics2, that is how I always do italics. And, on the rare chance that I use bold, I do it **this way** to readily set it off from the italics formatting. Ultimately, there are four combinations here, though, and software that is rendering to Markdown has to make its own style choices.

There are other decisions. Markdown, for some ungodly reason, promotes hard-wrapping (which I loathe). Markdown supports two different sorts of headers, one of which I find aesthetically pleasing, and then Setext-style. But again, a renderer has to either support a ton of options or make these decisions for you. Writage, for example, makes pretty much every decision opposite how I’d like it. Which is ok, but it means I spend a lot of time in vim reprocessing things.

I’ve been considering writing about this for months now, mostly to complain about Writage. But, this isn’t Writage’s fault. And I’d hesitate to call it a fault at all, it’s just a tradeoff that comes with a flexible markup language. I don’t think I would have made a lot of the decisions that Gruber made in establishing this format… But those decisions have led to it being a de facto standard for human-readable markup. Rich text would be worse off had this gone any other way.

  1. Textile gets this right, and Markdown gets it wrong, full stop. Major style guides refer to underline as an alternative to italic, and _underscore surround_ as an alternative to underline. I love Markdown, but I firmly believe this was a deeply flawed decision. ↩︎
  2. Even this is a poor example — when going to HTML, is _this_ <i> or <em>? <em> is likely preferable, but from a human-readable markup standpoint, is the aim style or structure? How does one reference the title of a book if _this_ is <em>? Textile distinguishes these as well. ↩︎