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 29 remaining solutions by signing in and submitting your own entry
#30 fufuror / @futachima - Score: 228 - 01/25/23 @ 17:25
5xidef<Esc>lldw/[xx<BS><BS><CR>xxi()<Esc>lr:<Esc>jxi<Tab><BS>    return <BS> <Esc>jllllllxjhxjlxjxjxjhhhhhhhxkxkxkxkxkxlllllr:jhr:jlr:jr:jr:jh:<Esc><C-G>r:<Esc>kkkkkkkjlla{<Del><Del><Del><Del><Del><Del>"<Esc>j0i        <Esc>j0i8<BS><Esc>8i <Esc>i   <BS><BS><BS><Esc>joi <Esc>u0i        <Esc>j0i        <Esc>j0i        <Esc>llllli"<Esc>lllla"<Esc>la <Esc>jddZZ

0 comments


Created by: @Seve_py

30 active golfers, 88 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

48
#3 - Peppa Pig / @PeppaPi95550250

07/15/2024 at 09:12AM

49
#4 - Saki Gw / @Sakigw

08/12/2020 at 11:42AM

49
#5 - Jon Krause / @jkrause314

08/12/2020 at 01:45PM

49
#6 - Tanzeel Kazi / @tanzeelkazi

08/12/2020 at 10:50PM

49
#7 - John Braxler / @braxler

08/04/2021 at 02:13PM

49
#8 - Topvimgolf Score / @topvimgolfscore

10/02/2023 at 07:04AM

49
#9 - Luoyb / @Luoyb

10/25/2023 at 07:30AM

50
#10 - Jean George / @JeanGeo20504212

03/11/2022 at 04:17PM

53
#11 - Martin Bielik / @mabielik

08/11/2020 at 08:56PM

53
#12 - Andreas Siegrist / @andreaszwei

06/16/2021 at 05:59PM

53
#13 - mevmev / @mevmev8

09/12/2021 at 04:28PM

58
#14 - Seve / @Seve_py

08/11/2020 at 08:53AM

61
#15 - Austin Willliams / @GuitarMusash616

11/13/2022 at 05:37AM

62
#16 - James / @Dronak

10/13/2023 at 03:04PM

68
#17 - RockerZZY / @rocker_zzy

08/24/2020 at 09:55AM

71
#18 - Sammit / @somemeatjain

01/25/2022 at 07:45PM

76
#19 - A White Dwarf / @AWhiteDwarf1

07/02/2021 at 04:18PM

77
#20 - Martin Kauppinen / @MartinKauppinen

08/15/2020 at 12:22PM

79
#21 - xtncl / @xtncl

06/10/2022 at 11:24PM

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

06/25/2022 at 06:57AM

80
#23 - Marco Meinardi / @Kee__no

12/30/2022 at 06:34PM

80
#24 - bonettimrc / @bonettimrc

04/24/2024 at 09:42PM

80
#25 - nickGPT / @nickandbro

08/24/2024 at 04:30AM

94
#26 - Macunaíma / @Macunama11

05/09/2022 at 05:14PM

102
#27 - Sergio / @SergioVl12

08/15/2020 at 05:07AM

108
#28 - Borna Sadeghi / @borna_sadeghi

04/03/2021 at 03:43PM

183
#29 - Paras Sud / @tsuyoihikari

08/07/2021 at 12:42AM

228
#30 - fufuror / @futachima

01/25/2023 at 05:25PM