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):
47
#61 - Ben Hill / KaizenSoze70

10/19/2017 at 05:25PM

48
#62 - oscar / zonza_mas

09/09/2016 at 02:01PM

49
#63 - exp977 / exp977

08/12/2016 at 02:03PM

49
#64 - Alexandre Jasmin / ajasmin

02/19/2017 at 04:41PM

50
#65 - f00b8tr / f00b8tr5

08/20/2016 at 05:40AM

50
#66 - Carl Egbert / CarlOEgbert

06/11/2017 at 08:36PM

51
#67 - some call me mattp / mattpep

08/11/2016 at 11:39AM

51
#68 - antoine biard / biard_antoine

08/29/2016 at 03:19PM

51
#69 - Utkrisht Dhankar / UtkrishtDhankar

09/07/2016 at 03:02PM

51
#70 - Josef S / fofefs

09/15/2016 at 12:24PM

51
#71 - Christian Rondeau / c_rondeau

10/16/2016 at 04:05AM

51
#72 - Chris Cummings / mistahcummings

10/31/2016 at 02:27AM

51
#73 - Marin Usalj / _supermarin

11/10/2016 at 12:23AM

51
#74 - Hannu Lounento / hlounent

12/19/2016 at 07:12PM

53
#75 - Daniele Oriani / DanieleOriani

09/02/2016 at 08:18PM

53
#76 - Mark Dawson / drmarkdawson

10/24/2016 at 09:39PM

53
#77 - extrintr / extrintr

01/31/2017 at 11:49PM

53
#78 - Simon Ticks / SimonTicks

06/10/2018 at 02:35PM

54
#79 - Paul Roe / ep_roe

08/24/2016 at 07:58AM

54
#80 - nixi3 / Nixi3cc

09/05/2016 at 04:20AM

55
#81 - Louis Caruana / louiecaruana

08/11/2016 at 04:49AM

56
#82 - jj johnson / jcassj1

08/22/2016 at 12:28PM

56
#83 - Cormac Relf / cormacrelf

09/01/2016 at 01:58PM

56
#84 - James Pringle / jameskpringle

03/20/2017 at 07:05PM

56
#85 - Jerry Wu / AzureSpectra

05/05/2017 at 06:11PM

56
#86 - Luke Lee / luke0201

05/06/2018 at 08:54AM

57
#87 - Eric Nielsen / ericbn8

08/14/2016 at 04:17AM

57
#88 - Martin Bielik / MrMadox2

08/16/2016 at 09:51PM

57
#89 - Ashish Narasimham / asheeshkabob

08/30/2016 at 04:15PM

58
#90 - Jan Liu / MaglevGankTrain

08/11/2016 at 12:28PM