Vim - Background Server
If your Vim has +ruby support, you can syntax highlight the current file and serve it over rack relatively simply.
Create a file with the following contents, then run :ruby load "filename.rb" inside Vim.
You can then visit localhost:1234 in your browser.
require "rack"
require "rack/source"
app = Rack::Source.new(__FILE__, lexer: :ruby)
child = fork do
Rack::Handler::WEBrick.run(
app,
AccessLog: [],
Logger: WEBrick::Log::new("/dev/null", 7),
Port: 1234
)
end
Process.detach(child)
Written by Chris Patuzzo
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#