<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: HideyukiMORI</title>
    <description>The latest articles on DEV Community by HideyukiMORI (@hideyukimori).</description>
    <link>https://dev.to/hideyukimori</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3995621%2Fd22faba8-a5e8-4ded-a514-1558d81cc5db.jpg</url>
      <title>DEV Community: HideyukiMORI</title>
      <link>https://dev.to/hideyukimori</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hideyukimori"/>
    <language>en</language>
    <item>
      <title>Primes, a Calendar and a Fractal From an Empty File: 5 Vim Spells</title>
      <dc:creator>HideyukiMORI</dc:creator>
      <pubDate>Sat, 05 Dec 2026 09:08:54 +0000</pubDate>
      <link>https://dev.to/hideyukimori/primes-a-calendar-and-a-fractal-from-an-empty-file-5-vim-spells-4cef</link>
      <guid>https://dev.to/hideyukimori/primes-a-calendar-and-a-fractal-from-an-empty-file-5-vim-spells-4cef</guid>
      <description>&lt;p&gt;Type one &lt;code&gt;*&lt;/code&gt; into an empty file, then a few dozen keys, and a Sierpinski triangle grows out of it, row by row:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;               *
              * *
             *   *
            * * * *
           *       *
          * *     * *
         *   *   *   *
        * * * * * * * *
       *               *
      * *             * *
     *   *           *   *
    * * * *         * * * *
   *       *       *       *
  * *     * *     * *     * *
 *   *   *   *   *   *   *   *
* * * * * * * * * * * * * * * *
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No script and no plugin. Just macros, substitutions, visual block and &lt;code&gt;g Ctrl-a&lt;/code&gt;. Here are five of these "spells", each with its keys and what the keys are doing. The video plays each one once at full speed, then again step by step:&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/3VKZxN67Lf8" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;The editor in the video is &lt;a href="https://github.com/hideyukiMORI/nene-nib" rel="noopener noreferrer"&gt;NeNe Nib&lt;/a&gt;, a free text editor for Windows 11 that I'm building. It works like Notepad, and &lt;code&gt;Ctrl+Shift+Space&lt;/code&gt; switches the same tab to Vim editing.&lt;/p&gt;

&lt;p&gt;Every sequence below gives the same result in Vim 9.1 started as &lt;code&gt;vim -u NONE -N&lt;/code&gt;, so you can try it in your own Vim. Your settings can change the result (&lt;code&gt;gdefault&lt;/code&gt; flips the meaning of &lt;code&gt;/g&lt;/code&gt;, for example), so start Vim without your vimrc. Keys are in Vim notation: &lt;code&gt;&amp;lt;Esc&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;CR&amp;gt;&lt;/code&gt; for Enter, &lt;code&gt;&amp;lt;C-v&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;C-a&amp;gt;&lt;/code&gt; for Ctrl-v and Ctrl-a, and &lt;code&gt;&amp;lt;Space&amp;gt;&lt;/code&gt; where a trailing space would be easy to miss. Start each one in an empty buffer, in Normal mode.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Binary from 0 to 31
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="n"&gt;qa&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;/^/&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;/&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;CR&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;ggyGGp&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;$&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;/^&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;CR&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;q&lt;/span&gt;
&lt;span class="mi"&gt;4&lt;/span&gt;@&lt;span class="n"&gt;a&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The macro puts a &lt;code&gt;0&lt;/code&gt; in front of every line, copies the whole buffer below itself, and changes the leading &lt;code&gt;0&lt;/code&gt; to &lt;code&gt;1&lt;/code&gt; in the pasted half. On an empty buffer that gives &lt;code&gt;0&lt;/code&gt; and &lt;code&gt;1&lt;/code&gt;. Each run adds a digit and doubles the lines: 4, 8, 16, then 32 lines from &lt;code&gt;00000&lt;/code&gt; to &lt;code&gt;11111&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Now the decimal numbers on the right:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;$&lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;/&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;CR&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="mi"&gt;2G&lt;/span&gt;$&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="no"&gt;G&lt;/span&gt;$&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every line gets &lt;code&gt;= 0&lt;/code&gt;, then &lt;code&gt;g Ctrl-a&lt;/code&gt; on a block from line 2 down adds 1, 2, 3… to the numbers in the block. The block starts at the end of the line on purpose. If it included the binary digits, &lt;code&gt;Ctrl-a&lt;/code&gt; would add to them as a decimal number instead.&lt;/p&gt;

&lt;p&gt;Last, pad the widths and move the bottom 16 lines next to the top 16:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;10s&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;$&lt;span class="o"&gt;/&lt;/span&gt;   &lt;span class="o"&gt;/&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;CR&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;:&lt;/span&gt;&lt;span class="mi"&gt;11&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;16s&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;$&lt;span class="o"&gt;/&lt;/span&gt;  &lt;span class="o"&gt;/&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;CR&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="mi"&gt;17G0&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="no"&gt;G&lt;/span&gt;$&lt;span class="n"&gt;dgg&lt;/span&gt;$&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;17&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;$&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;CR&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;00000 = 0   10000 = 16
00001 = 1   10001 = 17
00010 = 2   10010 = 18
...
01111 = 15  11111 = 31
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Next month's calendar
&lt;/h2&gt;

&lt;p&gt;January 1, 2027 is a Friday, so the month needs 5 empty cells before it, Sunday to Thursday.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Esc&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;yy35p&lt;/span&gt;
&lt;span class="n"&gt;ggVGg&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;36 lines of &lt;code&gt;-5&lt;/code&gt;, and &lt;code&gt;g Ctrl-a&lt;/code&gt; over all of them gives -4, -3, … 0, 1, … up to 31. The 5 numbers below 1 are the empty cells.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;/^/&lt;/span&gt;  &lt;span class="o"&gt;/&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;CR&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;:%&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;\&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;\&lt;span class="p"&gt;)&lt;/span&gt;$&lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;CR&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;/-&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;\&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;$&lt;span class="o"&gt;/&lt;/span&gt;  &lt;span class="o"&gt;/&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;CR&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Right-align every number 3 characters wide (add spaces, keep the last 3 characters), then turn 0 and the negative numbers into spaces.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="n"&gt;ggqa7gJjq4&lt;/span&gt;@&lt;span class="n"&gt;a&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;36 is 7 × 5 + 1. &lt;code&gt;7gJ&lt;/code&gt; joins 7 lines into one week, so 5 joins leave 5 weeks and the 31st alone on the last line. It has to be &lt;code&gt;gJ&lt;/code&gt;, not &lt;code&gt;J&lt;/code&gt;: &lt;code&gt;J&lt;/code&gt; removes the leading spaces of each line it joins, and the widths fall apart.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="n"&gt;ggO&lt;/span&gt;     &lt;span class="nc"&gt;January&lt;/span&gt; &lt;span class="mi"&gt;2027&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;CR&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Su&lt;/span&gt; &lt;span class="nc"&gt;Mo&lt;/span&gt; &lt;span class="nc"&gt;Tu&lt;/span&gt; &lt;span class="nc"&gt;We&lt;/span&gt; &lt;span class="nc"&gt;Th&lt;/span&gt; &lt;span class="nc"&gt;Fr&lt;/span&gt; &lt;span class="nc"&gt;Sa&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Esc&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;/^&lt;/span&gt; &lt;span class="o"&gt;//&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;CR&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;:%&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;$&lt;span class="o"&gt;//&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;CR&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    January 2027
Su Mo Tu We Th Fr Sa
                1  2
 3  4  5  6  7  8  9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Change &lt;code&gt;-5&lt;/code&gt; and the line count, and it works for any month.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. The primes up to 100
&lt;/h2&gt;

&lt;p&gt;The sieve of Eratosthenes, with &lt;code&gt;#&lt;/code&gt; as the "crossed out" mark.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="n"&gt;i0&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Esc&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;yy99pggVGg&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;100 zeros become 1 to 100.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="mi"&gt;2Gqa2jI&lt;/span&gt;&lt;span class="c1"&gt;#&amp;lt;Esc&amp;gt;q48@a&lt;/span&gt;
&lt;span class="mi"&gt;3Gqb3jI&lt;/span&gt;&lt;span class="c1"&gt;#&amp;lt;Esc&amp;gt;q31@b&lt;/span&gt;
&lt;span class="mi"&gt;5Gqc5jI&lt;/span&gt;&lt;span class="c1"&gt;#&amp;lt;Esc&amp;gt;q18@c&lt;/span&gt;
&lt;span class="mi"&gt;7Gqd7jI&lt;/span&gt;&lt;span class="c1"&gt;#&amp;lt;Esc&amp;gt;q12@d&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each macro starts on a prime, moves down by that prime, and marks the line. The run counts are just enough to reach line 100. So 4, 6, 8… are crossed out, then 6, 9, 12…, then the multiples of 5 and 7. You can stop at 7: the square root of 100 is 10, and every multiple of 11 or more below 100 has a smaller factor that already crossed it out.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="n"&gt;ggI&lt;/span&gt;&lt;span class="c1"&gt;#&amp;lt;Esc&amp;gt;:%s/#.*/./&amp;lt;CR&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;/^/&lt;/span&gt;   &lt;span class="o"&gt;/&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;CR&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;:%&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;\&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;\&lt;span class="p"&gt;)&lt;/span&gt;$&lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;/&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;CR&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="n"&gt;ggqe10gJjq9&lt;/span&gt;@&lt;span class="n"&gt;e&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;1 isn't prime, so mark it too. Turn every marked line into a dot, pad everything to 4 characters, and join every 10 lines into one row:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   .   2   3   .   5   .   7   .   .   .
  11   .  13   .   .   .  17   .  19   .
   .   .  23   .   .   .   .   .  29   .
  31   .   .   .   .   .  37   .   .   .
  41   .  43   .   .   .  47   .   .   .
   .   .  53   .   .   .   .   .  59   .
  61   .   .   .   .   .  67   .   .   .
  71   .  73   .   .   .   .   .  79   .
   .   .  83   .   .   .   .   .  89   .
   .   .   .   .   .   .  97   .   .   .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. The Tower of Hanoi
&lt;/h2&gt;

&lt;p&gt;The moves for 4 disks, from peg A to peg C. You type only the first move:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="no"&gt;A&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Esc&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="s2"&gt;"nyy
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's the whole solution for one disk. &lt;code&gt;"nyy&lt;/code&gt; keeps a copy in register &lt;code&gt;n&lt;/code&gt;, the template for "move the biggest disk".&lt;/p&gt;

&lt;p&gt;The recursion: to move n disks from A to C, park n-1 disks on B, move the biggest to C, then bring the n-1 disks from B to C. The moves for n-1 disks are already in the buffer, so the macro builds n from them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="n"&gt;qagg&lt;/span&gt;&lt;span class="s2"&gt;"lyG:%s/B/x/g&amp;lt;CR&amp;gt;:%s/C/B/g&amp;lt;CR&amp;gt;:%s/x/C/g&amp;lt;CR&amp;gt;
G"&lt;/span&gt;&lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="s2"&gt;"nyy
"&lt;/span&gt;&lt;span class="n"&gt;lpVG&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="no"&gt;A&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;CR&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;gv&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="no"&gt;B&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="no"&gt;A&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;CR&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;gv&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="no"&gt;B&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;CR&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;q&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;"lyG&lt;/code&gt; saves the current moves in register &lt;code&gt;l&lt;/code&gt;, then B and C swap places, using &lt;code&gt;x&lt;/code&gt; as a placeholder. The same moves now park the disks on B.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;"np&lt;/code&gt; puts the biggest-disk move below, and &lt;code&gt;&amp;lt;C-a&amp;gt;&lt;/code&gt; raises its disk number by one. &lt;code&gt;"nyy&lt;/code&gt; saves it for the next round.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;"lp&lt;/code&gt; pastes the saved moves again, and the selected copy swaps A and B. That's "from B to C". Pressing &lt;code&gt;:&lt;/code&gt; in Visual mode fills in the range for you, and &lt;code&gt;gv&lt;/code&gt; reselects the same lines.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="mi"&gt;2&lt;/span&gt;@&lt;span class="n"&gt;a&lt;/span&gt;
&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;/^/&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="o"&gt;/&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;CR&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;ggVGg&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two more runs give 7 moves, then 15. Number them, and it's solved:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. [1] A -&amp;gt; B
2. [2] A -&amp;gt; C
3. [1] B -&amp;gt; C
4. [3] A -&amp;gt; B
5. [1] C -&amp;gt; A
6. [2] C -&amp;gt; B
7. [1] A -&amp;gt; B
8. [4] A -&amp;gt; C
9. [1] B -&amp;gt; C
10. [2] B -&amp;gt; A
11. [1] C -&amp;gt; A
12. [3] B -&amp;gt; C
13. [1] A -&amp;gt; B
14. [2] A -&amp;gt; C
15. [1] B -&amp;gt; C
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  5. The Sierpinski triangle
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;*&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Esc&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="n"&gt;qa&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;*/&amp;amp;&amp;amp;/&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;CR&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;ggyGG&lt;/span&gt;$&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;gg0f&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Space&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nc"&gt;Gpq&lt;/span&gt;
&lt;span class="mi"&gt;3&lt;/span&gt;@&lt;span class="n"&gt;a&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The macro doubles every line to the right, copies the picture, blanks the right half of the top copy with a block replace, and pastes the copy below. One triangle becomes three: one on top, two below. 3 more runs, and it's 16 rows. If you know Pascal's triangle, this is it with a star on every odd number.&lt;/p&gt;

&lt;p&gt;It's still a right triangle. Put a space after every character, then add leading spaces from the bottom up, one more per line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;/&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;CR&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nc"&gt;Gkqbmz0&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;ggI&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Space&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Esc&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="s1"&gt;'zkq14@b
:%s/ *$//&amp;lt;CR&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Macro &lt;code&gt;b&lt;/code&gt; marks the line, inserts a space at the start of that line and every line above it, then jumps back to the mark and moves up one line. Trim the trailing spaces, and you get the triangle at the top of this post.&lt;/p&gt;

&lt;h2&gt;
  
  
  Before you install
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;It runs on Windows 11 (x64) only.&lt;/li&gt;
&lt;li&gt;NeNe Nib doesn't read &lt;code&gt;.vimrc&lt;/code&gt; files or load Vim plugins.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;:g&lt;/code&gt; supports only &lt;code&gt;d&lt;/code&gt; and &lt;code&gt;s&lt;/code&gt;, and &lt;code&gt;:sort&lt;/code&gt;, &lt;code&gt;:normal&lt;/code&gt; and the expression register aren't there yet. All five spells above stay inside what it supports.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://apps.microsoft.com/detail/9nclgdtfq529?cid=devto" rel="noopener noreferrer"&gt;Get NeNe Nib on the Microsoft Store (free)&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Open an empty file, press &lt;code&gt;Ctrl+Shift+Space&lt;/code&gt;, and type one star. If you can grow the triangle in fewer keys, I'd like to see how in the comments.&lt;/p&gt;

&lt;p&gt;The earlier video goes from &lt;code&gt;hjkl&lt;/code&gt; to a times table and FizzBuzz: &lt;a href="https://dev.to/hideyukimori/a-times-table-and-fizzbuzz-from-an-empty-file-in-a-few-vim-keystrokes-13f1"&gt;A Times Table and FizzBuzz From an Empty File, in a Few Vim Keystrokes&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;── Hideyuki Mori 🔗 &lt;a href="https://hideyuki-mori.com/?utm_source=devto&amp;amp;utm_campaign=nib-vim-black-magic" rel="noopener noreferrer"&gt;hideyuki-mori.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>vim</category>
      <category>windows</category>
      <category>productivity</category>
      <category>showdev</category>
    </item>
    <item>
      <title>A Times Table and FizzBuzz From an Empty File, in a Few Vim Keystrokes</title>
      <dc:creator>HideyukiMORI</dc:creator>
      <pubDate>Wed, 02 Dec 2026 16:25:39 +0000</pubDate>
      <link>https://dev.to/hideyukimori/a-times-table-and-fizzbuzz-from-an-empty-file-in-a-few-vim-keystrokes-13f1</link>
      <guid>https://dev.to/hideyukimori/a-times-table-and-fizzbuzz-from-an-empty-file-in-a-few-vim-keystrokes-13f1</guid>
      <description>&lt;p&gt;Start with an empty file. Type nine zeros, paste the line eight times, then repeat one short command per column, and the zeros turn into a 9x9 times table. No script, no plugin, and the only numbers you put in the file are zeros.&lt;/p&gt;

&lt;p&gt;That's the last chapter of a 12-minute video I made about Vim editing. It starts at &lt;code&gt;hjkl&lt;/code&gt; and builds up, one step at a time, to tricks like this:&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/-_sd7P0QVC8" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;The editor in the video is &lt;a href="https://github.com/hideyukiMORI/nene-nib" rel="noopener noreferrer"&gt;NeNe Nib&lt;/a&gt;, a free text editor for Windows 11 that I'm building. It works like Notepad, and &lt;code&gt;Ctrl+Shift+Space&lt;/code&gt; switches the same tab to Vim editing. There's no &lt;code&gt;.vimrc&lt;/code&gt; to write and nothing else to install.&lt;/p&gt;

&lt;p&gt;Every key sequence below also gives the same result in Vim 9.1, so you can try it in your own Vim. One catch: in gVim on Windows with &lt;code&gt;mswin.vim&lt;/code&gt; loaded, &lt;code&gt;Ctrl-v&lt;/code&gt; pastes and &lt;code&gt;Ctrl-a&lt;/code&gt; selects all, so use terminal Vim or &lt;code&gt;vim -u NONE&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  A times table from zeros
&lt;/h2&gt;

&lt;p&gt;Type a row of nine zeros, copy it, and paste it eight times:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="n"&gt;i0&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Esc&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;yy8p&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you have nine rows of zeros. For each column, move to it, select it down all nine rows with &lt;code&gt;Ctrl-v&lt;/code&gt;, and add with a count. Start with the rightmost column and work left:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="n"&gt;gg016l&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;8j9g&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="n"&gt;gg014l&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;8j8g&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="n"&gt;gg012l&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;8j7g&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="n"&gt;gg010l&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;8j6g&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="n"&gt;gg08l&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;8j5g&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="n"&gt;gg06l&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;8j4g&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="n"&gt;gg04l&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;8j3g&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="n"&gt;gg02l&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;8j2g&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="n"&gt;gg0&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;8jg&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One line per column. &lt;code&gt;gg0&lt;/code&gt; goes to the top left, and &lt;code&gt;16l&lt;/code&gt; moves to the 9th zero. Each zero plus its space is two characters, so the count before &lt;code&gt;l&lt;/code&gt; drops by 2 for each column to the left.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;g Ctrl-a&lt;/code&gt; adds a growing amount down the selection: 1 to the first line, 2 to the second, and so on. A count sets the step, so &lt;code&gt;9g&amp;lt;C-a&amp;gt;&lt;/code&gt; adds 9 to the first line, 18 to the second, 27 to the third. That's the 9 column of the table. The first column gets a plain &lt;code&gt;g&amp;lt;C-a&amp;gt;&lt;/code&gt;, which gives 1 to 9:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1 2 3 4 5 6 7 8 9
2 4 6 8 10 12 14 16 18
3 6 9 12 15 18 21 24 27
...
9 18 27 36 45 54 63 72 81
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why right to left? A number that grows to two digits pushes everything to its right. Working from the right, the columns still waiting on the left haven't moved, so the counts 16, 14, 12 and so on still land on them.&lt;/p&gt;

&lt;h2&gt;
  
  
  FizzBuzz without dividing
&lt;/h2&gt;

&lt;p&gt;The second trick starts from an empty file and a single &lt;code&gt;1&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  1 to 100
&lt;/h3&gt;

&lt;p&gt;Record a macro that copies the line and adds 1, then play it 98 times:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="n"&gt;i1&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Esc&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="n"&gt;qayyp&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;q&lt;/span&gt;
&lt;span class="mi"&gt;98&lt;/span&gt;@&lt;span class="n"&gt;a&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first line and the recording itself make two lines, so 98 more runs give 100.&lt;/p&gt;

&lt;h3&gt;
  
  
  Fizz on every third line
&lt;/h3&gt;

&lt;p&gt;Go to line 3, record "append Fizz, move down 3 lines", and play it 32 times:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="mi"&gt;3GqbA&lt;/span&gt; &lt;span class="nc"&gt;Fizz&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Esc&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;3jq&lt;/span&gt;
&lt;span class="mi"&gt;32&lt;/span&gt;@&lt;span class="n"&gt;b&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Recording handles line 3, and the 32 runs handle lines 6, 9, and so on up to 99. Use exactly 32: from line 99, &lt;code&gt;3j&lt;/code&gt; stops on line 100 instead of failing, so a 33rd run would put a Fizz on 100.&lt;/p&gt;

&lt;h3&gt;
  
  
  Buzz on every fifth line
&lt;/h3&gt;

&lt;p&gt;The same idea from line 5. Recording plus 19 runs covers lines 5, 10, … 100:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="mi"&gt;5GqcA&lt;/span&gt; &lt;span class="nc"&gt;Buzz&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Esc&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;5jq&lt;/span&gt;
&lt;span class="mi"&gt;19&lt;/span&gt;@&lt;span class="n"&gt;c&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Clean up
&lt;/h3&gt;

&lt;p&gt;Lines like 15 now read &lt;code&gt;15 Fizz Buzz&lt;/code&gt;. Join the two words, then delete the number on every line that has a word after it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;z&lt;/span&gt; &lt;span class="no"&gt;B&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;zB&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;
&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;/^&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;\&lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="o"&gt;//&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The second substitute only matches a number followed by a space, so lines with just a number keep it. The rest become &lt;code&gt;Fizz&lt;/code&gt;, &lt;code&gt;Buzz&lt;/code&gt; or &lt;code&gt;FizzBuzz&lt;/code&gt;, and all 100 lines match the correct output. Nothing ever checks whether a number divides by 3 or 5. The macros just step through the lines at that interval.&lt;/p&gt;

&lt;h2&gt;
  
  
  The chapters before
&lt;/h2&gt;

&lt;p&gt;If those tricks feel like a jump, the video builds up to them in this order:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Motions: &lt;code&gt;w&lt;/code&gt;, &lt;code&gt;b&lt;/code&gt;, &lt;code&gt;e&lt;/code&gt;, &lt;code&gt;0&lt;/code&gt;, &lt;code&gt;^&lt;/code&gt;, &lt;code&gt;$&lt;/code&gt;, &lt;code&gt;f&lt;/code&gt;, &lt;code&gt;t&lt;/code&gt;, &lt;code&gt;%&lt;/code&gt;, &lt;code&gt;*&lt;/code&gt;, and &lt;code&gt;Ctrl-o&lt;/code&gt; to jump back&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;d&lt;/code&gt;, &lt;code&gt;c&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt; with any motion, and &lt;code&gt;.&lt;/code&gt; to repeat&lt;/li&gt;
&lt;li&gt;Text objects: &lt;code&gt;ciw&lt;/code&gt;, &lt;code&gt;ci"&lt;/code&gt;, &lt;code&gt;ci(&lt;/code&gt;, &lt;code&gt;dap&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Visual block: add the same text to the start or end of many lines&lt;/li&gt;
&lt;li&gt;Registers and marks&lt;/li&gt;
&lt;li&gt;Macros, &lt;code&gt;g Ctrl-a&lt;/code&gt;, &lt;code&gt;cgn&lt;/code&gt;, &lt;code&gt;:g&lt;/code&gt; and &lt;code&gt;:v&lt;/code&gt;, and substitutions that swap parts of a line&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Before you install
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;It runs on Windows 11 (x64) only.&lt;/li&gt;
&lt;li&gt;NeNe Nib doesn't read &lt;code&gt;.vimrc&lt;/code&gt; files or load Vim plugins.&lt;/li&gt;
&lt;li&gt;In the current release (1.2.0), Vim's indent commands (&lt;code&gt;&amp;gt;&amp;gt;&lt;/code&gt; and friends) insert an 8-column tab, and that can't be changed yet.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;:g&lt;/code&gt; supports only &lt;code&gt;d&lt;/code&gt; and &lt;code&gt;s&lt;/code&gt;, and &lt;code&gt;:sort&lt;/code&gt; isn't there yet.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://apps.microsoft.com/detail/9nclgdtfq529?cid=devto" rel="noopener noreferrer"&gt;Get NeNe Nib on the Microsoft Store (free)&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Open an empty file, press &lt;code&gt;Ctrl+Shift+Space&lt;/code&gt;, and build the times table. If you know a shorter way to do it, I'd like to see it in the comments.&lt;/p&gt;




&lt;p&gt;── Hideyuki Mori 🔗 &lt;a href="https://hideyuki-mori.com/?utm_source=devto&amp;amp;utm_campaign=nib-vim-hjkl-to-magic" rel="noopener noreferrer"&gt;hideyuki-mori.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>vim</category>
      <category>windows</category>
      <category>productivity</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Strip the &gt; From a Pasted Quote, Then Put It Back: Everyday Vim Moves in a Notepad-Style Editor</title>
      <dc:creator>HideyukiMORI</dc:creator>
      <pubDate>Wed, 02 Dec 2026 12:09:14 +0000</pubDate>
      <link>https://dev.to/hideyukimori/strip-the-from-a-pasted-quote-then-put-it-back-everyday-vim-moves-in-a-notepad-style-editor-k7h</link>
      <guid>https://dev.to/hideyukimori/strip-the-from-a-pasted-quote-then-put-it-back-everyday-vim-moves-in-a-notepad-style-editor-k7h</guid>
      <description>&lt;p&gt;You copy a quote out of a chat, paste it, and every line starts with &lt;code&gt;&amp;gt;&lt;/code&gt;. Or an email arrives with line breaks in the middle of its sentences. Most of my text editing is small chores like these, in one file, and then I close it.&lt;/p&gt;

&lt;p&gt;For those, I want Notepad: open fast, select with the mouse, &lt;code&gt;Ctrl+C&lt;/code&gt;, &lt;code&gt;Ctrl+V&lt;/code&gt;. But a few Vim moves make the chore itself much shorter. So I made an editor that does both, and switches with one key.&lt;/p&gt;

&lt;p&gt;Here's a five-minute tour of where it fits:&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/jXNCJC7lZTM" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;This post writes down the moves from the video, so you can try them in any Vim, or in &lt;a href="https://github.com/hideyukiMORI/nene-nib" rel="noopener noreferrer"&gt;NeNe Nib&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The switch
&lt;/h2&gt;

&lt;p&gt;NeNe Nib opens like Notepad. Drag to select, copy, paste, save. &lt;code&gt;Ctrl+Shift+Space&lt;/code&gt; (or a click on the status bar) turns the same tab into Vim editing, and the same key turns it back.&lt;/p&gt;

&lt;p&gt;There's no &lt;code&gt;.vimrc&lt;/code&gt; to write. The Vim layer is my own implementation, tested against 6,892 cases generated by real Vim 9.1. I wrote about &lt;a href="https://dev.to/hideyukimori/i-built-a-44-mb-windows-text-editor-that-switches-between-notepad-style-editing-and-vim-31o"&gt;the editor itself&lt;/a&gt; earlier. This one is about using it.&lt;/p&gt;

&lt;h2&gt;
  
  
  A quote from a chat
&lt;/h2&gt;

&lt;p&gt;Paste this with the usual &lt;code&gt;Ctrl+V&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; Tomorrow's release can start at 3 p.m.
&amp;gt; I'll share the announcement text soon.
&amp;gt; Please take a look.

Hi, thanks for the update on the release. Once the
announcement text arrives, I'll check it right away and
reply by this evening.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Remove the &lt;code&gt;&amp;gt;&lt;/code&gt; from the quote.&lt;/strong&gt; Switch to Vim, then from the first line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="n"&gt;gg&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;jjld&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;Ctrl-v&lt;/code&gt; starts a block selection, &lt;code&gt;jj&lt;/code&gt; takes it down two lines, &lt;code&gt;l&lt;/code&gt; makes it two columns wide, and &lt;code&gt;d&lt;/code&gt; deletes the block. All three markers are gone at once.&lt;/p&gt;

&lt;p&gt;If you'd rather not count lines, a substitute does the same for every line that starts with &lt;code&gt;&amp;gt;&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;/^&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;//&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Join the broken sentences.&lt;/strong&gt; Put the cursor in the reply paragraph and press:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="n"&gt;vipJ&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;vip&lt;/code&gt; selects the paragraph, and &lt;code&gt;J&lt;/code&gt; joins its lines into one, with a space where each break was.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Put the quote markers back.&lt;/strong&gt; When you answer, select down the quote lines with a block and insert at the start of each:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="n"&gt;gg&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;jjI&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Esc&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Capital &lt;code&gt;I&lt;/code&gt; in a block selection types the same text at the start of every line, once you press &lt;code&gt;Esc&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Then switch back to Notepad-style editing, &lt;code&gt;Ctrl+A&lt;/code&gt;, &lt;code&gt;Ctrl+C&lt;/code&gt;, and paste it into the chat.&lt;/p&gt;

&lt;h2&gt;
  
  
  A short script
&lt;/h2&gt;

&lt;p&gt;The second file is a PowerShell list I wanted to tidy up. Twelve lines of names with a &lt;code&gt;0&lt;/code&gt; in front, then some &lt;code&gt;Copy-Item&lt;/code&gt; lines with blank lines between them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0 app.log
0 config.toml
...
0 todo.md
$dst = "D:\backup"
Copy-Item app.log

Copy-Item config.toml

Copy-Item users.csv

Copy-Item orders.csv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Comment out twelve lines at once.&lt;/strong&gt; The same block insert, with a count:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="n"&gt;gg&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;11jI&lt;/span&gt;&lt;span class="c1"&gt;# &amp;lt;Esc&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Turn the zeros into 1 to 12.&lt;/strong&gt; Select the twelve lines and press &lt;code&gt;g&lt;/code&gt; then &lt;code&gt;Ctrl-a&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="n"&gt;ggV11jg&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Plain &lt;code&gt;Ctrl-a&lt;/code&gt; would add 1 to every line. &lt;code&gt;g Ctrl-a&lt;/code&gt; adds 1 to the first, 2 to the second, and so on, so the zeros become a numbered list.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix one line, then repeat it.&lt;/strong&gt; Record the change to the first &lt;code&gt;Copy-Item&lt;/code&gt; line as a macro, then play it on the other three:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="mi"&gt;14GqaA&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Destination&lt;/span&gt; $&lt;span class="n"&gt;dst&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Esc&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;jjq3&lt;/span&gt;@&lt;span class="n"&gt;a&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;qa&lt;/code&gt; starts recording into register &lt;code&gt;a&lt;/code&gt;, &lt;code&gt;A&lt;/code&gt; appends at the end of the line, &lt;code&gt;jj&lt;/code&gt; moves to the next &lt;code&gt;Copy-Item&lt;/code&gt;, and &lt;code&gt;q&lt;/code&gt; stops. &lt;code&gt;3@a&lt;/code&gt; plays it three more times.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Remove the blank lines and indent the block.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="o"&gt;/^&lt;/span&gt;$&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt;
&lt;span class="nc"&gt;GV3k&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;:g/^$/d&lt;/code&gt; deletes every empty line. &lt;code&gt;V3k&amp;gt;&lt;/code&gt; selects the last four lines and indents them.&lt;/p&gt;

&lt;p&gt;With fifty lines instead of twelve, only the counts change.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it doesn't do
&lt;/h2&gt;

&lt;p&gt;So you know before you install:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It runs on Windows 11 (x64) only.&lt;/li&gt;
&lt;li&gt;It doesn't read &lt;code&gt;.vimrc&lt;/code&gt; files or load Vim plugins.&lt;/li&gt;
&lt;li&gt;In the current release (1.2.0), Vim indent is 8-column tabs. &lt;code&gt;:set sw&lt;/code&gt; and &lt;code&gt;expandtab&lt;/code&gt; are done but not released yet.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;:g&lt;/code&gt; supports only &lt;code&gt;d&lt;/code&gt; and &lt;code&gt;s&lt;/code&gt;, and &lt;code&gt;:sort&lt;/code&gt; isn't there yet.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://apps.microsoft.com/detail/9nclgdtfq529?cid=devto" rel="noopener noreferrer"&gt;Get NeNe Nib on the Microsoft Store (free)&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Paste something with &lt;code&gt;&amp;gt;&lt;/code&gt; in front of every line, press &lt;code&gt;Ctrl+Shift+Space&lt;/code&gt;, and try &lt;code&gt;gg&amp;lt;C-v&amp;gt;jjld&lt;/code&gt;. Which small chore would you add to this list?&lt;/p&gt;




&lt;p&gt;── Hideyuki Mori 🔗 &lt;a href="https://hideyuki-mori.com/?utm_source=devto&amp;amp;utm_campaign=nib-everyday-vim" rel="noopener noreferrer"&gt;hideyuki-mori.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>vim</category>
      <category>windows</category>
      <category>productivity</category>
      <category>showdev</category>
    </item>
    <item>
      <title>My Swift terminal games play themselves. Press an arrow key to take over, in your browser</title>
      <dc:creator>HideyukiMORI</dc:creator>
      <pubDate>Sat, 28 Nov 2026 08:04:48 +0000</pubDate>
      <link>https://dev.to/hideyukimori/my-swift-terminal-games-play-themselves-press-an-arrow-key-to-take-over-in-your-browser-2o46</link>
      <guid>https://dev.to/hideyukimori/my-swift-terminal-games-play-themselves-press-an-arrow-key-to-take-over-in-your-browser-2o46</guid>
      <description>&lt;p&gt;NeNe Swarm is a fixed-screen shooter, and NeNe Bolt is a side-scrolling platformer. In both, an AI plays forever. Press an arrow key and the game is yours from that frame on; leave the keys alone for 30 seconds and the AI takes over again.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjizy2r44kvlwhpdmplsa.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjizy2r44kvlwhpdmplsa.gif" alt="The browser version of NeNe Swarm: the AI pilot plays, then an arrow key takes over, the PILOT line switches to YOU AI IN 30, and the ship moves and fires" width="760" height="380"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;They are written in Swift for the Linux terminal, and both also run in the browser. Open &lt;a href="https://hideyuki-mori.com/?utm_source=devto&amp;amp;utm_campaign=swift-terminal-games" rel="noopener noreferrer"&gt;hideyuki-mori.com&lt;/a&gt; on a computer with a keyboard (a phone has no arrow keys), click the &lt;strong&gt;swarm&lt;/strong&gt; or &lt;strong&gt;bolt&lt;/strong&gt; icon on the site's desktop, click inside the window and press an arrow key.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Swarm (fixed shooter)&lt;/th&gt;
&lt;th&gt;Bolt (side-scroller)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Move&lt;/td&gt;
&lt;td&gt;← →&lt;/td&gt;
&lt;td&gt;← →&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Climb ladders&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;↑ ↓&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Jump&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;Z or Space (hold for higher)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fire&lt;/td&gt;
&lt;td&gt;Space or Z&lt;/td&gt;
&lt;td&gt;X (hold to charge)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Theme / difficulty / quit&lt;/td&gt;
&lt;td&gt;t / d / q&lt;/td&gt;
&lt;td&gt;t / d / q&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;While you are playing, the HUD says so (&lt;code&gt;YOU AI IN 27&lt;/code&gt; in Swarm, &lt;code&gt;PLAYER 30s&lt;/code&gt; in Bolt) and counts down to the moment the AI takes the controls back.&lt;/p&gt;

&lt;h2&gt;
  
  
  How a terminal game hears a key being released
&lt;/h2&gt;

&lt;p&gt;In Bolt, hold → and the runner keeps running; let go and it stops on that frame. That isn't a given in a terminal. Hold → in most terminals and the program gets a stream of repeated arrow sequences; let go and it gets nothing.&lt;/p&gt;

&lt;p&gt;Windows Terminal has a mode for this. When the game writes &lt;code&gt;ESC [ ? 9001 h&lt;/code&gt; at startup, the terminal switches to win32-input-mode, and every press and every release arrives as its own sequence, &lt;code&gt;ESC [ Vk ; Sc ; Uc ; Kd ; Cs ; Rc _&lt;/code&gt;, where &lt;code&gt;Kd&lt;/code&gt; says whether the key went down or up. These sequences pass through to programs running inside WSL, so the game knows exactly which keys are held on each frame. On exit it writes &lt;code&gt;ESC [ ? 9001 l&lt;/code&gt; before restoring the screen.&lt;/p&gt;

&lt;p&gt;In other terminals the games fall back to key repeats: a key counts as held for 0.6 seconds after it arrives and then for as long as the repeats keep coming, so the runner can overshoot a little. In the browser it's simple again, since &lt;code&gt;keydown&lt;/code&gt; and &lt;code&gt;keyup&lt;/code&gt; give the same information as win32-input-mode.&lt;/p&gt;

&lt;h2&gt;
  
  
  The game never reads the clock
&lt;/h2&gt;

&lt;p&gt;The game itself is a pure function: the current state, the buttons held on this frame and a seeded random source give the next state. Only the outermost layer reads the time, the keys and the seed. Your keys and the AI's decisions become the same set of buttons and go through the same function. Positions are integers (one cell is 16 units), and on screen the ships, runner, enemies, shots and terrain are blocks of color two terminal columns wide, so one "pixel" comes out roughly square.&lt;/p&gt;

&lt;p&gt;That is what made the browser versions checkable. They are TypeScript ports, written with Claude Code like the Swift originals, and I don't take a port's word for it: each one replays the same seeds and the same scripted key presses as the Swift code, renders every frame at two terminal sizes, and compares a hash of each frame's characters and colors with what Swift produced. The random generator is the same SplitMix64 on both sides, done in exact integer arithmetic. Swarm's port matches on 240,008 frames, including a script where a human cuts in four times and lets the AI take back over four times. Bolt's matches on 258,010.&lt;/p&gt;

&lt;p&gt;So when you take the controls on the site, you are playing the same game the Swift binary runs. &lt;a href="https://hideyuki-mori.com/?utm_source=devto&amp;amp;utm_campaign=swift-terminal-games" rel="noopener noreferrer"&gt;Try Swarm or Bolt at hideyuki-mori.com&lt;/a&gt; and see how long you last before the AI gets them back.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing the terminal version
&lt;/h2&gt;

&lt;p&gt;Each game has a one-line installer for Linux x86_64 (WSL2 on Windows works). For Swarm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -fsSL https://raw.githubusercontent.com/hideyukiMORI/nene-swarm/main/install.sh &lt;span class="o"&gt;|&lt;/span&gt; bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It checks the 2.7 MB download against &lt;code&gt;SHA256SUMS&lt;/code&gt; and installs one binary in &lt;code&gt;~/.local/bin&lt;/code&gt;. The Swift standard library is linked in, so all you need is glibc 2.35 or newer. From PowerShell, &lt;code&gt;install.ps1&lt;/code&gt; in the same repository runs it inside WSL.&lt;/p&gt;

&lt;p&gt;Bolt and Swarm have six siblings, all in Swift and open source: &lt;a href="https://github.com/hideyukiMORI/nene-gambit" rel="noopener noreferrer"&gt;Gambit&lt;/a&gt; (four AIs trade insults over chess), &lt;a href="https://github.com/hideyukiMORI/nene-igo" rel="noopener noreferrer"&gt;Igo&lt;/a&gt; (the same on a 19×19 Go board), &lt;a href="https://github.com/hideyukiMORI/nene-wire" rel="noopener noreferrer"&gt;Wire&lt;/a&gt; (a news ticker), &lt;a href="https://github.com/hideyukiMORI/nene-reversi" rel="noopener noreferrer"&gt;Reversi&lt;/a&gt;, &lt;a href="https://github.com/hideyukiMORI/nene-poker" rel="noopener noreferrer"&gt;Poker&lt;/a&gt; and &lt;a href="https://github.com/hideyukiMORI/nene-sand" rel="noopener noreferrer"&gt;Sand&lt;/a&gt; (pour sand with the mouse). Gambit, Igo and Wire run on the site too, to watch rather than play. The sources of the two you can play: &lt;a href="https://github.com/hideyukiMORI/nene-swarm" rel="noopener noreferrer"&gt;nene-swarm&lt;/a&gt; and &lt;a href="https://github.com/hideyukiMORI/nene-bolt" rel="noopener noreferrer"&gt;nene-bolt&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;── Hideyuki Mori 🔗 &lt;a href="https://hideyuki-mori.com/?utm_source=devto&amp;amp;utm_campaign=swift-terminal-games" rel="noopener noreferrer"&gt;hideyuki-mori.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>swift</category>
      <category>gamedev</category>
      <category>terminal</category>
      <category>linux</category>
    </item>
    <item>
      <title>No Index, No Debounce: Searching a Project on Every Keystroke</title>
      <dc:creator>HideyukiMORI</dc:creator>
      <pubDate>Fri, 27 Nov 2026 12:10:39 +0000</pubDate>
      <link>https://dev.to/hideyukimori/no-index-no-debounce-searching-a-project-on-every-keystroke-5eb4</link>
      <guid>https://dev.to/hideyukimori/no-index-no-debounce-searching-a-project-on-every-keystroke-5eb4</guid>
      <description>&lt;p&gt;When I typed &lt;code&gt;caret_sparks&lt;/code&gt; into NeNe Nib's project search, it went through 1,995 files, found 91 matching lines, and refreshed the list on each key I typed.&lt;/p&gt;

&lt;p&gt;There's no index behind it, and no "wait 300 ms before searching" timer either. Here's the whole search side of the editor in about a minute:&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/uF7mM3ryELA" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;What's in this post:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One palette for files, tabs, settings and search&lt;/li&gt;
&lt;li&gt;What happens between a keystroke and the next list of hits&lt;/li&gt;
&lt;li&gt;What I chose not to build, and where that costs you&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The editor
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/hideyukiMORI/nene-nib" rel="noopener noreferrer"&gt;NeNe Nib&lt;/a&gt; is my text editor for Windows 11, written in C++23 on plain Win32 and Direct2D. It works like Notepad by default, and &lt;code&gt;Ctrl+Shift+Space&lt;/code&gt; switches it to Vim editing. I've written about &lt;a href="https://dev.to/hideyukimori/117-ms-vs-908-ms-timing-my-text-editor-against-windows-notepad-5f57"&gt;how fast it opens files&lt;/a&gt; and &lt;a href="https://dev.to/hideyukimori/a-caret-that-glides-in-120-ms-without-slowing-your-typing-4ma7"&gt;the caret motion in 1.2.0&lt;/a&gt;. This one is about finding things.&lt;/p&gt;

&lt;h2&gt;
  
  
  One palette, one key
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Ctrl+P&lt;/code&gt; opens a single list. With an empty input it shows your open tabs, bookmarks, recently closed files and the files in the current folder, matched loosely by name. Type a few letters of a name and the file is there, with a preview on the right before you open it.&lt;/p&gt;

&lt;p&gt;A mark at the start of the input narrows where the list comes from:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Mark&lt;/th&gt;
&lt;th&gt;Lists&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;#&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;open tabs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;*&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;bookmarks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;@&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;recently closed files&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;files in the current folder&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;:&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;settings commands&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;?&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;every operation, with its shortcut&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;!&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;the whole project (the search in this post)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;%&lt;/code&gt; &lt;code&gt;^&lt;/code&gt; &lt;code&gt;&amp;amp;&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;symbols, diagnostics and references from a language server&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The language server marks only work when you connect one (clangd, for example). That's off by default.&lt;/p&gt;

&lt;p&gt;One small thing I like: in &lt;code&gt;:colorscheme&lt;/code&gt;, the theme under the selection previews its colors. Moving down the list of 125 themes repaints the editor as you go.&lt;/p&gt;

&lt;h2&gt;
  
  
  Search on every key
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Ctrl+Shift+F&lt;/code&gt; (or &lt;code&gt;:grep&lt;/code&gt; in Vim mode) opens the same palette with &lt;code&gt;!&lt;/code&gt;. From then on, every change to the input starts a new search under the project root.&lt;/p&gt;

&lt;p&gt;Here's what happens on one keystroke.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The UI thread only asks.&lt;/strong&gt; It hands a request with a new ticket number to a port and returns at once. The port is this small:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ProjectSearchPort&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;public&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;virtual&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;request&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;ProjectSearchRequest&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// a new request ends the previous one&lt;/span&gt;
    &lt;span class="k"&gt;virtual&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;cancel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="kt"&gt;uint64_t&lt;/span&gt; &lt;span class="n"&gt;ticket&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;nodiscard&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;virtual&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;vector&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ProjectSearchBatch&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;collect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Threads and files stay behind it, in the Windows layer. The UI thread calls &lt;code&gt;request&lt;/code&gt;, later &lt;code&gt;collect&lt;/code&gt;s whatever has arrived, and draws the rows that are visible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A worker reads 1 MiB at a time.&lt;/strong&gt; It walks the folder tree with &lt;code&gt;FindFirstFileExW&lt;/code&gt; and reads each file in 1 MiB chunks. One unit of work is either one folder listing or one chunk, so a new request never waits behind a whole file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Matching is a pure function.&lt;/strong&gt; Each chunk goes to &lt;code&gt;project_hits_in&lt;/code&gt;, which takes the bytes, the query and the state left by the previous chunk:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;nodiscard&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="nc"&gt;ProjectChunkHits&lt;/span&gt; &lt;span class="nf"&gt;project_hits_in&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nc"&gt;ProjectScan&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;scan&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;string_view&lt;/span&gt; &lt;span class="n"&gt;chunk&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                                               &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nc"&gt;ProjectQuery&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="kt"&gt;size_t&lt;/span&gt; &lt;span class="n"&gt;room&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;A chunk can end in the middle of a line. That partial line is carried into the next chunk and matched as one line. A property test checks that cutting a file into chunks gives exactly the same hits as matching the whole file in one go.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Old work is thrown away.&lt;/strong&gt; When you type the next character, the previous ticket is dropped. The worker finishes at most the chunk it's holding, and results with an old ticket are ignored. That's why there's no debounce timer: an outdated search costs one chunk, not one project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How long is a chunk?&lt;/strong&gt; On my machine, matching one 1 MiB chunk of source-like text took about 0.1 to 1.2 ms (Release build, median of 31 runs, measured once while other work was running on the PC). The design record has the numbers per query.&lt;/p&gt;
&lt;h2&gt;
  
  
  What it skips
&lt;/h2&gt;

&lt;p&gt;To keep the search on your own files and away from surprises, the walk skips:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;hidden folders, and &lt;code&gt;.git&lt;/code&gt;, &lt;code&gt;node_modules&lt;/code&gt;, &lt;code&gt;build&lt;/code&gt; and &lt;code&gt;out&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;junctions and symbolic links to folders, so it can't loop&lt;/li&gt;
&lt;li&gt;files over 16 MiB, and files with a NUL byte in their first 8 KiB&lt;/li&gt;
&lt;li&gt;cloud files that aren't on the PC yet. Searching never triggers a download.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The query matches literally and ignores case, like &lt;code&gt;Ctrl+F&lt;/code&gt; with &lt;code&gt;ignorecase&lt;/code&gt;. Start it with &lt;code&gt;/&lt;/code&gt; to use a Vim pattern instead. You get one hit per line, up to 1,000 hits, and &lt;code&gt;Enter&lt;/code&gt; opens the file at that line and column.&lt;/p&gt;
&lt;h2&gt;
  
  
  What I didn't build
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;An external search tool.&lt;/strong&gt; Running ripgrep as a child process would be fast, but I'd have to ship another executable with the editor. Reading the files myself on the worker was enough.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;An index.&lt;/strong&gt; An index would make huge trees fast, but it has to follow every change made outside the editor, and it needs somewhere to live. Without one, Nib reads the files every time. On a tree of a gigabyte, expect seconds, not milliseconds.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A delay before searching.&lt;/strong&gt; Waiting 300 ms after the last key is the usual way to avoid wasted work. Dropping the old ticket does the same job, and the list doesn't lag behind your typing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where this costs you.&lt;/strong&gt; The skip list is fixed (it doesn't read &lt;code&gt;.gitignore&lt;/code&gt; yet), and lines that aren't valid UTF-8, such as Shift_JIS files, aren't matched. Both are on the list for later.&lt;/p&gt;
&lt;h2&gt;
  
  
  Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Put the UI thread behind a tiny port, and give the work in small pieces to a worker.&lt;/li&gt;
&lt;li&gt;If a stale request only costs one small piece, you may not need a debounce at all.&lt;/li&gt;
&lt;li&gt;Make the matcher a pure function, and test that chunked results equal whole-file results.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Design record: &lt;a href="https://github.com/hideyukiMORI/nene-nib/blob/main/docs/adr/0167-project-search-runs-on-the-worker-and-streams-hits-into-the-palette.md" rel="noopener noreferrer"&gt;ADR 0167, project search on the worker&lt;/a&gt; (Japanese)&lt;/li&gt;
&lt;li&gt;The port: &lt;a href="https://github.com/hideyukiMORI/nene-nib/blob/main/src/application/ProjectSearchPort.hpp" rel="noopener noreferrer"&gt;&lt;code&gt;ProjectSearchPort.hpp&lt;/code&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;The matcher: &lt;a href="https://github.com/hideyukiMORI/nene-nib/blob/main/src/core/ProjectHits.hpp" rel="noopener noreferrer"&gt;&lt;code&gt;ProjectHits.hpp&lt;/code&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;The palette marks and the preview: the &lt;a href="https://github.com/hideyukiMORI/nene-nib#readme" rel="noopener noreferrer"&gt;README&lt;/a&gt; (FR-006, FR-026)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://apps.microsoft.com/detail/9nclgdtfq529?cid=devto" rel="noopener noreferrer"&gt;Get NeNe Nib on the Microsoft Store (free)&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Open a project folder, press &lt;code&gt;Ctrl+Shift+F&lt;/code&gt;, and type a name you use a lot. How large is the folder you usually search, and does your editor keep up with every key?&lt;/p&gt;


&lt;div class="ltag__user ltag__user__id__3995621"&gt;
    &lt;a href="/hideyukimori" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&gt;
        &lt;img src="https://media2.dev.to/dynamic/image/width=150,height=150,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3995621%2Fd22faba8-a5e8-4ded-a514-1558d81cc5db.jpg" alt="hideyukimori image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/hideyukimori"&gt;HideyukiMORI&lt;/a&gt;Follow
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/hideyukimori"&gt;Building API-first PHP tools for self-hosted business workflows. Creator of NENE2 and the NeNe OSS series.&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;



</description>
      <category>showdev</category>
      <category>windows</category>
      <category>cpp</category>
      <category>productivity</category>
    </item>
    <item>
      <title>A Caret That Glides in 120 ms Without Slowing Your Typing</title>
      <dc:creator>HideyukiMORI</dc:creator>
      <pubDate>Fri, 27 Nov 2026 06:41:36 +0000</pubDate>
      <link>https://dev.to/hideyukimori/a-caret-that-glides-in-120-ms-without-slowing-your-typing-4ma7</link>
      <guid>https://dev.to/hideyukimori/a-caret-that-glides-in-120-ms-without-slowing-your-typing-4ma7</guid>
      <description>&lt;p&gt;In NeNe Nib 1.2.0, the caret glides instead of teleporting, and it never holds your typing back.&lt;/p&gt;

&lt;p&gt;It's hard to describe and hard to stop noticing once you've typed with it. Here it is in real time:&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/hyy7_ePLoRg" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;What's in this post:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What the motion looks like, and how to turn it on&lt;/li&gt;
&lt;li&gt;Why it feels smooth, and why it never makes you wait&lt;/li&gt;
&lt;li&gt;Sparks: a small burst in your theme's colors on every keystroke&lt;/li&gt;
&lt;li&gt;Why both are off by default&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The editor
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/hideyukiMORI/nene-nib" rel="noopener noreferrer"&gt;NeNe Nib&lt;/a&gt; is my text editor for Windows 11, written in C++23 on Win32 and Direct2D. It works like Notepad by default, and &lt;code&gt;Ctrl+Shift+Space&lt;/code&gt; switches it to Vim editing. Version 1.1.0 showed a 16 MiB file in 117 ms, which I &lt;a href="https://dev.to/hideyukimori/117-ms-vs-908-ms-timing-my-text-editor-against-windows-notepad-5f57"&gt;measured against Windows Notepad&lt;/a&gt; last week.&lt;/p&gt;

&lt;p&gt;1.2.0 adds two things that are just for the feel of typing: caret motion and sparks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Turn it on
&lt;/h2&gt;

&lt;p&gt;Both switches are in the settings drawer. In Vim mode you can also type them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;set&lt;/span&gt; &lt;span class="n"&gt;caretmotion&lt;/span&gt;
&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;set&lt;/span&gt; &lt;span class="n"&gt;caretmotiontime&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;120&lt;/span&gt;
&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;set&lt;/span&gt; &lt;span class="n"&gt;caretsparks&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;code&gt;caretmotion&lt;/code&gt; makes the caret glide, &lt;code&gt;caretmotiontime&lt;/code&gt; sets how long a glide takes (40 to 300 ms, 120 by default), and &lt;code&gt;caretsparks&lt;/code&gt; throws a small burst on every keystroke. The two switches are independent. You can have the glide without the sparks, or the other way around.&lt;/p&gt;
&lt;h2&gt;
  
  
  Why it feels smooth
&lt;/h2&gt;
&lt;h3&gt;
  
  
  The front lands first
&lt;/h3&gt;

&lt;p&gt;The caret isn't moved as one rectangle. Each of its four corners travels on its own, and the corners on the side it's moving toward arrive first:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Corner&lt;/th&gt;
&lt;th&gt;Arrives at&lt;/th&gt;
&lt;th&gt;With 120 ms&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Front-most&lt;/td&gt;
&lt;td&gt;45% of the time&lt;/td&gt;
&lt;td&gt;54 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Second&lt;/td&gt;
&lt;td&gt;60%&lt;/td&gt;
&lt;td&gt;72 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Third&lt;/td&gt;
&lt;td&gt;85%&lt;/td&gt;
&lt;td&gt;102 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Back-most&lt;/td&gt;
&lt;td&gt;100%&lt;/td&gt;
&lt;td&gt;120 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;With the 120 ms default, the leading corner lands in 54 ms. For a moment the caret stretches into a short trail pointing back the way it came, then settles back into a caret. Each corner follows a cubic ease-out curve, so it starts fast and slows into place. The trail has a soft edge, and it's drawn in your theme's colors.&lt;/p&gt;

&lt;p&gt;This is the core of it, from &lt;a href="https://github.com/hideyukiMORI/nene-nib/blob/main/src/core/CaretGlide.cpp" rel="noopener noreferrer"&gt;&lt;code&gt;CaretGlide.cpp&lt;/code&gt;&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="nc"&gt;CaretQuad&lt;/span&gt; &lt;span class="nf"&gt;caret_motion_quad&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nc"&gt;CaretQuad&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;from&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nc"&gt;CaretQuad&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="kt"&gt;uint32_t&lt;/span&gt; &lt;span class="n"&gt;elapsed&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                            &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="kt"&gt;uint32_t&lt;/span&gt; &lt;span class="n"&gt;duration&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;noexcept&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;duration&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="kd"&gt;auto&lt;/span&gt; &lt;span class="n"&gt;shares&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;caret_corner_shares&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;from&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// 0.45, 0.6, 0.85 or 1.0 per corner&lt;/span&gt;
    &lt;span class="nc"&gt;CaretQuad&lt;/span&gt; &lt;span class="n"&gt;shown&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="kt"&gt;size_t&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;corner_count&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;span&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;static_cast&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;float&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;duration&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;shares&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;at&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;progress&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;1.0F&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;static_cast&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;float&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;elapsed&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;span&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;share&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;eased&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;progress&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// 1 - (1 - u)^3&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="kd"&gt;auto&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;start&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;from&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;corners&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;at&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="kd"&gt;auto&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;end&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;corners&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;at&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="n"&gt;shown&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;corners&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;at&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
            &lt;span class="nc"&gt;CaretPoint&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;between&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;end&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;share&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;between&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;end&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;share&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;shown&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;It's a pure function. It never reads the clock: the time comes in as &lt;code&gt;elapsed&lt;/code&gt;, measured by the Windows layer with &lt;code&gt;QueryPerformanceCounter&lt;/code&gt;. That keeps the motion easy to test without a window.&lt;/p&gt;
&lt;h3&gt;
  
  
  It follows the caret wherever it goes
&lt;/h3&gt;

&lt;p&gt;The caret glides whenever it actually moves: typing, arrow keys, clicks, &lt;code&gt;n&lt;/code&gt; and &lt;code&gt;*&lt;/code&gt;, matching brackets with &lt;code&gt;%&lt;/code&gt;, and &lt;code&gt;gg&lt;/code&gt; and &lt;code&gt;G&lt;/code&gt; from one end of the file to the other. Switching between the insert bar and the Vim block caret glides too, since the four corners just head for the new shape.&lt;/p&gt;

&lt;p&gt;When the view changes rather than the caret, as with a tab switch or a window resize, it simply jumps. Nothing moves without a reason.&lt;/p&gt;
&lt;h2&gt;
  
  
  Why it never makes you wait
&lt;/h2&gt;

&lt;p&gt;Smooth caret animations have a bad reputation with fast typists, and fairly so: if the caret lags behind your keys, the editor feels slow. Nib avoids that in three ways.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The text doesn't wait.&lt;/strong&gt; Your keystroke goes into the document right away. The motion is a layer drawn on top of the text. Nib doesn't rebuild any line layout for it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A new move starts from where the caret is drawn.&lt;/strong&gt; If you press the next key while the caret is still moving, the motion doesn't queue up and doesn't jump back. It starts again from the corners on screen and heads for the new place. Holding &lt;code&gt;j&lt;/code&gt; or typing a word quickly stays one continuous movement.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You choose the speed.&lt;/strong&gt; 120 ms is the default. At 40 ms the glide is barely there, just enough to see where the caret went. At 300 ms you can watch it travel across the screen.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Nothing runs when nothing moves.&lt;/strong&gt; The animation timer runs only during a glide. Once the caret settles, it stops.&lt;/p&gt;
&lt;h2&gt;
  
  
  Sparks
&lt;/h2&gt;

&lt;p&gt;Turn on &lt;code&gt;caretsparks&lt;/code&gt;, and every character you type throws seven small sparks from where it lands. They fade within about 420 ms.&lt;/p&gt;

&lt;p&gt;The colors come from your theme, so they match whichever of Nib's 125 themes you use.&lt;/p&gt;

&lt;p&gt;A few details:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sparks come from characters you type. Pastes, undo, &lt;code&gt;.&lt;/code&gt; repeats and macro replays don't throw any, and neither do caret moves. (One exception: Japanese committed through the IME in Vim mode doesn't throw sparks either.)&lt;/li&gt;
&lt;li&gt;There's no random number generator. Each spark's direction, speed and size come from a hash of the keystroke's sequence number, so the effect is deterministic and easy to test.&lt;/li&gt;
&lt;li&gt;At most eight keystrokes' worth of sparks are alive at once, so a fast burst of typing doesn't pile up.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Why it's off by default
&lt;/h2&gt;

&lt;p&gt;Nib is a tool first. Some people love motion while they type, and some people find any motion distracting. So both features start off, and they stay quiet in the places where motion gets in the way:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;While the IME is composing.&lt;/strong&gt; When you type Japanese, the composition stays still under your eyes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;When Windows animation effects are off.&lt;/strong&gt; If you've turned off &lt;em&gt;Animation effects&lt;/em&gt; (Settings &amp;gt; Accessibility &amp;gt; Visual effects), Nib doesn't animate the caret or throw sparks, even with the settings on.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When they're off, all they add to the keystroke path is reading one setting, so a feature you don't use costs next to nothing.&lt;/p&gt;
&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Design record: &lt;a href="https://github.com/hideyukiMORI/nene-nib/blob/main/docs/adr/0192-caret-motion-trails-behind-the-caret.md" rel="noopener noreferrer"&gt;ADR 0192, caret motion and sparks&lt;/a&gt; (Japanese)&lt;/li&gt;
&lt;li&gt;The motion: &lt;a href="https://github.com/hideyukiMORI/nene-nib/blob/main/src/core/CaretGlide.cpp" rel="noopener noreferrer"&gt;&lt;code&gt;CaretGlide.cpp&lt;/code&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;The sparks: &lt;a href="https://github.com/hideyukiMORI/nene-nib/blob/main/src/core/CaretSparks.hpp" rel="noopener noreferrer"&gt;&lt;code&gt;CaretSparks.hpp&lt;/code&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://apps.microsoft.com/detail/9nclgdtfq529?cid=devto" rel="noopener noreferrer"&gt;Get NeNe Nib on the Microsoft Store (free)&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Open the settings drawer, turn on caret motion, and type a few lines. Then try 40 ms and 300 ms. Which speed did you keep?&lt;/p&gt;


&lt;div class="ltag__user ltag__user__id__3995621"&gt;
    &lt;a href="/hideyukimori" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&gt;
        &lt;img src="https://media2.dev.to/dynamic/image/width=150,height=150,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3995621%2Fd22faba8-a5e8-4ded-a514-1558d81cc5db.jpg" alt="hideyukimori image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/hideyukimori"&gt;HideyukiMORI&lt;/a&gt;Follow
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/hideyukimori"&gt;Building API-first PHP tools for self-hosted business workflows. Creator of NENE2 and the NeNe OSS series.&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;



</description>
      <category>showdev</category>
      <category>windows</category>
      <category>cpp</category>
      <category>vim</category>
    </item>
    <item>
      <title>117 ms vs 908 ms: Timing My Text Editor Against Windows Notepad</title>
      <dc:creator>HideyukiMORI</dc:creator>
      <pubDate>Tue, 24 Nov 2026 13:52:37 +0000</pubDate>
      <link>https://dev.to/hideyukimori/117-ms-vs-908-ms-timing-my-text-editor-against-windows-notepad-5f57</link>
      <guid>https://dev.to/hideyukimori/117-ms-vs-908-ms-timing-my-text-editor-against-windows-notepad-5f57</guid>
      <description>&lt;p&gt;My text editor shows a 16 MiB file in 117 ms. Windows Notepad takes 908 ms on the same machine.&lt;/p&gt;

&lt;p&gt;Both numbers are medians of 20 runs, measured the same way from outside the apps. I also timed Sakura Editor, a long-standing Windows editor that's popular in Japan.&lt;/p&gt;


&lt;div&gt;
    &lt;iframe src="https://www.youtube.com/embed/8rAQmeq9qfU" width="315" height="560"&gt;
    &lt;/iframe&gt;
  &lt;/div&gt;


&lt;p&gt;What's in this post:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How I timed three editors without trusting any app's own clock&lt;/li&gt;
&lt;li&gt;The numbers, including the ones where Nib loses&lt;/li&gt;
&lt;li&gt;Four things Nib does to open a 16 MiB file fast&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The setup
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/hideyukiMORI/nene-nib" rel="noopener noreferrer"&gt;NeNe Nib&lt;/a&gt; is my text editor for Windows 11. It works like Notepad by default, and &lt;code&gt;Ctrl+Shift+Space&lt;/code&gt; switches it to Vim editing. I wrote about &lt;a href="https://dev.to/hideyukimori/i-built-a-44-mb-windows-text-editor-that-switches-between-notepad-style-editing-and-vim-31o"&gt;what it does and how its first frame appears in 41 ms&lt;/a&gt; earlier.&lt;/p&gt;

&lt;p&gt;This time I wanted a number I could compare with other editors. The app's internal timer can't do that, because every app starts and stops its own clock in a different place.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I measured it
&lt;/h2&gt;

&lt;p&gt;I timed what you actually see:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Just before the action, turn a marker on the screen white.&lt;/li&gt;
&lt;li&gt;Record the screen at 60 fps.&lt;/li&gt;
&lt;li&gt;Count frames from the white marker to the frame where text appears inside the app's window.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;One frame is about 17 ms, so that's the resolution. I rotated the order of the apps on every run and threw away the first run as a warm-up.&lt;/p&gt;

&lt;p&gt;All runs used one PC: Windows 11 Pro (build 26300), Core i9-10850K, RTX 3090, 3840×2160. Each app had default settings and the same 1584×892 client area. The files were UTF-8 &lt;code&gt;.txt&lt;/code&gt; files with LF line endings and some Japanese text, and they were already in the OS file cache.&lt;/p&gt;

&lt;p&gt;For memory, I read &lt;code&gt;PrivateWorkingSetSize&lt;/code&gt; from &lt;code&gt;GetProcessMemoryInfo&lt;/code&gt; after the app settled. That's RAM actually in use, without GPU or shared memory.&lt;/p&gt;

&lt;h2&gt;
  
  
  The numbers
&lt;/h2&gt;

&lt;p&gt;Medians of 20 runs for time and 10 runs for memory. Bold is the best of the three.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;NeNe Nib 1.1.0&lt;/th&gt;
&lt;th&gt;Sakura Editor 2.4.3&lt;/th&gt;
&lt;th&gt;Notepad 11.2609&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Launch with 200 lines, until text appears&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;100 ms&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;267 ms&lt;/td&gt;
&lt;td&gt;450 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Launch with 16 MiB, until text appears&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;117 ms&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;383 ms&lt;/td&gt;
&lt;td&gt;908 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RAM after opening 200 lines&lt;/td&gt;
&lt;td&gt;14.1 MiB&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;11.6 MiB&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;40.4 MiB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RAM after opening 16 MiB&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;30.4 MiB&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;54.2 MiB&lt;/td&gt;
&lt;td&gt;88.7 MiB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Package size&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;4.75 MB&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;5.62 MB&lt;/td&gt;
&lt;td&gt;18.55 MB&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Against Notepad, that's about 4.5x faster with the small file and 7.8x faster with the 16 MiB file.&lt;/p&gt;

&lt;p&gt;Nib doesn't win everything:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;With a small file, Sakura Editor uses less RAM.&lt;/li&gt;
&lt;li&gt;Sakura Editor's package is 3.61 MB without its help files, which is smaller than Nib.&lt;/li&gt;
&lt;li&gt;Both Sakura Editor (2.26 MB) and Notepad (3.21 MB) have smaller executables than Nib (4.57 MB). Notepad's package size doesn't include the Windows App Runtime and VCLibs it needs.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What Nib does to open 16 MiB in 117 ms
&lt;/h2&gt;

&lt;p&gt;Nib doesn't show part of the file first. For files up to 64 MiB, it reads the whole file and builds its line index before the text appears.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;So the speed has to come from doing less work per byte.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  1. The bytes are never copied
&lt;/h3&gt;

&lt;p&gt;The bytes read from disk go through encoding detection and become the document's text without a copy.&lt;/p&gt;

&lt;p&gt;They travel in a move-only type, &lt;code&gt;SealedBytes&lt;/code&gt;, so nothing can change them on the way. In the prototype, building the document from a 16 MiB file dropped from 11.3 ms to 8.3 ms.&lt;/p&gt;

&lt;p&gt;A UTF-8 BOM isn't erased either. Nib starts the text 3 bytes later instead of moving the whole file in memory.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. The text is a piece table
&lt;/h3&gt;

&lt;p&gt;The file stays in one buffer, and typed text goes into another. Right after opening, the document is a single piece: "the whole file buffer."&lt;/p&gt;

&lt;p&gt;Nothing gets rearranged when a file opens.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. The line index uses one bit per byte
&lt;/h3&gt;

&lt;p&gt;To find where a line starts, Nib keeps an index of line breaks. It splits the text into 64 KiB chunks, and each chunk uses one of two forms:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Few line breaks&lt;/strong&gt;: a list of 16-bit positions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Many line breaks&lt;/strong&gt;: one bit per byte, plus a running count every 512 bytes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With the bit form, counting the line breaks before any position takes one stored count and a &lt;code&gt;popcount&lt;/code&gt; over at most 8 words. Nib never rereads the text to find a line.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. It draws only the visible lines
&lt;/h3&gt;

&lt;p&gt;Only the lines in the window are drawn. The conversion to UTF-16 for DirectWrite happens only for those lines, only when they're drawn.&lt;/p&gt;

&lt;p&gt;A 16 MiB file still needs only a few dozen lines of work to reach the screen.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I haven't measured
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Other PCs, and GPUs other than NVIDIA&lt;/li&gt;
&lt;li&gt;Files that aren't in the OS file cache&lt;/li&gt;
&lt;li&gt;Keystroke latency (this method couldn't produce usable data)&lt;/li&gt;
&lt;li&gt;Nib with the language server or minimap turned on&lt;/li&gt;
&lt;li&gt;Launching from the Microsoft Store icon instead of the executable&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The short video shows 133 ms vs 983 ms. Those came from the recorded takes (median of 5), and recording adds load, so they're higher than the table.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Measurement record: &lt;a href="https://github.com/hideyukiMORI/nene-nib/blob/main/docs/quality/editor-comparison-2026-11-23.md" rel="noopener noreferrer"&gt;editor-comparison-2026-11-23.md&lt;/a&gt; (Japanese)&lt;/li&gt;
&lt;li&gt;How documents open: &lt;a href="https://github.com/hideyukiMORI/nene-nib/blob/main/docs/adr/0159-documents-open-through-one-read-port-that-completes-on-the-worker.md" rel="noopener noreferrer"&gt;ADR 0159&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;No copy on read: &lt;a href="https://github.com/hideyukiMORI/nene-nib/blob/main/docs/adr/0141-file-read-arrives-as-sealed-bytes.md" rel="noopener noreferrer"&gt;ADR 0141&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;The line index: &lt;a href="https://github.com/hideyukiMORI/nene-nib/blob/main/docs/adr/0121-newline-index-is-bounded-by-source-bytes.md" rel="noopener noreferrer"&gt;ADR 0121&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://apps.microsoft.com/detail/9nclgdtfq529?cid=devto" rel="noopener noreferrer"&gt;Get NeNe Nib on the Microsoft Store (free)&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you run the same kind of test on your own PC, I'd like to see the numbers. How do you measure how fast an app feels?&lt;/p&gt;


&lt;div class="ltag__user ltag__user__id__3995621"&gt;
    &lt;a href="/hideyukimori" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&gt;
        &lt;img src="https://media2.dev.to/dynamic/image/width=150,height=150,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3995621%2Fd22faba8-a5e8-4ded-a514-1558d81cc5db.jpg" alt="hideyukimori image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/hideyukimori"&gt;HideyukiMORI&lt;/a&gt;Follow
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/hideyukimori"&gt;Building API-first PHP tools for self-hosted business workflows. Creator of NENE2 and the NeNe OSS series.&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;


</description>
      <category>showdev</category>
      <category>windows</category>
      <category>performance</category>
      <category>cpp</category>
    </item>
    <item>
      <title>I Built a 4.4 MB Windows Text Editor That Switches Between Notepad-Style Editing and Vim</title>
      <dc:creator>HideyukiMORI</dc:creator>
      <pubDate>Mon, 23 Nov 2026 04:39:54 +0000</pubDate>
      <link>https://dev.to/hideyukimori/i-built-a-44-mb-windows-text-editor-that-switches-between-notepad-style-editing-and-vim-31o</link>
      <guid>https://dev.to/hideyukimori/i-built-a-44-mb-windows-text-editor-that-switches-between-notepad-style-editing-and-vim-31o</guid>
      <description>&lt;p&gt;Sometimes I just want to open a file, change one line, and leave. Notepad is fine until I need search across a folder or a Vim motion. A full IDE is more than that moment needs.&lt;/p&gt;

&lt;p&gt;So I built &lt;strong&gt;NeNe Nib&lt;/strong&gt;, a text editor for Windows 11. It's one 4.4 MB executable (as Windows reports it; 4,571,648 bytes) with no runtime to install. It works like Notepad by default, and &lt;code&gt;Ctrl+Shift+Space&lt;/code&gt; switches it to Vim editing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://apps.microsoft.com/detail/9nclgdtfq529?cid=devto" rel="noopener noreferrer"&gt;Get NeNe Nib on the Microsoft Store (free)&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/xke9Ph3RQ3M" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  What it does
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Ordinary editing or Vim.&lt;/strong&gt; Switch with &lt;code&gt;Ctrl+Shift+Space&lt;/code&gt; or a click on the status bar.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Vim checked against real Vim.&lt;/strong&gt; The Vim layer is written from scratch and tested against 6,892 cases generated by Vim 9.1. In NORMAL mode the Japanese IME turns off, and INSERT turns it back on.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Large files.&lt;/strong&gt; UTF-8 files up to 1 GiB load in the background.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Find things fast.&lt;/strong&gt; &lt;code&gt;Ctrl+P&lt;/code&gt; lists tabs, bookmarks, recent files and folder files with a preview. &lt;code&gt;Ctrl+Shift+F&lt;/code&gt; searches a project.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Markdown preview.&lt;/strong&gt; Tables, GitHub alerts, colored code blocks and clickable task lists.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;125 themes&lt;/strong&gt; and syntax colors for 25 languages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Private by default.&lt;/strong&gt; No account, no usage data, and no network connections of its own.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;On my development PC (Core i9-10850K, RTX 3090), the app's own timing shows 45.7 ms from process creation to presenting the first frame, and 0.47 ms from receiving a keystroke to presenting its frame. Both are medians of five runs and exclude OS composition and display time.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it doesn't do
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;It runs only on Windows 11 (22H2 or later, x64). Windows 10 is not supported.&lt;/li&gt;
&lt;li&gt;Vim indent is fixed to 8-column tabs: &lt;code&gt;:set sw=4&lt;/code&gt; and &lt;code&gt;:set expandtab&lt;/code&gt; are refused for now.&lt;/li&gt;
&lt;li&gt;It doesn't load &lt;code&gt;.vimrc&lt;/code&gt; files or Vim plugins. Mappings are stored in Nib's own settings.&lt;/li&gt;
&lt;li&gt;Search patterns don't support &lt;code&gt;\v&lt;/code&gt; yet, and NORMAL &lt;code&gt;R&lt;/code&gt; and uppercase marks are missing.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;:sort&lt;/code&gt; isn't there yet, and &lt;code&gt;:g&lt;/code&gt; supports only &lt;code&gt;d&lt;/code&gt; and &lt;code&gt;s&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Language-server support is off by default, and you install the server yourself.&lt;/li&gt;
&lt;li&gt;Project search reads UTF-8 files only.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Fast startup without slowing down typing
&lt;/h2&gt;

&lt;p&gt;Nib is written in C++23 on plain Win32, Direct2D and DirectWrite, with no UI library. The executable imports 15 DLLs, all part of Windows (8 are delay-loaded).&lt;/p&gt;

&lt;p&gt;The first frame made the biggest difference to startup.&lt;/p&gt;

&lt;p&gt;Initializing a Direct3D device takes about 150 ms on my NVIDIA setup, while a WARP (software) device takes about 9 ms.&lt;/p&gt;

&lt;p&gt;So Nib draws the first frame with WARP while the GPU initializes on another thread, then switches about 170 ms later. That took the first frame from &lt;strong&gt;177.65 ms to 40.6 ms&lt;/strong&gt; on my machine at the time.&lt;/p&gt;

&lt;p&gt;To keep typing fast too, the WARP frame goes to a dedicated child window instead of the main window:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a child window that covers the main window's client area, and let WARP draw there.&lt;/li&gt;
&lt;li&gt;Give the main window's DirectComposition target only a swap chain created on the hardware device.&lt;/li&gt;
&lt;li&gt;When the GPU is ready, present the same frame on the main window, then destroy the child window.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;With this design, my measurements at the time showed a 41.3 ms startup and 0.638 ms per keystroke.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;If you want something as easy to open as Notepad, with Vim there when you reach for it, I'd love for you to try it. Bug reports and ideas are welcome on &lt;a href="https://github.com/hideyukiMORI/nene-nib/issues" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://apps.microsoft.com/detail/9nclgdtfq529?cid=devto" rel="noopener noreferrer"&gt;Get NeNe Nib on the Microsoft Store (free)&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A ZIP is on the &lt;a href="https://github.com/hideyukiMORI/nene-nib/releases/tag/v1.1.0" rel="noopener noreferrer"&gt;v1.1.0 release page&lt;/a&gt;. Its executable is unsigned, so SmartScreen may warn you; the Store version is the easier path.&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>windows</category>
      <category>vim</category>
      <category>cpp</category>
    </item>
    <item>
      <title>A Local Markdown Notes App for Windows, Built in Plain C</title>
      <dc:creator>HideyukiMORI</dc:creator>
      <pubDate>Tue, 10 Nov 2026 12:18:07 +0000</pubDate>
      <link>https://dev.to/hideyukimori/a-local-markdown-notes-app-for-windows-built-in-plain-c-2pe6</link>
      <guid>https://dev.to/hideyukimori/a-local-markdown-notes-app-for-windows-built-in-plain-c-2pe6</guid>
      <description>&lt;p&gt;NeNe Folio is a Markdown notes app for Windows.&lt;/p&gt;

&lt;p&gt;Your notes stay as plain &lt;code&gt;.md&lt;/code&gt; files in a folder you choose. No account, no ads, no usage analytics.&lt;/p&gt;

&lt;p&gt;It renders Mermaid diagrams, keeps five previous versions of each note, and went live on the Microsoft Store on November 1. I wrote it in plain C against the raw Win32 API — the build notes are at the end.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://apps.microsoft.com/detail/9PCHS225SWBX" rel="noopener noreferrer"&gt;Get NeNe Folio on the Microsoft Store&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftjdbvxdlhk8vkbrpbe6e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftjdbvxdlhk8vkbrpbe6e.png" alt="NeNe Folio 1.3.2 in English: categories on the left, a Markdown note with a Mermaid flowchart on the right" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What it does
&lt;/h2&gt;

&lt;p&gt;The window has two parts: your notes, grouped by category, on the left, and the open note on the right.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Write and read.&lt;/strong&gt; Edit plain Markdown, then switch to a reading view with headings, lists, tables, quotes, and code blocks. Code blocks in supported languages get basic syntax highlighting. Keep the list beside the note, or give the note the whole window.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pictures and diagrams.&lt;/strong&gt; Show PNG and JPEG images from local files or HTTPS links. Mermaid flowcharts and sequence diagrams are drawn in the current theme.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Find things.&lt;/strong&gt; Filter notes by name and content, search inside the open note, and replace text with regular expressions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Organize.&lt;/strong&gt; Give each category a color, and drag notes to reorder them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Version history.&lt;/strong&gt; The app keeps up to five previous versions of each note, and you can restore any of them into the editor.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Customize.&lt;/strong&gt; A wide selection of themes, light and dark, that you can preview before applying. Text zoom, a minimap, line numbers, keyboard shortcuts, and a command palette. The UI is available in English, Japanese, and Simplified Chinese.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyd4h6cv5gmhicespvagy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyd4h6cv5gmhicespvagy.png" alt="The theme picker with Nord selected" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Your files, your folder
&lt;/h2&gt;

&lt;p&gt;Notes are ordinary Markdown files in a folder you pick. If you stop using the app, your notes are still right there.&lt;/p&gt;

&lt;p&gt;Remote images need a connection to their HTTPS host. That's the one network feature in the app itself.&lt;/p&gt;

&lt;p&gt;You can import UTF-8 Markdown files, export a note as Markdown, or export your saved notes as a ZIP that can include the local images they reference. The ZIP doesn't include settings or version history, so back up the whole folder if you want those too.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it doesn't do (yet)
&lt;/h2&gt;

&lt;p&gt;I'd rather you know this before you install:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No sync.&lt;/strong&gt; There's no built-in cloud sync. If you use several PCs, put your notes in a folder you already sync.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Raw HTML inside Markdown isn't rendered.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Images are PNG and JPEG only.&lt;/strong&gt; Mermaid support covers flowcharts and sequence diagrams, and only part of their syntax.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Requires Windows 10 version 2004 or later (x64 only).&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Install it
&lt;/h2&gt;

&lt;p&gt;The easiest way is the Microsoft Store, which also delivers updates:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://apps.microsoft.com/detail/9PCHS225SWBX" rel="noopener noreferrer"&gt;NeNe Folio on the Microsoft Store&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Prefer not to use the Store? There's a portable ZIP, with a SHA256SUMS file, on &lt;a href="https://github.com/hideyukiMORI/nene-folio/releases" rel="noopener noreferrer"&gt;GitHub Releases&lt;/a&gt;. Extract everything and run &lt;code&gt;NeNeFolio.exe&lt;/code&gt;. The portable build is unsigned.&lt;/p&gt;

&lt;p&gt;If you try it, tell me what's missing in &lt;a href="https://github.com/hideyukiMORI/nene-folio/issues" rel="noopener noreferrer"&gt;GitHub Issues&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it's built
&lt;/h2&gt;

&lt;p&gt;NeNe Folio is written in C23 against the raw Win32 API. No UI framework.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;About two months, 393 commits, and 72,005 lines in &lt;code&gt;src/&lt;/code&gt;, from September 9 to the v1.3.2 release on November 6.&lt;/li&gt;
&lt;li&gt;Compiled with clang-cl 19.1.5. MSVC's &lt;code&gt;cl&lt;/code&gt; (19.44) rejects C23's &lt;code&gt;nullptr&lt;/code&gt; even with &lt;code&gt;/std:clatest&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The C runtime is statically linked (&lt;code&gt;/MT&lt;/code&gt;), so the app only needs DLLs that ship with Windows. No VC++ redistributable.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I designed it and made the decisions; AI agents (Claude Code) wrote much of the implementation.&lt;/p&gt;

&lt;p&gt;Three things surprised me along the way.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. A frameless window that keeps WS_THICKFRAME still paints its border
&lt;/h3&gt;

&lt;p&gt;The window is &lt;code&gt;WS_POPUP | WS_THICKFRAME&lt;/code&gt;. I kept the thick frame so Snap, maximize, and resizing behave normally. Returning 0 from &lt;code&gt;WM_NCCALCSIZE&lt;/code&gt; makes the client area cover the whole window.&lt;/p&gt;

&lt;p&gt;Then a light band appeared inside the window edge. I thought I'd fixed it. The next day it was back, after the window had sat in the background for a while.&lt;/p&gt;

&lt;p&gt;The cause: &lt;code&gt;DefWindowProc&lt;/code&gt; draws the border based on whether &lt;code&gt;WS_THICKFRAME&lt;/code&gt; is set, not on what &lt;code&gt;WM_NCCALCSIZE&lt;/code&gt; returned. It paints that border the moment the window is deactivated. Nothing invalidates the client area afterwards, so the band stays until the next resize.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The fix: handle &lt;code&gt;WM_NCACTIVATE&lt;/code&gt; yourself and return TRUE without calling &lt;code&gt;DefWindowProc&lt;/code&gt;.&lt;/strong&gt; That alone removes the band. I also swallow &lt;code&gt;WM_NCPAINT&lt;/code&gt; as a guard.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="no"&gt;WM_NCACTIVATE&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;TRUE&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="no"&gt;WM_NCPAINT&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  2. Japanese text looked thinner than everything else
&lt;/h3&gt;

&lt;p&gt;RichEdit's font binding (&lt;code&gt;IMF_AUTOFONT&lt;/code&gt;) was silently rendering Japanese in Yu Gothic instead of my body font, Noto Sans JP.&lt;/p&gt;

&lt;p&gt;Turning &lt;code&gt;IMF_AUTOFONT&lt;/code&gt; off fixed Japanese but left emoji as missing glyphs. What worked was associating the body font with &lt;code&gt;SHIFTJIS_CHARSET&lt;/code&gt; and &lt;code&gt;GB2312_CHARSET&lt;/code&gt; through &lt;code&gt;EM_SETCHARFORMAT&lt;/code&gt; with &lt;code&gt;SCF_ASSOCIATEFONT&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;It's merged to &lt;code&gt;main&lt;/code&gt; but not in a release yet (&lt;a href="https://github.com/hideyukiMORI/nene-folio/issues/783" rel="noopener noreferrer"&gt;issue #783&lt;/a&gt;, fixed in &lt;a href="https://github.com/hideyukiMORI/nene-folio/pull/784" rel="noopener noreferrer"&gt;PR #784&lt;/a&gt;).&lt;/p&gt;
&lt;h3&gt;
  
  
  3. The Store doesn't need your certificate
&lt;/h3&gt;

&lt;p&gt;You can submit an &lt;strong&gt;unsigned&lt;/strong&gt; MSIX. The Store signs the package with Microsoft's certificate when it publishes it, so I didn't buy a code-signing certificate.&lt;/p&gt;

&lt;p&gt;Windows won't sideload an unsigned MSIX, though. So I tested a copy signed with a throwaway test certificate: install, save, restart, upgrade from an older version, and uninstall (the notes must survive).&lt;/p&gt;

&lt;p&gt;I submitted just after midnight on November 1 (JST), and it was live in the Store late that same evening.&lt;/p&gt;
&lt;h2&gt;
  
  
  Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Raw Win32 is viable for a real app, but expect to own behavior a framework would hide, such as non-client painting.&lt;/li&gt;
&lt;li&gt;RichEdit's font binding can override your font for a single writing system. Check it with real text in every language you support.&lt;/li&gt;
&lt;li&gt;Shipping to the Store was cheaper than I expected: no certificate to buy. Put what you save into testing the install path.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://apps.microsoft.com/detail/9PCHS225SWBX" rel="noopener noreferrer"&gt;Microsoft Store page&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/hideyukiMORI/nene-folio" rel="noopener noreferrer"&gt;Source on GitHub (MIT)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/hideyukiMORI/nene-folio/blob/main/docs/MARKDOWN.md" rel="noopener noreferrer"&gt;Supported Markdown and Mermaid syntax&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/hideyukiMORI/nene-folio/blob/main/docs/adr/0014-frameless-window-answers-ncactivate.md" rel="noopener noreferrer"&gt;ADR 0014: the frameless window answers WM_NCACTIVATE&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Where do you keep your Markdown notes today — a plain folder, an editor, or a cloud app? I'm curious what would make you switch.&lt;/p&gt;

&lt;p&gt;── Hideyuki Mori (Ayane International) 🔗 &lt;a href="https://hideyuki-mori.com/en/?ref=devto" rel="noopener noreferrer"&gt;hideyuki-mori.com&lt;/a&gt;&lt;/p&gt;


&lt;div class="ltag__user ltag__user__id__3995621"&gt;
    &lt;a href="/hideyukimori" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&gt;
        &lt;img src="https://media2.dev.to/dynamic/image/width=150,height=150,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3995621%2Fd22faba8-a5e8-4ded-a514-1558d81cc5db.jpg" alt="hideyukimori image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/hideyukimori"&gt;HideyukiMORI&lt;/a&gt;Follow
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/hideyukimori"&gt;Building API-first PHP tools for self-hosted business workflows. Creator of NENE2 and the NeNe OSS series.&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;



</description>
      <category>windows</category>
      <category>markdown</category>
      <category>c</category>
      <category>productivity</category>
    </item>
    <item>
      <title>I Ban the Second Way of Doing Anything: What That Costs</title>
      <dc:creator>HideyukiMORI</dc:creator>
      <pubDate>Sat, 05 Sep 2026 15:23:40 +0000</pubDate>
      <link>https://dev.to/hideyukimori/i-ban-the-second-way-of-doing-anything-what-that-costs-24fm</link>
      <guid>https://dev.to/hideyukimori/i-ban-the-second-way-of-doing-anything-what-that-costs-24fm</guid>
      <description>&lt;p&gt;For a long time I believed a good reviewer was enough to keep a codebase honest. Then I counted how many times I had written the same review comment.&lt;/p&gt;

&lt;p&gt;"There's already a function for that." "We read the clock through the port, not directly." "That's the third way we format a date."&lt;/p&gt;

&lt;p&gt;None of these were bugs. All of them were the same failure: a meaning that had grown a second implementation path. And every one of them had passed review, because reviewers hold rules in memory, and memory is exactly the thing that doesn't scale.&lt;/p&gt;

&lt;p&gt;So I adopted one rule and made it the constitution of everything I build since: &lt;strong&gt;every meaning gets exactly one implementation path, and a machine keeps it that way.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Not "prefer". Not "should". One path, and the build fails if you add another.&lt;/p&gt;

&lt;h2&gt;
  
  
  what the rule actually says
&lt;/h2&gt;

&lt;p&gt;It sounds like a style preference. It isn't. It's a claim about where truth lives.&lt;/p&gt;

&lt;p&gt;If there is one way to read the current time, then "does this code depend on the wall clock?" is a question with a mechanical answer: does it import the one adapter that's allowed to? If there are two ways, the question needs a human, and the human needs to remember both ways, and next month there are three.&lt;/p&gt;

&lt;p&gt;The rule cascades. One way to read time means one adapter that's allowed to. One adapter means a build check that rejects &lt;code&gt;now()&lt;/code&gt; everywhere else. A build check means someone has to prove it fires. A proof means a document that quotes real output. Every step is boring. Every step is the thing that was missing the last time I found a second path in review.&lt;/p&gt;

&lt;p&gt;I tested how far this goes by starting five small repositories in six days — Kotlin, C#, Go, Rust, Java — each with the same constitution, the same rule IDs, the same demand that every rule declare whether a machine enforces it or a person does. Five languages, one rule, 159 merged pull requests. That's the evidence behind everything below.&lt;/p&gt;

&lt;h2&gt;
  
  
  what it costs
&lt;/h2&gt;

&lt;p&gt;Be honest about this part or the rule is just a slogan.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Adding a rule touches three places.&lt;/strong&gt; The rule text, the enforcement matrix that says how it's held, and the actual check. Change one and the other two drift. So I wrote a check for that too — the docs and the matrix are validated against each other in the build. Now adding a rule is slower than not adding it. That's the point, but it's also the cost.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The checks themselves become a codebase.&lt;/strong&gt; The Java clock has about 1,800 lines of dependency-free conformance checking to guard maybe 5,000 lines of application. For a desktop clock. I am not going to pretend that ratio is comfortable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You have to prove the machine is watching.&lt;/strong&gt; A check you have never seen fail is not a check. I learned this the hard way this week: my determinism gate rejected the first violation I planted, I wrote "active" in the log, and a second probe walked straight through. The config file behind the gate was being loaded by no build script. A different, bundled rule had caught my first probe by accident. Proving each gate fires — and reading &lt;em&gt;which&lt;/em&gt; rule fired — is a real tax, and you pay it every time you add one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Some of it never becomes mechanical.&lt;/strong&gt; Across the five repos, the rules that stayed with humans were always the same kind: "this name is too generic", "this invariant is now written in two places", "this shortcut bypasses the boundary". Rules about &lt;em&gt;meaning&lt;/em&gt;. Every language's toolchain could hold structure — dependency direction, module boundaries, forbidden calls — and none of them could hold meaning. I write those rules down as "planned" or "impossible" and leave them to review. The rule about one path applies to the enforcement too: don't claim the machine holds what it doesn't.&lt;/p&gt;

&lt;h2&gt;
  
  
  what I got for it
&lt;/h2&gt;

&lt;p&gt;The second path stopped appearing. Not because people got better — because the build got red.&lt;/p&gt;

&lt;p&gt;And something I didn't expect: the rule catches &lt;em&gt;me&lt;/em&gt;. The five repositories were built by one person with an AI agent. The AI drifts toward the second path constantly, because the second path is usually the locally obvious one. The machine doesn't care who wrote it. In one afternoon the checks caught a half-wired gate, a test suite that had never run, and a proof document that quoted expected output instead of real output. All three were mine.&lt;/p&gt;

&lt;h2&gt;
  
  
  where this is wrong
&lt;/h2&gt;

&lt;p&gt;This is the part I'd want to read if I were skeptical, so here it is.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Throwaway code.&lt;/strong&gt; If the repository will not exist in a month, the three-place sync is pure overhead. I don't do this for prototypes, and I don't do it for scripts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Teams that can't agree on which way is the one way.&lt;/strong&gt; The rule assumes a decision. If two people each believe their path is canonical, mechanical enforcement just automates the argument. Decide first, then enforce. I have the easy version of this problem: it's one person and an agent.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The rule can't fully hold itself.&lt;/strong&gt; When I put the five repositories side by side, the word "active" — as in "this rule is actively enforced by a machine" — meant something different in each one. The C# repo counted "tests and review" as enforcement. The Java repo would have called the same thing "planned". The Kotlin repo left 41 of 56 rules out of its matrix entirely, as review obligations. Same author, same week, five definitions. The principle demands one path for every meaning, and the meaning of "enforced" had five. I only found that out by counting. So: the rule is still held by a person at the top, and that person drifts too.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It's six days, not six years.&lt;/strong&gt; Everything above is what it looks like when you start this way. I don't yet have evidence for what happens when a codebase built like this is three years old and the checks have to change. My older PHP tools have a lighter version of the same idea and it has held, but that's a different rule set and a different claim.&lt;/p&gt;

&lt;h2&gt;
  
  
  the shape of it
&lt;/h2&gt;

&lt;p&gt;If you take one thing: the rule isn't "one way". Everybody says that. The rule is &lt;strong&gt;one way, held by something that doesn't forget&lt;/strong&gt; — and then being honest, in writing, about every place where that something is still a human.&lt;/p&gt;

&lt;p&gt;The five repos and their enforcement matrices are public: &lt;a href="https://github.com/hideyukiMORI/nene-clock" rel="noopener noreferrer"&gt;nene-clock&lt;/a&gt; (Java) is the most complete, and its &lt;a href="https://github.com/hideyukiMORI/nene-clock/blob/main/docs/QUALITY_GATES.md" rel="noopener noreferrer"&gt;QUALITY_GATES.md&lt;/a&gt; is the matrix I mean — 46 rows, 31 fully mechanical, 8 partially, 6 planned, 1 impossible. The half-wired gate story is &lt;a href="https://dev.to/hideyukimori/my-gate-failed-for-the-wrong-reason-nothing-was-loading-the-config-3kde"&gt;its own post&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Where does your codebase have two ways of doing the same thing right now — and who is holding the rule that says there should be one?&lt;/p&gt;

&lt;p&gt;── Hideyuki Mori (Ayane International) 🔗 &lt;a href="https://hideyuki-mori.com/en/?ref=devto" rel="noopener noreferrer"&gt;hideyuki-mori.com&lt;/a&gt;&lt;/p&gt;


&lt;div class="ltag__user ltag__user__id__3995621"&gt;
    &lt;a href="/hideyukimori" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&gt;
        &lt;img src="https://media2.dev.to/dynamic/image/width=150,height=150,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3995621%2Fd22faba8-a5e8-4ded-a514-1558d81cc5db.jpg" alt="hideyukimori image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/hideyukimori"&gt;HideyukiMORI&lt;/a&gt;Follow
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/hideyukimori"&gt;Building API-first PHP tools for self-hosted business workflows. Creator of NENE2 and the NeNe OSS series.&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;


</description>
      <category>programming</category>
      <category>architecture</category>
      <category>opensource</category>
      <category>discuss</category>
    </item>
    <item>
      <title>My Gate Failed for the Wrong Reason: Nothing Was Loading the Config</title>
      <dc:creator>HideyukiMORI</dc:creator>
      <pubDate>Sat, 05 Sep 2026 15:03:52 +0000</pubDate>
      <link>https://dev.to/hideyukimori/my-gate-failed-for-the-wrong-reason-nothing-was-loading-the-config-3kde</link>
      <guid>https://dev.to/hideyukimori/my-gate-failed-for-the-wrong-reason-nothing-was-loading-the-config-3kde</guid>
      <description>&lt;p&gt;I planted a forbidden call in my core module, ran the build, watched it fail, and wrote down "determinism gate: active."&lt;/p&gt;

&lt;p&gt;The file that defined that gate wasn't being loaded by anything.&lt;/p&gt;

&lt;p&gt;This is a small Java 21 desktop clock (&lt;a href="https://github.com/hideyukiMORI/nene-clock" rel="noopener noreferrer"&gt;nene-clock&lt;/a&gt;, MIT) that I built in two days with an AI agent as a test bed for one rule: &lt;strong&gt;every meaning has exactly one implementation path, and a machine — not a reviewer — keeps it that way.&lt;/strong&gt; Part of that rule is "core never reads the wall clock." I had wired &lt;a href="https://github.com/policeman-tools/forbidden-apis" rel="noopener noreferrer"&gt;forbidden-apis&lt;/a&gt; to reject &lt;code&gt;Instant.now()&lt;/code&gt;, &lt;code&gt;System.nanoTime()&lt;/code&gt; and friends by method signature, and I had a written proof that it worked.&lt;/p&gt;

&lt;p&gt;What you'll get from this post:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;how a gate can fail for the right rule and the wrong reason, with the exact lines&lt;/li&gt;
&lt;li&gt;two more dead checks the same afternoon exposed, including a test suite that had never run&lt;/li&gt;
&lt;li&gt;the three habits I now apply before I write the word "active" next to anything&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What broke
&lt;/h2&gt;

&lt;p&gt;My repo keeps a file called &lt;code&gt;gate-proofs.md&lt;/code&gt;. For every custom check, it records a planted violation, the task that ran, the output, and confirmation that removing the violation turns the build green again. The idea is simple: a check I have never seen fail is not a check.&lt;/p&gt;

&lt;p&gt;The first entry, P1, was for the determinism rule. I put &lt;code&gt;LocalDateTime.now()&lt;/code&gt; in &lt;code&gt;:core:application&lt;/code&gt;, ran &lt;code&gt;./gradlew check&lt;/code&gt;, and it failed. I recorded the proof and moved on.&lt;/p&gt;

&lt;p&gt;Before starting the next piece of work I tried a second probe, this time with two different APIs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kt"&gt;long&lt;/span&gt; &lt;span class="n"&gt;probe&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;nanoTime&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;java&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;time&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;Instant&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;now&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="na"&gt;toEpochMilli&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;The build passed.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Why
&lt;/h2&gt;

&lt;p&gt;The forbidden signatures live in &lt;code&gt;config/forbiddenapis/determinism.txt&lt;/code&gt;. The convention plugin that every module applies was supposed to hand that file to forbidden-apis. Here is what it actually handed over, from the diff of the fix:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="c1"&gt;// build-logic/src/main/kotlin/neneclock.java-conventions.gradle.kts — before&lt;/span&gt;
&lt;span class="nf"&gt;forbiddenApis&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;bundledSignatures&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;setOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"jdk-unsafe"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"jdk-deprecated"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"jdk-non-portable"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                              &lt;span class="s"&gt;"jdk-internal"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"jdk-reflection"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"jdk-system-out"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;signaturesFiles&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;files&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rootProject&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"config/forbiddenapis/base.txt"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Only &lt;code&gt;base.txt&lt;/code&gt;. The determinism file existed, was committed, was referenced in the docs, and was read by nobody.&lt;/p&gt;

&lt;p&gt;So why did P1 fail? Because forbidden-apis ships bundled signature sets, and &lt;code&gt;jdk-unsafe&lt;/code&gt; forbids &lt;strong&gt;methods that silently use the default time zone&lt;/strong&gt;. &lt;code&gt;LocalDateTime.now()&lt;/code&gt; happens to be one of them. My probe had been caught by a rule about locale safety, not by my rule about determinism. &lt;code&gt;System.nanoTime()&lt;/code&gt; and &lt;code&gt;Instant.now()&lt;/code&gt; are not in that bundle, so they walked straight through.&lt;/p&gt;

&lt;p&gt;It got slightly worse. The &lt;code&gt;:adapters:system-time&lt;/code&gt; module — the one place allowed to read the clock — has an override that removes &lt;code&gt;determinism.txt&lt;/code&gt; from its own signature list, so the exception is visible in the build file. That override was a no-op. You cannot remove a file from a list that never contained it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The gate had failed for the right rule and the wrong reason, and the proof I wrote down was true and useless.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  The other two things that were dead
&lt;/h2&gt;

&lt;p&gt;Fixing the wiring meant rerunning everything, and rerunning everything found two more.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The conformance engine's own tests had never run.&lt;/strong&gt; My project-specific checks live in &lt;code&gt;build-logic&lt;/code&gt;, which is a Gradle &lt;em&gt;included build&lt;/em&gt;. Tasks in an included build are not part of the root &lt;code&gt;check&lt;/code&gt; unless you say so. I had written "every rule has positive and negative unit tests" — true — and neither &lt;code&gt;./gradlew check&lt;/code&gt; nor CI had executed them once. The first time I ran &lt;code&gt;./gradlew -p build-logic test&lt;/code&gt;, two failed. One of them meant that a correctly written waiver comment was being rejected, and the test for it was green because it only asserted the rule ID, not the &lt;em&gt;reason&lt;/em&gt; the violation was reported. Failing for the wrong reason, again, one layer down.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The proof document's first version quoted output I expected, not output I got.&lt;/strong&gt; When I retook P1 from the real console, the excerpt did not match what I had pasted. I had written the proof from memory of what the tool &lt;em&gt;should&lt;/em&gt; say. That is not a proof; that is a wish with a code block around it.&lt;/p&gt;
&lt;h2&gt;
  
  
  The fix
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/hideyukiMORI/nene-clock/pull/27" rel="noopener noreferrer"&gt;PR #27&lt;/a&gt; (+238 / −59), merged the same day as &lt;a href="https://github.com/hideyukiMORI/nene-clock/issues/26" rel="noopener noreferrer"&gt;Issue #26&lt;/a&gt; was opened:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Build the signature list once and hand it to &lt;strong&gt;both&lt;/strong&gt; the main and test forbidden-apis tasks. Tests reading real time are a determinism failure too.&lt;/li&gt;
&lt;li&gt;Make &lt;code&gt;check&lt;/code&gt; depend on &lt;code&gt;:build-logic:test&lt;/code&gt;, so the engine's own negative proofs run on every gate.&lt;/li&gt;
&lt;li&gt;Add a new rule, &lt;strong&gt;CNF-011&lt;/strong&gt;: if a file under &lt;code&gt;config/&lt;/code&gt; is not referenced by any build script, &lt;code&gt;validateConformance&lt;/code&gt; fails. "Placed but not wired" is now something the machine says, not something I have to remember to look for.&lt;/li&gt;
&lt;li&gt;Retake every proof from real output and keep the wrong first version in the history.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The probe now fails like this — quoted from the console, not from my head:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Forbidden method invocation: java.lang.System#nanoTime() [現在時刻は WallClockPort / TickSource からのみ得る。
ここで読むと決定性が壊れる（ARC-007）]
Forbidden method invocation: java.time.Instant#now() [現在時刻は WallClockPort / TickSource からのみ得る。
ここで読むと決定性が壊れる（ARC-007）]
Scanned 17 class file(s) for forbidden API invocations (in 0.02s), 2 error(s).
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;(The messages are in Japanese because the repo is; they say "the current time comes only from WallClockPort / TickSource — reading it here breaks determinism (ARC-007).")&lt;/p&gt;

&lt;p&gt;And CNF-011's own negative proof, P12, planting an orphan file:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CNF-011 config/forbiddenapis/orphan.txt
      — この設定ファイルを読み込むビルドスクリプトが無い。置いても効かない
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;"No build script loads this configuration file. Placing it here has no effect."&lt;/p&gt;

&lt;p&gt;The registry now has 14 proofs. Each one records what was planted, what task ran, what the tool printed, and that the build went green again after the violation was removed.&lt;/p&gt;

&lt;p&gt;One thing I want to be precise about, because I got it wrong in a first draft elsewhere: this is not a story about Java being special. My Go repo enforces the same rule with &lt;code&gt;depguard&lt;/code&gt; at the package level, and my Rust repo makes &lt;code&gt;std::time&lt;/code&gt; a name-resolution error with &lt;code&gt;#![no_std]&lt;/code&gt;. Java's forbidden-apis just names the ban at the finest grain — a method signature — which is what let me keep &lt;code&gt;LocalDateTime.now(Clock)&lt;/code&gt; legal in the one adapter that needs it. The wiring mistake could have happened in any of them.&lt;/p&gt;
&lt;h2&gt;
  
  
  What I'd tell past me
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;A red build proves that &lt;em&gt;something&lt;/em&gt; rejected your probe. It does not prove that &lt;em&gt;your rule&lt;/em&gt; did.&lt;/strong&gt; Read the message. Check the rule ID. If the tool that fired isn't the one you were testing, you have no proof yet.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A test that asserts only the rule ID will happily pass on the wrong rejection.&lt;/strong&gt; Assert the reason, or at least assert on a fixture that can only fail one way.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Paste output; never type it.&lt;/strong&gt; The moment I wrote what the tool "would" say, my proof document became documentation of my expectations. Those were exactly the expectations that were wrong.&lt;/p&gt;

&lt;p&gt;And one for the toolchain rather than the person: presence of a config file is not evidence that anything reads it. If your gate has a config directory, write the check that fails when a file in it is orphaned. Mine is 53 lines plus a 46-line test, and it would have caught the original bug before I wrote a single proof.&lt;/p&gt;
&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Issue #26 — &lt;em&gt;determinism.txt is not loaded by any build&lt;/em&gt;: &lt;a href="https://github.com/hideyukiMORI/nene-clock/issues/26" rel="noopener noreferrer"&gt;https://github.com/hideyukiMORI/nene-clock/issues/26&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;PR #27 — the fix and the retaken proofs: &lt;a href="https://github.com/hideyukiMORI/nene-clock/pull/27" rel="noopener noreferrer"&gt;https://github.com/hideyukiMORI/nene-clock/pull/27&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;gate-proofs.md&lt;/code&gt; §3 — the section titled "what we learned while proving", including the wrong first version: &lt;a href="https://github.com/hideyukiMORI/nene-clock/blob/main/docs/quality/gate-proofs.md" rel="noopener noreferrer"&gt;https://github.com/hideyukiMORI/nene-clock/blob/main/docs/quality/gate-proofs.md&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;The enforcement matrix, where this rule went from "active" back to honest: &lt;a href="https://github.com/hideyukiMORI/nene-clock/blob/main/docs/QUALITY_GATES.md" rel="noopener noreferrer"&gt;https://github.com/hideyukiMORI/nene-clock/blob/main/docs/QUALITY_GATES.md&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Related posts from the same repo family: &lt;a href="https://dev.to/hideyukimori/ci-paid-for-itself-on-the-first-run-4-repos-real-bugs-2m61"&gt;CI Paid for Itself on the First Run: 4 Repos, Real Bugs&lt;/a&gt; and &lt;a href="https://dev.to/hideyukimori/my-generator-hid-a-lint-error-ci-never-checks-what-nobody-commits-3186"&gt;My Generator Hid a Lint Error: CI Never Checks What Nobody Commits&lt;/a&gt; — both are the same shape: a green result that was measuring the wrong thing.&lt;/p&gt;

&lt;p&gt;Which check in your build have you seen fail for the reason you think it fails for?&lt;/p&gt;

&lt;p&gt;── Hideyuki Mori (Ayane International) 🔗 &lt;a href="https://hideyuki-mori.com/en/?ref=devto" rel="noopener noreferrer"&gt;hideyuki-mori.com&lt;/a&gt;&lt;/p&gt;


&lt;div class="ltag__user ltag__user__id__3995621"&gt;
    &lt;a href="/hideyukimori" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&gt;
        &lt;img src="https://media2.dev.to/dynamic/image/width=150,height=150,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3995621%2Fd22faba8-a5e8-4ded-a514-1558d81cc5db.jpg" alt="hideyukimori image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/hideyukimori"&gt;HideyukiMORI&lt;/a&gt;Follow
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/hideyukimori"&gt;Building API-first PHP tools for self-hosted business workflows. Creator of NENE2 and the NeNe OSS series.&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;



</description>
      <category>programming</category>
      <category>java</category>
      <category>gradle</category>
      <category>testing</category>
    </item>
    <item>
      <title>Two AI Agents Shared a Todo File and a Line Vanished</title>
      <dc:creator>HideyukiMORI</dc:creator>
      <pubDate>Sat, 08 Aug 2026 08:06:55 +0000</pubDate>
      <link>https://dev.to/hideyukimori/two-ai-agents-shared-a-todo-file-and-a-line-vanished-22jd</link>
      <guid>https://dev.to/hideyukimori/two-ai-agents-shared-a-todo-file-and-a-line-vanished-22jd</guid>
      <description>&lt;p&gt;A line disappeared from my todo file.&lt;/p&gt;

&lt;p&gt;Not corrupted. Not moved to the archive where completed items go. Just absent — present in one version, missing in the next, with nothing in between reporting a failure.&lt;/p&gt;

&lt;p&gt;I run several AI coding agents in parallel, one per repository, and they share a single plain-text todo file as their cross-repo coordination point. I've &lt;a href="https://dev.to/hideyukimori/a-todotxt-shared-by-a-human-and-ai-agents-why-plain-text-beat-a-saas-board-for-my-workflow-5dbh"&gt;written before about why plain text beat a SaaS board for this&lt;/a&gt;. This post is about the failure mode I hadn't accounted for.&lt;/p&gt;

&lt;h2&gt;
  
  
  The shape of the bug
&lt;/h2&gt;

&lt;p&gt;Every writer to that file — a CLI, a terminal UI, and the agents themselves — does the same thing: read the whole file, change one line in memory, write the whole file back.&lt;/p&gt;

&lt;p&gt;Three processes doing full-file read-modify-write on one path, with no locking anywhere.&lt;/p&gt;

&lt;p&gt;That's a lost update, and it's textbook. If session A reads the file, session B reads it, A writes, then B writes, B's copy never contained A's change and now the file doesn't either. No error surfaces because nothing went wrong at the filesystem level. Both writes succeeded. One of them just described a world that no longer existed by the time it landed.&lt;/p&gt;

&lt;p&gt;I had built a coordination mechanism whose entire job was to be shared, and left out the only part that makes sharing safe.&lt;/p&gt;

&lt;h2&gt;
  
  
  The part that was harder than the fix
&lt;/h2&gt;

&lt;p&gt;Here's what I actually want to pass on, because the concurrency bug is the boring half.&lt;/p&gt;

&lt;p&gt;When I noticed the file looked wrong, I did the obvious thing: diff it against the last backup. Which produced a wall of differences, because between those two points several agents had legitimately edited many lines — rewording items, compressing finished work, updating deadlines. Almost every line had changed &lt;em&gt;somehow&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;So "what's different" was useless. Nearly everything was different. The question I actually needed to answer was narrower: &lt;strong&gt;is there anything that exists in the old version and has no counterpart in the new one?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That's a set-difference question, not a line-diff question. And answering it meant picking a distinctive word from each candidate line — a repo name, an error string, a ticket number — and searching for that word across the current file. Most of the "missing" lines turned up immediately in reworded form. One didn't. That one was really gone.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A line diff tells you what changed. It doesn't tell you what's missing.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If your recovery instinct is &lt;code&gt;diff old new&lt;/code&gt;, it will work beautifully on a file nobody edits and drown you on a file that several writers touch all day.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I changed, and what I haven't
&lt;/h2&gt;

&lt;p&gt;The honest status: the analysis is done, the fix isn't shipped. The candidates are file locking around every writer, or a modification-time check before each write that aborts if the file moved underneath you, or simply backing up more than once a day — because right now that daily snapshot is the only restore point I have, which is itself a finding.&lt;/p&gt;

&lt;p&gt;I'm not going to pretend I've closed this. What I did do immediately was change my recovery procedure, since that cost nothing and would have saved the hour I spent chasing phantom deletions.&lt;/p&gt;

&lt;h2&gt;
  
  
  The same bug, one layer down
&lt;/h2&gt;

&lt;p&gt;What makes this worth writing up rather than filing away is that I hit the identical structure the same week, in a product, in a database.&lt;/p&gt;

&lt;p&gt;One of my apps had just gained a scheduler that sends payment reminders on a timer. Multiple workers, one queue of things to send — so exactly one worker must own a given run. The obvious implementation is: check whether the lock row is free, and if it is, claim it. Two lines of code, and a window between them where another worker can do the same check and reach the same conclusion. Same lost update, dressed as an invoice going out twice.&lt;/p&gt;

&lt;p&gt;SQLite was one of the supported backends and it has no advisory locks, so the design couldn't lean on a database primitive. That constraint turned out to be a gift, because it forced the version that's actually testable: a plain table where &lt;strong&gt;acquiring is a single conditional &lt;code&gt;UPDATE&lt;/code&gt;, and a first-time claim is a single &lt;code&gt;INSERT&lt;/code&gt; on the primary key&lt;/strong&gt;. No check-then-act window, because there's no gap between checking and acting — the database's own atomicity does the arbitration. Releasing verifies a holder token, so a worker can't release someone else's lock. A TTL reclaims locks from workers that died holding them. Six tests, verified against three database engines.&lt;/p&gt;

&lt;p&gt;The todo file and the scheduler are the same bug at different altitudes. The database one got a rigorous fix because it was going to touch customers. The file one is still open because it only bites me.&lt;/p&gt;

&lt;p&gt;I notice that's a real ordering, and also that it's how the file ended up unprotected in the first place.&lt;/p&gt;

&lt;h2&gt;
  
  
  Takeaways
&lt;/h2&gt;

&lt;p&gt;If more than one process writes a whole file, you have a lost-update bug, whether or not you've seen it yet. Agent sessions count as processes. They're just processes that write convincing commit messages.&lt;/p&gt;

&lt;p&gt;Make claiming a resource one statement, not two. Any "check, then act" pair has a gap in it, and the gap is where two workers agree they both won.&lt;/p&gt;

&lt;p&gt;When you're recovering a multi-writer file, don't ask what changed — ask what has no counterpart. Pick a distinctive token from each old line and search for it in the new one. Reworded is not deleted, and a diff can't tell them apart.&lt;/p&gt;

&lt;p&gt;The lock table, the single-statement claim, and its six tests are here: &lt;a href="https://github.com/hideyukiMORI/nene-clear/pull/406" rel="noopener noreferrer"&gt;nene-clear#406&lt;/a&gt;. The todo file still has no lock.&lt;/p&gt;

&lt;p&gt;What's the shared file in your setup that nobody has put a lock on?&lt;/p&gt;

&lt;p&gt;── Hideyuki Mori (Ayane International) 🔗 &lt;a href="https://hideyuki-mori.com/en/?ref=devto" rel="noopener noreferrer"&gt;hideyuki-mori.com&lt;/a&gt;&lt;/p&gt;


&lt;div class="ltag__user ltag__user__id__3995621"&gt;
    &lt;a href="/hideyukimori" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&gt;
        &lt;img src="https://media2.dev.to/dynamic/image/width=150,height=150,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3995621%2Fd22faba8-a5e8-4ded-a514-1558d81cc5db.jpg" alt="hideyukimori image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/hideyukimori"&gt;HideyukiMORI&lt;/a&gt;Follow
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/hideyukimori"&gt;Building API-first PHP tools for self-hosted business workflows. Creator of NENE2 and the NeNe OSS series.&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;


</description>
      <category>ai</category>
      <category>devops</category>
      <category>discuss</category>
      <category>sqlite</category>
    </item>
  </channel>
</rss>
