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 9v00665bf61b000000000279

Define Gray code states

List the states using Gray code and assign Gray code values to each state.

Start file
typedef enum logic [3:0] {
  S   = 4'b    ,
  S   = 4'b    ,
  S   = 4'b    ,
  S   = 4'b    ,
  S   = 4'b    ,
  S   = 4'b    ,
  S   = 4'b    ,
  S   = 4'b    ,
  S   = 4'b    ,
  S   = 4'b    ,
  S   = 4'b    ,
  S   = 4'b    ,
  S   = 4'b    ,
  S   = 4'b    ,
  S   = 4'b    ,
  S   = 4'b    
} state_t;
End file
typedef enum logic [3:0] {
  S00 = 4'b0000,
  S01 = 4'b0001,
  S02 = 4'b0011,
  S03 = 4'b0010,
  S04 = 4'b0110,
  S05 = 4'b0111,
  S06 = 4'b0101,
  S07 = 4'b0100,
  S08 = 4'b1100,
  S09 = 4'b1101,
  S10 = 4'b1111,
  S11 = 4'b1110,
  S12 = 4'b1010,
  S13 = 4'b1011,
  S14 = 4'b1001,
  S15 = 4'b1000
} state_t;

View Diff

2,17c2,17
<   S   = 4'b    ,
<   S   = 4'b    ,
<   S   = 4'b    ,
<   S   = 4'b    ,
<   S   = 4'b    ,
<   S   = 4'b    ,
<   S   = 4'b    ,
<   S   = 4'b    ,
<   S   = 4'b    ,
<   S   = 4'b    ,
<   S   = 4'b    ,
<   S   = 4'b    ,
<   S   = 4'b    ,
<   S   = 4'b    ,
<   S   = 4'b    ,
<   S   = 4'b    
---
>   S00 = 4'b0000,
>   S01 = 4'b0001,
>   S02 = 4'b0011,
>   S03 = 4'b0010,
>   S04 = 4'b0110,
>   S05 = 4'b0111,
>   S06 = 4'b0101,
>   S07 = 4'b0100,
>   S08 = 4'b1100,
>   S09 = 4'b1101,
>   S10 = 4'b1111,
>   S11 = 4'b1110,
>   S12 = 4'b1010,
>   S13 = 4'b1011,
>   S14 = 4'b1001,
>   S15 = 4'b1000

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 9 remaining solutions by signing in and submitting your own entry
#10 maruryota / @maruryota - Score: 124 - 09/12/24 @ 17:30
<CR>l<C-V>G4bhhs0<Esc>qq<CR><C-V>G5ge<C-A>q14@q2Gmm<C-V>9jA0<Esc>fblq0r0jq7@0q1r1jq7@1`mfbll4@08@14@0`mfb3lmm2@04@14@04@12@0`ml@02@12@02@12@02@12@02@1@0ZZ

0 comments


Created by: @maharba6

10 active golfers, 30 entries

Leaderboard (lowest score wins):
56
#1 - Danilo J. S. Bellini 🥊🇧🇷 / @danilobellini

06/18/2024 at 09:27PM

56
#2 - Peppa Pig / @PeppaPi95550250

07/09/2024 at 11:01AM

56
#3 - John Braxler / @braxler

08/05/2024 at 03:04PM

69
#4 - Valacar / @valacar

06/03/2024 at 07:43AM

69
#5 - nickGPT / @nickandbro

08/21/2024 at 08:02PM

83
#6 - jinx balotchnik / @balotchnik

07/13/2024 at 08:08AM

99
#7 - constap / @constap

06/16/2024 at 01:33PM

112
#8 - cotarmanach / @cotarmanach

06/04/2024 at 09:03PM

118
#9 - maharba6 / @maharba6

06/17/2024 at 04:03AM

124
#10 - maruryota / @maruryota

09/12/2024 at 05:30PM