Real Vim ninjas count every keystroke - do you?

Pick a challenge, fire up Vim, and show us what you got.

Changelog, Rules & FAQ, updates: @vimgolf, RSS.

Your VimGolf key: please sign in

$ gem install vimgolf
$ vimgolf setup
$ vimgolf put 9v00665943dc000000000278

Hex to binary

Convert hexadecimal numbers into binary format.

Start file
LDR R0, =0xCC           // Load R0 with 0xCC
LDR R1, =0xAA           // Load R1 with 0xAA

AND R2, R0, R1    //  R2 =  R0 & R1  -> 0x88
ORR R3, R0, R1    //  R3 =  R0 | R1  -> 0xEE
EOR R4, R0, R1    //  R4 =  R0 ^ R1  -> 0x66
LSL R6, R0, #2    //  R6 =  R0 << 2  -> 0x30
LSR R7, R0, #2    //  R7 =  R0 >> 2  -> 0x33
ROR R9, R0, #3    //  R9 =  R0 >> 3  -> 0x99
LSL R10, R0, #3   // R10 =  R0 << 3  -> 0xC0
LSR R11, R0, #29  // R11 =  R0 >> 29 -> 0x03
ORR R12, R10, R11 // R12 = R10 | R11 -> 0xC3
End file
LDR R0, =0xCC           // Load R0 with 0xCC (0b11001100)
LDR R1, =0xAA           // Load R1 with 0xAA (0b10101010)

AND R2, R0, R1    //  R2 =  R0 & R1  -> 0x88 (0b10001000)
ORR R3, R0, R1    //  R3 =  R0 | R1  -> 0xEE (0b11101110)
EOR R4, R0, R1    //  R4 =  R0 ^ R1  -> 0x66 (0b01100110)
LSL R6, R0, #2    //  R6 =  R0 << 2  -> 0x30 (0b00110000)
LSR R7, R0, #2    //  R7 =  R0 >> 2  -> 0x33 (0b00110011)
ROR R9, R0, #3    //  R9 =  R0 >> 3  -> 0x99 (0b10011001)
LSL R10, R0, #3   // R10 =  R0 << 3  -> 0xC0 (0b11000000)
LSR R11, R0, #29  // R11 =  R0 >> 29 -> 0x03 (0b00000011)
ORR R12, R10, R11 // R12 = R10 | R11 -> 0xC3 (0b11000011)

View Diff

1,2c1,2
< LDR R0, =0xCC           // Load R0 with 0xCC
< LDR R1, =0xAA           // Load R1 with 0xAA
---
> LDR R0, =0xCC           // Load R0 with 0xCC (0b11001100)
> LDR R1, =0xAA           // Load R1 with 0xAA (0b10101010)
4,12c4,12
< AND R2, R0, R1    //  R2 =  R0 & R1  -> 0x88
< ORR R3, R0, R1    //  R3 =  R0 | R1  -> 0xEE
< EOR R4, R0, R1    //  R4 =  R0 ^ R1  -> 0x66
< LSL R6, R0, #2    //  R6 =  R0 << 2  -> 0x30
< LSR R7, R0, #2    //  R7 =  R0 >> 2  -> 0x33
< ROR R9, R0, #3    //  R9 =  R0 >> 3  -> 0x99
< LSL R10, R0, #3   // R10 =  R0 << 3  -> 0xC0
< LSR R11, R0, #29  // R11 =  R0 >> 29 -> 0x03
< ORR R12, R10, R11 // R12 = R10 | R11 -> 0xC3
---
> AND R2, R0, R1    //  R2 =  R0 & R1  -> 0x88 (0b10001000)
> ORR R3, R0, R1    //  R3 =  R0 | R1  -> 0xEE (0b11101110)
> EOR R4, R0, R1    //  R4 =  R0 ^ R1  -> 0x66 (0b01100110)
> LSL R6, R0, #2    //  R6 =  R0 << 2  -> 0x30 (0b00110000)
> LSR R7, R0, #2    //  R7 =  R0 >> 2  -> 0x33 (0b00110011)
> ROR R9, R0, #3    //  R9 =  R0 >> 3  -> 0x99 (0b10011001)
> LSL R10, R0, #3   // R10 =  R0 << 3  -> 0xC0 (0b11000000)
> LSR R11, R0, #29  // R11 =  R0 >> 29 -> 0x03 (0b00000011)
> ORR R12, R10, R11 // R12 = R10 | R11 -> 0xC3 (0b11000011)

Solutions

The best way to learn is to practice. Below, you will find some of the solutions other golfers have entered. To unlock higher ranked solutions, submit your own entry which does as well or better than the solutions you can currently see - climb the ladder!

Check out these helpful resources to improve your Vim skills... Game on.

Unlock 16 remaining solutions by signing in and submitting your own entry
#17 Joe Finn / @jafinn3 - Score: 98 - 06/07/24 @ 16:02
:%s/\(\/.*\)\(0x[A-E0-9]\+\)/\=printf("%s%s (0b%08b)", submatch(1), submatch(2), submatch(2))/g<CR>ZZ

0 comments


Created by: @maharba6

17 active golfers, 78 entries

Leaderboard (lowest score wins):
29
#1 - Peppa Pig / @PeppaPi95550250

10/07/2024 at 04:10AM

31
#2 - Danilo J. S. Bellini 🥊🇧🇷 / @danilobellini

08/05/2024 at 12:18AM

31
#3 - nickGPT / @nickandbro

08/21/2024 at 08:05PM

32
#4 - jinx balotchnik / @balotchnik

07/13/2024 at 08:44AM

32
#5 - Blake Raymond / @bit-ray

07/21/2024 at 06:23AM

33
#6 - John Braxler / @braxler

06/19/2024 at 01:50PM

33
#7 - Tanzeel Kazi / @tanzeelkazi

07/10/2024 at 07:08AM

34
#8 - Valacar / @valacar

06/09/2024 at 07:35AM

35
#9 - Alain Mosnier / @amosnier

06/03/2024 at 06:15PM

39
#10 - maharba6 / @maharba6

07/04/2024 at 10:53AM

40
#11 - Sander Meij / @SanderMeij

06/05/2024 at 03:32PM

43
#12 - jeffreymrussell / @jeffreymrussell

05/31/2024 at 09:49AM

44
#13 - TobSick / @TobSick

06/08/2024 at 08:08AM

45
#14 - cotarmanach / @cotarmanach

06/01/2024 at 01:11AM

45
#15 - Alex Weeren / @AlexWeeren

09/11/2024 at 01:33PM

63
#16 - Zigmas Bitinas / @samgiz

05/31/2024 at 10:49PM

98
#17 - Joe Finn / @jafinn3

06/07/2024 at 04:02PM