Questions tagged [binary-file]

Questions about editing non-text files.

Filter by
Sorted by
Tagged with
3
votes
1answer
224 views

How to list content of nested jars

Suppose, I have a .jar file a.jar, which I can view via vim a.jar, giving a list of the content like: a1.txt a2.txt b.jar I can press enter and load the content of each file; however, for .jars ...
18
votes
3answers
12k 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: ...
0
votes
0answers
24 views

Command (e.g. `g++`) does not point to the same binary when run from the terminal or from (neo)vim

I have NVIM v0.4.3 on macOS Mojave version 10.14.6 I have different version of g++ compilers on my machine and made the following alias in my .zshrc file: alias g++="/usr/local/bin/g++-9" ...
1
vote
1answer
71 views

hex mode crashes after saving file

I have a a.out file from "hello world" in c: #include <stdio.h> #include <stdlib.h> int main(){ printf("hello world\n"); } Which I can see in hexdump (file a.out) ...
3
votes
1answer
17k 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.
3
votes
1answer
826 views

vim hex editor with xxd not working as intended

I'm trying to use vim as a hex editor. I am using the %!xxd / %!xxd -r method, and it worked fine until I tried a some bytes that didn't work as expected : 00000000: 1337 6161 6161 6161 6161 6161 ...
101
votes
5answers
104k 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 ...
142
votes
2answers
252k 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?
2
votes
1answer
271 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
164 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 ...
9
votes
1answer
956 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?
3
votes
1answer
901 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 ...
1
vote
1answer
2k 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 ...
4
votes
1answer
203 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 ...
6
votes
1answer
2k 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 ...
9
votes
2answers
2k 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, [...
13
votes
2answers
3k 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 ...
1
vote
2answers
1k 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 ...
4
votes
2answers
1k 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-...
17
votes
2answers
6k 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 ...