2013-08-08

Golang playground in Vim

I noticed I use the Go language playground quite a lot to try out the packages on different use cases but going back and forth between the snipped and vim was painful (vim muscle memory, copy paste etc ... this is annoying).
I found a vim plugin that actually call the page directly from a vim buffer.

Installation

I assume here you have pathogen already installed.
note: webapi-vim is a dependency
# cd ~/.vim/bundle
# git clone https://github.com/mattn/webapi-vim.git
# git clone https://github.com/mattn/goplayground-vim.git

Usage

The plugin is associated with the .go files so you need to open one (you actually don't need to save it)
# vim test.go
Type your snippet and [ESC]:Playground
... and boom ! Thanks mattn for the plugin !