30 changed files with 13293 additions and 2 deletions
@ -1,3 +1,7 @@ |
|||||
[user] |
[user] |
||||
email = lhark@hotmail.fr |
|
||||
name = lhark |
name = lhark |
||||
|
email = lhark@hotmail.fr |
||||
|
[master] |
||||
|
autosetuprebase = always |
||||
|
[color] |
||||
|
ui = auto |
||||
|
|||||
@ -0,0 +1,5 @@ |
|||||
|
let g:netrw_dirhistmax =10 |
||||
|
let g:netrw_dirhist_cnt =3 |
||||
|
let g:netrw_dirhist_1='/home/lhark/.config/xfce4/xfconf' |
||||
|
let g:netrw_dirhist_2='/home/lhark/dev/paiji2/.git' |
||||
|
let g:netrw_dirhist_3='/usr/share/themes/Mire_v2_blue' |
||||
@ -0,0 +1,16 @@ |
|||||
|
" Java specific config |
||||
|
|
||||
|
" Indentation |
||||
|
setlocal autoindent |
||||
|
setlocal si |
||||
|
setlocal shiftwidth=4 |
||||
|
setlocal noexpandtab |
||||
|
" Anonymous classes |
||||
|
setlocal cindent cinoptions& cinoptions+=j1 |
||||
|
" Repair extends and implements Indentation |
||||
|
setlocal indentkeys& indentkeys+=0=extends indentkeys+=0=implements |
||||
|
|
||||
|
"Syntax highlighting |
||||
|
let java_highlight_java_lang_ids=1 |
||||
|
let java_highlight_functions="style" |
||||
|
let java_highlight_debug=1 |
||||
@ -0,0 +1,670 @@ |
|||||
|
/** |
||||
|
* Reflection.java |
||||
|
* |
||||
|
* A utility class for javacomplete mainly for reading class or package information. |
||||
|
* Version: 0.77 |
||||
|
* Maintainer: cheng fang <fangread@yahoo.com.cn> |
||||
|
* Last Change: 2007-09-16 |
||||
|
* Copyright: Copyright (C) 2007 cheng fang. All rights reserved. |
||||
|
* License: Vim License (see vim's :help license) |
||||
|
* |
||||
|
*/ |
||||
|
|
||||
|
import java.lang.reflect.*; |
||||
|
import java.io.*; |
||||
|
import java.util.*; |
||||
|
import java.util.zip.*; |
||||
|
|
||||
|
class Reflection { |
||||
|
static final String VERSION = "0.77"; |
||||
|
|
||||
|
static final int OPTION_FIELD = 1; |
||||
|
static final int OPTION_METHOD = 2; |
||||
|
static final int OPTION_STATIC_FIELD = 4; |
||||
|
static final int OPTION_STATIC_METHOD = 8; |
||||
|
static final int OPTION_CONSTRUCTOR = 16; |
||||
|
static final int OPTION_STATIC = 12; // compound static
|
||||
|
static final int OPTION_INSTANCE = 15; // compound instance
|
||||
|
static final int OPTION_ALL = 31; // compound all
|
||||
|
static final int OPTION_SUPER = 32; |
||||
|
static final int OPTION_SAME_PACKAGE = 64; |
||||
|
|
||||
|
static final int STRATEGY_ALPHABETIC = 128; |
||||
|
static final int STRATEGY_HIERARCHY = 256; |
||||
|
static final int STRATEGY_DEFAULT = 512; |
||||
|
|
||||
|
static final int RETURN_ALL_PACKAGE_INFO = 0x1000; |
||||
|
|
||||
|
static final String KEY_NAME = "'n':"; // "'name':";
|
||||
|
static final String KEY_TYPE = "'t':"; // "'type':";
|
||||
|
static final String KEY_MODIFIER = "'m':"; // "'modifier':";
|
||||
|
static final String KEY_PARAMETERTYPES = "'p':"; // "'parameterTypes':";
|
||||
|
static final String KEY_RETURNTYPE = "'r':"; // "'returnType':";
|
||||
|
static final String KEY_DESCRIPTION = "'d':"; // "'description':";
|
||||
|
static final String KEY_DECLARING_CLASS = "'c':"; // "'declaringclass':";
|
||||
|
|
||||
|
static final String NEWLINE = ""; // "\r\n"
|
||||
|
|
||||
|
static boolean debug_mode = false; |
||||
|
|
||||
|
static Hashtable htClasspath = new Hashtable(); |
||||
|
|
||||
|
public static boolean existed(String fqn) { |
||||
|
boolean result = false; |
||||
|
try { |
||||
|
Class.forName(fqn); |
||||
|
result = true; |
||||
|
} |
||||
|
catch (Exception ex) { |
||||
|
} |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
public static String existedAndRead(String fqns) { |
||||
|
Hashtable mapPackages = new Hashtable(); // qualified name --> StringBuffer
|
||||
|
Hashtable mapClasses = new Hashtable(); // qualified name --> StringBuffer
|
||||
|
|
||||
|
for (StringTokenizer st = new StringTokenizer(fqns, ","); st.hasMoreTokens(); ) { |
||||
|
String fqn = st.nextToken(); |
||||
|
try { |
||||
|
Class clazz = Class.forName(fqn); |
||||
|
putClassInfo(mapClasses, clazz); |
||||
|
} |
||||
|
catch (Exception ex) { |
||||
|
String binaryName = fqn; |
||||
|
boolean found = false; |
||||
|
while (true) { |
||||
|
try { |
||||
|
int lastDotPos = binaryName.lastIndexOf('.'); |
||||
|
if (lastDotPos == -1) |
||||
|
break; |
||||
|
binaryName = binaryName.substring(0, lastDotPos) + '$' + binaryName.substring(lastDotPos+1, binaryName.length()); |
||||
|
Class clazz = Class.forName(binaryName); |
||||
|
putClassInfo(mapClasses, clazz); |
||||
|
found = true; |
||||
|
break; |
||||
|
} |
||||
|
catch (Exception e) { |
||||
|
} |
||||
|
} |
||||
|
if (!found) |
||||
|
putPackageInfo(mapPackages, fqn); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (mapPackages.size() > 0 || mapClasses.size() > 0) { |
||||
|
StringBuffer sb = new StringBuffer(4096); |
||||
|
sb.append("{"); |
||||
|
for (Enumeration e = mapPackages.keys(); e.hasMoreElements(); ) { |
||||
|
String s = (String)e.nextElement(); |
||||
|
sb.append("'").append( s.replace('$', '.') ).append("':").append(mapPackages.get(s)).append(","); |
||||
|
} |
||||
|
for (Enumeration e = mapClasses.keys(); e.hasMoreElements(); ) { |
||||
|
String s = (String)e.nextElement(); |
||||
|
sb.append("'").append( s.replace('$', '.') ).append("':").append(mapClasses.get(s)).append(","); |
||||
|
} |
||||
|
sb.append("}"); |
||||
|
return sb.toString(); |
||||
|
} |
||||
|
else |
||||
|
return ""; |
||||
|
} |
||||
|
|
||||
|
private static String getPackageList(String fqn) { |
||||
|
Hashtable mapPackages = new Hashtable(); |
||||
|
putPackageInfo(mapPackages, fqn); |
||||
|
return mapPackages.size() > 0 ? mapPackages.get(fqn).toString() : ""; |
||||
|
} |
||||
|
|
||||
|
private static Hashtable collectClassPath() { |
||||
|
if (!htClasspath.isEmpty()) |
||||
|
return htClasspath; |
||||
|
|
||||
|
// runtime classes
|
||||
|
if ("Kaffe".equals(System.getProperty("java.vm.name"))) { |
||||
|
addClasspathesFromDir(System.getProperty("java.home") + File.separator + "share" + File.separator + "kaffe" + File.separator); |
||||
|
} |
||||
|
else if ("GNU libgcj".equals(System.getProperty("java.vm.name"))) { |
||||
|
if (new File(System.getProperty("sun.boot.class.path")).exists()) |
||||
|
htClasspath.put(System.getProperty("sun.boot.class.path"), ""); |
||||
|
} |
||||
|
|
||||
|
if (System.getProperty("java.vendor").toLowerCase(Locale.US).indexOf("microsoft") >= 0) { |
||||
|
// `*.ZIP` files in `Packages` directory
|
||||
|
addClasspathesFromDir(System.getProperty("java.home") + File.separator + "Packages" + File.separator); |
||||
|
} |
||||
|
else { |
||||
|
// the following code works for several kinds of JDK
|
||||
|
// - JDK1.1: classes.zip
|
||||
|
// - JDK1.2+: rt.jar
|
||||
|
// - JDK1.4+ of Sun and Apple: rt.jar + jce.jar + jsse.jar
|
||||
|
// - JDK1.4 of IBM split rt.jar into core.jar, graphics.jar, server.jar
|
||||
|
// combined jce.jar and jsse.jar into security.jar
|
||||
|
// - JDK for MacOS X split rt.jar into classes.jar, ui.jar in Classes directory
|
||||
|
addClasspathesFromDir(System.getProperty("java.home") + File.separator + "lib" + File.separator); |
||||
|
addClasspathesFromDir(System.getProperty("java.home") + File.separator + "jre" + File.separator + "lib" + File.separator); |
||||
|
addClasspathesFromDir(System.getProperty("java.home") + File.separator + ".." + File.separator + "Classes" + File.separator); |
||||
|
} |
||||
|
|
||||
|
// ext
|
||||
|
String extdirs = System.getProperty("java.ext.dirs"); |
||||
|
for (StringTokenizer st = new StringTokenizer(extdirs, File.pathSeparator); st.hasMoreTokens(); ) { |
||||
|
addClasspathesFromDir(st.nextToken() + File.separator); |
||||
|
} |
||||
|
|
||||
|
// user classpath
|
||||
|
String classPath = System.getProperty("java.class.path"); |
||||
|
StringTokenizer st = new StringTokenizer(classPath, File.pathSeparator); |
||||
|
while (st.hasMoreTokens()) { |
||||
|
String path = st.nextToken(); |
||||
|
File f = new File(path); |
||||
|
if (!f.exists()) |
||||
|
continue; |
||||
|
|
||||
|
if (path.endsWith(".jar") || path.endsWith(".zip")) |
||||
|
htClasspath.put(f.toString(), ""); |
||||
|
else { |
||||
|
if (f.isDirectory()) |
||||
|
htClasspath.put(f.toString(), ""); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return htClasspath; |
||||
|
} |
||||
|
|
||||
|
private static void addClasspathesFromDir(String dirpath) { |
||||
|
File dir = new File(dirpath); |
||||
|
if (dir.isDirectory()) { |
||||
|
String[] items = dir.list(); // use list() instead of listFiles() since the latter are introduced in 1.2
|
||||
|
for (int i = 0; i < items.length; i++) { |
||||
|
File f = new File(dirpath + items[i]); |
||||
|
if (!f.exists()) |
||||
|
continue; |
||||
|
|
||||
|
if (items[i].endsWith(".jar") || items[i].endsWith(".zip") || items[i].endsWith(".ZIP")) { |
||||
|
htClasspath.put(f.toString(), ""); |
||||
|
} |
||||
|
else if (items.equals("classes")) { |
||||
|
if (f.isDirectory()) |
||||
|
htClasspath.put(f.toString(), ""); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* If name is empty, put all loadable package info into map once. |
||||
|
*/ |
||||
|
private static void putPackageInfo(Hashtable map, String name) { |
||||
|
String prefix = name.replace('.', '/') + "/"; |
||||
|
Hashtable subpackages = new Hashtable(); |
||||
|
Hashtable classes = new Hashtable(); |
||||
|
for (Enumeration e = collectClassPath().keys(); e.hasMoreElements(); ) { |
||||
|
String path = (String)e.nextElement(); |
||||
|
if (path.endsWith(".jar") || path.endsWith(".zip")) |
||||
|
appendListFromJar(subpackages, classes, path, prefix); |
||||
|
else |
||||
|
appendListFromFolder(subpackages, classes, path, prefix); |
||||
|
} |
||||
|
|
||||
|
if (subpackages.size() > 0 || classes.size() > 0) { |
||||
|
StringBuffer sb = new StringBuffer(1024); |
||||
|
sb.append("{'tag':'PACKAGE','subpackages':["); |
||||
|
for (Enumeration e = subpackages.keys(); e.hasMoreElements(); ) { |
||||
|
sb.append("'").append(e.nextElement()).append("',"); |
||||
|
} |
||||
|
sb.append("],'classes':["); |
||||
|
for (Enumeration e = classes.keys(); e.hasMoreElements(); ) { |
||||
|
sb.append("'").append(e.nextElement()).append("',"); |
||||
|
} |
||||
|
sb.append("]}"); |
||||
|
map.put(name, sb.toString()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static void appendListFromJar(Hashtable subpackages, Hashtable classes, String path, String prefix) { |
||||
|
try { |
||||
|
for (Enumeration entries = new ZipFile(path).entries(); entries.hasMoreElements(); ) { |
||||
|
String entry = entries.nextElement().toString(); |
||||
|
int len = entry.length(); |
||||
|
if (entry.endsWith(".class") && entry.indexOf('$') == -1 |
||||
|
&& entry.startsWith(prefix)) { |
||||
|
int splitPos = entry.indexOf('/', prefix.length()); |
||||
|
String shortname = entry.substring(prefix.length(), splitPos == -1 ? entry.length()-6 : splitPos); |
||||
|
if (splitPos == -1) { |
||||
|
if (!classes.containsKey(shortname)) |
||||
|
classes.put(shortname, ""); //classes.put(shortname, "{'tag':'CLASSDEF','name':'"+shortname+"'}");
|
||||
|
} |
||||
|
else { |
||||
|
if (!subpackages.containsKey(shortname)) |
||||
|
subpackages.put(shortname, ""); //subpackages.put(shortname, "{'tag':'PACKAGE','name':'" +shortname+"'}");
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
catch (Throwable e) { |
||||
|
//e.printStackTrace();
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static void appendListFromFolder(Hashtable subpackages, Hashtable classes, String path, String prefix) { |
||||
|
try { |
||||
|
String fullPath = path + "/" + prefix; |
||||
|
File file = new File(fullPath); |
||||
|
if (file.isDirectory()) { |
||||
|
String[] descents = file.list(); |
||||
|
for (int i = 0; i < descents.length; i++) { |
||||
|
if (descents[i].indexOf('$') == -1) { |
||||
|
if (descents[i].endsWith(".class")) { |
||||
|
String shortname = descents[i].substring(0, descents[i].length()-6); |
||||
|
if (!classes.containsKey(shortname)) |
||||
|
classes.put(shortname, ""); |
||||
|
} |
||||
|
else if ((new File(fullPath + "/" + descents[i])).isDirectory()) { |
||||
|
if (!subpackages.containsKey(descents[i])) |
||||
|
subpackages.put(descents[i], ""); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
catch (Throwable e) { |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private static int INDEX_PACKAGE = 0; |
||||
|
private static int INDEX_CLASS = 1; |
||||
|
|
||||
|
// generate information of all packages in jar files.
|
||||
|
public static String getPackageList() { |
||||
|
Hashtable map = new Hashtable(); |
||||
|
|
||||
|
for (Enumeration e = collectClassPath().keys(); e.hasMoreElements(); ) { |
||||
|
String path = (String)e.nextElement(); |
||||
|
if (path.endsWith(".jar") || path.endsWith(".zip")) |
||||
|
appendListFromJar(path, map); |
||||
|
} |
||||
|
|
||||
|
StringBuffer sb = new StringBuffer(4096); |
||||
|
sb.append("{"); |
||||
|
//sb.append("'*':'").append( map.remove("") ).append("',"); // default package
|
||||
|
for (Enumeration e = map.keys(); e.hasMoreElements(); ) { |
||||
|
String s = (String)e.nextElement(); |
||||
|
StringBuffer[] sbs = (StringBuffer[])map.get(s); |
||||
|
sb.append("'").append( s.replace('/', '.') ).append("':") |
||||
|
.append("{'tag':'PACKAGE'"); |
||||
|
if (sbs[INDEX_PACKAGE].length() > 0) |
||||
|
sb.append(",'subpackages':[").append(sbs[INDEX_PACKAGE]).append("]"); |
||||
|
if (sbs[INDEX_CLASS].length() > 0) |
||||
|
sb.append(",'classes':[").append(sbs[INDEX_CLASS]).append("]"); |
||||
|
sb.append("},"); |
||||
|
} |
||||
|
sb.append("}"); |
||||
|
return sb.toString(); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public static void appendListFromJar(String path, Hashtable map) { |
||||
|
try { |
||||
|
for (Enumeration entries = new ZipFile(path).entries(); entries.hasMoreElements(); ) { |
||||
|
String entry = entries.nextElement().toString(); |
||||
|
int len = entry.length(); |
||||
|
if (entry.endsWith(".class") && entry.indexOf('$') == -1) { |
||||
|
int slashpos = entry.lastIndexOf('/'); |
||||
|
String parent = entry.substring(0, slashpos); |
||||
|
String child = entry.substring(slashpos+1, len-6); |
||||
|
putItem(map, parent, child, INDEX_CLASS); |
||||
|
|
||||
|
slashpos = parent.lastIndexOf('/'); |
||||
|
if (slashpos != -1) { |
||||
|
AddToParent(map, parent.substring(0, slashpos), parent.substring(slashpos+1)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
catch (Throwable e) { |
||||
|
//e.printStackTrace();
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static void putItem(Hashtable map, String parent, String child, int index) { |
||||
|
StringBuffer[] sbs = (StringBuffer[])map.get(parent); |
||||
|
if (sbs == null) { |
||||
|
sbs = new StringBuffer[] { new StringBuffer(256), // packages
|
||||
|
new StringBuffer(256) // classes
|
||||
|
}; |
||||
|
} |
||||
|
if (sbs[index].toString().indexOf("'" + child + "',") == -1) |
||||
|
sbs[index].append("'").append(child).append("',"); |
||||
|
map.put(parent, sbs); |
||||
|
} |
||||
|
|
||||
|
public static void AddToParent(Hashtable map, String parent, String child) { |
||||
|
putItem(map, parent, child, INDEX_PACKAGE); |
||||
|
|
||||
|
int slashpos = parent.lastIndexOf('/'); |
||||
|
if (slashpos != -1) { |
||||
|
AddToParent(map, parent.substring(0, slashpos), parent.substring(slashpos+1)); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public static String getClassInfo(String className) { |
||||
|
Hashtable mapClasses = new Hashtable(); |
||||
|
try { |
||||
|
Class clazz = Class.forName(className); |
||||
|
putClassInfo(mapClasses, clazz); |
||||
|
} |
||||
|
catch (Exception ex) { |
||||
|
} |
||||
|
|
||||
|
if (mapClasses.size() == 1) { |
||||
|
return mapClasses.get(className).toString(); // return {...}
|
||||
|
} |
||||
|
else if (mapClasses.size() > 1) { |
||||
|
StringBuffer sb = new StringBuffer(4096); |
||||
|
sb.append("["); |
||||
|
for (Enumeration e = mapClasses.keys(); e.hasMoreElements(); ) { |
||||
|
String s = (String)e.nextElement(); |
||||
|
sb.append(mapClasses.get(s)).append(","); |
||||
|
} |
||||
|
sb.append("]"); |
||||
|
return sb.toString(); // return [...]
|
||||
|
} |
||||
|
else |
||||
|
return ""; |
||||
|
} |
||||
|
|
||||
|
private static void putClassInfo(Hashtable map, Class clazz) { |
||||
|
if (map.containsKey(clazz.getName())) |
||||
|
return ; |
||||
|
|
||||
|
try { |
||||
|
StringBuffer sb = new StringBuffer(1024); |
||||
|
sb.append("{") |
||||
|
.append("'tag':'CLASSDEF',").append(NEWLINE) |
||||
|
.append("'flags':'").append(Integer.toString(clazz.getModifiers(), 2)).append("',").append(NEWLINE) |
||||
|
.append("'name':'").append(clazz.getName().replace('$', '.')).append("',").append(NEWLINE) |
||||
|
//.append("'package':'").append(clazz.getPackage().getName()).append("',").append(NEWLINE) // no getPackage() in JDK1.1
|
||||
|
.append("'classpath':'1',").append(NEWLINE) |
||||
|
.append("'fqn':'").append(clazz.getName().replace('$', '.')).append("',").append(NEWLINE); |
||||
|
|
||||
|
Class[] interfaces = clazz.getInterfaces(); |
||||
|
if (clazz.isInterface()) { |
||||
|
sb.append("'extends':["); |
||||
|
} else { |
||||
|
Class superclass = clazz.getSuperclass(); |
||||
|
if (superclass != null && !"java.lang.Object".equals(superclass.getName())) { |
||||
|
sb.append("'extends':['").append(superclass.getName().replace('$', '.')).append("'],").append(NEWLINE); |
||||
|
putClassInfo(map, superclass); // !!
|
||||
|
} |
||||
|
sb.append("'implements':["); |
||||
|
} |
||||
|
for (int i = 0, n = interfaces.length; i < n; i++) { |
||||
|
sb.append("'").append(interfaces[i].getName().replace('$', '.')).append("',"); |
||||
|
putClassInfo(map, interfaces[i]); // !!
|
||||
|
} |
||||
|
sb.append("],").append(NEWLINE);; |
||||
|
|
||||
|
Constructor[] ctors = clazz.getConstructors(); |
||||
|
sb.append("'ctors':["); |
||||
|
for (int i = 0, n = ctors.length; i < n; i++) { |
||||
|
Constructor ctor = ctors[i]; |
||||
|
sb.append("{"); |
||||
|
appendModifier(sb, ctor.getModifiers()); |
||||
|
appendParameterTypes(sb, ctor.getParameterTypes()); |
||||
|
sb.append(KEY_DESCRIPTION).append("'").append(ctors[i].toString()).append("'"); |
||||
|
sb.append("},").append(NEWLINE); |
||||
|
} |
||||
|
sb.append("], ").append(NEWLINE); |
||||
|
|
||||
|
Field[] fields = clazz.getFields(); |
||||
|
//java.util.Arrays.sort(fields, comparator);
|
||||
|
sb.append("'fields':["); |
||||
|
for (int i = 0, n = fields.length; i < n; i++) { |
||||
|
Field f = fields[i]; |
||||
|
int modifier = f.getModifiers(); |
||||
|
sb.append("{"); |
||||
|
sb.append(KEY_NAME).append("'").append(f.getName()).append("',"); |
||||
|
if (!f.getDeclaringClass().getName().equals(clazz.getName())) |
||||
|
sb.append(KEY_DECLARING_CLASS).append("'").append(f.getDeclaringClass().getName()).append("',"); |
||||
|
appendModifier(sb, modifier); |
||||
|
sb.append(KEY_TYPE).append("'").append(f.getType().getName()).append("'"); |
||||
|
sb.append("},").append(NEWLINE); |
||||
|
} |
||||
|
sb.append("], ").append(NEWLINE); |
||||
|
|
||||
|
Method[] methods = clazz.getMethods(); |
||||
|
//java.util.Arrays.sort(methods, comparator);
|
||||
|
sb.append("'methods':["); |
||||
|
for (int i = 0, n = methods.length; i < n; i++) { |
||||
|
Method m = methods[i]; |
||||
|
int modifier = m.getModifiers(); |
||||
|
sb.append("{"); |
||||
|
sb.append(KEY_NAME).append("'").append(m.getName()).append("',"); |
||||
|
if (!m.getDeclaringClass().getName().equals(clazz.getName())) |
||||
|
sb.append(KEY_DECLARING_CLASS).append("'").append(m.getDeclaringClass().getName()).append("',"); |
||||
|
appendModifier(sb, modifier); |
||||
|
sb.append(KEY_RETURNTYPE).append("'").append(m.getReturnType().getName()).append("',"); |
||||
|
appendParameterTypes(sb, m.getParameterTypes()); |
||||
|
sb.append(KEY_DESCRIPTION).append("'").append(m.toString()).append("'"); |
||||
|
sb.append("},").append(NEWLINE); |
||||
|
} |
||||
|
sb.append("], ").append(NEWLINE); |
||||
|
|
||||
|
Class[] classes = clazz.getClasses(); |
||||
|
sb.append("'classes': ["); |
||||
|
for (int i = 0, n = classes.length; i < n; i++) { |
||||
|
Class c = classes[i]; |
||||
|
sb.append("'").append(c.getName().replace('$', '.')).append("',"); |
||||
|
putClassInfo(map, c); // !!
|
||||
|
} |
||||
|
sb.append("], ").append(NEWLINE); |
||||
|
|
||||
|
appendDeclaredMembers(map, clazz, sb); |
||||
|
|
||||
|
sb.append("}"); |
||||
|
map.put(clazz.getName(), sb); |
||||
|
} |
||||
|
catch (Exception ex) { |
||||
|
//ex.printStackTrace();
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private static void appendDeclaredMembers(Hashtable map, Class clazz, StringBuffer sb) { |
||||
|
Constructor[] ctors = clazz.getDeclaredConstructors(); |
||||
|
sb.append("'declared_ctors':["); |
||||
|
for (int i = 0, n = ctors.length; i < n; i++) { |
||||
|
Constructor ctor = ctors[i]; |
||||
|
if (!Modifier.isPublic(ctor.getModifiers())) { |
||||
|
sb.append("{"); |
||||
|
appendModifier(sb, ctor.getModifiers()); |
||||
|
appendParameterTypes(sb, ctor.getParameterTypes()); |
||||
|
sb.append(KEY_DESCRIPTION).append("'").append(ctors[i].toString()).append("'"); |
||||
|
sb.append("},").append(NEWLINE); |
||||
|
} |
||||
|
} |
||||
|
sb.append("], ").append(NEWLINE); |
||||
|
|
||||
|
Field[] fields = clazz.getDeclaredFields(); |
||||
|
sb.append("'declared_fields':["); |
||||
|
for (int i = 0, n = fields.length; i < n; i++) { |
||||
|
Field f = fields[i]; |
||||
|
int modifier = f.getModifiers(); |
||||
|
if (!Modifier.isPublic(modifier)) { |
||||
|
sb.append("{"); |
||||
|
sb.append(KEY_NAME).append("'").append(f.getName()).append("',"); |
||||
|
if (!f.getDeclaringClass().getName().equals(clazz.getName())) |
||||
|
sb.append(KEY_DECLARING_CLASS).append("'").append(f.getDeclaringClass().getName()).append("',"); |
||||
|
appendModifier(sb, modifier); |
||||
|
sb.append(KEY_TYPE).append("'").append(f.getType().getName()).append("'"); |
||||
|
sb.append("},").append(NEWLINE); |
||||
|
} |
||||
|
} |
||||
|
sb.append("], ").append(NEWLINE); |
||||
|
|
||||
|
Method[] methods = clazz.getDeclaredMethods(); |
||||
|
sb.append("'declared_methods':["); |
||||
|
for (int i = 0, n = methods.length; i < n; i++) { |
||||
|
Method m = methods[i]; |
||||
|
int modifier = m.getModifiers(); |
||||
|
if (!Modifier.isPublic(modifier)) { |
||||
|
sb.append("{"); |
||||
|
sb.append(KEY_NAME).append("'").append(m.getName()).append("',"); |
||||
|
if (!m.getDeclaringClass().getName().equals(clazz.getName())) |
||||
|
sb.append(KEY_DECLARING_CLASS).append("'").append(m.getDeclaringClass().getName()).append("',"); |
||||
|
appendModifier(sb, modifier); |
||||
|
sb.append(KEY_RETURNTYPE).append("'").append(m.getReturnType().getName()).append("',"); |
||||
|
appendParameterTypes(sb, m.getParameterTypes()); |
||||
|
sb.append(KEY_DESCRIPTION).append("'").append(m.toString()).append("'"); |
||||
|
sb.append("},").append(NEWLINE); |
||||
|
} |
||||
|
} |
||||
|
sb.append("], ").append(NEWLINE); |
||||
|
|
||||
|
Class[] classes = clazz.getDeclaredClasses(); |
||||
|
sb.append("'declared_classes': ["); |
||||
|
for (int i = 0, n = classes.length; i < n; i++) { |
||||
|
Class c = classes[i]; |
||||
|
if (!Modifier.isPublic(c.getModifiers())) { |
||||
|
sb.append("'").append(c.getName().replace('$', '.')).append("',"); |
||||
|
putClassInfo(map, c); // !!
|
||||
|
} |
||||
|
} |
||||
|
sb.append("], ").append(NEWLINE); |
||||
|
} |
||||
|
|
||||
|
private static void appendModifier(StringBuffer sb, int modifier) { |
||||
|
sb.append(KEY_MODIFIER).append("'").append(Integer.toString(modifier, 2)).append("', "); |
||||
|
} |
||||
|
|
||||
|
private static void appendParameterTypes(StringBuffer sb, Class[] paramTypes) { |
||||
|
if (paramTypes.length == 0) return ; |
||||
|
|
||||
|
sb.append(KEY_PARAMETERTYPES).append("["); |
||||
|
for (int j = 0; j < paramTypes.length; j++) { |
||||
|
sb.append("'").append(paramTypes[j].getName()).append("',"); |
||||
|
} |
||||
|
sb.append("],"); |
||||
|
} |
||||
|
|
||||
|
private static boolean isBlank(String str) { |
||||
|
int len; |
||||
|
if (str == null || (len = str.length()) == 0) |
||||
|
return true; |
||||
|
for (int i = 0; i < len; i++) |
||||
|
if ((Character.isWhitespace(str.charAt(i)) == false)) |
||||
|
return false; |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
// test methods
|
||||
|
|
||||
|
static void debug(String s) { |
||||
|
if (debug_mode) |
||||
|
System.out.println(s); |
||||
|
} |
||||
|
static void output(String s) { |
||||
|
if (!debug_mode) |
||||
|
System.out.print(s); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
private static void usage() { |
||||
|
System.out.println("Reflection for javacomplete (" + VERSION + ")"); |
||||
|
System.out.println(" java [-classpath] Reflection [-c] [-d] [-e] [-h] [-v] [-p] [-s] name[,comma_separated_name_list]"); |
||||
|
System.out.println("Options:"); |
||||
|
System.out.println(" -a list all members in alphabetic order"); |
||||
|
System.out.println(" -c list constructors"); |
||||
|
System.out.println(" -C return class info"); |
||||
|
System.out.println(" -d default strategy, i.e. instance fields, instance methods, static fields, static methods"); |
||||
|
System.out.println(" -e check class existed"); |
||||
|
System.out.println(" -E check class existed and read class information"); |
||||
|
System.out.println(" -D debug mode"); |
||||
|
System.out.println(" -p list package content"); |
||||
|
System.out.println(" -P print all package info in the Vim dictionary format"); |
||||
|
System.out.println(" -s list static fields and methods"); |
||||
|
System.out.println(" -h help"); |
||||
|
System.out.println(" -v version"); |
||||
|
} |
||||
|
|
||||
|
public static void main(String[] args) { |
||||
|
String className = null; |
||||
|
int option = 0x0; |
||||
|
boolean wholeClassInfo = false; |
||||
|
boolean onlyStatic = false; |
||||
|
boolean onlyConstructor = false; |
||||
|
boolean listPackageContent = false; |
||||
|
boolean checkExisted = false; |
||||
|
boolean checkExistedAndRead = false; |
||||
|
boolean allPackageInfo = false; |
||||
|
|
||||
|
for (int i = 0, n = args.length; i < n && !isBlank(args[i]); i++) { |
||||
|
//debug(args[i]);
|
||||
|
if (args[i].charAt(0) == '-') { |
||||
|
if (args[i].length() > 1) { |
||||
|
switch (args[i].charAt(1)) { |
||||
|
case 'a': |
||||
|
break; |
||||
|
case 'c': // request constructors
|
||||
|
option = option | OPTION_CONSTRUCTOR; |
||||
|
onlyConstructor = true; |
||||
|
break; |
||||
|
case 'C': // class info
|
||||
|
wholeClassInfo = true; |
||||
|
break; |
||||
|
case 'd': // default strategy
|
||||
|
option = option | STRATEGY_DEFAULT; |
||||
|
break; |
||||
|
case 'D': // debug mode
|
||||
|
debug_mode = true; |
||||
|
break; |
||||
|
case 'e': // class existed
|
||||
|
checkExisted = true; |
||||
|
break; |
||||
|
case 'E': // check existed and read class information
|
||||
|
checkExistedAndRead = true; |
||||
|
break; |
||||
|
case 'h': // help
|
||||
|
usage(); |
||||
|
return ; |
||||
|
case 'v': // version
|
||||
|
System.out.println("Reflection for javacomplete (" + VERSION + ")"); |
||||
|
break; |
||||
|
case 'p': |
||||
|
listPackageContent = true; |
||||
|
break; |
||||
|
case 'P': |
||||
|
option = RETURN_ALL_PACKAGE_INFO; |
||||
|
break; |
||||
|
case 's': // request static members
|
||||
|
option = option | OPTION_STATIC_METHOD | OPTION_STATIC_FIELD; |
||||
|
onlyStatic = true; |
||||
|
break; |
||||
|
default: |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
className = args[i]; |
||||
|
} |
||||
|
} |
||||
|
if (className == null && (option & RETURN_ALL_PACKAGE_INFO) != RETURN_ALL_PACKAGE_INFO) { |
||||
|
return; |
||||
|
} |
||||
|
if (option == 0x0) |
||||
|
option = OPTION_INSTANCE; |
||||
|
|
||||
|
if (wholeClassInfo) |
||||
|
output( getClassInfo(className) ); |
||||
|
else if ((option & RETURN_ALL_PACKAGE_INFO) == RETURN_ALL_PACKAGE_INFO) |
||||
|
output( getPackageList() ); |
||||
|
else if (checkExistedAndRead) |
||||
|
output( existedAndRead(className) ); |
||||
|
else if (checkExisted) |
||||
|
output( String.valueOf(existed(className)) ); |
||||
|
else if (listPackageContent) |
||||
|
output( getPackageList(className) ); |
||||
|
} |
||||
|
} |
||||
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -0,0 +1,55 @@ |
|||||
|
" Toggle Background |
||||
|
" Modified: 2011 Apr 29 |
||||
|
" Maintainer: Ethan Schoonover |
||||
|
" License: OSI approved MIT license |
||||
|
|
||||
|
if exists("g:loaded_togglebg") |
||||
|
finish |
||||
|
endif |
||||
|
let g:loaded_togglebg = 1 |
||||
|
|
||||
|
" noremap is a bit misleading here if you are unused to vim mapping. |
||||
|
" in fact, there is remapping, but only of script locally defined remaps, in |
||||
|
" this case <SID>TogBG. The <script> argument modifies the noremap scope in |
||||
|
" this regard (and the noremenu below). |
||||
|
nnoremap <unique> <script> <Plug>ToggleBackground <SID>TogBG |
||||
|
inoremap <unique> <script> <Plug>ToggleBackground <ESC><SID>TogBG<ESC>a |
||||
|
vnoremap <unique> <script> <Plug>ToggleBackground <ESC><SID>TogBG<ESC>gv |
||||
|
nnoremenu <script> Window.Toggle\ Background <SID>TogBG |
||||
|
inoremenu <script> Window.Toggle\ Background <ESC><SID>TogBG<ESC>a |
||||
|
vnoremenu <script> Window.Toggle\ Background <ESC><SID>TogBG<ESC>gv |
||||
|
tmenu Window.Toggle\ Background Toggle light and dark background modes |
||||
|
nnoremenu <script> ToolBar.togglebg <SID>TogBG |
||||
|
inoremenu <script> ToolBar.togglebg <ESC><SID>TogBG<ESC>a |
||||
|
vnoremenu <script> ToolBar.togglebg <ESC><SID>TogBG<ESC>gv |
||||
|
tmenu ToolBar.togglebg Toggle light and dark background modes |
||||
|
noremap <SID>TogBG :call <SID>TogBG()<CR> |
||||
|
|
||||
|
function! s:TogBG() |
||||
|
let &background = ( &background == "dark"? "light" : "dark" ) |
||||
|
if exists("g:colors_name") |
||||
|
exe "colorscheme " . g:colors_name |
||||
|
endif |
||||
|
endfunction |
||||
|
|
||||
|
if !exists(":ToggleBG") |
||||
|
command ToggleBG :call s:TogBG() |
||||
|
endif |
||||
|
|
||||
|
function! ToggleBackground() |
||||
|
echo "Please update your ToggleBackground mapping. ':help togglebg' for information." |
||||
|
endfunction |
||||
|
|
||||
|
function! togglebg#map(mapActivation) |
||||
|
try |
||||
|
exe "silent! nmap <unique> ".a:mapActivation." <Plug>ToggleBackground" |
||||
|
exe "silent! imap <unique> ".a:mapActivation." <Plug>ToggleBackground" |
||||
|
exe "silent! vmap <unique> ".a:mapActivation." <Plug>ToggleBackground" |
||||
|
finally |
||||
|
return 0 |
||||
|
endtry |
||||
|
endfunction |
||||
|
|
||||
|
if !exists("no_plugin_maps") && !hasmapto('<Plug>ToggleBackground') |
||||
|
call togglebg#map("<F5>") |
||||
|
endif |
||||
|
After Width: | Height: | Size: 1.6 KiB |
@ -0,0 +1 @@ |
|||||
|
Subproject commit e37b9358980d312c1f4fbbcb4a36d1a9d4bdb415 |
||||
File diff suppressed because it is too large
@ -0,0 +1,568 @@ |
|||||
|
*javacomplete.txt* For Vim version 7.0 and above. Last change: 2011-01-30 |
||||
|
|
||||
|
JAVACOMPLETE REFERENCE MANUAL by cheng fang~ |
||||
|
fangread@yahoo.com.cn~ |
||||
|
|
||||
|
|
||||
|
1. Overview |javacomplete-overview| |
||||
|
1.1 Features |javacomplete-features| |
||||
|
1.2 Requirements |javacomplete-requirements| |
||||
|
1.3 Download |javacomplete-download| |
||||
|
1.4 Install |javacomplete-install| |
||||
|
2. Usage |javacomplete-usage| |
||||
|
2.1 Input contexts |javacomplete-contexts| |
||||
|
2.2 Kind letter |javacomplete-kindletter| |
||||
|
2.3 Options |javacomplete-options| |
||||
|
2.4 Commands |javacomplete-commands| |
||||
|
3. Java parser in Vim |javacomplete-parser| |
||||
|
3.1 Abstract Syntax Tree |javacomplete-ast| |
||||
|
3.2 Global Constants |javacomplete-constants| |
||||
|
3.3 Parsing Functions |javacomplete-functions| |
||||
|
3.4 Sample |javacomplete-sample| |
||||
|
4. FAQ |javacomplete-faq| |
||||
|
5. Limitations |javacomplete-limitations| |
||||
|
6. History |
||||
|
6.1 javacomplete |javacomplete-history| |
||||
|
6.2 Parser |java-parser-history| |
||||
|
6.2 Reflection.java |javacomplete-reflection| |
||||
|
7. Todo |javacomplete-todo| |
||||
|
8. Thanks |javacomplete-thanks| |
||||
|
|
||||
|
============================================================================== |
||||
|
1. Overview *javacomplete-overview* |
||||
|
|
||||
|
This is javacomplete, an omni-completion script of JAVA language for vim 7 and |
||||
|
above. It includes javacomplete.vim, java_parser.vim, Reflection.java, and |
||||
|
javacomplete.txt. |
||||
|
|
||||
|
1.1 Features *javacomplete-features* |
||||
|
|
||||
|
- List members of a class, including (static) fields, (static) methods and ctors. |
||||
|
- List classes or subpackages of a package. |
||||
|
- Provide parameters information of a method, list all overload methods. |
||||
|
- Complete an incomplete word. |
||||
|
- Provide a complete JAVA parser written in Vim script language. |
||||
|
- Use the JVM to obtain most information. |
||||
|
- Use the embedded parser to obtain the class information from source files. |
||||
|
- Tags generated by ctags can also be used. |
||||
|
- JSP is supported, Builtin objects such as request, session can be recognized. |
||||
|
The classes and jar files in the WEB-INF will be appended automatically to the classpath. |
||||
|
|
||||
|
1.2 Requirements *javacomplete-requirements* |
||||
|
|
||||
|
It works on all the platforms wherever |
||||
|
- Vim version 7.0 and above, |
||||
|
- JDK version 1.1 and above, |
||||
|
exists. |
||||
|
|
||||
|
1.3 Download *javacomplete-download* |
||||
|
|
||||
|
You can download the lastest version from this url: |
||||
|
http://www.vim.org/scripts/script.php?script_id=1785 |
||||
|
|
||||
|
1.4 Install *javacomplete-install* |
||||
|
|
||||
|
1. Unzip javacomplete.zip to a directory of 'runtimepath', e.g. |
||||
|
$HOME/.vim (unix/linux), $VIM/vimfiles (windows). > |
||||
|
> unzip javacomplete.zip -d ~/.vim |
||||
|
|
||||
|
< To update Vim help tags, run vim and run command: > |
||||
|
:helptags $HOME/.vim/doc |
||||
|
< or > |
||||
|
:helptags $VIM/vimfiles/doc |
||||
|
|
||||
|
NOTE: javacomplete.vim, java_parser.vim and Reflection.java should be in one |
||||
|
autoload directory of 'runtimepath'. |
||||
|
javacomplete.txt should be in one doc directory of 'runtimepath'. |
||||
|
|
||||
|
2. Set 'omnifunc' option. e.g. > |
||||
|
:setlocal omnifunc=javacomplete#Complete |
||||
|
< Or, use autocmd: > |
||||
|
:" Only do this part when compiled with support for autocommands. |
||||
|
:if has("autocmd") |
||||
|
: autocmd Filetype java setlocal omnifunc=javacomplete#Complete |
||||
|
:endif |
||||
|
You can add this command to your .vimrc or _vimrc. |
||||
|
|
||||
|
3. Set 'completefunc' option to show parameters information IF YOU LIKE. e.g. > |
||||
|
:setlocal completefunc=javacomplete#CompleteParamsInfo |
||||
|
You can map as follows for better display: > |
||||
|
:inoremap <buffer> <C-X><C-U> <C-X><C-U><C-P> |
||||
|
:inoremap <buffer> <C-S-Space> <C-X><C-U><C-P> |
||||
|
|
||||
|
4. Reflection.java will be automatcally compiled and placed to $HOME when you |
||||
|
use first time. Assure that Reflection.java is in the same directory with |
||||
|
javacomplete.vim to be searched in autoload subdirectory of &rtp. |
||||
|
If no Reflection.class is generated, check that you have the write permission |
||||
|
in $HOME directory. |
||||
|
If a previous Reflection.java is not compatible with the new version |
||||
|
javacomplete.vim, please compile Reflection.java manually. |
||||
|
|
||||
|
============================================================================== |
||||
|
2. Usage *javacomplete-usage* |
||||
|
|
||||
|
You can use it like other omni-completion script. Many samples of input context |
||||
|
are gived in the following section. |
||||
|
|
||||
|
Make sure a JVM launcher (default 'java') can be searched in the PATH enviroment |
||||
|
variable, otherwise Use javacomplete#SetJVMLauncher() to specify one. See option |
||||
|
`javacomplete-launcher`. |
||||
|
|
||||
|
See FAQ in time if some problem occurs. When meeting other problems not |
||||
|
described in FAQ, you can contact with the auther by the following e-mail: |
||||
|
fangread@yahoo.com.cn |
||||
|
|
||||
|
2.1 Input contexts |javacomplete-contexts| |
||||
|
It recognize nearly all kinds of Primary Expressions (see langspec-3.0) |
||||
|
except for "Primary.new Indentifier". Casting conversion is also supported. |
||||
|
|
||||
|
Samples of input contexts are as following: (Note that '|' indicates cursor) |
||||
|
(1). after '.', list members of a class or a package |
||||
|
- package.| subpackages and classes of a package |
||||
|
- Type.| static members of the 'Type' class and "class" |
||||
|
- var.| or field.| members of a variable or a field |
||||
|
- method().| members of result of method() |
||||
|
- this.| members of the current class |
||||
|
- ClassName.this.| members of the qualified class |
||||
|
- super.| members of the super class |
||||
|
- array.| members of an array object |
||||
|
- array[i].| array access, return members of the element of array |
||||
|
- "String".| String literal, return members of java.lang.String |
||||
|
- int.| or void.| primitive type or pseudo-type, return "class" |
||||
|
- int[].| array type, return members of a array type and "class" |
||||
|
- java.lang.String[].| |
||||
|
- new int[].| members of the new array instance |
||||
|
- new java.lang.String[i=1][].| |
||||
|
- new Type().| members of the new class instance |
||||
|
- Type.class.| class literal, return members of java.lang.Class |
||||
|
- void.class.| or int.class.| |
||||
|
- ((Type)var).| cast var as Type, return members of Type. |
||||
|
- (var.method()).| same with "var.|" |
||||
|
- (new Class()).| same with "new Class().|" |
||||
|
|
||||
|
(2). after '(', list matching methods with parameters information. |
||||
|
- method(|) methods matched |
||||
|
- var.method(|) methods matched |
||||
|
- new ClassName(|) constructors matched |
||||
|
- this(|) constructors of current class matched |
||||
|
- super(|) constructors of super class matched |
||||
|
Any place between '(' and ')' will be supported soon. |
||||
|
Help information of javadoc is not supported yet. |
||||
|
|
||||
|
(3). after an incomplete word, list all the matched beginning with it. |
||||
|
- var.ab| subset of members of var beginning with `ab` |
||||
|
- ab| list of all maybes |
||||
|
|
||||
|
(4). import statement |
||||
|
- " import java.util.|" |
||||
|
- " import java.ut|" |
||||
|
- " import ja|" |
||||
|
- " import java.lang.Character.|" e.g. "Subset" |
||||
|
- " import static java.lang.Math.|" e.g. "PI, abs" |
||||
|
|
||||
|
(5). package declaration |
||||
|
- " package com.|" |
||||
|
|
||||
|
The above are in simple expression. |
||||
|
(6). after compound expression: |
||||
|
- PrimaryExpr.var.| |
||||
|
- PrimaryExpr.method().| |
||||
|
- PrimaryExpr.method(|) |
||||
|
- PrimaryExpr.var.ab| |
||||
|
e.g. |
||||
|
- "java.lang . System.in .|" |
||||
|
- "java.lang.System.getenv().|" |
||||
|
- "int.class.toString().|" |
||||
|
- "list.toArray().|" |
||||
|
- "new ZipFile(path).|" |
||||
|
- "new ZipFile(path).entries().|" |
||||
|
|
||||
|
(7). Nested expression: |
||||
|
- "System.out.println( str.| )" |
||||
|
- "System.out.println(str.charAt(| )" |
||||
|
- "for (int i = 0; i < str.|; i++)" |
||||
|
- "for ( Object o : a.getCollect| )" |
||||
|
|
||||
|
|
||||
|
2.2 Kind letter *javacomplete-kindletter* |
||||
|
|
||||
|
A single letter indicates the kind of compeltion item. These kinds are: |
||||
|
+ ctor |
||||
|
v local variable or parameter |
||||
|
f nonstatic field |
||||
|
F static field |
||||
|
m nonstatic method |
||||
|
M static method |
||||
|
P package |
||||
|
C class type |
||||
|
I interface type |
||||
|
|
||||
|
2.3 Options *javacomplete-options* |
||||
|
|
||||
|
1. Set java compiler (default 'javac') using the following function: |
||||
|
javacomplete#SetCompiler('javac') *javacomplete-compiler* |
||||
|
|
||||
|
2. Set java launcher (default 'java') using the following function: |
||||
|
javacomplete#SetJVMLauncher('java') *javacomplete-launcher* |
||||
|
|
||||
|
3. Set classpath using the following function: > |
||||
|
javacomplete#AddClassPath('jarfile_or_classes_path') |
||||
|
javacomplete#DelClassPath('jarfile_or_classes_path') |
||||
|
javacomplete#SetClassPath('semicolon_separated_string') |
||||
|
< |
||||
|
Another two variables will be used if they are existing: |
||||
|
|g:java_classpath| global classpath |
||||
|
|b:classpath| associated with current buffer |
||||
|
In one sense, s:classpath is like a classpath option for a PROJECT. |
||||
|
If some of them are body set, the priority of these variables is: |
||||
|
first, b:classpath first, |
||||
|
second, s:classpath |
||||
|
third, g:java_classpath |
||||
|
last, $CLASSPATH |
||||
|
|
||||
|
4. Set sourcepath using the following function: > |
||||
|
javacomplete#AddSourcePath('sources_file_path') |
||||
|
javacomplete#DelSourcePath('sources_file_path') |
||||
|
javacomplete#SetSourcePath('sources_file_path') |
||||
|
|
||||
|
5. Set option for using JDK1.1 if you meet the problem described in FAQ 3: > |
||||
|
javacomplete#UseJDK11() |
||||
|
|
||||
|
6. Set methods to search declaration: > |
||||
|
" 1 - by builtin searchdecl(), quickest but inaccurate in many cases. |
||||
|
" 2 - by special Searchdecl(), work NOT WELL YET. |
||||
|
" 4 - by java_parser, slowest but accurate in most cases. Not for JSP. |
||||
|
javacomplete#SetSearchdeclMethod() |
||||
|
|
||||
|
2.4 Commands *javacomplete-commands* |
||||
|
|
||||
|
============================================================================== |
||||
|
3. Java parser in Vim *javacomplete-parser* |
||||
|
|
||||
|
3.1 Abstract Syntax Tree *javacomplete-ast* |
||||
|
|
||||
|
3.2 Global Constants *javacomplete-constants* |
||||
|
|
||||
|
3.3 Parsing Functions *javacomplete-functions* |
||||
|
|
||||
|
3.4 Sample Codes *javacomplete-sample* |
||||
|
This parser can be a good candidate for anyone who needs a java parser to get |
||||
|
a abstract syntax tree for many use. The following are sample codes: > |
||||
|
|
||||
|
" NOTE: The script contains a single parser instance. You cannot create |
||||
|
" another parser! The only way to parse another JAVA code is reset the |
||||
|
" parser by calling java_parser#InitParser(). |
||||
|
|
||||
|
" 1. Initialize the parser |
||||
|
" for a code snippet, |
||||
|
call java_parser#InitParser(['for (int i = 0; i < N; i++) {', '', '}']) |
||||
|
" or for the current buffer, |
||||
|
call java_parser#InitParser(getline('^', '$')) |
||||
|
" or for a whole source file |
||||
|
call java_parser#InitParser(readfile('java/util/Arrays.java')) |
||||
|
|
||||
|
" 2. Get the result tree |
||||
|
call java_parser#compilationUnit() |
||||
|
" or others according to the input code |
||||
|
call java_parser#expression() |
||||
|
call java_parser#block() |
||||
|
call java_parser#statement() |
||||
|
|
||||
|
" 3. Use the tree as you like |
||||
|
|
||||
|
" 4. The default scan strategy is scanning only sklenton. |
||||
|
" You can change it by set the option 'scanStrategy'. |
||||
|
" The values for 'scanStrategy' option are: |
||||
|
" 0 - only class members when parse full file; |
||||
|
" 1 - keep statement as a whole string; |
||||
|
" 2 - all |
||||
|
call java_parser#InitParser(getline('^', '$'), {'scanStrategy': 2}) |
||||
|
|
||||
|
" 5. I recommend that keeping scanStrategy as default. |
||||
|
" If you want to parse a code snippet such as a method body of the whole |
||||
|
" file, you can call java_parser#GotoPosition() to go to what you are going |
||||
|
" to start parsing. |
||||
|
" Then, call java_parser#block(), java_parser#statement() or |
||||
|
" java_parser#expression() to parse the smaller snippet. |
||||
|
" NOTE: This way will keep the result tree reserved. |
||||
|
call java_parser#GotoPosition(def.body.pos) |
||||
|
call java_parser#block() |
||||
|
|
||||
|
============================================================================== |
||||
|
4. FAQ *javacomplete-faq* |
||||
|
|
||||
|
(1). When you meets the following problem: > |
||||
|
omni-completion error: Exception in thread "main" |
||||
|
java.lang.NoClassDefFoundError: Reflection |
||||
|
It is Reflection.class not found in autoload directory or $HOME that cause |
||||
|
this problem. |
||||
|
There are several reasons causing this problem: |
||||
|
o No compiler. Use javacomplete#SetCompiler() to specify one. |
||||
|
o No write permission for $HOME directory. |
||||
|
|
||||
|
(2). Reflection.java should be searched in autoload subdirectory of &rtp. |
||||
|
Reflection.class should be searched in $HOME or autoload subdirectory of &rtp. |
||||
|
If not found, javacomplete try to compile it and place the generated class |
||||
|
file in $HOME. |
||||
|
|
||||
|
(3). A error when using JDK1.1: |
||||
|
Unable to initialize threads: cannot find class java/lang/Thread |
||||
|
When I tested JDK1.1.8 on Windows XP, I found -classpath options cause it. |
||||
|
There are two way to avoid it is: |
||||
|
o Add the runtime classes to classpath, like |
||||
|
"${JDK118}\classes;${JDK118}\lib\classes.zip;${JDK118}\lib\classes.jar;" |
||||
|
o Add Reflection.class and others to the CLASSPATH enviroment variable. |
||||
|
And call javacomplete#UseJDK11() to set option. |
||||
|
|
||||
|
============================================================================== |
||||
|
5. Limitations *javacomplete-limitations* |
||||
|
|
||||
|
The embedded parser works a bit slower than expected. |
||||
|
|
||||
|
============================================================================== |
||||
|
6. History |
||||
|
|
||||
|
6.1 javacomplete *javacomplete-history* |
||||
|
|
||||
|
v0.77.1.2 |
||||
|
2011-01-30 Fixed to adapt globpath() (vim < 7.2). Patched by Sam Lidder. |
||||
|
|
||||
|
v0.77.1.1 |
||||
|
2010-11-12 Fixed to ignore the 'suffixes' and 'wildignore' options which |
||||
|
make Reflection.class can not be found. |
||||
|
|
||||
|
v0.77.1 |
||||
|
2007-09-19 Supported showing method parameters information in any place |
||||
|
between parenthesises. |
||||
|
|
||||
|
v0.77 |
||||
|
2007-09-19 bug fix |
||||
|
2007-09-18 Added GetCurrentFileKey() avoid empty key of s:files for current buffer. |
||||
|
2007-09-16 Use a new strategy for searching inherited members. |
||||
|
2007-09-11 |
||||
|
- Supported new contexts "jav|", "var|", just after an incomplete word. |
||||
|
- Supported new context "abs(|)", a imported static method. |
||||
|
2007-09-10 |
||||
|
- Improved FoundClassDeclaration() |
||||
|
- Fixed bug calling cursor(0, 0) |
||||
|
2007-09-09 Rewrote DoGetClassInfo(), GetFQN() and IsFQN()¡£ |
||||
|
2007-09-08 Fixed a bug when merging superclass's members |
||||
|
2007-09-05 -- 07 |
||||
|
- Improved s:MergeLines() and s:ExtractCleanExpr(). |
||||
|
- Rewrote CompleteAfterDot(). Added ParseExpr(). Removed s:GetNextSubexprType() |
||||
|
- Supported accessible static imported members. |
||||
|
- Supported accessible inherited members. |
||||
|
|
||||
|
2007-09-04 Used b:changedtick and getftime() to check buffer (or other file) for changing. |
||||
|
2007-09-01 Supported not-file-name toplevel or static member class in source files. |
||||
|
|
||||
|
v0.76.8 |
||||
|
2007-08-30 |
||||
|
- Created the s:TreeVisitor to search type or symbol names. |
||||
|
- Supported local and anonymous class. |
||||
|
|
||||
|
2007-08-29 |
||||
|
- Supported appending automatically classpath under WEB-INF for jsp files. |
||||
|
|
||||
|
v0.76.7 |
||||
|
2007-08-28 |
||||
|
- Fixed case of "new java.util.zip.ZipFile().|" |
||||
|
- Improved process of type arguments and method parameters. JAVA5+ |
||||
|
- Reorganize codes in javacomplete#Complete() |
||||
|
- Added CONTEXT_NEED_TYPE, removed CONTEXT_INCOMPLETE_WORD |
||||
|
|
||||
|
2007-08-24 Add Context types for type declaration: CONTEXT_NEED_TYPE |
||||
|
|
||||
|
v0.76.6 |
||||
|
2007-08-23 Improved GetStatement() and related. Bug fixed. |
||||
|
|
||||
|
v0.76.5 |
||||
|
2007-08-21 |
||||
|
- Fixed bug: "foo().|", "getFoo().foo().|", |
||||
|
"for (Enumeration entries = ; entries.|; )". |
||||
|
- Supported input contexts: "((Object)o).|", "((Object)o).getClass().|", |
||||
|
"new ZipFile(path).|", "(new String().)|". |
||||
|
|
||||
|
v0.76.4 |
||||
|
2007-08-17 |
||||
|
- Improved input contexts: "int.class.toString().|", "list.toArray().|". |
||||
|
- Fixed recognizing "this(|)", "method1(|)" |
||||
|
- Added the 'kind' letter to distinguish between classes and packages. |
||||
|
2007-08-14 |
||||
|
- Support accessible nested classes. |
||||
|
- Support import static members and import accessible nested classes. |
||||
|
2007-08-11 |
||||
|
- Fixed a bug when Reflection.java is in the path which contains space. |
||||
|
- Improved process of this and super in JSP. |
||||
|
- Fixed an severe bug parsing current jsp file. |
||||
|
|
||||
|
v0.76.3 |
||||
|
2007-08-10 |
||||
|
- Add an option 'searchdecl' set by javacomplete#SetSearchdeclMethod(). |
||||
|
- Make an improvement for jsp file. |
||||
|
- Clear cache when set options affecting classpath. |
||||
|
- Improved DoGetPackageList() and s:GenerateImports(). |
||||
|
- Replace codes searching list of string with index(). |
||||
|
|
||||
|
v0.76.2 |
||||
|
2007-08-08 |
||||
|
- Fix failing to list members of nested class. |
||||
|
- Combine members of local packages and loadable packages. |
||||
|
- Add quick recognition of package or import. |
||||
|
2007-08-06 Add inherited fields and methods to local class. |
||||
|
|
||||
|
v0.76.1 |
||||
|
2007-08-04 |
||||
|
- Fix using a: in javacomplete#SetClassPath() |
||||
|
- Fix a bug in javacomplete#GetClassPath() |
||||
|
|
||||
|
v0.76 2007-08-04 |
||||
|
2007-08-04 |
||||
|
- Fix a infinite loop bug in s:GetMatchedIndexEx() |
||||
|
- Fix that array type not recognised in compound expression. |
||||
|
- Add a option for JDK1.1. See FAQ 3. |
||||
|
2007-08-03 |
||||
|
- Improve for 'this' or 'super'. |
||||
|
- Support searching toplevel class in sourcepath. |
||||
|
- Clean |
||||
|
2007-08-02 |
||||
|
- Improve the process of checking a class in one of packages. |
||||
|
2007-08-01 |
||||
|
- Add Searchdecl() using java_parser.vim to provide quick information. |
||||
|
- Supports input context: "StringLiteral".|, "int.|", "void.|" |
||||
|
2007-07-28 |
||||
|
- Automatcally compile Reflection.java and place it to $HOME. |
||||
|
- Add option 'javacompiler', default 'javac' |
||||
|
- Add option 'java', default 'java' |
||||
|
|
||||
|
v0.75 2007-02-13 |
||||
|
- Add java_parser.vim. |
||||
|
- Add b:sourcepath option. |
||||
|
- Improve recognition of classes defined in current buffer or in source path. |
||||
|
- Support generating class information from tags instead of returning list directly. |
||||
|
|
||||
|
v0.74 2007-02-03 |
||||
|
- Support jre1.2 (and above). |
||||
|
- Support input context like "boolean.class.|" |
||||
|
- Handle java primitive types like 'int'. |
||||
|
|
||||
|
v0.73 2007-02-01 |
||||
|
- Fix bug that CLASSPATH not used when b:classpath or g:java_classpath not set. |
||||
|
- Fix bug that call filter() without making a copy for incomplete. |
||||
|
- Improve recognition of declaration of this class |
||||
|
|
||||
|
v0.72 2007-01-31 Handle nested expression. |
||||
|
v0.71 2007-01-28 Add Basic support for class in current folder. |
||||
|
v0.70 2007-01-27 Complete the reflection part. |
||||
|
v0.60 2007-01-25 Design TClassInfo, etc. |
||||
|
v0.50 2007-01-21 Use java and Reflection.class directly. |
||||
|
|
||||
|
|
||||
|
6.2 Parser *java-parser-history* |
||||
|
|
||||
|
v0.67 |
||||
|
2007-09-11 Append a error string to imported qid when error occurs. |
||||
|
2007-09-10 Improved regexp constants. |
||||
|
2007-09-07 Fixed type2Str(). Removed qualident2Str(). |
||||
|
|
||||
|
v0.66.1 08-30 Changed classCreatorRest(). |
||||
|
v0.66 08-27 Minor changes |
||||
|
|
||||
|
v0.65 |
||||
|
2007-08-23 |
||||
|
- Improved s:scanComment(), s:Strpart(), s:String2Flags(). |
||||
|
- Improved recognizing methods, ctors, and variable declarators declared in most common form. |
||||
|
- Added s:optFinalParameter(), s:methodDeclaratorRest_opt(). |
||||
|
- Removed s:GetLine() and s:GetCol(). |
||||
|
- Rewrote binary functions. |
||||
|
|
||||
|
v0.64 |
||||
|
2007-08-21 |
||||
|
- Added quick recognizing fields or methods declared in most common form. |
||||
|
- Optimized code: s:modeAndEXPR(), formalParameter(), and others. |
||||
|
|
||||
|
v0.63 |
||||
|
2007-08-10 |
||||
|
- Removed the unclear s:tokens and s:modifier_keywords. |
||||
|
- Add java_parser#GetSnapshot() and java_parser#Restore(). |
||||
|
2007-08-09 Fixed a bug when no top level class defined |
||||
|
|
||||
|
v0.62 2007-08-08 |
||||
|
2007-08-08 Fix values in s:Flags and s:modifiersOpt() and the related. |
||||
|
2007-08-07 Optimize code of scanDoubleQuote() and importDeclaration(). |
||||
|
|
||||
|
v0.61 2007-08-04 |
||||
|
2007-08-01 Fix a bug typetag(). return a:token -> return tolower(a:token) |
||||
|
2007-07-31 |
||||
|
- Rename all script functions matching "s:Java_\(\i\+\)" to "s:\1". |
||||
|
- Change s:EOI = '' |
||||
|
- Use get() instead of s:GetOption(). Remove it. |
||||
|
- Use repeat() instead of s:PrependChar(). Remove it. |
||||
|
- Improve scanChar() |
||||
|
|
||||
|
v0.60 2007-07-31 Now it nearly is a complete parser and support Java5,6. |
||||
|
And tested correctly on all java files in jdk6 src.zip. |
||||
|
2007-07-19 Support new language features in java 5 and above. |
||||
|
2007-07-25 Add supports for parsing statement, block or expression |
||||
|
2007-07-28 Place it to autoload directory. |
||||
|
2007-07-30 Clean this script. |
||||
|
|
||||
|
v0.51 2007-02-13 Optimize several scan function. |
||||
|
v0.50 2007-02-10 Complete the skeleton. |
||||
|
|
||||
|
|
||||
|
6.3 Reflection.java *javacomplete-reflection* |
||||
|
|
||||
|
v0.77 |
||||
|
2007-09-14 Improved generating information of all packages in jar files. |
||||
|
2007-09-06 |
||||
|
- Improved getting paths of all system jar files for different JDKs |
||||
|
in different platforms. |
||||
|
2007-08-14 Major improvement. Support nontoplevel classes. |
||||
|
|
||||
|
v0.76.3 |
||||
|
2007-08-09 Redefined '-P' option for returning all packages and subpackages info in one time. |
||||
|
|
||||
|
v0.76.2 |
||||
|
2007-08-06 Return a modifier value as a string because it more than 32bit. |
||||
|
|
||||
|
v0.76 |
||||
|
2007-08-04 Support checking and reading package members for '-E'. |
||||
|
2007-08-02 |
||||
|
- Add an option '-E'. |
||||
|
- Use ZipFile and ZipEntry instead of JarFile and JarEntry, |
||||
|
so that it can be compiled by and run on JDK1.1 and above. |
||||
|
v0.7 2007-02-17 |
||||
|
|
||||
|
============================================================================== |
||||
|
7. Todo *javacomplete-todo* |
||||
|
|
||||
|
- Improve performance of the embedded parser. Incremental parser. |
||||
|
- Add quick information using balloonexpr, ballooneval, balloondelay. |
||||
|
- Add javadoc |
||||
|
- Give a hint for class name conflict in different packages. |
||||
|
- Support parameter information for template |
||||
|
|
||||
|
============================================================================== |
||||
|
8. Thanks *javacomplete-thanks* |
||||
|
* Bram Moolenaar and all Vim contributors for Vim |
||||
|
* The insenvim project |
||||
|
* The javac and gjc sources |
||||
|
* All of you for using this script :) |
||||
|
|
||||
|
* For help, documentation, bug report : |
||||
|
Martin Stubenschrott author of IComplete |
||||
|
Vissale NEANG author of OmniCppComplete |
||||
|
David Fishburn author of SQLComplete and others |
||||
|
Nico Weber testing on the Mac |
||||
|
Thomas Link testing on cygwin+bash |
||||
|
Zhixing Yu |
||||
|
* For the bug of 'wildignore' options |
||||
|
Rodrigo Rosenfeld Rosas |
||||
|
Alexandru Mo?oi |
||||
|
|
||||
|
FeedBack: |
||||
|
Any problem, bug or suggest are welcome to send to fangread@yahoo.com.cn |
||||
|
|
||||
|
============================================================================== |
||||
|
vim:tw=78:ts=8:ft=help:norl: |
||||
@ -0,0 +1,254 @@ |
|||||
|
*solarized.vim* for Vim version 7.3 or newer. Modified: 2011 May 05 |
||||
|
|
||||
|
|
||||
|
Solarized Vim Colorscheme by Ethan Schoonover ~ |
||||
|
|
||||
|
Solarized Colorscheme *solarized* |
||||
|
*solarized-help* |
||||
|
*solarized-colors* |
||||
|
*solarized-colorscheme* |
||||
|
*vim-colors-solarized* |
||||
|
|
||||
|
Solarized is a carefully designed selective contrast colorscheme with dual |
||||
|
light and dark modes that runs in both GUI, 256 and 16 color modes. |
||||
|
|
||||
|
See the homepage at http://ethanschoonover.com/solarized for screenshots and |
||||
|
details. |
||||
|
|
||||
|
0. Install |solarized-install| |
||||
|
1. Solarized Menu |solarized-menu| |
||||
|
2. Options |solarized-options| |
||||
|
3. Toggle Background |solarized-togglebg| |
||||
|
4. Terminal Issues |solarized-term| |
||||
|
|
||||
|
============================================================================== |
||||
|
0. Install *solarized-install* |
||||
|
|
||||
|
Note: I recommend using Tim Pope's pathogen plugin to install this |
||||
|
colorscheme. See https://github.com/tpope/vim-pathogen . If you've installed |
||||
|
pathogen properly you can install Solarized with the following commands, |
||||
|
followed by the .vimrc configuration below. |
||||
|
|
||||
|
$ cd ~/.vim/bundle |
||||
|
$ git clone https://github.com/altercation/vim-colors-solarized.git |
||||
|
|
||||
|
If you aren't using pathogen, you can use the following three steps to install |
||||
|
Solarized: |
||||
|
|
||||
|
1. Download the solarized distribution (available on the homepage above) |
||||
|
and unarchive the file. |
||||
|
|
||||
|
2. Move `solarized.vim` to your `.vim/colors` directory. |
||||
|
|
||||
|
3. Move each of the files in each subdirectories to the corresponding .vim |
||||
|
subdirectory (e.g. autoload/togglebg.vim goes into your .vim/autoload |
||||
|
directory as .vim/autoload/togglebg.vim). |
||||
|
|
||||
|
|
||||
|
After installation, place the following lines in your .vimrc: |
||||
|
|
||||
|
syntax enable |
||||
|
set background=dark |
||||
|
colorscheme solarized |
||||
|
|
||||
|
or, for the light background mode of Solarized: |
||||
|
|
||||
|
syntax enable |
||||
|
set background=light |
||||
|
colorscheme solarized |
||||
|
|
||||
|
============================================================================== |
||||
|
1. Solarized Menu *solarized-menu* |
||||
|
|
||||
|
Solarized makes available a menu when used in Vim GUI mode (gvim, macvim). |
||||
|
This menu includes many of the options detailed below so that you can test out |
||||
|
different values quickly without modifying your .vimrc file. If you wish to |
||||
|
turn off this menu permanently, simply place the following line in your .vimrc |
||||
|
above the "colorscheme solarized" line. |
||||
|
|
||||
|
let g:solarized_menu=0 |
||||
|
|
||||
|
============================================================================== |
||||
|
2. Toggle Background *solarized-togglebg* |
||||
|
*toggle-bg* *togglebg* |
||||
|
*toggle-background* |
||||
|
|
||||
|
Solarized comes with Toggle Background, a simple plugin to switch between |
||||
|
light and dark background modes and reset the colorscheme. This is most useful |
||||
|
for colorschemes that support both light and dark modes and in terminals or |
||||
|
gui vim windows where the background will be properly set. |
||||
|
|
||||
|
Toggle Background can be accessed by: |
||||
|
|
||||
|
* the Solarized menu (in Vim gui mode) |
||||
|
* the Window menu (in Vim gui mode, even if the Solarized menu is off) |
||||
|
* the "yin/yang" toolbar button (in Vim gui mode) |
||||
|
* the default mapping of <F5> |
||||
|
* custom key mapping you set in your .vimrc (see below) |
||||
|
* command line via ":ToggleBG" (no quotes) |
||||
|
|
||||
|
Toggle Background starts with a default mapping to function key <F5>. If you |
||||
|
are already using this in a mapping, Toggle Background will not map itself to |
||||
|
a default and you will have to map it manually in your .vimrc file, or |
||||
|
remove/change your existing <F5> mapping to another value. To customize the |
||||
|
keyboard mapping in your .vimrc file, use the following line, changing the |
||||
|
"<F5>" value to the key or key combination you wish to use: |
||||
|
|
||||
|
call togglebg#map("<F5>") |
||||
|
|
||||
|
Note that you'll want to use a single function key or equivalent if you want |
||||
|
the plugin to work in all modes (normal, insert, visual). |
||||
|
|
||||
|
When using the plugin during normal, visual, or insert mode, there should be |
||||
|
no interruption in workflow. However, if you activate the plugin during |
||||
|
REPLACE mode, you will switch to standard insert mode (you will leave the |
||||
|
overwrite replace mode). |
||||
|
|
||||
|
============================================================================== |
||||
|
3. Solarized Terminal Issues *solarized-term* |
||||
|
|
||||
|
If you are going to use Solarized in Terminal mode (i.e. not in a GUI version |
||||
|
like gvim or macvim), **please please please** consider setting your terminal |
||||
|
emulator's colorscheme to used the Solarized palette. I've included palettes |
||||
|
for some popular terminal emulator as well as Xdefaults in the official |
||||
|
Solarized download available from the Solarized homepage listed at the top of |
||||
|
this help document. If you use Solarized *without* these colors, Solarized |
||||
|
will need to be told to degrade its colorscheme to a set compatible with the |
||||
|
limited 256 terminal palette (whereas by using the terminal's 16 ansi color |
||||
|
values, you can set the correct, specific values for the Solarized palette). |
||||
|
|
||||
|
If you do use the custom terminal colors, solarized.vim should work out of |
||||
|
the box for you. If you are using a terminal emulator that supports 256 |
||||
|
colors and don't want to use the custom Solarized terminal colors, you will |
||||
|
need to use the degraded 256 colorscheme. To do so, simply add the following |
||||
|
line *before* the `colorschem solarized` line: |
||||
|
|
||||
|
let g:solarized_termcolors=256 |
||||
|
|
||||
|
Again, I recommend just changing your terminal colors to Solarized values |
||||
|
either manually or via one of the many terminal schemes available for import. |
||||
|
|
||||
|
============================================================================== |
||||
|
4. Solarized Options *solarized-options* |
||||
|
|
||||
|
|
||||
|
AUTOGENERATE OPTIONS |
||||
|
|
||||
|
You can easily modify and experiment with Solarized display options using the |
||||
|
Solarized menu when using Vim in gui mode. Once you have things set to your |
||||
|
liking, you can autogenerate the current option list in a format ready for |
||||
|
insertion into your .vimrc file using the Solarized menu "Autogenerate |
||||
|
Options" command or at the command line with: |
||||
|
|
||||
|
:SolarizedOptions |
||||
|
|
||||
|
|
||||
|
OPTION LIST |
||||
|
|
||||
|
Set these in your vimrc file prior to calling the colorscheme. |
||||
|
|
||||
|
option name default optional |
||||
|
------------------------------------------------ |
||||
|
g:solarized_termcolors= 16 | 256 |
||||
|
g:solarized_termtrans = 0 | 1 |
||||
|
g:solarized_degrade = 0 | 1 |
||||
|
g:solarized_bold = 1 | 0 |
||||
|
g:solarized_underline = 1 | 0 |
||||
|
g:solarized_italic = 1 | 0 |
||||
|
g:solarized_contrast = "normal"| "high" or "low" |
||||
|
g:solarized_visibility= "normal"| "high" or "low" |
||||
|
g:solarized_hitrail = 0 | 1 |
||||
|
g:solarized_menu = 1 | 0 |
||||
|
------------------------------------------------ |
||||
|
|
||||
|
|
||||
|
OPTION DETAILS |
||||
|
|
||||
|
------------------------------------------------ |
||||
|
g:solarized_termcolors= 256 | 16 *'solarized_termcolors'* |
||||
|
------------------------------------------------ |
||||
|
The most important option if you are using vim in terminal (non gui) mode! |
||||
|
This tells Solarized to use the 256 degraded color mode if running in a 256 |
||||
|
color capable terminal. Otherwise, if set to `16` it will use the terminal |
||||
|
emulators colorscheme (best option as long as you've set the emulators colors |
||||
|
to the Solarized palette). |
||||
|
|
||||
|
If you are going to use Solarized in Terminal mode (i.e. not in a GUI |
||||
|
version like gvim or macvim), **please please please** consider setting your |
||||
|
terminal emulator's colorscheme to used the Solarized palette. I've included |
||||
|
palettes for some popular terminal emulator as well as Xdefaults in the |
||||
|
official Solarized download available from: |
||||
|
http://ethanschoonover.com/solarized . If you use Solarized without these |
||||
|
colors, Solarized will by default use an approximate set of 256 colors. It |
||||
|
isn't bad looking and has been extensively tweaked, but it's still not quite |
||||
|
the real thing. |
||||
|
|
||||
|
------------------------------------------------ |
||||
|
g:solarized_termtrans = 0 | 1 *'solarized_termtrans'* |
||||
|
------------------------------------------------ |
||||
|
If you use a terminal emulator with a transparent background and Solarized |
||||
|
isn't displaying the background color transparently, set this to 1 and |
||||
|
Solarized will use the default (transparent) background of the terminal |
||||
|
emulator. *urxvt* required this in my testing; iTerm2 did not. |
||||
|
|
||||
|
Note that on Mac OS X Terminal.app, solarized_termtrans is set to 1 by |
||||
|
default as this is almost always the best option. The only exception to this |
||||
|
is if the working terminfo file supports 256 colors (xterm-256color). |
||||
|
|
||||
|
------------------------------------------------ |
||||
|
g:solarized_degrade = 0 | 1 *'solarized_degrade'* |
||||
|
------------------------------------------------ |
||||
|
For test purposes only; forces Solarized to use the 256 degraded color mode |
||||
|
to test the approximate color values for accuracy. |
||||
|
|
||||
|
------------------------------------------------ |
||||
|
g:solarized_bold = 1 | 0 *'solarized_bold'* |
||||
|
------------------------------------------------ |
||||
|
------------------------------------------------ |
||||
|
g:solarized_underline = 1 | 0 *'solarized_underline'* |
||||
|
------------------------------------------------ |
||||
|
------------------------------------------------ |
||||
|
g:solarized_italic = 1 | 0 *'solarized_italic'* |
||||
|
------------------------------------------------ |
||||
|
If you wish to stop Solarized from displaying bold, underlined or |
||||
|
italicized typefaces, simply assign a zero value to the appropriate |
||||
|
variable, for example: `let g:solarized_italic=0` |
||||
|
|
||||
|
------------------------------------------------ |
||||
|
g:solarized_contrast = "normal"| "high" or "low" *'solarized_contrast'* |
||||
|
------------------------------------------------ |
||||
|
Stick with normal! It's been carefully tested. Setting this option to high |
||||
|
or low does use the same Solarized palette but simply shifts some values up |
||||
|
or down in order to expand or compress the tonal range displayed. |
||||
|
|
||||
|
------------------------------------------------ |
||||
|
g:solarized_visibility = "normal"| "high" or "low" *'solarized_visibility'* |
||||
|
------------------------------------------------ |
||||
|
Special characters such as trailing whitespace, tabs, newlines, when |
||||
|
displayed using ":set list" can be set to one of three levels depending on |
||||
|
your needs. |
||||
|
|
||||
|
------------------------------------------------ |
||||
|
g:solarized_hitrail = 0 | 1 *'solarized_hitrail'* |
||||
|
------------------------------------------------ |
||||
|
Visibility can make listchar entities more visible, but if one has set |
||||
|
cursorline on, these same listchar values standout somewhat less due to the |
||||
|
background color of the cursorline. g:solarized_hitrail enables highlighting |
||||
|
of trailing spaces (only one of the listchar types, but a particularly |
||||
|
important one) while in the cursoline in a different manner in order to make |
||||
|
them more visible. This may not work consistently as Solarized is using |
||||
|
a pattern match than can be overridden by a more encompassing syntax-native |
||||
|
match such as a comment line. |
||||
|
|
||||
|
|
||||
|
------------------------------------------------ |
||||
|
g:solarized_menu = 1 | 0 *'solarized_menu'* |
||||
|
------------------------------------------------ |
||||
|
Solarized includes a menu providing access to several of the above |
||||
|
display related options, including contrast and visibility. This allows |
||||
|
for an easy method of testing different values quickly before settling |
||||
|
on a final assignment for your .vimrc. If you wish to turn off this menu, |
||||
|
assign g:solarized_menu a value of 0. |
||||
|
|
||||
|
|
||||
|
vim:tw=78:noet:ts=8:ft=help:norl: |
||||
@ -0,0 +1,51 @@ |
|||||
|
'solarized_bold' solarized.txt /*'solarized_bold'* |
||||
|
'solarized_contrast' solarized.txt /*'solarized_contrast'* |
||||
|
'solarized_degrade' solarized.txt /*'solarized_degrade'* |
||||
|
'solarized_hitrail' solarized.txt /*'solarized_hitrail'* |
||||
|
'solarized_italic' solarized.txt /*'solarized_italic'* |
||||
|
'solarized_menu' solarized.txt /*'solarized_menu'* |
||||
|
'solarized_termcolors' solarized.txt /*'solarized_termcolors'* |
||||
|
'solarized_termtrans' solarized.txt /*'solarized_termtrans'* |
||||
|
'solarized_underline' solarized.txt /*'solarized_underline'* |
||||
|
'solarized_visibility' solarized.txt /*'solarized_visibility'* |
||||
|
before solarized.txt /*before* |
||||
|
java-parser-history javacomplete.txt /*java-parser-history* |
||||
|
javacomplete-ast javacomplete.txt /*javacomplete-ast* |
||||
|
javacomplete-commands javacomplete.txt /*javacomplete-commands* |
||||
|
javacomplete-compiler javacomplete.txt /*javacomplete-compiler* |
||||
|
javacomplete-constants javacomplete.txt /*javacomplete-constants* |
||||
|
javacomplete-download javacomplete.txt /*javacomplete-download* |
||||
|
javacomplete-faq javacomplete.txt /*javacomplete-faq* |
||||
|
javacomplete-features javacomplete.txt /*javacomplete-features* |
||||
|
javacomplete-functions javacomplete.txt /*javacomplete-functions* |
||||
|
javacomplete-history javacomplete.txt /*javacomplete-history* |
||||
|
javacomplete-install javacomplete.txt /*javacomplete-install* |
||||
|
javacomplete-kindletter javacomplete.txt /*javacomplete-kindletter* |
||||
|
javacomplete-launcher javacomplete.txt /*javacomplete-launcher* |
||||
|
javacomplete-limitations javacomplete.txt /*javacomplete-limitations* |
||||
|
javacomplete-options javacomplete.txt /*javacomplete-options* |
||||
|
javacomplete-overview javacomplete.txt /*javacomplete-overview* |
||||
|
javacomplete-parser javacomplete.txt /*javacomplete-parser* |
||||
|
javacomplete-reflection javacomplete.txt /*javacomplete-reflection* |
||||
|
javacomplete-requirements javacomplete.txt /*javacomplete-requirements* |
||||
|
javacomplete-sample javacomplete.txt /*javacomplete-sample* |
||||
|
javacomplete-thanks javacomplete.txt /*javacomplete-thanks* |
||||
|
javacomplete-todo javacomplete.txt /*javacomplete-todo* |
||||
|
javacomplete-usage javacomplete.txt /*javacomplete-usage* |
||||
|
javacomplete.txt javacomplete.txt /*javacomplete.txt* |
||||
|
solarized solarized.txt /*solarized* |
||||
|
solarized-colors solarized.txt /*solarized-colors* |
||||
|
solarized-colorscheme solarized.txt /*solarized-colorscheme* |
||||
|
solarized-help solarized.txt /*solarized-help* |
||||
|
solarized-install solarized.txt /*solarized-install* |
||||
|
solarized-menu solarized.txt /*solarized-menu* |
||||
|
solarized-options solarized.txt /*solarized-options* |
||||
|
solarized-term solarized.txt /*solarized-term* |
||||
|
solarized-togglebg solarized.txt /*solarized-togglebg* |
||||
|
solarized.vim solarized.txt /*solarized.vim* |
||||
|
toggle-background solarized.txt /*toggle-background* |
||||
|
toggle-bg solarized.txt /*toggle-bg* |
||||
|
togglebg solarized.txt /*togglebg* |
||||
|
urxvt solarized.txt /*urxvt* |
||||
|
vim-colors-solarized solarized.txt /*vim-colors-solarized* |
||||
|
without solarized.txt /*without* |
||||
Loading…
Reference in new issue