Numbered multi-cursors

Created by Arcanemagus
Last updated about 7 months ago
// Add a number next to cursors when there are multiple of them at once
atom-text-editor {
  .cursors {
    counter-reset: cursor;
  }

  .cursor {
    // border-color: white !important;
    counter-increment: cursor;

    &:not(:only-of-type) {
      @cursor-color: hsl(220, 100%, 66%);
      border-color: @cursor-color !important;
      &::after {
        // To make the numbers appear under the cursor:
        // position: relative;
        // top: var(--editor-font-size);
        // left: -0.5em;

        // To make the numbers appear justified with the bottom:
        position: relative;
        top: ~'calc(var(--editor-font-size) * 0.2)';

        padding: 1px;
        color: fade(white, 40%);
        background-color: fade(@cursor-color, 40%);
        font-size: ~'calc(var(--editor-font-size) * 0.65)';
        content: counter(cursor);
      }
    }
  }
}

Adds a small number after each cursor, but only when you have multiple cursors active.

Note that the number is simply the number they are displayed in, not the order they were added!