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 57ab8b6f621d160fcd000001

C Reformatting

You may use Visual mode... or not. #uppercase

Start file
typedef enum {
   FORMAT_AUDIO_UNKNOWN = 0,
   FORMAT_AUDIO_VORBIS  = 1,
   FORMAT_AUDIO_PCM_U8  = 2,
   FORMAT_AUDIO_PCM_S16LE = 3,
   FORMAT_AUDIO_PCM_S24LE = 4,
   FORMAT_AUDIO_ADPCM_MS = 5, /*!< Microsoft ADPCM */
   FORMAT_AUDIO_AAC = 6,      /*!< Detected but not supported */
   FORMAT_AUDIO_OPUS = 7,     /*!< Xiph Opus */
   FORMAT_AUDIO_NONE = 0x10
} FMT_audio_type;
/* --- */
End file
FMT_AUDIO_TYPE(FORMAT_AUDIO_UNKNOWN, 0);
FMT_AUDIO_TYPE(FORMAT_AUDIO_VORBIS, 1);
FMT_AUDIO_TYPE(FORMAT_AUDIO_PCM_U8, 2);
FMT_AUDIO_TYPE(FORMAT_AUDIO_PCM_S16LE, 3);
FMT_AUDIO_TYPE(FORMAT_AUDIO_PCM_S24LE, 4);
FMT_AUDIO_TYPE(FORMAT_AUDIO_ADPCM_MS, 5);
FMT_AUDIO_TYPE(FORMAT_AUDIO_AAC, 6);
FMT_AUDIO_TYPE(FORMAT_AUDIO_OPUS, 7);
FMT_AUDIO_TYPE(FORMAT_AUDIO_NONE, 0x10);

View Diff

1,12c1,9
< typedef enum {
<    FORMAT_AUDIO_UNKNOWN = 0,
<    FORMAT_AUDIO_VORBIS  = 1,
<    FORMAT_AUDIO_PCM_U8  = 2,
<    FORMAT_AUDIO_PCM_S16LE = 3,
<    FORMAT_AUDIO_PCM_S24LE = 4,
<    FORMAT_AUDIO_ADPCM_MS = 5, /*!< Microsoft ADPCM */
<    FORMAT_AUDIO_AAC = 6,      /*!< Detected but not supported */
<    FORMAT_AUDIO_OPUS = 7,     /*!< Xiph Opus */
<    FORMAT_AUDIO_NONE = 0x10
< } FMT_audio_type;
< /* --- */
---
> FMT_AUDIO_TYPE(FORMAT_AUDIO_UNKNOWN, 0);
> FMT_AUDIO_TYPE(FORMAT_AUDIO_VORBIS, 1);
> FMT_AUDIO_TYPE(FORMAT_AUDIO_PCM_U8, 2);
> FMT_AUDIO_TYPE(FORMAT_AUDIO_PCM_S16LE, 3);
> FMT_AUDIO_TYPE(FORMAT_AUDIO_PCM_S24LE, 4);
> FMT_AUDIO_TYPE(FORMAT_AUDIO_ADPCM_MS, 5);
> FMT_AUDIO_TYPE(FORMAT_AUDIO_AAC, 6);
> FMT_AUDIO_TYPE(FORMAT_AUDIO_OPUS, 7);
> FMT_AUDIO_TYPE(FORMAT_AUDIO_NONE, 0x10);

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 96 remaining solutions by signing in and submitting your own entry
#97 ILikeVim / VimIsCool - Score: 64 - 09/07/16 @ 13:42
ddG..:%s/\v^\s+(\w+)\s+\=\s(.*\d).*$/FMT_AUDIO_TYPE(\1, \2);/<CR>ZZ

0 comments

#98 Chris / Gaunah_ - Score: 64 - 09/07/16 @ 15:35
ddGdk:%s#\s*\(\w\+\)\s*= \(\w\+\).*#FMT_AUDIO_TYPE(\1, \2);#g<CR>ZZ

0 comments

#99 Albert Mikó / berci1992 - Score: 65 - 08/25/16 @ 20:34
%gU$w"zyw:%s/^ */<C-R>z(<CR>dd.:%s/\/.*<CR>:%s/,.*/);/<CR>:%s/ *=/,<CR>A);<Esc>ggddZZ

0 comments

#100 Sahar Rachamim / SRachamim - Score: 66 - 09/21/16 @ 16:06
%gU$w"zyw:%s/^ */<C-R>z(<CR>dd.:%s/\/.*/<CR>:%s/,.*/);/<CR>:%s/ *=/,<CR>A);<Esc>ggddZZ

0 comments

#101 Samir Sadek / netsamir - Score: 67 - 08/13/16 @ 10:05
:v/O/d<CR>:%s/\v^\s+(\w+)\s+\=\s(.*\d).*$/FMT_AUDIO_TYPE(\1, \2);/g<CR>ZZ

0 comments

#102 Christian Guenter / chris_guenter - Score: 68 - 08/14/16 @ 18:11
dddGdd2xgUiw"adiwddA,<Esc>:%s/\s\+\(\S\+\)\s\+=\(.*\),.*/<C-R>a(<0xe4><BS>\1,\2);<CR>ZZ

0 comments

#103 Ryan Blais / reblais - Score: 68 - 10/14/16 @ 04:18
dd:%s/ *\(.\{-}\) \+= \([^, ]*\).*/FMT_AI<BS>UDIO_TYPE(\1, \2);/g<CR><Down>d<Down>ZZ

0 comments

#104 timerella® / timerella - Score: 69 - 11/16/16 @ 23:40
:%s/\v   (\w+).+\= ((\d|x)+).*$/FMT_AUDIO_TYPE(\1, \2);<CR>:1d|10,11d<CR>ZZ

0 comments

#105 Matt Walsh / wattmalsh - Score: 70 - 02/08/17 @ 00:50
dd/fmt<CR>viwU"ayiwVjd:%s/,.*$//g<CR>:%s/\s*=\s*/, /g<CR>:%norm d^"aPa(<C-V><Esc>A);<CR>ZZ

0 comments

#106 Atrament / Atrament - Score: 71 - 08/20/16 @ 16:43
dd:%s:\s*/\*.*\*/<CR>BveU"fdedGVH:norm0cw<C-R>f(<CR>:%s/,<CR>:%s/\s*=\(.*\)/,\1);<CR>ZZ

0 comments

#107 d1uckym d1uckym / d1uckym - Score: 72 - 08/14/16 @ 03:22
<GddqdIFMT_AUDIO_TYPE(<Esc>jq8@d2dd:%s/,.*$/);/g<CR>:%s/\s*=/,/g<CR>$a);<Esc>:w<CR>::<BS><BS>ZZ

0 comments

#108 TweetDreams / TweetMusicians - Score: 72 - 10/08/16 @ 11:06
dd10G2dd:%s/^   \(\w*\) *= \([0-9x]*\).*$/FMT_AUDIO_TYPE(\1, \2);/g<CR>:wq<CR>

0 comments

#109 marty / computerliker - Score: 73 - 05/05/17 @ 03:37
ddVG<Gdd2s$<BS><Esc>A<BS><Esc>0gUe:%s/,.*/);<CR>jA);<Esc>jbyekqqPa(<Esc>k0q8@qqqf df=i,<Esc>WWq8@qddZZ

0 comments

#110 Constantine / ConstantineHatz - Score: 74 - 09/12/16 @ 21:25
%gU$w"zyw%:%s/^ */<C-R>z(<CR>dd.:%s/\/.*<CR>:%s/,.*/)<CR>:%s/)/);/<CR>:%s/ *=/,<CR>A);<Esc>ggddZZ

0 comments

#111 Łukasz Daniluk / lukaszd93 - Score: 74 - 10/01/16 @ 14:44
:g:^[t}/]:d|%s:   \(\w*\) *= \(\(0x\)\?\x*\).*:FMT_AUDIO_TYPE(\1, \2);:<CR>ZZ

0 comments

#112 Walker Boh / walker_boh - Score: 82 - 08/11/16 @ 07:40
ddGdddWgUWdwVH<<C-Q>GI<C-R>"(<Esc>GddA,<Esc>:%s/\(.*\) ?<BS>*= \(.*\),.*/\%<BS>1, \"<BS>2);<CR>:%s/ ,/,/<CR>:<Up><CR>ZZ

0 comments

#113 Felipe Oliveira / felipecvo - Score: 86 - 08/17/16 @ 13:33
ddGdddwgUWdwVH<VG<C-V>I<C-R>"(<Esc>jGddA,<Esc>:%s/\s+=/,/<CR>:<Up><Left><Left><Left><Left><Left>\<CR>:%s/\s*\//<BS>.*//<CR>:%s/,%<BS>$//<BS>);/<CR>:wq<CR>

0 comments

#114 Putente / Putente_ - Score: 88 - 09/03/16 @ 21:43
:g!/^\s/d<CR>:s<BS>%s/^\s*/FMT_AUDIO_TYPE(/<CR>:%s/\s*=/,/<CR>u:S<BS>5s<BS><BS>%s/,.*$/,/<Left><BS><Right><CR>:<Up><Up><CR>:%s/$/);/<CR>ZZ

0 comments

#115 blizzow / blizzow - Score: 90 - 08/14/16 @ 06:20
ddGdkh<C-C><C-C><C-V>gg0x:%s/, .*/,/<CR>gg<C-C><C-C><C-V>GIFMT_AUDIO_TYPE(<Esc>:%s/ =/,/<CR>u:%s/ *=/,/<CR>:%s/,$/);/<CR>jA);<Esc>:wq<CR>

0 comments

#116 amospalla / amospalla - Score: 92 - 08/11/16 @ 15:30
ddGdkh<C-V>gg0x:%s/, .*/,/<CR>gg<C-V>GIFMT_AUDIO_TYPE(<Esc>:%s/ -<BS>=/,/<CR>u:%s/ (<BS>*=/,/<CR>:%s/,$/);/<CR>jA);<Esc>:w<CR>:q<CR>

0 comments

#117 PeterGC / petkusGC - Score: 93 - 08/12/16 @ 00:08
<GddIFMT_AUDIO_TYPE(<Esc>j.j.j.j.j.j.j.j.jdddd:%s/ = /, /<CR>A);<Esc>kF,c$);<Esc>k;.k;f,;.k.k.k.k.k.j,hxjxZZ

0 comments

#118 kodemaan / kodemaan - Score: 103 - 08/12/16 @ 19:37
ddGk2ddh<C-V>gg0x:%s/FO/FMT_AUDIO_TYPE(FO/g<CR>:%s/\s\+\/.\+\///g<CR>:5s<BS><BS>%s/\s\+=/,/g<CR>:5s<BS><BS>%s/,$/);/g<CR>j$a);<Esc>:<BS>ZZ

0 comments

#119 Jordan Wightman / tuo2 - Score: 107 - 08/13/16 @ 11:10
<Down><Up>ddGd<Up>A,<Esc>Vgg:s/,<BS>v<BS>\v<BS>v,.*$/);/g<CR>VGgg:s/\v\s+\=/,)g<CR>u:<Up><BS>/g<CR>u:<Up><Left><Left><BS><CR>VGgg:s/\v^.<BS>\s+/FMT_AUDIO/<BS>_TYPE(/g<CR>:wq<CR>

0 comments

#120 Michael Brailsford / brailsmt - Score: 143 - 08/11/16 @ 15:16
ddG.dw$xgU0gUw"addkf,Dk.k;.gg0qmPuqqm"apu"aPJr(w;hbhr,lxA<BS>);j<BS><Esc>j0q@m10@@8@@@@@@@@@@uuA);<Esc>ja.<BS>,<Esc>ja,<Esc>jA,<Esc>:7<CR>@@@@@@bhbbhxxa 0<Esc>:6<CR>f xr,:3<CR>f xk.:wq<CR>

0 comments

#121 Marc / Fusselgesicht - Score: 149 - 08/12/16 @ 09:40
ddqq<<i(<Esc>ea, <Esc>d2wi <Esc>A<BS>);<Esc>j<0xc2><0xb0>^q@q7@q@q7@q@q@q@q@q<Esc>kkkkldt)<Esc>jhhhhhdt)jl.jll0i<Esc>t)li0<Esc>jhhhhhhhhhhhhhhdwkqq^puP<Esc>0vwUywqywkPk^Pqqk^P<Esc>q@q@q@q@q@@<Esc>9j2dj<Esc>:wq<CR>

0 comments

Created by: mcr05

121 active golfers, 444 entries

Leaderboard (lowest score wins):
30
#1 - Antony Scriven / antonyscriven

02/01/2017 at 06:03PM

30
#2 - Saki Gw / Sakigw

02/01/2017 at 09:01PM

30
#3 - Petro Тrouq / zulolosi

03/14/2017 at 07:56AM

30
#4 - Alexander Bessonov / nonsleepr

03/14/2017 at 11:48PM

30
#5 - Ilya Shakirov / aelaau

03/20/2017 at 03:02PM

30
#6 - Andreas Anderbach / anderbacha

03/21/2017 at 12:49PM

30
#7 - 梧桐王子 / WutongYujie

04/26/2017 at 04:57AM

30
#8 - Remus Dalrymple / bornintheflames

05/05/2017 at 12:31AM

30
#9 - Urtica dioica / udioica

06/08/2017 at 11:26PM

32
#10 - Smylers / Smylers2

08/12/2016 at 04:41AM

32
#11 - Andrew Smith / amazing_andrew

08/14/2016 at 12:59AM

32
#12 - John Braxler / braxler

08/16/2016 at 04:49PM

32
#13 - Richard O'Brien / richard0b

08/18/2016 at 03:42AM

32
#14 - Ivan De Dios / IvantheDugtrio

08/22/2016 at 05:04AM

32
#15 - hyhit / hyhit2

08/22/2016 at 08:59AM

32
#16 - jaresty / jaresty

08/22/2016 at 03:19PM

32
#17 - Aaron Fresh / AaronFresh7

08/27/2016 at 12:22PM

32
#18 - Stephen Aument / saument

08/30/2016 at 06:29PM

32
#19 - Karol Łukaszewicz / Karolukaszewicz

09/01/2016 at 09:24PM

32
#20 - jdupont655 / jdupont655

09/01/2016 at 11:01PM

32
#21 - ymmtmdk / ymmtmdk

09/04/2016 at 08:52AM

32
#22 - loki2441 / loki2441

09/05/2016 at 09:40AM

32
#23 - Peter / sunirbmag

09/05/2016 at 08:45PM

32
#24 - hor1ace / hor3ace

09/07/2016 at 01:29PM

32
#25 - Diton / aardito21

09/26/2016 at 12:41AM

32
#26 - manbogot / gmanbor

10/02/2016 at 08:11AM

32
#27 - trx / trxdbg

10/11/2016 at 12:31AM

32
#28 - Bill Ruddock / biinari

10/31/2016 at 01:51AM

32
#29 - i1464083 / i1464083

11/18/2016 at 01:32PM

32
#30 - Kevin Ash / ashkevinm

04/12/2017 at 07:47PM

33
#31 - Jon Krause / jkrause314

08/11/2016 at 04:29PM

33
#32 - Pedro Santos / pedrosans

08/12/2016 at 04:09AM

33
#33 - Marcin Radomski / _dextero

08/12/2016 at 08:12AM

33
#34 - 박 재 성 / javajigi

09/24/2016 at 02:24AM

33
#35 - Zhihong Liu / pieapple03

02/11/2017 at 12:11PM

33
#36 - Daniel / Daniel00288663

03/17/2017 at 12:49PM

35
#37 - Matthieu Crapet / mcr05

08/14/2016 at 08:15AM

35
#38 - Jeremiah Goyette / JeremiahGoyette

08/20/2016 at 04:56AM

38
#39 - Marcel Akkerman / MarcelAkkerman

12/21/2016 at 07:13PM

39
#40 - Lifepillar / lifepillar

08/17/2016 at 04:36PM

41
#41 - Cristian Lupașcu / clupasq

08/11/2016 at 07:00AM

41
#42 - Krzysztof Borkowski / smiechowy

09/02/2016 at 10:27PM

41
#43 - Sarin Durong / Sarin4Du

12/12/2016 at 01:39AM

41
#44 - kkh / kkhdlut

06/15/2017 at 04:24PM

42
#45 - Foo Bar / foobar01123

08/16/2016 at 09:31AM

43
#46 - Rosalie Tolentino / rosatolen

08/14/2016 at 11:49PM

43
#47 - jn / j1357924

08/23/2016 at 07:44PM

43
#48 - Raymond Chang / raymond743209

04/27/2017 at 07:34AM

44
#49 - Sarang Khim / sarang_khim

08/12/2016 at 06:06AM

44
#50 - ♜ José Doval / pepellou

08/29/2016 at 10:50PM

44
#51 - ✘A / Lolicon_H

09/18/2016 at 04:08AM

44
#52 - Christophe Perrotin / ChrisPerSurTwit

09/24/2016 at 10:29PM

44
#53 - Social Botolinum / SocialBot4

01/25/2017 at 01:15PM

48
#54 - oscar / zonza_mas

09/09/2016 at 02:01PM

49
#55 - exp977 / exp977

08/12/2016 at 02:03PM

49
#56 - Alexandre Jasmin / ajasmin

02/19/2017 at 04:41PM

50
#57 - f00b8tr / f00b8tr5

08/20/2016 at 05:40AM

50
#58 - Carl Egbert / CarlOEgbert

06/11/2017 at 08:36PM

51
#59 - some call me mattp / mattpep

08/11/2016 at 11:39AM

51
#60 - antoine biard / biard_antoine

08/29/2016 at 03:19PM

51
#61 - Utkrisht Dhankar / UtkrishtDhankar

09/07/2016 at 03:02PM

51
#62 - Josef S / fofefs

09/15/2016 at 12:24PM

51
#63 - Christian Rondeau / c_rondeau

10/16/2016 at 04:05AM

51
#64 - Chris Cummings / mistahcummings

10/31/2016 at 02:27AM

51
#65 - Marin Usalj / _supermarin

11/10/2016 at 12:23AM

51
#66 - Hannu Lounento / hlounent

12/19/2016 at 07:12PM

53
#67 - Daniele Oriani / DanieleOriani

09/02/2016 at 08:18PM

53
#68 - Mark Dawson / MarkMarkgdawson

10/24/2016 at 09:39PM

53
#69 - extrintr / extrintr

01/31/2017 at 11:49PM

54
#70 - Paul Roe / ep_roe

08/24/2016 at 07:58AM

54
#71 - nixi3 / Nixi3cc

09/05/2016 at 04:20AM

55
#72 - Louis Caruana / louiecaruana

08/11/2016 at 04:49AM

56
#73 - jj johnson / jcassj1

08/22/2016 at 12:28PM

56
#74 - Cormac Relf / cormacrelf

09/01/2016 at 01:58PM

56
#75 - James Pringle / jameskpringle

03/20/2017 at 07:05PM

56
#76 - Jerry Wu / AzureSpectra

05/05/2017 at 06:11PM

57
#77 - Eric Nielsen / ericbn8

08/14/2016 at 04:17AM

57
#78 - Martin Bielik / MrMadox2

08/16/2016 at 09:51PM

57
#79 - Ashish Narasimham / asheeshkabob

08/30/2016 at 04:15PM

58
#80 - Jan Liu / MaglevGankTrain

08/11/2016 at 12:28PM

58
#81 - Etienne Florent / EtienneFlorent

11/22/2016 at 10:24AM

59
#82 - Antoni Villalonga / friki

08/16/2016 at 11:14AM

59
#83 - Premium Ben / muppling

08/19/2016 at 08:14AM

60
#84 - Herbert S. / herbertshlong

08/12/2016 at 10:36PM

60
#85 - Noud Speijcken / noudspeijcken

08/18/2016 at 07:59PM

60
#86 - Nico Jansen / nicojansen1804

01/03/2017 at 06:47PM

60
#87 - Tommaso Leonardi / tom_leon

05/11/2017 at 02:46PM

61
#88 - Olaf Ole Olafsson / OlafOleOlafsson

08/12/2016 at 08:53PM

61
#89 - Hans Yelek / hans_yelek

01/09/2017 at 11:56PM

61
#90 - Adam Kożuch / adamkozuch

06/12/2017 at 12:52AM

62
#91 - AODQ / AODQIG

08/20/2016 at 12:19AM

63
#92 - Maxime Reis / MaximeReis

08/13/2016 at 06:17AM

63
#93 - Andy Balaam / andybalaam

08/16/2016 at 01:56PM

63
#94 - u03c6 / u03c6

08/18/2016 at 09:23PM

63
#95 - 張育瑄 / harry830622

11/24/2016 at 10:30AM

64
#96 - Guillem Blanco / BlancoGuillem

08/24/2016 at 10:27PM

64
#97 - ILikeVim / VimIsCool

09/07/2016 at 01:42PM

64
#98 - Chris / Gaunah_

09/07/2016 at 03:35PM

65
#99 - Albert Mikó / berci1992

08/25/2016 at 08:34PM

66
#100 - Sahar Rachamim / SRachamim

09/21/2016 at 04:06PM

67
#101 - Samir Sadek / netsamir

08/13/2016 at 10:05AM

68
#102 - Christian Guenter / chris_guenter

08/14/2016 at 06:11PM

68
#103 - Ryan Blais / reblais

10/14/2016 at 04:18AM

69
#104 - timerella® / timerella

11/16/2016 at 11:40PM

70
#105 - Matt Walsh / wattmalsh

02/08/2017 at 12:50AM

71
#106 - Atrament / Atrament

08/20/2016 at 04:43PM

72
#107 - d1uckym d1uckym / d1uckym

08/14/2016 at 03:22AM

72
#108 - TweetDreams / TweetMusicians

10/08/2016 at 11:06AM

73
#109 - marty / computerliker

05/05/2017 at 03:37AM

74
#110 - Constantine / ConstantineHatz

09/12/2016 at 09:25PM

74
#111 - Łukasz Daniluk / lukaszd93

10/01/2016 at 02:44PM

82
#112 - Walker Boh / walker_boh

08/11/2016 at 07:40AM

86
#113 - Felipe Oliveira / felipecvo

08/17/2016 at 01:33PM

88
#114 - Putente / Putente_

09/03/2016 at 09:43PM

90
#115 - blizzow / blizzow

08/14/2016 at 06:20AM

92
#116 - amospalla / amospalla

08/11/2016 at 03:30PM

93
#117 - PeterGC / petkusGC

08/12/2016 at 12:08AM

103
#118 - kodemaan / kodemaan

08/12/2016 at 07:37PM

107
#119 - Jordan Wightman / tuo2

08/13/2016 at 11:10AM

143
#120 - Michael Brailsford / brailsmt

08/11/2016 at 03:16PM

149
#121 - Marc / Fusselgesicht

08/12/2016 at 09:40AM