开发者

Open the JEdit JDiff-Plugin from the command line

开发者 https://www.devze.com 2023-01-25 03:35 出处:网络
I am using JEdit with the JDiff plugin for file compares. Now I would like to open the JDiff plugi开发者_C百科n from another tool using command line parameters. Is this possible? So far I was only abl

I am using JEdit with the JDiff plugin for file compares. Now I would like to open the JDiff plugi开发者_C百科n from another tool using command line parameters. Is this possible? So far I was only able to open the 2 files i want to compare in JEdit.


This almost works..... I just can't get the macro to execute after the other files are loaded...

Put this macro in a file.

view.splitVertically();
editPane.prevBuffer();
jdiff.DualDiff.toggleFor(view);

If you on Linux or Mac, put it in ~/.jedit/macros/split_wins_and_jdiff.bsh. If you're on Windows, put it someplace... ( c:/split_wins_and_jdiff.bsh maybe?)

Then run:

java -jar jedit.jar -noserver  -norestore  \
    -run=$HOME/.jedit/macros/split_wins_and_jdiff.bsh\
    file_on_left file_on_right

The problem is, I can't get the macro to run after initialization, so that method results in an error. If you're ok with doing a two step process, then you could do:

Setup

  • Install the above macro in your macros area ( ~/.jedit/macros for linux, mac)
  • Create a shortcut for the macro:
    • click Utilities -> Global Options
    • in panel on the left, select "Shortcuts"
    • in the filter, type "split_wins_and_jdiff"
    • double-click on the cell to the right of "split_wins_and_jdiff" and below "primary shortcut"
    • do a command sequence ( my macro command sequences always begin with ctrl+m. I think that is a JEdit convention... )
    • save shortcut by clicking the "Ok" buttons

How to Use

Whenever you want to quickly jdiff two files: * Open the two files:

java -jar jedit.jar -noserver  -norestore file_on_left file_on_right 
  • Right after jedit loads, run your macro with the shortcut you created.

Without Macros

Btw, you can do all this without the macro, if you create a shortcut for JDiff ( for me it is ctrl+shift+d, d)

  • Open the two files:

    java -jar jedit.jar -noserver -norestore file_on_left file_on_right

  • Split the screens vertically

    ctrl+3

  • On the right screen ( which is now selected after the split), cycle to the other buffer with ctrl+page-up.

  • Turn on JDiff with your shortcut ( for me ctrl+shift+d, d)

Creating macros in jedit is dead simple. You can simply record them and they'll popup in a new buffer where you can view the actual macro code. This is what I did to create the macro. Try exploring the macro menu and macro usage.


I realize this is an old question, but I ran into this the other day. I built on the idea of running a beanshell script like in Ross' answer. I believe I got everything to work (without having to manually run the macro), and thought I'd contribute here to say "thanks" for steering me in the right direction.

Here's my whole setup for getting jEdit to diff from the command line, and it includes using jEdit as the "difftool" for Git.

PS: I wanted to make this a follow-up to Ross' answer, but I'm new here, and didn't realize I needed currency to comment on an answer.

0

精彩评论

暂无评论...
验证码 换一张
取 消