Skip to content

Instantly share code, notes, and snippets.

@kennypete
Created April 18, 2024 20:46
Show Gist options
  • Save kennypete/1fae2e48f5b0577f9b7b10712cec3212 to your computer and use it in GitHub Desktop.
Save kennypete/1fae2e48f5b0577f9b7b10712cec3212 to your computer and use it in GitHub Desktop.
Navigating the modes of Vim

Navigating the modes of Vim

This diagram illustrates navigating through Vim’s modes. It was built factoring Vim 9 (i.e., all its modes, including up to two new modes, cr and cvr, in November 2023). Information about the state() and 'showmode' is provided too.

SVG version

Some features are only available in the SVG version. It is not provided directly from within this gist’s files because SVGs do not always play nicely in GitHub (particularly, refusing to display embedded fonts).

The SVG version includes hover text help, which shows pertinent information about the underlying key, command, mode, etc. It also includes links to the applicable Vim help entry from almost all the elements in the chart.

Right click the image below to open the SVG in a new tab or window. Alternatively, just click it to open it directly.

Other versions

My pCloud Public folder has other versions: GIF, JPG, PNG, TIF, and PDF. The page/image size is A2, and it prints fairly well to an A2 poster. The PDF version has the Vim help links, though not the hover text.

About

This diagram initially was inspired by VIM Modes Transition Diagram (Parker, 2012), though Navigating the modes of Vim takes the coverage of modes, help, and details to a deeper level and it provides many unique things in a more colourful chart.

Building the diagram was an on/off, labourious effort. Looking back, I started it in late 2022, so it was about 18 months to get to “version 1”, which I am satisfied with.

For anyone interested, the software and scripts used to produce the final SVG diagram and the other outputs:

  • Visio 2003. This was used for editing the main file (.vsd) and saving the intermediate SVG file. It was also used to save the final GIF, JPG, GIF, and TIF versions). I used it because, despite it being archaic, it was familiar and is fairly simple to use. In retrospect, maybe learning the intricacies of Inkscape may have been a better idea. The downside of using Visio was that masses of MS namespace junk is produced in the intermediate SVG file (but it was not too hard to write scripts to get rid of that junk consistently).
  • Dosis font (made into Dosis-Regular.woff2.base64) so that it could be embedded in the SVG (following these instructions). I chose Dosis font because of its minimalist, narrow profile, and its open licence.
  • PowerShell script, running several OmniMark processes, to strip the MS-specific SVG code from the interim SVG, add the Dosis font, add metadata, and include a small number of internal hyperlinks. Another scripting language could have been used, such as Python, but, for plain text and SGML/XML processing, once you are proficient using OmniMark it's hard not to use it. An XML validation step was also used to verify that the final SVG is valid against the SVG 1.1 DTD, which was also using OmniMark.
  • Inkscape to open the final SVG and save the PDF version (chosen because Inkscape created the smallest file size).

Licence

CC BY-NC-SA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment