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

Change double quotes to single quotes, but with a twist

Although this challenge is in the context of a Python function, you don't need to know Python to do this challenge. It is to add contexts and interesting constraints. The file contains a function that prints a multi-line string literal. I wrote the string literal with double quotes, but then I decided to use single quotes instead, and that's your challenge. However, interestingly enough, the string itself contains single and double quotes. This means, inside the string literal, the originally escaped double quotes no longer need to be escaped, but the single quotes now need to be escaped. Note that the triple double quotes in the docstring should be left alone.

Start file
def some_python_function():
    """
    This is a Python docstring. It describes what a function does.
    The triple quotes above and below me do not need to be changed.
    """

    print(
        "The Gryphon added, \"Come, let's hear some of YOUR adventures.\" "
        "\"I could tell you my adventures - beginning from this morning,\" "
        "said Alice a little timidly: \"but it's no use going back to yesterday, "
        "because I was a different person then.\""
    )
End file
def some_python_function():
    """
    This is a Python docstring. It describes what a function does.
    The triple quotes above and below me do not need to be changed.
    """

    print(
        'The Gryphon added, "Come, let\'s hear some of YOUR adventures." '
        '"I could tell you my adventures - beginning from this morning," '
        'said Alice a little timidly: "but it\'s no use going back to yesterday, '
        'because I was a different person then."'
    )

View Diff

8,11c8,11
<         "The Gryphon added, \"Come, let's hear some of YOUR adventures.\" "
<         "\"I could tell you my adventures - beginning from this morning,\" "
<         "said Alice a little timidly: \"but it's no use going back to yesterday, "
<         "because I was a different person then.\""
---
>         'The Gryphon added, "Come, let\'s hear some of YOUR adventures." '
>         '"I could tell you my adventures - beginning from this morning," '
>         'said Alice a little timidly: "but it\'s no use going back to yesterday, '
>         'because I was a different person then."'

Solutions by @GavinKoeng:

Unlock 19 remaining solutions by signing in and submitting your own entry
Created by: @skylerdong

59 active golfers, 338 entries

Solutions by @GavinKoeng:
22
#25 - Gavin / @GavinKoeng

01/15/2026 at 12:47AM

23
#>28 - Gavin / @GavinKoeng

01/15/2026 at 12:47AM

24
#>30 - Gavin / @GavinKoeng

01/15/2026 at 12:46AM

25
#>32 - Gavin / @GavinKoeng

01/15/2026 at 12:46AM

26
#>33 - Gavin / @GavinKoeng

01/15/2026 at 12:44AM

27
#>35 - Gavin / @GavinKoeng

01/15/2026 at 12:43AM

32
#>36 - Gavin / @GavinKoeng

01/15/2026 at 12:42AM

34
#>37 - Gavin / @GavinKoeng

01/15/2026 at 12:41AM

35
#>39 - Gavin / @GavinKoeng

01/15/2026 at 12:40AM

37
#>42 - Gavin / @GavinKoeng

01/15/2026 at 12:40AM

38
#>48 - Gavin / @GavinKoeng

01/15/2026 at 12:40AM

40
#>49 - Gavin / @GavinKoeng

01/15/2026 at 12:38AM

41
#>50 - Gavin / @GavinKoeng

01/15/2026 at 12:38AM

43
#>50 - Gavin / @GavinKoeng

01/15/2026 at 12:37AM

44
#>53 - Gavin / @GavinKoeng

01/15/2026 at 12:36AM

46
#>55 - Gavin / @GavinKoeng

01/15/2026 at 12:36AM

48
#>57 - Gavin / @GavinKoeng

01/15/2026 at 12:33AM

52
#>57 - Gavin / @GavinKoeng

01/15/2026 at 12:32AM

63
#>59 - Gavin / @GavinKoeng

01/15/2026 at 12:31AM