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):
58
#91 - Etienne Florent / EtienneFlorent

11/22/2016 at 10:24AM

58
#92 - Anne Pacalet / _Anne_P

07/10/2017 at 01:03PM

59
#93 - Antoni Villalonga / friki

08/16/2016 at 11:14AM

59
#94 - Tact Overflow / muppling

08/19/2016 at 08:14AM

60
#95 - Herbert S. / herbertshlong

08/12/2016 at 10:36PM

60
#96 - Noud Speijcken / noudspeijcken

08/18/2016 at 07:59PM

60
#97 - Nico Jansen / nicojansen1804

01/03/2017 at 06:47PM

60
#98 - Tommaso Leonardi / tom_leon

05/11/2017 at 02:46PM

61
#99 - Olaf Ole Olafsson / OlafOleOlafsson

08/12/2016 at 08:53PM

61
#100 - Hans Yelek / hans_yelek

01/09/2017 at 11:56PM

61
#101 - Adam Kożuch / adamkozuch

06/12/2017 at 12:52AM

62
#102 - AODQ / AODQIG

08/20/2016 at 12:19AM

63
#103 - Maxime Reis / MaximeReis

08/13/2016 at 06:17AM

63
#104 - Andy Balaam / andybalaam

08/16/2016 at 01:56PM

63
#105 - u03c6 / u03c6

08/18/2016 at 09:23PM

63
#106 - 張育瑄 / harry830622

11/24/2016 at 10:30AM

64
#107 - Guillem Blanco / BlancoGuillem

08/24/2016 at 10:27PM

64
#108 - ILikeVim / VimIsCool

09/07/2016 at 01:42PM

64
#109 - Chris / Gaunah_

09/07/2016 at 03:35PM

65
#110 - Albert Mikó / berci1992

08/25/2016 at 08:34PM

66
#111 - Sahar Rachamim / SRachamim

09/21/2016 at 04:06PM

66
#112 - Thomas Barusseau / ThomasBarusseau

12/15/2017 at 03:28PM

67
#113 - Samir Sadek / netsamir

08/13/2016 at 10:05AM

68
#114 - Christian Guenter / chris_guenter

08/14/2016 at 06:11PM

68
#115 - Ryan Blais / reblais

10/14/2016 at 04:18AM

69
#116 - timerella® / timerella

11/16/2016 at 11:40PM

70
#117 - Matt Walsh / wattmalsh

02/08/2017 at 12:50AM

71
#118 - Atrament / Atrament

08/20/2016 at 04:43PM

72
#119 - d1uckym d1uckym / d1uckym

08/14/2016 at 03:22AM

72
#120 - TweetDreams / TweetMusicians

10/08/2016 at 11:06AM