How do I open a .diff file on a mac? - diff

I have a .diff file but I don't know how to open it. I trie using FileMerge but that doesn't give me an option to open a .diff file.
Any ideas? Thanks.

Diffs are just plain text. You should be able to open it with TextEdit or any other text editor. If you want syntax highlighting probably many of the fancier editors could do that. I just used Aquamacs Emacs to load a diff file and it provided some highlighting.
And if you want to ‘apply’ the diff to a file, use the patch command, like in SanHolo's answer.

Use patch from the command line, like you would on a Linux box.
patch original_file.c diff_file.diff
Edit:
I'm assuming that with "open" you mean to apply the diff file to the original. If you just want to take a look at the file, see Chris' answer.

Vim offers coloration for diff files. If you'd rather go graphical, use MacVim (which is free) or TextMate (not free).
TextMate
MacVim
Vim

Kompare opens .diff in convenient view

Related

Is there a way of opening a file from the integrated terminal into a specific editor in VS Code?

Following this similar question, it's possible to open a specific file from the integrated terminal via:
code -r <filename>
However, what if, in order to be more organized, I wished to open certain files in certain editors? This would be very useful for quickly creating certain types of boilerplate setups...
I'm guessing it could be something like this?
code -r --editor 1 <filename>
It's not possible yet, but it could be, you just need to upvote this issue I've created.

NerdTREE in VSCODE

In VIM there is a pluggin called NerdTREE that is to move between folders, I am looking for something similar for vscode, where I can move between files but with the keyboard.
As I write this, there is an extension available in VSCode with the same name you mention.
This recently released extension has only basic commands such as creating folders and files, moving between them, copying, pasting, renaming or opening a file.
Well, it also has very few configuration options so maybe that is discouraging, but in short I consider it a good alternative for the moment to have some of that vim pluggin, and maybe over time the developer will add new features.
Here is the repository of this extension so you can take a look at it: https://github.com/61130061/NERDTree

Automatically opening a file in emacs by specifying the file name

I created a TAGS file for emacs in my django project using the following command on my Linux machine
ctags -eR *
I can now jump to a symbol definition using M-. and specifying the symbol name.In my project i have py,html and css files so is there also a way i can make emacs automatically open a file, if i specify the file name ?.
Thank You
I think you are looking for project management. There are few packages to manage project directory in emacs. The best one may be ede. but Its not easy to setup. It does have some learning curve and its limitations.
Thankfully there are many easy ones. like eproject. https://github.com/jrockway/eproject/wiki
anyway you can also check out emacswiki page for more details. http://www.emacswiki.org/ProjectSettings
http://www.emacswiki.org/emacs/find-file-in-tags.el
IDO (Interactive Do) mode does this. If you activate it, C-x C-f searches for files matching what you are typing, interactively. Beware though, it may take some time to get used to it.
[edit] The search is based on files or directories you've recently visited, and you can use M-s to force a search.
From the comments, I figured that you are looking for has nothing to do with tags, you just want a better find-file that makes good automatic guesses for the path given only the file name.
For this, I use the entirely awesome ido-mode: http://emacswiki.org/emacs/InteractivelyDoThings

Is there a diff tool that allows copy-paste

Is there a diff tool that allows you to paste two segments of text and get a diff? I can't use an online tool because I'm dealing with proprietary data, and I haven't found a tool that provides that feature.
Try WinMerge. It'll do that.
Steps:
Download and install winmerge
Open WinMerge & Create new <CTRL+N>
Paste into left & right, then refresh <F5>
In case anyone comes here looking for a tool for Macs that can do this, it seems that there are two tools that can do just this.
Beyond Compare, the Mac version is currently in beta.
Kaleidoscope app
Copy first text
File -> New from Clipboard
Copy second text
Edit -> Paste to comparison
Unfortunately, it doesn't seem to be possible to change the texts once they've been pasted.
There is also a similar (closed) question (the question itself was for a Mac tool, but at least one answer has an alternative diff tool for Windows):
Diff tool for Mac without saving text to files
For those who use Atom, there’s the split-diff package.
KDiff3 can do that too. On startup just Cancel the open dialog and than copy&paste snippets into the two panes. It immediately (re)computes their diff.
Notepad++ makes it really easy to do that: paste first text, open new tab, paste second text then Plugin > Compare > Compare.
Make sure you have the compare plugin installed.
Source: https://stackoverflow.com/a/15817384/965176
I think this might be what you're looking for - Line Diff - it's a online tool that takes as input two snippets of code/text, diff them and then render a nice github like html page (permanent or temporary stored) that you can then share with coworkers.
I used BBEdit (Mac OS X):
paste your snippets into 2 separate new documents (without saving)
go to search → find differences
using the clock icon, pick your new documents
The app has a subscription model, but this doesn't seem to be a premium feature.
You can try online tools
it's good
https://www.diffchecker.com/
Or you can try KDIFF3 its also a good tool
http://kdiff3.sourceforge.net/
also you can try online diff tool , maybe it's useful to you.

Which tools exists for byte-level inspection of files?

I have a partially corrupted MS-Word file which I'd like to inspect in the byte-level.
HexEdit is pretty nice (allows you to edit files too)
What you need is a hex editor. Some text editors can run in this mode. I always used PSPadfor this
As always there's emacs, hexl-mode allows you to view and edit hex-files.
I like the freeware hex editor xvi32 for this kind of task.
I'm sure there are many, but Ultraedit does this.
If you have Visual Studio installed, you can add the .dat extension to the file and open it in Visual Studio to get a hex/ASCII display.
010 Editor is nice for looking at files that follow some template, it'll try to turn the raw data into meaningful labeled values for you.
Take a gander at BeyondCompare for file comparisons; version 3 has comparisons for Word files as well. You'd be surprised at how often you'll use it once you have it.