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


Created by: @pykJzzzsmAzloZl

36 active golfers, 135 entries

Leaderboard (lowest score wins):
131
#31 - Kapildev Neupane / @KapildevNeupane

01/01/2021 at 12:40PM

137
#32 - Scott Atkins / @scottrick49

05/28/2021 at 04:50PM

144
#33 - Bharath / @Bharath15952517

05/09/2021 at 06:57AM

151
#34 - noam teyssier / @noamteyssier

06/26/2021 at 08:03PM

158
#35 - Jan Klatka / @KlatkaJan

05/27/2021 at 01:48PM

163
#36 - dvorak4tzx / @dvorak4tzx4

12/28/2020 at 05:08PM