--- /dev/null
+#!/bin/bash
+
+# mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving
+bindkey '^[^[[C' forward-word
+bindkey '^[^[[D' backward-word
+
+if [ -f "$HOME/.zshrc" ]; then
+ source "$HOME/.zshrc"
+ fi
+
+if [ -n "$JEDITERM_SOURCE" ]
+then
+ source $JEDITERM_SOURCE
+fi
\ No newline at end of file
}
try {
- URL resource = LocalTerminalDirectRunner.class.getClassLoader().getResource("jediterm-" + shellName + ".in");
+ String rcfile = "jediterm-" + shellName + ".in";
+ if ("zsh".equals(shellName)) {
+ rcfile = ".zshrc";
+ }
+ URL resource = LocalTerminalDirectRunner.class.getClassLoader().getResource(rcfile);
if (resource != null) {
URI uri = resource.toURI();
return uri.getPath();
if (rcFilePath != null &&
- shellIntegration &&
- (shellName.equals("bash") || shellName.equals("sh"))) {
- result.add("--rcfile");
- result.add(rcFilePath);
- int idx = command.indexOf("--rcfile");
- if (idx >= 0) {
- command.remove(idx);
- if (idx < command.size()) {
- envs.put("JEDITERM_SOURCE", command.get(idx));
- command.remove(idx);
- }
+ shellIntegration) {
+ if (shellName.equals("bash") || shellName.equals("sh")) {
+ addRcFileArgument(envs, command, result, rcFilePath, "--rcfile");
+ }
+ else if (shellName.equals("zsh")) {
+ envs.put("ZDOTDIR", new File(rcFilePath).getParent());
}
}
}
}
+ private static void addRcFileArgument(Map<String, String> envs,
+ List<String> command,
+ List<String> result,
+ String rcFilePath, String rcfileOption) {
+ result.add(rcfileOption);
+ result.add(rcFilePath);
+ int idx = command.indexOf(rcfileOption);
+ if (idx >= 0) {
+ command.remove(idx);
+ if (idx < command.size()) {
+ envs.put("JEDITERM_SOURCE", command.get(idx));
+ command.remove(idx);
+ }
+ }
+ }
+
private static boolean loginOrInteractive(List<String> command) {
return command.contains("-i") || command.contains("--login") || command.contains("-l");
}