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 5fe050e596c8f7000cda4ddc

RUST match with enum for Coin

RUST match with enum for Coin rusty practice on vimgolf

Start file
enum Coin {
	Penny,
	Nickel,
	Dime,
	Quarter,
}
End file
enum Coin {
	Penny,
	Nickel,
	Dime,
	Quarter,
}

fn value_in_cents(coin: Coin) -> u32 {
	match coin {
		Coin::Penny => 1,
		Coin::Nickel => 5,
		Coin::Dime => 10,
		Coin::Quarter => 25,
	}
}

View Diff

6a7,15
> 
> fn value_in_cents(coin: Coin) -> u32 {
> 	match coin {
> 		Coin::Penny => 1,
> 		Coin::Nickel => 5,
> 		Coin::Dime => 10,
> 		Coin::Quarter => 25,
> 	}
> }

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 40 remaining solutions by signing in and submitting your own entry
#41 dvorak4tzx / @dvorak4tzx4 - Score: 163 - 12/28/20 @ 17:08
j4yyGo<CR>fn value_in_cents(coin: Coin) -> u32 {<CR><C-C><C-C>pkdd<C-V>jjjICoin::<Esc>ko<Tab>match coin {<CR><C-C><C-C>ddqa<S-Tab><Tab><C-C><C-C>i<Tab><C-C><C-C>$i => 1,<BS><C-C><C-C>jq@a>>A<C-C><C-C>i => 5<C-C><C-C>j>>$i => 10<C-C><C-C>j>>$i => 25<C-C><C-C>o}<C-C><C-C><<yyp<<:wq<CR>

0 comments


#42 梅 / @umetosawara - Score: 163 - 04/12/22 @ 13:05
:%s/\t/\tCoin::/g<CR>:%s/,/ => ,/g<CR>ggv<Up><Down><Down><Down><Down><Down>yGuuGo<CR><Esc>p4ximatch<Up><CR>fn value_in_cents(coin; <BS><BS>: Coin) -> u32 {<Esc>GO}<Esc><C-V><Up><Up><Up>ljkkkjjkk><Esc>3wlkjj3wwwjkbi1<Down>5<Down><Left>10<Down><Right>25<Up><Up><Up><Up><Up><Down><Left><Left><Left><Left><Left><BS>c<Esc>ZZ

0 comments


Created by: @pykJzzzsmAzloZl

42 active golfers, 147 entries

Leaderboard (lowest score wins):
118
#31 - 'ymdarake / @ymdarake

09/04/2022 at 10:26AM

124
#32 - 盧小小 / @VegetaLu

04/02/2022 at 09:55AM

127
#33 - maxtong / @maxtong1987

03/19/2021 at 10:38AM

130
#34 - Sebastien Spoon / @SebastienSpoon

12/28/2020 at 07:47AM

131
#35 - Kapildev Neupane / @KapildevNeupane

01/01/2021 at 12:40PM

137
#36 - Scott Atkins / @scottrick49

05/28/2021 at 04:50PM

137
#37 - h / @tgen22334

03/17/2022 at 05:08AM

144
#38 - Bharath / @Bharath15952517

05/09/2021 at 06:57AM

151
#39 - noam teyssier / @noamteyssier

06/26/2021 at 08:03PM

158
#40 - Jan Klatka / @KlatkaJan

05/27/2021 at 01:48PM

163
#41 - dvorak4tzx / @dvorak4tzx4

12/28/2020 at 05:08PM

163
#42 - 梅 / @umetosawara

04/12/2022 at 01:05PM