使用IntelliJ来区分两个任意文件 [英] Using IntelliJ to diff two arbitrary files

查看:163
本文介绍了使用IntelliJ来区分两个任意文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的很喜欢IntelliJ diff工具。我想知道是否可以使用此工具来区分两个任意文件。即文件不在IntelliJ项目中。只需在文件系统中选择两个文件并区分它们?如果我想要区分两个字符串怎么样?在我的文本编辑器中,我只创建了两个新文档,粘贴文本并对其进行区分,然后在完成后不保存文件。这可能吗?

I'm really liking the IntelliJ diff tool. I'm wondering if it is possible to use this tool to diff two arbitrary files. I.e. files NOT in an IntelliJ project. Just pick two files in the file system and diff them? What about if I want to diff two strings? In my text editor, I'd just create two new documents, paste the text in and diff them, then not save the files when done. Is this possible?

谢谢

推荐答案

找到这个命令行:

在MacOSX上:( IDEA EAP 11)

/Applications/IntelliJ\ IDEA\ 11.app/Contents/MacOS/idea diff /Users/ben75/file1.txt /Users/ben75/file2.txt

在MacOSX上,当IDEA(11)打开时,它无法运行。

On MacOSX it can't run when IDEA (11) is open.

在Windows上:(IDEA EAP 12)

"C:\Program Files (x86)\JetBrains\IntelliJ IDEA 12.0\bin\idea.exe" diff C:\Users\ben75\file1.txt C:\Users\ben75\file2.txt

即使IDEA已经打开也会运行。

It runs even if IDEA is already open.

我在尝试时遇到麻烦比较没有扩展名的文件(或不匹配的扩展名)

I have trouble when trying to compare files with no extensions (or extensions that don't match )

直接来自IDEA(EAP 12)

不太容易,但是有效......

Not so easy, but it works...


  • 文件>打开...>选择file1.txt

  • 文件>打开...>选择file2.txt

  • 创建收藏夹列表并将这两个文件添加到此收藏夹列表中。
    (为此:ctrl +右键单击编辑器中的文件名选项卡>将
    添加到收藏夹>选择刚刚创建的收藏夹列表 - 参见屏幕截图)

  • 最后,打开收藏夹视图(Alt + 2或点击左侧或IDEA窗口)。

  • 选择两个文件

  • 右键单击:比较两个文件(或ctrl + D)

  • File > Open... > select "file1.txt"
  • File > Open... > select "file2.txt"
  • Create a "Favorite list" and add both files to this favorite list. (to do this : ctrl+right-click on file name tab in the editor > add to favorite > select the favorite list just created - see screenshot)
  • Finally, open the "Favorites" view (Alt+2 or click on it on the left or your IDEA windows).
  • Select both files
  • Right click : "compare two files" (or ctrl+D)

这篇关于使用IntelliJ来区分两个任意文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆