Skip to content

Instantly share code, notes, and snippets.

@robbiev
Last active July 26, 2021 14:55
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save robbiev/85a8e07e447cf692f2196a44d60de73a to your computer and use it in GitHub Desktop.
Save robbiev/85a8e07e447cf692f2196a44d60de73a to your computer and use it in GitHub Desktop.
vim keybindings for the Go Playground at https://play.golang.org

Wasavi is some sort of vim implementation for browser text fields.

Once installed go to https://play.golang.org, you can use INSERT or CTRL+ENTER to enter the vim mode. To quit use the usual vim commands.

Tips:

  • The default keybinding to enter vim mode, CTRL+ENTER, conflicts with the standard playground shortcuts (CTRL+ENTER to format, SHIFT+ENTER to run). I recommend configuring wasavi to not enter vim mode on CTRL+ENTER (just use INSERT or configure something else)
  • Once you remapped CTRL+ENTER, you can have the following workflow:
    1. Enter vim mode (INSERT)
    2. Make changes, :wq
    3. Run or auto-format using the playground's default SHIFT+ENTER or CTRL+ENTER shortcuts
    4. Re-enter vim mode (INSERT)

Recording macros even seems to work. The most annoying thing so far has been that dots are seen as part of words and I'm not used to that, if anyone finds a way to fix that let me know.

Obviously wasavi works on other web pages as well.

For more Go banter see my blog https://garbagecollected.org/ or follow me on Twitter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment