Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [binary-file]

Questions about editing non-text files.

2
votes
1answer
139 views

Why does Vi change the size of my .bin file?

I have a .bin file which has a size of 8192. If I open the file in Vi, then use :wq without making any changes, the file size becomes 8193. What's happening? It's a HEX file if that makes any ...
1
vote
0answers
97 views

Hide binary portion in mixed text-binary file

I have a self-extracting "archive" generated by Makeself tool, which is essentially a shell script with a large binary blob in inside. What I want is to view only text part of the file, while hiding ...
2
votes
1answer
376 views

Why is `%!xxd -r` result wrong while `xxd -r` from console with the same input works correctly?

I have the following file named asterix: 0000000: 15 00 1f c1 13 31 49 80 02 64 01 08 42 48 ef 28 0000010: 2d cd 0c 02 00 07 f1 e9 1b 04 63 30 c7 08 20 When I open this file in vim, I ...
9
votes
1answer
407 views

How to open *.dia files as *.gz files?

vim proj.dia gives binary data. If renamed, vim opens it by unzipping: $ mv proj.dia proj.dia.gz $ vim proj.dia.gz How to make the .dia act the same as .gz?
0
votes
1answer
839 views

How to edit a readonly zip file?

I tried to edit a zip file and change its content using the following commands :set modifiable :%s/xxA/..\//g :x! But it returned the following error W10: Warning: Changing a readonly file 55 ...
3
votes
1answer
891 views

How to force Vim to open given file as another filetype? (e.g. .txt.gz?)

Problem: I have .glabels generated files, which are gzipped xml. When I rename file to have suffix .xml.gz, then VIM properly recognizes file and it's editable, human readable xml. After edit I have ...
2
votes
1answer
10k views

Where is xxd in Windows gvim?

Does it exist? Is it Linux only? Do I have to install it? According to this, it's :!xxd to convert the file to hex, and it's :!xxd -r to convert it back again.
4
votes
1answer
132 views

How do I perform a replacement on all files in a zip archive?

I have openend a zip archive with vim (zip.vim v27) and now want to replace a string in all files contained in the archive. I'm aware that I could manually open all files in buffers and then do bufdo ...
13
votes
2answers
2k views

How to get the current byte offset in whole file

I saw that you could display the current byte offset in the statusline using %o, but I found no function or command which does the same. Is there a way of getting the current byte offset ...
9
votes
2answers
1k views

Go to X bytes from here

How can I move X bytes forward, starting from the current cursor location (including line breaks)? [count]go could be used to move forward X bytes from the start of the buffer. I tried Shift + V, G, [...
0
votes
2answers
522 views

How to make vim to uncompress archive formats?

In here it's suggested that vim can do automatic uncompression of gzip/zip files (including other formats) and it's something built-in. How do I open compressed file then? Sample scenario: curl ...
2
votes
2answers
829 views

How to check if file is binary?

Is there any way to determine within Vim that the file which I'm editing is either in text or binary format? For example: vim http://example.com/ vs: vim http://cdn.sstatic.net/vi/img/apple-touch-...
9
votes
1answer
6k views

Jumping to a byte offset, and displaying position as byte offset

How can I move the cursor to the nth byte in the buffer? How can I display the current cursor position in the ruler in terms of the byte offset, rather than lines and columns? (Follow-up question: ...
69
votes
2answers
132k views

How can I use Vim as a hex editor? [duplicate]

Is there a neat way I can view binary files as hex in Vim, and save it back to binary from the hex?
13
votes
2answers
3k views

How to tell vim not to try to unzip a file

I'm trying to open an .xlsx file in Vim, but got an error saying: ***error*** (zip#Browse) unzip not available on your system I know it's a binary file, but I want to do some checksums and ...
71
votes
5answers
53k views

How to edit binary files with Vim?

Is there a way to edit binary files in some kind of hexadecimal mode? For example if I have some binary data shown by xxd or hexdump -C like this: $ hexdump -C a.bin | head -n 5 00000000 cf fa ed ...