Vim's UserGettingBored Autocmd

zdw1 pts0 comments

Vim's UserGettingBored autocmdIn short: Vim has a joke autocmd called UserGettingBored that doesn&rsquo;t do anything.<br>Vim&rsquo;s automatic commands feature, usually shortened to &ldquo;autocmd&rdquo;, lets you run code when various events occur. For example, you could implement an auto-save feature by binding the TextChanged event to the :w command.<br>Vim has over 100 events, from &ldquo;buffer was created&rdquo; to &ldquo;file was saved&rdquo;. But one of them sticks out to me: UserGettingBored. Here&rsquo;s the documentation:<br>UserGettingBored: When the user presses the same key 42 times. Just kidding! :-)

When I saw this, I was busy doing something else and it completely derailed me. &ldquo;I must know more,&rdquo; I thought.<br>Here&rsquo;s what I found:<br>Unfortunately, it doesn&rsquo;t do anything. It only exists in the documentation (and some tests). If you try to use it with somethig like autocmd UserGettingBored ..., you&rsquo;ll get a &ldquo;no such group or event&rdquo; error.

It&rsquo;s present in Vim, Neovim, and Vim Classic.

It was first added by Bram Moolenaar in July 2000, over a year before Vim 6.0 was released. The original description was, &ldquo;When the user hits CTRL-C. Just kidding!&rdquo; And it didn&rsquo;t do anything back then, so I don&rsquo;t think it&rsquo;s ever been real.

In August 2001, he added the smiley face to the documentation. It then read, &ldquo;When the user hits CTRL-C. Just kidding! :-)&rdquo;

Twelve years later, in 2013, the description changed to its current iteration: &ldquo;When the user presses the same key 42 times. Just kidding! :-)&rdquo;

In 2022, developer Mike Smith created an unofficial plugin inspired by this joke autocmd. If you press the same key 42 times in Insert mode, a picture of Samuel L. Jackson appears. 22 years later, it&rsquo;s finally real.

rsquo ldquo rdquo usergettingbored autocmd user

Related Articles