Skip to main content
Commonmark migration
Source Link

#Vim, 39, 34 keystrokes

Vim, 39, 34 keystrokes

:se ri
Y:s/./<C-r>"/g
<C-o>qqgJC<C-r>"<esc>gJ@qq@q

5 bytes saved thanks to @Lynn!

Here is a gif of it happening live: (Note that this gif is of a previous version since I haven't had time to re-record it yet).

enter image description here

And here is an explanation of how it works:

:se ri                  "Turn 'reverse indent' on.
Y                       "Yank this line
:s/./<C-r>"/g           "Replace every character on this line with the register
                        "We just yanked followed by a newline
<C-o>                   "Jump to our previous location
     qq                 "Start recording in register 'q'
       gJ               "Join these two lines
         C              "Delete this line, and enter insert mode
          <C-r>"<esc>   "Paste the line we just deleted backwards 
gJ                      "Join these two lines
  @q                    "Call macro 'q'. This will run until we hit the bottom of the buffer.
    q                   "Stop recording.
     @q                 "Start our recursive macro

On a side note, Y grabs an extra newline, which is usually an obnoxious feature. This is probably the first ever time that it has actually saved several bytes!

#Vim, 39, 34 keystrokes

:se ri
Y:s/./<C-r>"/g
<C-o>qqgJC<C-r>"<esc>gJ@qq@q

5 bytes saved thanks to @Lynn!

Here is a gif of it happening live: (Note that this gif is of a previous version since I haven't had time to re-record it yet).

enter image description here

And here is an explanation of how it works:

:se ri                  "Turn 'reverse indent' on.
Y                       "Yank this line
:s/./<C-r>"/g           "Replace every character on this line with the register
                        "We just yanked followed by a newline
<C-o>                   "Jump to our previous location
     qq                 "Start recording in register 'q'
       gJ               "Join these two lines
         C              "Delete this line, and enter insert mode
          <C-r>"<esc>   "Paste the line we just deleted backwards 
gJ                      "Join these two lines
  @q                    "Call macro 'q'. This will run until we hit the bottom of the buffer.
    q                   "Stop recording.
     @q                 "Start our recursive macro

On a side note, Y grabs an extra newline, which is usually an obnoxious feature. This is probably the first ever time that it has actually saved several bytes!

Vim, 39, 34 keystrokes

:se ri
Y:s/./<C-r>"/g
<C-o>qqgJC<C-r>"<esc>gJ@qq@q

5 bytes saved thanks to @Lynn!

Here is a gif of it happening live: (Note that this gif is of a previous version since I haven't had time to re-record it yet).

enter image description here

And here is an explanation of how it works:

:se ri                  "Turn 'reverse indent' on.
Y                       "Yank this line
:s/./<C-r>"/g           "Replace every character on this line with the register
                        "We just yanked followed by a newline
<C-o>                   "Jump to our previous location
     qq                 "Start recording in register 'q'
       gJ               "Join these two lines
         C              "Delete this line, and enter insert mode
          <C-r>"<esc>   "Paste the line we just deleted backwards 
gJ                      "Join these two lines
  @q                    "Call macro 'q'. This will run until we hit the bottom of the buffer.
    q                   "Stop recording.
     @q                 "Start our recursive macro

On a side note, Y grabs an extra newline, which is usually an obnoxious feature. This is probably the first ever time that it has actually saved several bytes!

added 12 characters in body
Source Link
DJMcMayhem
  • 59.6k
  • 17
  • 196
  • 348

#Vim, 3939, 34 keystrokes

:se ri
Y:s/./<C-r>"/g
<C-o>qqjC<Co>qqgJC<C-r>"<esc>j@qq@q:%s/\n<cr>r>"<esc>gJ@qq@q

5 bytes saved thanks to @Lynn!

Here is a gif of it happening live: (Note that this gif is of a previous version since I haven't had time to re-record it yet).

enter image description here

And here is an explanation of how it works:

:se ri                  "Turn 'reverse indent' on.
Y                       "Yank this line
:s/./<C-r>"/g           "Replace every character on this line with the register
                        "We just yanked followed by a newline
<C-o>                   "Jump to our previous location
     qq                 "Start recording in register 'q'
       j gJ               "Move"Join downthese onetwo linelines
        C C              "Delete this line, and enter insert mode
          <C-r>"<esc>    "Paster"Paste the line we just deleted backwards 
     gJ                   "(That's why we turned"Join onthese 'reversetwo indent')lines
j                       "Move down one line
 @q                     "Call macro 'q'. This will run until we hit the bottom of the buffer.
   q q                   "Stop recording.
    @q @q                 "Start our recursive macro
      :%s/\n<cr>        "Remove every new

On a side note, Y grabs an extra newline, which is usually an obnoxious feature. This is probably the first ever time that it has actually saved several bytes!

#Vim, 39 keystrokes

:se ri
Y:s/./<C-r>"/g
<C-o>qqjC<C-r>"<esc>j@qq@q:%s/\n<cr>

Here is a gif of it happening live:

enter image description here

And here is an explanation of how it works:

:se ri                  "Turn 'reverse indent' on.
Y                       "Yank this line
:s/./<C-r>"/g           "Replace every character on this line with the register
                        "We just yanked followed by a newline
<C-o>                   "Jump to our previous location
     qq                 "Start recording in register 'q'
       j                "Move down one line
        C               "Delete this line, and enter insert mode
         <C-r>"<esc>    "Paster the line we just deleted backwards 
                        "(That's why we turned on 'reverse indent')
j                       "Move down one line
 @q                     "Call macro 'q'. This will run until we hit the bottom of the buffer.
   q                    "Stop recording.
    @q                  "Start our recursive macro
      :%s/\n<cr>        "Remove every new

On a side note, Y grabs an extra newline, which is usually an obnoxious feature. This is probably the first ever time that it has actually saved several bytes!

#Vim, 39, 34 keystrokes

:se ri
Y:s/./<C-r>"/g
<C-o>qqgJC<C-r>"<esc>gJ@qq@q

5 bytes saved thanks to @Lynn!

Here is a gif of it happening live: (Note that this gif is of a previous version since I haven't had time to re-record it yet).

enter image description here

And here is an explanation of how it works:

:se ri                  "Turn 'reverse indent' on.
Y                       "Yank this line
:s/./<C-r>"/g           "Replace every character on this line with the register
                        "We just yanked followed by a newline
<C-o>                   "Jump to our previous location
     qq                 "Start recording in register 'q'
       gJ               "Join these two lines
         C              "Delete this line, and enter insert mode
          <C-r>"<esc>   "Paste the line we just deleted backwards 
gJ                      "Join these two lines
  @q                    "Call macro 'q'. This will run until we hit the bottom of the buffer.
    q                   "Stop recording.
     @q                 "Start our recursive macro

On a side note, Y grabs an extra newline, which is usually an obnoxious feature. This is probably the first ever time that it has actually saved several bytes!

added 1239 characters in body
Source Link
DJMcMayhem
  • 59.6k
  • 17
  • 196
  • 348

#Vim, 39 keystrokes

:se ri
Y:s/./<C-r>"/g
<C-o>qqjC<C-r>"<esc>j@qq@q:%s/\n<cr>

Explanation/gif to come inHere is a minutegif of it happening live:

enter image description here

And here is an explanation of how it works:

:se ri                  "Turn 'reverse indent' on.
Y                       "Yank this line
:s/./<C-r>"/g           "Replace every character on this line with the register
                        "We just yanked followed by a newline
<C-o>                   "Jump to our previous location
     qq                 "Start recording in register 'q'
       j                "Move down one line
        C               "Delete this line, and enter insert mode
         <C-r>"<esc>    "Paster the line we just deleted backwards 
                        "(That's why we turned on 'reverse indent')
j                       "Move down one line
 @q                     "Call macro 'q'. This will run until we hit the bottom of the buffer.
   q                    "Stop recording.
    @q                  "Start our recursive macro
      :%s/\n<cr>        "Remove every new

On a side note, Y grabs an extra newline, which is usually an obnoxious feature. This is probably the first ever time that it has actually saved several bytes!

#Vim, 39 keystrokes

:se ri
Y:s/./<C-r>"/g
<C-o>qqjC<C-r>"<esc>j@qq@q:%s/\n<cr>

Explanation/gif to come in a minute

#Vim, 39 keystrokes

:se ri
Y:s/./<C-r>"/g
<C-o>qqjC<C-r>"<esc>j@qq@q:%s/\n<cr>

Here is a gif of it happening live:

enter image description here

And here is an explanation of how it works:

:se ri                  "Turn 'reverse indent' on.
Y                       "Yank this line
:s/./<C-r>"/g           "Replace every character on this line with the register
                        "We just yanked followed by a newline
<C-o>                   "Jump to our previous location
     qq                 "Start recording in register 'q'
       j                "Move down one line
        C               "Delete this line, and enter insert mode
         <C-r>"<esc>    "Paster the line we just deleted backwards 
                        "(That's why we turned on 'reverse indent')
j                       "Move down one line
 @q                     "Call macro 'q'. This will run until we hit the bottom of the buffer.
   q                    "Stop recording.
    @q                  "Start our recursive macro
      :%s/\n<cr>        "Remove every new

On a side note, Y grabs an extra newline, which is usually an obnoxious feature. This is probably the first ever time that it has actually saved several bytes!

Source Link
DJMcMayhem
  • 59.6k
  • 17
  • 196
  • 348
Loading