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 8 remaining solutions by signing in and submitting your own entry
#9 Sergio / @SergioVl12 - Score: 102 - 08/15/20 @ 05:07
c2t def<Esc>f[c$():<Esc>:%s/\v[\{\},;]//g<CR>ddi"<Esc>f0i": <Esc>A}<Esc>qqkA,<Esc>F"a:<Esc>q4@qki    return {<Esc>Jxj0<C-V>kjjjjjI        <Esc>ZZ

0 comments


Created by: @Seve_py

9 active golfers, 29 entries

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

08/31/2020 at 02:36AM

49
#2 - Saki Gw / @Sakigw

08/12/2020 at 11:42AM

49
#3 - Jon Krause / @jkrause314

08/12/2020 at 01:45PM

49
#4 - Tanzeel Kazi / @tanzeelkazi

08/12/2020 at 10:50PM

53
#5 - Martin Bielik / @mabielik

08/11/2020 at 08:56PM

58
#6 - Seve / @Seve_py

08/11/2020 at 08:53AM

68
#7 - RockerZZY / @rocker_zzy

08/24/2020 at 09:55AM

77
#8 - Martin Kauppinen / @MartinKauppinen

08/15/2020 at 12:22PM

102
#9 - Sergio / @SergioVl12

08/15/2020 at 05:07AM