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

46 active golfers, 139 entries

Leaderboard (lowest score wins):
62
#31 - Biswajit / @biswajitpatra

12/12/2024 at 02:49PM

63
#32 - Kamal Aghayev / @agayev169

03/01/2025 at 07:41PM

63
#33 - Nathan Gilman / @npgilman

04/16/2025 at 01:27AM

67
#34 - Tzadiko / @Tzadiko

12/15/2024 at 11:25PM

67
#35 - lovebigwei / @lovebigwei

12/26/2024 at 07:25AM

68
#36 - editor3D / @editor3D

11/15/2024 at 11:08PM

69
#37 - Diwakar Singh Parmar / @parmardiwakar150

12/26/2024 at 01:59PM

74
#38 - jresnick3 / @jresnick3

04/01/2025 at 08:55AM

76
#39 - Ryo3110 / @r-3110

03/08/2025 at 11:43AM

79
#40 - cr100 / @rekicc

11/09/2024 at 09:51AM

84
#41 - Buliway / @Buliway

11/30/2024 at 09:24PM

85
#42 - Theau Poulat / @theaupoulat

04/03/2025 at 08:13PM

101
#43 - Guillaume Seren / @guillaumeseren

12/09/2024 at 01:38PM

107
#44 - Oli / @olileung

03/14/2025 at 12:03PM

140
#45 - Kevin Gandolfi / @kevinGandolfi

04/26/2025 at 09:17PM

765
#46 - Badita Marin-Georgian / @GeorgianBadita

11/19/2024 at 10:27PM