go-playground
go-playground copied to clipboard
Vim keybind `:w[rite]` as a shortcut to run the code
Thanks for this playground, Vim mode was the killer feature I have been looking for that sets this playground well above any other I have used!
On macOS, I can easily enough use ⌘+⏎ as a shortcut to run the code on the playground, which is nice. I have muscle memory for :w (:write) in Vim's normal mode to save a file, so it would be nice if this was also a shortcut for the same action.
As it stands, it seems the :w command is recognized somehow. I don't see an error like the following:
However, it doesn't appear to actually do anything (format / submit). Would you consider a change to map :w as a shortcut meaning the same as cmd+enter?
Hello @ian-h-chamberlain and thank you for the feedback.
The ⌘+⏎ shortcut and VIM commands are implemented in different way.
A quick run shortcut is actually a monaco editor action.
The vim mode is actually a hacky adapter that listens for commands on top of monaco.
This implementation is actually a port of other vim-emulation library and command handler is implemented inside that library.
But I'll try to look into that.
Thanks for the quick response! From their README, it looks like you might just be able to bind an ex mode command to wire up the submit action, as long as the :<cmd><Enter> keypresses still end up propagating to the VimMode handler? Thanks for looking into it!
@ian-h-chamberlain thank you for the research :)
Will be shipped in a next release.