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 5f316d5c8d826b000640670e

C to python code snippet

C code can be easily translated into Python code. However, the difference in syntax can make this process tedious and time-consuming. Can Vim help you here?

Start file
const wc_units_data wc_units_frequency[]=
{
    {"mHz", 1e-3},
    {"Hz", 1.0},
    {"kHz", 1e3},
    {"MHz", 1e6},
    {"GHz", 1e9},
    {NULL,0}
};
End file
def wc_units_frequency():
    return {"mHz": 1e-3,
            "Hz": 1.0,
            "kHz": 1e3,
            "MHz": 1e6,
            "GHz": 1e9,
            "NULL": 0}

View Diff

1,9c1,7
< const wc_units_data wc_units_frequency[]=
< {
<     {"mHz", 1e-3},
<     {"Hz", 1.0},
<     {"kHz", 1e3},
<     {"MHz", 1e6},
<     {"GHz", 1e9},
<     {NULL,0}
< };
---
> def wc_units_frequency():
>     return {"mHz": 1e-3,
>             "Hz": 1.0,
>             "kHz": 1e3,
>             "MHz": 1e6,
>             "GHz": 1e9,
>             "NULL": 0}

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 21 remaining solutions by signing in and submitting your own entry
#22 Paras Sud / @tsuyoihikari - Score: 183 - 08/07/21 @ 00:42
viwdidef<Esc>lllviwdi<BS><Esc>$hhvldi()<Esc>$r:jddGdd:2<CR>ireturn <Esc>uVjjjjj:s/[{}]//<CR>Vkkkkk:<Up><CR>kkkkkireturn {<Esc>$<Esc>G$a}<Esc>Vkkkkk:s/,/:<CR>i"<Esc>wwi"<Esc>lli <Esc>kjV<Esc><Esc>kkkkhhhhhhhi        <Esc>vhhhhhhhyjPj^Pj^Pj^P:w<CR>/asdf<CR>:wq<CR>

0 comments


Created by: @Seve_py

22 active golfers, 68 entries

Leaderboard (lowest score wins):
48
#1 - Tom Dalling / @tom_dalling

08/31/2020 at 02:36AM

48
#2 - quemeraisc / @quemeraisc

05/06/2022 at 03:03PM

49
#3 - Saki Gw / @Sakigw

08/12/2020 at 11:42AM

49
#4 - Jon Krause / @jkrause314

08/12/2020 at 01:45PM

49
#5 - Tanzeel Kazi / @tanzeelkazi

08/12/2020 at 10:50PM

49
#6 - John Braxler / @braxler

08/04/2021 at 02:13PM

50
#7 - Jean George / @JeanGeo20504212

03/11/2022 at 04:17PM

53
#8 - Martin Bielik / @mabielik

08/11/2020 at 08:56PM

53
#9 - Andreas Siegrist / @andreaszwei

06/16/2021 at 05:59PM

53
#10 - mevmev / @mevmev8

09/12/2021 at 04:28PM

58
#11 - Seve / @Seve_py

08/11/2020 at 08:53AM

61
#12 - Austin Willliams / @GuitarMusash616

11/13/2022 at 05:37AM

68
#13 - RockerZZY / @rocker_zzy

08/24/2020 at 09:55AM

71
#14 - Sammit / @somemeatjain

01/25/2022 at 07:45PM

76
#15 - A White Dwarf / @AWhiteDwarf1

07/02/2021 at 04:18PM

77
#16 - Martin Kauppinen / @MartinKauppinen

08/15/2020 at 12:22PM

79
#17 - xtncl / @xtncl

06/10/2022 at 11:24PM

80
#18 - Хью Джолли / @DzolliH

06/25/2022 at 06:57AM

94
#19 - Macunaíma / @Macunama11

05/09/2022 at 05:14PM

102
#20 - Sergio / @SergioVl12

08/15/2020 at 05:07AM

108
#21 - Borna Sadeghi / @borna_sadeghi

04/03/2021 at 03:43PM

183
#22 - Paras Sud / @tsuyoihikari

08/07/2021 at 12:42AM