\n\n\"\n\nif [ $TM_CURRENT_WORD ] \nthen\n\techo \"\"\nfi",
input: "none",
keyEquivalent: "^h",
name: "Documentation For Word",
output: "showAsHTML",
scope: "source.java",
uuid: "CE007C8C-9A0B-43B8-AEAF-45613BCD3DF7"},
{beforeRunningCommand: "saveActiveFile",
command:
"#!/usr/bin/env ruby -w\n#\n# WARNING: This script modifies the source of your file!!! No one but\n# yourself is responsible for it losing code.\n#\n# Provides an Eclipse like Organize Imports except it can't\n# add imports. It cleans up the list by filtering out unused\n# imports and alphabetizing the used.\n#\n# * alphabetizes imports placing java.* and javax.* before others.\n# * removes unused imports.\n# * maintains any \"package.*;\" imports and static imports\n# * supports class names starting with lowercase characters (legacy code)\n#\n\nrequire 'pp'\n\nbefore, imports, after, all = [], [], [], []\n\nSTDIN.each do |line|\n all << line\n \n if line =~ /\\s*^import /\n imports << line.strip\n elsif imports.empty? && (before.empty? || !before.last.strip.empty?)\n before << line\n elsif !imports.empty? && after.empty?\n # remove empty lines after the imports and before anything else\n after << line unless line.strip.empty?\n elsif\n after << line\n end\nend\n\nif imports.empty?\n # if there are no imports just output the original lines and exit\n all.each { |line| puts line }\n exit 0\nend\n\nclasses = {}\nimports.each do |import|\n import.scan(/\\s*import\\s+([A-Za-z0-9.]+)\\.([a-zA-Z0-9]+);/) do |package, name|\n classes[name] = { :package => package }\n end\nend\n\nafter.each do |line|\n next if line =~ %r{^\\s*(//|/\\*|\\*)} #comments\n \n # Attempt to find all classes in the file. This is loose in that it\n # accepts words with lowercase letters and identifies them as classes. This is OK\n # since it won't add imports, it's only used to determine if an existing import\n # is valid.\n line.scan(/\\b([A-Za-z]\\w*)(\\b|\\.)/) do |name, boundary|\n classes[name][:used] = 1 if classes[name]\n end\nend\n\n# Based upon the classes found in the file determine the used imports\njava_imports, other_imports = [], []\nclasses.each_pair do |name, info|\n if info[:used]\n array = (info[:package] =~ /^java[x]?\\./) ? java_imports : other_imports\n array << \"import \#{info[:package]}.\#{name};\"\n end\nend\n\n# Include any .* imports and static imports since they can't be validated\nimports.each do |import|\n if import =~ /\\.\\*\\s*;/ || import =~ /^import static /\n array = (import =~ / java[x]?\\./) ? java_imports : other_imports\n array << import\n end\nend\n\n# create section comprised of the import lines attempting to remove duplicate empty lines\nlast_was_empty, import_lines = before.last.strip.empty?, []\n[[\"\"], java_imports.sort, [\"\"], other_imports.sort, [\"\"]].flatten.each do |line|\n # prevent multiple empty lines\n next if last_was_empty && line.strip.empty? \n\n last_was_empty = line.strip.empty? \n import_lines << line\nend\n\n[before, import_lines, after].flatten.each do |line|\n puts line\nend\n",
input: "selection",
keyEquivalent: "@O",
name: "Organize Imports",
output: "replaceSelectedText",
scope: "source.java",
uuid: "E330E2EF-0057-4920-9364-01604C67E664"}]