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 107 remaining solutions by signing in and submitting your own entry
#108 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


#109 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


#110 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


#111 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


#112 Thomas Barusseau / ThomasBarusseau - Score: 66 - 12/15/17 @ 15:28
ddG..:%s/\v^\s+(\w+_<BS>)\s+\=\s(.*\d).*$/FMT_AUDIO_TYPE(\1, \2);/<CR>ZZ

0 comments


#113 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


#114 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


#115 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


#116 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


#117 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


#118 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


#119 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


#120 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


#121 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


#122 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


#123 Ł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


#124 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


#125 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


#126 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


#127 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


#128 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


#129 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


#130 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


#131 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


#132 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


#133 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


#134 Paul Inc / hiniol1982 - Score: 156 - 07/13/17 @ 19:31
ddGdk<C-V>gghhhhhhhhhhhIFMT_AUDIO_TYPE(<Esc>f <C-V>lljjjjjjjjd: = <CR>:/<Up>.= /<BS><CR>:%s//, <CR>00ggf,;R);<Esc>j;.j.jl.j/<Esc>.jhhDA);<Esc>jF,lD;lll.A);k<BS><Esc>jDA0<BS>);<Esc>jA0;<BS><BS>);<Esc>kkkkkkkkhhhhkjhxjxZZ

0 comments


Created by: mcr05

134 active golfers, 515 entries

Leaderboard (lowest score wins):
32
#31 - manbogot / gmanbor

10/02/2016 at 08:11AM

32
#32 - trx / trxdbg

10/11/2016 at 12:31AM

32
#33 - Bill Ruddock / biinari

10/31/2016 at 01:51AM

32
#34 - i1464083 / i1464083

11/18/2016 at 01:32PM

32
#35 - Kevin Ash / ashkevinm

04/12/2017 at 07:47PM

32
#36 - harpocrates744 / harpocrates744

09/05/2017 at 10:07PM

33
#37 - Jon Krause / jkrause314

08/11/2016 at 04:29PM

33
#38 - Pedro Santos / pedrosans

08/12/2016 at 04:09AM

33
#39 - Marcin Radomski / _dextero

08/12/2016 at 08:12AM

33
#40 - 박 재 성 / javajigi

09/24/2016 at 02:24AM

33
#41 - Zhihong Liu / pieapple03

02/11/2017 at 12:11PM

33
#42 - Daniel / Daniel00288663

03/17/2017 at 12:49PM

35
#43 - Matthieu Crapet / mcr05

08/14/2016 at 08:15AM

35
#44 - Jeremiah Goyette / JeremiahGoyette

08/20/2016 at 04:56AM

38
#45 - Marcel Akkerman / MarcelAkkerman

12/21/2016 at 07:13PM

39
#46 - Lifepillar / lifepillar

08/17/2016 at 04:36PM

41
#47 - Cristian Lupașcu / clupasq

08/11/2016 at 07:00AM

41
#48 - Krzysztof Borkowski / smiechowy

09/02/2016 at 10:27PM

41
#49 - Sarin Durong / Sarin4Du

12/12/2016 at 01:39AM

41
#50 - kkh / kkhdlut

06/15/2017 at 04:24PM

42
#51 - Foo Bar / foobar01123

08/16/2016 at 09:31AM

43
#52 - Rosalie Tolentino / rosatolen

08/14/2016 at 11:49PM

43
#53 - jn / j1357924

08/23/2016 at 07:44PM

43
#54 - Raymond Chang / raymond743209

04/27/2017 at 07:34AM

44
#55 - Sarang Khim / sarang_khim

08/12/2016 at 06:06AM

44
#56 - ♜ Pepe Doval / pepellou

08/29/2016 at 10:50PM

44
#57 - ✘A / Lolicon_H

09/18/2016 at 04:08AM

44
#58 - Christophe Perrotin / ChrisPerSurTwit

09/24/2016 at 10:29PM

44
#59 - Social Botolinum / SocialBot4

01/25/2017 at 01:15PM

46
#60 - Gurukandhamoorthi / Gurukandhamoor1

07/10/2017 at 02:04PM