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):
73
#121 - marty / computerliker

05/05/2017 at 03:37AM

74
#122 - Constantine / ConstantineHatz

09/12/2016 at 09:25PM

74
#123 - Łukasz Daniluk / lukaszd93

10/01/2016 at 02:44PM

82
#124 - Walker Boh / walker_boh

08/11/2016 at 07:40AM

86
#125 - Felipe Oliveira / felipecvo

08/17/2016 at 01:33PM

88
#126 - Putente / Putente_

09/03/2016 at 09:43PM

90
#127 - blizzow / blizzow

08/14/2016 at 06:20AM

92
#128 - amospalla / amospalla

08/11/2016 at 03:30PM

93
#129 - PeterGC / petkusGC

08/12/2016 at 12:08AM

103
#130 - kodemaan / kodemaan

08/12/2016 at 07:37PM

107
#131 - Jordan Wightman / tuo2

08/13/2016 at 11:10AM

143
#132 - Michael Brailsford / brailsmt

08/11/2016 at 03:16PM

149
#133 - Marc / Fusselgesicht

08/12/2016 at 09:40AM

156
#134 - Paul Inc / hiniol1982

07/13/2017 at 07:31PM