4

I use jEdit as a text editor, because it's cross-platform, and has all the features I need (Java regular expressions, keystroke macros, etc). However, it's a pain to set up on a new computer, and to synchronise settings (keyboard bindings, file save options, etc).

Can anyone suggest a good way of doing this? Ideally it should synchronise in the background, perhaps writing to a Dropbox folder. I've had a look in the jEdit plugins, and there doesn't appear to be anything.

Thanks!

2
  • 1
    One thought is that you will eventually settle on a set of settings. You're not going to spend your entire career monkeying around with settings. Then your settings will be mostly static and you can just copy them around. Anyways, an alternative may be the dropbox solution. If you're on mac or linux, you can do a soft link to your dropbox destination like ln -s ~/Dropbox/jedit_settings ~/.jedit Commented Apr 13, 2016 at 23:57
  • True, but setting it up on a new computer is such a pain that I've made most of those changes separately on my laptop and work PC, and I would like to be sure that they're synchronised. I guess I can do that manually (especially now the properties files appear to be sorted in the latest version!), but I wondered if there was a more integrated way of doing it. Commented Apr 17, 2016 at 7:12

2 Answers 2

1

I use the following macro to clean up and zip my jEdit settings directory to my Google Drive directory on my Mac:

void delete(String name) {
  path = jEdit.getSettingsDirectory()+"/"+name;
  VFS vfs = VFSManager.getVFSForPath(path);
  session = vfs.createVFSSession(path,view);
  vfs._delete(session, path, view);
  if (session != null) vfs._endVFSSession(session,view);
}

runInSystemShell(view, "cd " + jEdit.getSettingsDirectory());

// clean up files
delete("abbrevs");  // I use SuperAbbrevs
delete("killring.xml");
delete("recent.xml");
delete("perspective.xml");
delete("activity.log");
delete("history");
delete("printspec");
delete("registers.xml");
delete("pluginMgr-Cached.xml.gz");
delete("macros" + File.separator + ".macroManagerCache");   // File.separator = System.getProperty("file.separator")
delete("server");
delete("jedit_quicknote.txt");  // or qn.txt
delete("mirrorList.xml");       // mirrorList can be updated by Options -> Plugin Manager

// clean up directories
delete("jars-cache");
delete("settings-backup");
delete("cache");
delete("DockableWindowManager");
delete("PluginManager.download");
delete("printspec");

runInSystemShell(view, "rm -f ~/Google\\ Drive/doc/jedit.zip; zip -r ~/Google\\ Drive/doc/jedit.zip * -x '*.DS_Store'");

Then I can run the following alias to unzip the settings on other machines:

alias je_sync="rm -rf ~/.jedit/*; unzip ~/Google\ Drive/doc/jedit.zip -d ~/.jedit/"
2
  • Looks really useful. I've been considering ways of doing something like that in a scripting language outside jEdit, but a macro seems a more integrated way of doing it. I won't be able to get to it until I've finished setting up the new Ubuntu on my laptop, but I'll give it a try. Thanks! Commented Apr 23, 2016 at 20:50
  • You are welcome! :) Btw, I deleted many "temporary" setting files that are not important to me. You may want to keep some of them, so please review and modify the macro before using it. See jedit.org/users-guide/settings-directory.html for more details about the setting directory.
    – AhLeung
    Commented Apr 23, 2016 at 21:15
0

There is no built-in or plugin way I'm aware of to synchronize jEdit settings. But everything should be stored in your settings directory. ("should" because some plugins might store stuff elsewhere, especially if it uses settings together with other ways to do stuff, like git or svn that store user credentials in ~/.subversion/ and so on. Where the settings directory lives depends on the OS you are using jEdit on if you do not use the -settings switch to start jEdit).

So to synchronize the settings, just synchronize the settings directory via some means like Google Drive, Box, Dropbox or anything else. You can even make jEdit directly use those directories with the -settings switch, e. g. if you are on an OS that does not properly support symlinks like Windows.

But be aware that there can arise serious problems or unexpected behaviour. E. g. you will also sync stuff like recent files, last window and dialog positions, last opened files, ...
And more importantly, jEdit currently does not behave too well if you run two instances in the same settings directory, this for sure also would cover cases where you sync the settings folder via some means.

One scenario that will happen if you use two jEdit instances (not windows, real instances, like opened with -noserver) on the same computer on the same settings directory and will for sure also happen with such a synced directory:

  • instance A starts running, reads the settings files and stores their last modification date
  • instance A writes configuration file Z and stores its last modification date
  • instance B starts running, reads the settings files and stores their last modification date
  • instance B writes configuration file Z and stores its last modification date
  • instance A wants to write configuration file Z, but sees that its last modification date is newer than what it remembered. It will give a warning to the log, but nothing more and will not save file Z anymore until restarted.

So if Z e. g. is the properties file, any settings changes done after this in instance A will just be lost and not saved. And this happens on a per-file basis, depending on which instance first writes a certain file after both instances were started, so some files may be locked by instance A, some by instance B which could further increase confusion.

So, if you are ok with syncing stuff like recent files, last open files, and other stuff with paths in it and so on and so on and you make sure that you will not use two jEdit instances on the same settings directory at the same time, it could be ok to just use something like Google Drive or alike.

Not the answer you're looking for? Browse other questions tagged or ask your own question.