Using IntelliJ to differentiate between two arbitrary files

I really like the IntelliJ diff tool. I am wondering if this tool can be used to distinguish between two arbitrary files. That is, the files are NOT in the IntelliJ project. Just select two files in the file system and separate them? And if I want to break two lines? In my text editor, I simply create two new documents, insert text and distinguish between them, and then do not save the files at the end. Is it possible?

thank

+44
intellij-idea diff
Jan 17 '13 at 19:20
source share
5 answers

Found this command line:

on MacOSX: (IDEA EAP 11)

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

On MacOSX, it cannot work when IDEA (11) is open.

on 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 

It works even if IDEA is already open.

I'm having trouble trying to compare files without extensions (or extensions that don't match)

Directly from IDEA (EAP 12)

Not so simple, but it works ...

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

add to favorites

+44
Jan 19 '13 at 8:32
source share

IntelliJ Idea 13 has a Compare to Clipboard feature. This function compares the current open file with the version that you copied to your clipboard. This is a great, easy way to easily compare and merge two files. It can also be used to compare two arbitrary blocks of code. I can’t understand why one block is working and the other is not? Use this feature.

This option is present in the View> Compare with clipboard section. I assigned a keyboard shortcut that is easy to remember to give me quick access to this feature.

View> Compare with Clipboard

+34
Jan 21 '14 at 23:42
source share

Select 2 files in the Project panel and press CTRL + D.

enter image description here

+22
Oct 24 '13 at 8:12
source share

Yes you can (of course, if we are talking about text files). But, probably, you will need to create some kind of project (only to open files there).

Then your steps will be as follows:

1) Add to the created project file No. 1 and file No. 2.

2) Open file # 1 in the editor

3) Right-click in the left menu (project file browser) in file No. 2 and find the menu item Compare File with Editor .

enter image description here

It's all. After p.3) the comparison windows will open.

+3
Jan 17 '13 at 19:53
source share

To compare two files that are both not part of the project, the following works for me in IntelliJ IDEA Ultimate 14.1.7:

  • Open the first file in the IDE (either by dragging it from Windows Explorer to a window or into a file / Open).
  • From the viewing menu, select "Compare with ..."
  • In the "Select Path" dialog box that appears, select the second file (either directly or by dragging it from Windows Explorer to the dialog box).

Then it opens in a traditional file comparison panel. If you try to edit one of the files, the usual dialog box “Are you sure you want to change the file that is not in your project” will appear in it, which can be accepted if this is what you are trying to do.

0
Nov 06 '17 at 17:12
source share



All Articles