writings from zac anger

old blog

2017 todo list

I'm re-posting NY resolutions as a checklist, post-dated for the end of this year.

Some things will be ongoing tasks, and won't be checked off until I feel like I've been consistent with them for several months at the least.

I may add things to this list, or remove ones that I've straight-up decided were a bad idea (like buying a car).

The checklist is using GFM, which this blog generator doesn't understand. (That's on the list.)

things i hope to maybe do in 2017

  • [ ] Work less at work
    • [ ] Mainly, stop working on weekends and in the middle of the night and stuff
  • [ ] Get familiar enough with ClojureScript to write something real-world
  • [ ] Same, with Haskell
  • [x] Learn more about sh and POSIX compat in general
    • [x] Also convert as much of my dotfiles as possible to use sh instead of bash
    • [x] Also weed out my dotfiles, they're ridiculous
  • [ ] At least record the acoustic album that's been written and sitting there for ages
  • [ ] Maybe get Windows working enough to finish up the electro album thing
  • [x] Start learning to play the cello
  • [ ] Be healther
    • [ ] Switch to vaping, for real this time
    • [x] Maybe eat better?
      • [x] Less pizza, at least
  • [x] Finish paying off debts, so close
    • [x] Also try not to tap into savings so much for stupid things
  • [ ] Change how this blog is built, so it's more flexible, and maybe using something fun like Frog (using GFM).
    • [x] Also, blog more (at least, clear out my drafts dir).
  • [x] Be making more money
    • [x] Preferably where I am now, but somewhere else if that doesn't work out
    • [x] Also start actually emailing recruiters back
  • [x] Actually finish anything ever
    • [x] Various unfinished small projects
  • [x] Make progress on learning Korean, for real this time
  • [x] Try really hard to not write any untested code
  • [x] Make a real effort to talk to real humans in real life
  • [x] Take the time to move all things using Facebook auth away from this
  • [x] Delete Facebook
  • [x] Get more tattoos

So You Want To Learn vim

So You Want To Learn vim

Why Read This?

Why am I qualified to talk about this? There are so many Intro To Vim posts/articles/whatever out there, so why should you read this one?

This isn't going to be a Vim tutorial. It's more of a guide to guides and a short overview of resources.

I've been using Vim full-time for around two years now, and used a lot of other editors before Vim. It took me a while to figure out what I wanted in an editor, and when I did figure it out it turned out Vim was what I needed. I'm not a Vim expert, but I'm solid enough with it that I can be much more productive in Vim than in any other editor. I'm writing this post in Vim because it's far more comfortable for me now than some other thing with buttons and menus and pointing and clicking and all that. Vim fits really nicely into the environment and workflow I already had (entirely terminal-based).

Do You Really Want To Learn Vim?

Are you sure? Why do you want to learn Vim? Is it because someone told you your editor isn't a real editor and real programmers use Vim (or Emacs)? That's bullshit. Real programmers use whatever tools help them be productive. If you're already good with your editor, and it suits your needs, stick with it. You should learn Vim if you're not happy with what you're using now. It doesn't matter if you use Atom or Emacs or Eclipse or whatever. If you know your editor well and can get stuff done in it, don't switch editors just because someone said you should. Learn Vim if you're tired of how resource-heavy Atom is, or you spend a lot of time sshed into servers, or you just haven't found something that felt right yet.

That being said, I love Vim, and if you want to learn it, and have the time to get moving with it, I think you should. I've used loads of editors in the past (Nano, Notepad++, Kilo/OpenEmacs, Hipper, Atom, LightTable, WebStorm, Visual Studio, VS Code, TextAdept, Sublime Text, and probably others). They all have their good parts and their bad parts. So does Vim, but for me the good far outweighs the bad with Vim (and most of the bad is Vimscript, which is kind of really rough).

Where You Should Start

There are loads of resources for learning Vim out there. A lot of them take the form of games and such. Ignore all those. They'll only teach you the basics, usually just of navigation and maybe two modes. They won't help you understand Vim, they'll just teach you enough to be able to open it, enter text, move around, and quit. If that's all you need in an editor, switch to Notepad or Nano. Learning how to move and enter text is important, but it's also important to know why things are the way they are in Vim.


Start with vimtutor. If you're on Linux, BSD, or Mac, you probably already have it installed. Just type vimtutor in a terminal, and do the whole thing. You don't have to do it all at once, and you don't have to do it only once. I think I've gone through it two or three times, and the first time took me three days, doing just a bit at a time.

If you're on Windows, you'll need to install Vim manually, and then you should have Vim available under %ProgramFiles%\vim\vim[version]\vimtutor.bat.


Then read this. It explains a lot about how to think about using Vim.

This bit, from the guy who wrote Vim originally, is also worth a read.

Then go read this. There's a lot of information there. You don't need to remember it all, but it's a handy reference.

If you get stuck at any point, use the built-in help (with :h thing, like :h reg). The help in Vim is great, probably better than any other editor's. You should get in the habit of checking the help before Googling something, because the help is probably more accurate, and is also closer at hand.

Which Vim?

Most OSs will come with some version of Vim already installed (the exception being Windows). Chances are it's a stripped-down and/or old version, though. I use and highly recommend Neovim, but if that's not available or up to date for your system, make sure you're on Vim 8. Vim 7.x is pretty old, and missing a lot of the nice things that are in Neovim and now in Vim 8.

There are graphical versions of Vim — Gvim, MacVim, GUI wrappers for Neovim, etc. You can use those if you want, there's nothing wrong with them. I don't see the point in them personally, because they don't add anything except some menus and buttons which all do things you can just do in Vim or in the shell anyway, but some people really like them. Use the thing that makes you comfortable.

Other Editors

You can also get started in some other editor. Every good editor has a Vim plugin, and I actually recommend starting this way if you're not comfortable switching all at once. I used Vim plugins in LightTable, Atom, and TextAdept for a few months before actually making the switch, and it made things a bit easier. You will hit limits with those plugins, though: most of them don't have any ex command support (all the things that start with :), and some of them (like VS Code's) are really basic.


It's really easy to get lost in configuration, for any editor (or any tool, I guess). Vim is just as bad as the rest. Some people, myself included, spend way too much time tweaking their configs. I don't recommend starting with someone else's configs, though. They'll have opinions that don't align with yours, and their .vimrc will be built for how they do things not how you do. I do recommend cruising GitHub and looking at people's dotfiles for ideas, but don't go with some preconfigured setup that you don't understand.

I use this very minimal vimrc sometimes, when I need to, and here's my (kinda messy) init.vim for Neovim.

You will need a plugin manager, eventually. I use NeoBundle, which I think is Neovim-specific. I hear really good things about Vundle for Vim. Pathogen and Dein are also out there, but I haven't tried either of them.

Other Stuff

You might end up on systems that don't have Vim (like in containers). They will probably have vi, though. A lot of the stuff you're used to doing in Vim might not work in vi, but some of it will. You should read up a little bit on vi just in case. Also read the bit on how to pronounce it, because people will be confused if you say veye.

Read this post (and everything else on that blog). Seriously. Even to an intermediate user, there's a lot of good stuff to be learned.

Don't get discouraged. It took me a few weeks to get fully comfortable using a Vim plugin in other editors, and then another few weeks after I switched full-time to Vim before I felt like I was productive again. It's like learning any other big new thing (a language, framework, paradigm, whatever): it takes time. For me (and for all Vim users, I assume), that time investment has definitely been worth it.

Continuing Education

I make an effort to learn and practice one new thing a day (not Vim-specific; a piece of Clojure's stdlib, Bash trick, whatever). Once you're comfortable using Vim, I recommend doing the same. For example, take a few minutes to check out what you can do with c and try to use c more than usual for a few days, until you reach for it naturally when it makes sense.

There are Vim Golf sites (and a StackExchange thing, I think). These are fun ways to learn more efficient ways to get stuff done in Vim.

Don't feel pressured to use more advanced features right away. Neat things like macros, advanced register usage, and fancy regex stuff are all very useful, but you don't need to know and use everything all at once. When you find yourself doing something repetitive or annoying, that's a good time to find a better way to do it.

a short rant about languages and people

I wrote this on Mastodon but decided to cross-post for whatever reason.

One of my biggest pet peeves is when people talk about how great foo-lang is as an alernative to bar-lang, & it turns out they're just shit at bar-lang, or write deliberately bad bar-lang in examples to try to make foo-lang look better. Don't do that. If you can't write decent, idiomatic bar-lang, you don't get to hate it yet. If you can and are writing it like someone who's never read a tutorial on it intentionally, you're just making foo-lang's community look like assholes. Chances are foo-lang is pretty great, & can stand up on its own merits. Talk about those, not how bad your half-assed bar-lang is in comparison. I see this a lot with functional languages that compile to JS, especially, & it's sad, because most of those languages are actually really neat & there are a lot of good reasons to try them, but people saying 'look how horrible this JS is compared to this other thing' when the JS looks like it was written by someone who skimmed a jQuery tutorial once really doesn't present the community very well. So don't do that.

Also: a fun vim/Twitter trick (I also cross-posted this to Twitter ): :set textwidth=140, then gq. You're welcome.

WTF is Set?

WTF is Set?

Please excuse the funky syntax highlighting in this post. Apparently the thing my blog uses for that doesn't know what to do about template strings.

So, someone asked in a Slack channel how they might clean up the following code:

getNames (contacts) {
  let contacts_set = []

  contacts.forEach((contact) => {
    let firstName = get(contact, 'contactInfo.firstName')
    let lastName  = get(contact, 'contactInfo.lastName')
    let fullName = `${firstName} ${lastName}`

    if (contacts_set.includes(fullName)) {
    } else {

    set(this, 'contactsSet', contactsSet)

Note that the get and set going on here seemed to be Ember-specific. I don't know Ember so don't ask me.

And I said, how about this?

getNames: (contacts) =>
  [...new Set(
    contacts.map(({ contactInfo: { firstName, lastName }}) =>
      `${firstName} ${lastName}`))]

I like this version because it's very concise and still readable (to me). It also doesn't do mutation-y stuff, which is a good thing.

And then someone else asked:

Can some one eli5 what Set is that's referenced above?

Which made me realise that a lot of folks still aren't using a lot of the nice new things from ES2015, so I explained a bit. Here's how I understand it.

Set is a new (in ES2015) iterable builtin (like Array, String, TypedArray). Map is also new in 2015. Set is to Array as Map is to Object, kinda.

For practical usage Set is basically Array but unique, and with different methods. add, has, delete, size, and some others. There's a lot more info on MDN.

You can pass Set an iterable, which is why the thing I have above works (because thing inside new Set() results in an array).

In that case Set isn't being used for too much besides just the fact that it's Set (so it only holds unique values). Someone else pointed out in the same channel that maybe it's not the best idea if you have a lot of values, because then you're creating another thing, which is totally true.

There's a bit more background here) on what JS's Set is suppose to be kind of like.

And underneath it sorta looks vaguely like this:

class Set {
  constructor () {
    this.storage = []
  add (a) {
    if (!this.storage.includes(a)) {
  has (a) {
    return this.storage.includes(a)
  remove (a) {
    this.storage.splice(this.storage.indexOf(a), 1)

That's a lot of stuff, but mostly you can think of Set as a thing that's like Array but it only holds unique things.

There's also a WeakSet which can only hold objects. I haven't really found a valid use case for WeakSet and WeakMap yet, personally.

Set turns out to be pretty useful. I've used it a few times at work (with appropriate polyfills) without any problems, and I use it in a few places in zeelib, my sort-of-sometimes-popular utility library. Definitely play around with it!

Recommendations For New Web Devs

Some Recommendations for New (Web) Developers

Some of these thoughts probably apply to all developers. Some don't.

  1. Learn an editor. It doesn't matter which editor. Just learn one. Be good at it. I don't care if you use Visual Studio or Emacs or whatever. Be really good at the thing you pick, though.
  2. Learn enough vi to get by. You will need to know it, at some point. At the very least, learn how to enter text, move around, save, quit, and quit without saving.
  3. Install jq (build it from source if you want the newest hotness; otherwise install it with your package manager). Don't install the jq clones written in other languages (not C) — most of them are slow and/or only half-finished.
  4. Get comfortable with Bash. You don't have to be great with it, just know enough to get by. It doesn't matter what shell you actually use (Zsh, Ksh, Bash, Sh, Dash, Ash, PowerShell — I don't care, whatever). If you're writing stuff that's going to be run by other people, ever, write it in Bash. If you're writing stuff that may or may not be run on a server, write it in POSIX-compliant sh.
  5. Spend some time on Twitter. Facebook is for finding out how your middle-school best friend's back surgery went. LinkedIn is for collecting recruiter spam just in case. Twitter is for following people who say things that matter, so get on Twitter.
  6. No one cares if you can't afford a Mac. Macs aren't great computers, they're okay computers that are very expensive. If you can't afford a Mac, try Linux (I recommend Debian with the XFCE desktop environment, but try other things too if you want!). If you don't have time for that, Windows is also okay (just remember to tell your editor and Git to use UNIX-style line-endings).
  7. Don't work (for your employer) on the weekends. Work on side projects, if you want. Or do other things. Go out to brunch. Climb a mountain. Learn a Primus song on bass. Get drunk. Just don't work for the person who pays you to work during the week. If they seem to expect you to be working when you're not at work, start looking for another job.
  8. Learn other languages. HTML and CSS are not programming languages, so they don't count. JS is actually a really great language (so don't take shit from Java or C# developers who bitch about it!), but it's only one language. Learn another language that helps you think about what you do in a different way. Scheme (specifically, Racket) is a really nice one to start with. Haskell is interesting (or some other ML-type language, like OCaml or Purescript). C is also really useful to know, even if you only ever learn enough to write a basic shell or something.
  9. Figure out your own method for managing tasks. Chances are, you'll work for more than one company over the next few years. Your employer might be really into Jira, or Trello, or whatever, or they might change their mind four times a year, but either way, getting heavily invested in one tool is not a great idea. Use their thing, but also figure out what works for you. I keep track of tasks for work in plain Markdown files, and I use lilnote for personal tasks. Just find a thing you like and stick with it.
  10. Make time for personal development. Including on the clock. If your employer doesn't like that you spend a half hour every morning catching up on what new flags Chromium shipped, or competing on Codewars, or whatever other technical thing happens to really interest you but might also benefit your company, start looking for another job.