从命令行打开 JEdit JDiff-Plugin

发布于 2024-10-01 14:42:51 字数 101 浏览 0 评论 0原文

我使用 JEdit 和 JDiff 插件进行文件比较。现在我想使用命令行参数从另一个工具打开 JDiff 插件。这可能吗?到目前为止,我只能在 JEdit 中打开我想要比较的 2 个文件。

I am using JEdit with the JDiff plugin for file compares. Now I would like to open the JDiff plugin 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

述情 2024-10-08 14:42:51

这几乎有效......我只是无法让宏在加载其他文件后执行...

将此宏放入文件中。

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

如果您使用的是 Linux 或 Mac,请将其放入 ~/.jedit/macros/split_wins_and_jdiff.bsh 中。如果您使用的是 Windows,请将其放在某个地方...(c:/split_wins_and_jdiff.bsh 也许?)

然后运行:

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

问题是,我无法让宏在之后运行 初始化,因此该方法会导致错误。如果您可以执行两步过程,那么您可以执行以下操作:

安装

  • 在宏区域中安装上述宏(对于 Linux,~/.jedit/macros, mac)
  • 创建宏的快捷方式:
    • 点击实用程序 ->全局选项
    • 在左侧面板中,选择“快捷方式”
    • 在过滤器中输入“split_wins_and_jdiff”
    • 双击“split_wins_and_jdiff”右侧和“主快捷方式”下方的单元格
    • 执行命令序列(我的宏命令序列始终以 ctrl+m 开头。我认为这是 JEdit 约定... )
    • 点击“确定”按钮保存快捷方式

如何 使用

每当您想要快速 jdiff 两个文件时 :
* 打开这两个文件:

java -jar jedit.jar -noserver  -norestore file_on_left file_on_right 
  • 在 jedit 加载后,立即使用您创建的快捷方式运行宏。

没有宏

顺便说一句,如果您为 JDiff 创建快捷方式,则无需宏即可完成所有这些操作(对我来说是 ctrl+shift+ d, d)

  • 打开两个文件:

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

  • 垂直分割屏幕

    ctrl+3

  • 右屏幕(现在在分割后被选中),使用 ctrl+page-up 循环到另一个缓冲区。

  • 使用快捷键打开 JDiff(对我来说 ctrl+shift+dd

) 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.

傾旎 2024-10-08 14:42:51

我意识到这是一个老问题,但前几天我遇到了这个问题。我建立在运行豆壳脚本的想法之上,就像罗斯的回答一样。我相信我已经让一切正常工作(无需手动运行宏),并且我想在这里做出贡献来表示“感谢”引导我走向正确的方向。

这是我让 jEdit 从命令行进行 diff 的整个设置,其中包括使用 jEdit 作为Git 的“difftool”。

PS:我想让这是罗斯答案的后续,但我是新来的,并没有意识到我需要货币来评论答案。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文