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 9v00672c1db90000000005ba

Fix the git merge conflicts

Solve the merge conflicts in the Python file

Start file
<<<<<<< HEAD
def calculate_total(items):
    """Calculate total price of items with 10% discount"""
    total = sum(item['price'] for item in items)
    return total * 0.9  # Apply 10% discount
=======
def calculate_total(items):
    """Calculate total price of items with tax"""
    total = sum(item['price'] for item in items)
    return total * 1.15  # Apply 15% tax
>>>>>>> feature/add-tax

def format_currency(amount):
<<<<<<< HEAD
    """Format amount as USD"""
    return f"${amount:.2f}"
=======
    """Format amount as EUR"""
    return f"€{amount:.2f}"
>>>>>>> feature/currency-update

def process_order(items):
    total = calculate_total(items)
<<<<<<< HEAD
    return {
        'status': 'success',
        'total': format_currency(total),
        'items_count': len(items)
    }
=======
    shipping = 5.99 if total < 50 else 0
    return {
        'status': 'processed',
        'total': format_currency(total + shipping),
        'shipping': shipping
    }
>>>>>>> feature/shipping
End file
def calculate_total(items):
   
"""Calculate total price of items with tax"""
    total
= sum(item['price'] for item in items)
    total
= total * 0.9  # Apply 10% discount
   
return total * 1.15  # Apply 15% tax

def format_currency(amount):
   
"""Format amount as EUR"""
   
return f"€{amount:.2f}"

def process_order(items):
    total
= calculate_total(items)
    shipping
= 5.99 if total < 50 else 0
   
return {
       
'status': 'processed',
       
'total': format_currency(total + shipping),
       
'items_count': len(items),
       
'shipping': shipping
   
}

View Diff

1d0
< <<<<<<< HEAD
3,7d1
<     """Calculate total price of items with 10% discount"""
<     total = sum(item['price'] for item in items)
<     return total * 0.9  # Apply 10% discount
< =======
< def calculate_total(items):
9a4
>     total = total * 0.9  # Apply 10% discount
11d5
< >>>>>>> feature/add-tax
14,17d7
< <<<<<<< HEAD
<     """Format amount as USD"""
<     return f"${amount:.2f}"
< =======
20d9
< >>>>>>> feature/currency-update
24,30d12
< <<<<<<< HEAD
<     return {
<         'status': 'success',
<         'total': format_currency(total),
<         'items_count': len(items)
<     }
< =======
34a17
>         'items_count': len(items),
37d19
< >>>>>>> feature/shipping

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 41 remaining solutions by signing in and submitting your own entry
#42 Badita Marin-Georgian / @GeorgianBadita - Score: 765 - 11/19/24 @ 22:27
d6ji<Esc>ud5jkjjjjddjd:10<CR>ujddddddddkkjjjjddjjjddddddddddddddjjjjjjddjkkkkkkkkkkkkkOtotal = total )<BS>* 0.9 # Plly<BS><BS><BS><BS>Apply 10% dic<BS>scount<Esc>i<Esc>hhhhhhhhhhhhhhhhhhi<BS>  <Esc>;w<CR>Gfgg<Esc>ggdG<50-53>def calculate_total(items):<CR>    """Calculate total price of items with tax"""<CR>    total = sum(item['price'] for item in items)<CR>    total = total * 0.9  # Apply 10% discount<CR>    return total * 1.15  # Apply 15% tax<CR><CR>def format_currency(amount):<CR>    """Format amount as EUR"""<CR>    return f"<0xe2><0x82><0xac>{amount:.2f}"<CR><CR>def process_order(items):<CR>    total = calculate_total(items)<CR>    shipping = 5.99 if total < 50 else 0<CR>    return {<CR>        'status': 'processed',<CR>        'total': format_currency(total + shipping),<CR>        'items_count': len(items),<CR>        'shipping': shipping<CR>    }<Esc>[201~<Esc>;<Esc>l<Esc>;<Esc><Esc>;:w<CR>:q<CR>

0 comments


Created by: @pacuna

42 active golfers, 126 entries

Leaderboard (lowest score wins):
36
#1 - Danilo J. S. Bellini 🥊🇧🇷 / @danilobellini

11/11/2024 at 06:24PM

36
#2 - Peppa Pig / @PeppaPigSg

11/12/2024 at 12:48AM

36
#3 - John Braxler / @braxler

11/13/2024 at 03:15PM

37
#4 - rike09 / @rike09

11/11/2024 at 11:21PM

39
#5 - ldmnt / @ldmnt

01/02/2025 at 01:37AM

39
#6 - Herschel / @herschel-ma

01/05/2025 at 01:09PM

42
#7 - MartnRamtin / @MartnRamtin

12/30/2024 at 02:10PM

44
#8 - ProGamerYeet / @ProGamerYeet

11/09/2024 at 10:20PM

44
#9 - Oleksii Sanin / @AlexSanin

11/16/2024 at 03:58PM

44
#10 - ShookerAndBeta / @Shooker2012

11/21/2024 at 09:02AM

44
#11 - myu-innocence / @myu-innocence

12/21/2024 at 12:54PM

45
#12 - dejam2007 / @dejam2007

12/29/2024 at 02:14PM

51
#13 - iantalks / @iantalks

11/28/2024 at 04:46PM

53
#14 - Goonoo Kim / @goonookim

11/14/2024 at 06:33AM

53
#15 - Fredrik Robertsen / @fredrikr79

11/15/2024 at 02:43PM

55
#16 - Michael Cuffaro / @maiku1008

11/09/2024 at 08:09PM

55
#17 - Janusz Spatz / @janusz-anue

03/14/2025 at 09:44PM

57
#18 - thedvd98 / @thedvd98

11/09/2024 at 01:21PM

57
#19 - Fionn Fitzmaurice / @fionn

12/25/2024 at 03:09PM

57
#20 - Ben / @meyerben

01/14/2025 at 04:39AM

58
#21 - Pablo Acuna / @pacuna

11/07/2024 at 01:58AM

58
#22 - Nikita Dobrynin / @girvel

12/23/2024 at 09:15PM

59
#23 - Matthew Berthoud / @Matthew-Berthoud

01/07/2025 at 10:20AM

60
#24 - Nicolas Lunde / @nlund3

01/30/2025 at 11:49PM

60
#25 - Oliver Green / @olijg

03/14/2025 at 03:22PM

61
#26 - _3tHeR_ / @3ther-joyboy

11/18/2024 at 04:38PM

62
#27 - k1mosabe / @k1mosabe

12/02/2024 at 07:49PM

62
#28 - Biswajit / @biswajitpatra

12/12/2024 at 02:49PM

63
#29 - Kamal Aghayev / @agayev169

03/01/2025 at 07:41PM

63
#30 - Nathan Gilman / @npgilman

04/16/2025 at 01:27AM