Skip to main content
added 6 characters in body
Source Link
Jordan
  • 11.3k
  • 1
  • 33
  • 55

Vim + coreutils, 32 keystrokes

You can never have too many Vim answers.

qqYv:!rev
Pjq@=len(@")
@q2dkv{gJ

Explanation

qq               " Start recording macro
Y                " Yank (copy) line
v:!rev<CR>       " Reverse line with coreutils rev command
Pj               " Paste yanked line above this line
q                " Stop recording
@=len(@")<CR>@q  " Playback macro once for each character
2dk              " Delete last 3 lines
v{gJ             " Join lines

Vim + coreutils, 32 keystrokes

You can never have too many Vim answers.

qqYv:!rev
Pjq@=len(@")
@q2dkv{gJ

Explanation

qq               " Start recording macro
Y                " Yank (copy) line
v:!rev<CR>       " Reverse line with coreutils rev command
Pj               " Paste yanked line this line
q                " Stop recording
@=len(@")<CR>@q  " Playback macro once for each character
2dk              " Delete last 3 lines
v{gJ             " Join lines

Vim + coreutils, 32 keystrokes

You can never have too many Vim answers.

qqYv:!rev
Pjq@=len(@")
@q2dkv{gJ

Explanation

qq               " Start recording macro
Y                " Yank (copy) line
v:!rev<CR>       " Reverse line with coreutils rev command
Pj               " Paste yanked line above this line
q                " Stop recording
@=len(@")<CR>@q  " Playback macro once for each character
2dk              " Delete last 3 lines
v{gJ             " Join lines
Source Link
Jordan
  • 11.3k
  • 1
  • 33
  • 55

Vim + coreutils, 32 keystrokes

You can never have too many Vim answers.

qqYv:!rev
Pjq@=len(@")
@q2dkv{gJ

Explanation

qq               " Start recording macro
Y                " Yank (copy) line
v:!rev<CR>       " Reverse line with coreutils rev command
Pj               " Paste yanked line this line
q                " Stop recording
@=len(@")<CR>@q  " Playback macro once for each character
2dk              " Delete last 3 lines
v{gJ             " Join lines