Skip to content

Instantly share code, notes, and snippets.

@sorah sorah/vim.cgi forked from thinca/vim.cgi
Created Dec 2, 2009

Embed
What would you like to do?
#!/usr/bin/env ruby
"
execute 'help' getline(1)
.,/\*\S\+\*$/?\S?print
qa!
"
require 'rubygems'
require 'json'
require 'cgi'
TEMP = './temp'
cgi = CGI.new
json = JSON.parse(cgi["json"])
print cgi.header('text/plain')
text = json['events'][0]['message']['text']
if text =~ /^:h(e(lp?)?)?\s+(.+)/
open(TEMP, 'w'){|f| f.write($2)}
print `vim -Z -u NONE -N -e -s #{TEMP} < #{__FILE__}`
File.delete(TEMP)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.