# File lib/plugins/history.rb, line 35
  def self.save_history
    filename = File.expand_path(config.plugins.history.filename)
    keys = config.plugins.history.keys
    history = { }
    keys.each do |key|
      history[key] = public_storage[key]
    end
    max_of_history = config.plugins.history.max_of_history
    history[:history] = Readline::HISTORY.to_a.reverse.uniq.reverse
    if history[:history].size > max_of_history
      history[:history] = history[:history][-max_of_history..-1]
    end

    File.open(filename, 'w') do |f|
      f.write Zlib::Deflate.deflate(Marshal.dump(history))
    end
    puts "history saved(#{File.size(filename)/1000}kb)"
  end