Skip to main content
5 of 5
Commonmark migration

Vim, 43, 41 bytes

qqSLoading... |<esc>:sl250m
r/@:r-@:r\@:@qq@q

Two bytes saved thanks to @Udioica!

Here's a (slightly outdated) animation of it happening in real time!

enter image description here

And here is an explanation:

qq                              " Start recording into register 'q'
  SLoading... |<esc>            " Replace all of the text in the buffer with 'Loading... |'
                    :sl250m     " Sleep for 250 ms
r/                              " Replace the bar with a slash
  @:                            " Re-run the last ex command (sleeping)
    r-                          " Replace the slash with a dash
      @:                        " Re-run the last ex command (sleeping)
        r\                      " Replace the dash with a backslash
          @:                    " Re-run the last ex command (sleeping)
            @q                  " Run macro 'q' (the one we're recording)
              q                 " Stop recording
               @q               " Call macro 'q', which will run forever because it's recursive
DJMcMayhem
  • 59.6k
  • 17
  • 196
  • 348