Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

SourceTree thinks .vimrc is binary, so I can't see the diff within the window.

Based on this page, I thought it was because of the encoding, so tried changing the encoding to utf-8 using the following steps from this page:

:set bomb
:set fileencoding=utf-8

but that didn't fix it. What do I need to do?

[Update] Fixed it:

There was a non-ascii character (device control three, 0x13) that didn't show up at all in Vim, but is rendered as "DC3" in Sublime Text. After deleting it, the problem was solved! Thanks for all the help.

share|improve this question
Do you have any "hard" escape sequences in the file? –  Heptite Jul 9 '13 at 21:09
You mean like \" somewhere in the file? No, I don't have any of those. –  EthanP Jul 10 '13 at 15:31
No, that's not what I mean. I mean actual control characters like an escape (0x1B) or any character in the ASCII table below a space (that is, anything lower than 0x20). –  Heptite Jul 10 '13 at 20:50
Not that I know of –  EthanP Jul 16 '13 at 21:13

2 Answers 2

up vote 0 down vote accepted

Turn off the BOMB option. (Byte Order Mark Bytes)

It adds two bytes to the beginning of a text file to indicate endianness. They are 0xFF & 0xFE, I forget which order is what, but that's why your VCS thinks your .vimrc is a binary file.

You should edit your .vimrc, then turn OFF the bomb option and save .vimrc. This should remove the BOM bytes. Worst case, reset/remove the BOMB option from your .vimrc file, then use vim's binary mode to remove the icky bytes.

# edit .vimrc
$ vim .vimrc
# remove / comment out the set BOMB line
# reset the BOMB option (:set nobomb)
# save file, exit vim

If the BOM bytes are gone (use file), you're done, commit and enjoy. If not:

# remove the BOMB bytes using binary mode
$ vim -b .vimrc
# save and exit, .vimrc should no longer have the BOMB bytes.

Also, the 'file' command can tell you if a file has the BOMB bytes too.

You can also use the 'xxd' command (comes with vim) to view the hex bytes of a file:

xxd .vimrc | head

should show you if the BOM bytes exist or not. (It's quite handy for many things)

share|improve this answer
Thanks, but it looks like there are no BOMB bytes: xxd .vimrc | head => 0000000: 224e 756d 6265 7273 0a73 6574 206e 756d "Numbers.set num I think the problem is that charset=binary, but I'm not sure how to get that to stop happening. I tried copy/pasting into a new file and saving, but the new file has charset=binary too. –  EthanP Jul 23 '13 at 15:48
Hmmm, most programs which determine binary/text tend to scan a few hundred or thousand bytes to make a decision. Do you have any UTF-8 characters in your .vimrc? I do, neat symbols in my listchars setting, among others. Since UTF-8 is denoted by bytes with bit 7 set (0x80 - 0xFD), that'll set off sourcetree's detector. –  lornix Jul 23 '13 at 21:13
Yup, I had a non-ascii character (device control three, 0x13) that was invisible in Vim, but is rendered as "DC3" in Sublime. I deleted it and problem solved! Thanks for all the help. –  EthanP Jul 27 '13 at 19:32

Have you tried the other response of stackoverflow page ?

Open your .vimrc in vim and :

:write ++enc=utf-8
share|improve this answer
Thanks, but I tried that and SourceTree still calls it a "binary file" with "no preview available" –  EthanP Jul 10 '13 at 15:31
Can you copy paste your vimrc on gist(gist.github.com) ? –  Hettomei Jul 10 '13 at 21:09
And what gave << file -I .vimrc >> (if you can in a terminal) ? –  Hettomei Jul 10 '13 at 21:18
gist.github.com/ethanp/6015228 –  EthanP Jul 16 '13 at 21:17
file -I .vimrc ==> .vimrc: application/octet-stream; charset=binary –  EthanP Jul 16 '13 at 21:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.