Questions tagged [binary-file]

Questions about editing non-text files.

Although Vim was made to edit text files, it is possible to edit binary files with the option set binary or with the -b parameter. This options implies the folowing:

  • textwidth and wrapmargin are set to 0
  • modeline and expandtab are turned off
  • The fileformat and fileformats options won't be used
  • Files will be written using single line endings

For more information see :h edit-binary

22 questions
174
votes
2 answers

How can I use Vim as a hex editor?

Is there a neat way I can view binary files as hex in Vim, and save it back to binary from the hex?
nos
  • 1,893
  • 2
  • 13
  • 7
10
votes
1 answer

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?
Velkan
  • 215
  • 1
  • 6
4
votes
1 answer

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 %s/foo/bar/g | update, or that I could unpack the…
l4mpi
  • 855
  • 7
  • 17
3
votes
1 answer

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 inside this archive, I am more interested in the…
alperc
  • 131
  • 3
2
votes
2 answers

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…
kenorb
  • 18,433
  • 18
  • 72
  • 134
2
votes
1 answer

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 difference. EDIT: This is what was added to the file by…
Tim M
  • 123
  • 4
1
vote
1 answer

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 substitutions on 10 lines Press ENTER or type command to…
SuperKrish
  • 217
  • 1
  • 5
1
vote
1 answer

How to enter linefeed in binary mode?

Trying to find a linefeed within a binary file using vim -b, but any attempt at entering that byte value (e.g. control-v control-j, control-v 010, control-v u000a) turns into a NUL (^@) instead. I've tried using vim 8.2.2029 and neovim v0.5.1 on…
Mark Reed
  • 226
  • 1
  • 5
1
vote
0 answers

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 the binary part completely (possibly abbreviating…
Thunderbeef
  • 497
  • 4
  • 12