Questions tagged [binary-file]

Questions about editing non-text files.

Filter by
Sorted by
Tagged with
-1 votes
0 answers

Problem re-installing

I tried to clean up my neovim (lazyvim distri) configuration by deleting all files in the next folders: 1.~/.config/nvim 2.~/.local/state/nvim 2.~/.local/share/nvim For reinstalling I used the command ...
Newbie_user's user avatar
0 votes
0 answers

Adding new line characters after a specific amount of bytes

I'd like to add new line characters after every specific number of bytes in binary mode. I tried this script but the repetition count depends on the number of characters not bytes. Like when there is ...
fx-kirin's user avatar
  • 101
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 ...
Mark Reed's user avatar
  • 226
1 vote
0 answers

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" ...
ecjb's user avatar
  • 149
1 vote
1 answer

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) ...
milanHrabos's user avatar
5 votes
2 answers

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 6161 ...
aguilbau's user avatar
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 ...
alperc's user avatar
  • 131
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 ...
Tim M's user avatar
  • 123
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 ...
Thunderbeef's user avatar
3 votes
1 answer

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 ...
Ruslan's user avatar
  • 475
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's user avatar
  • 215
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 ...
SuperKrish's user avatar
8 votes
1 answer

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 ...
Grzegorz Wierzowiecki's user avatar
3 votes
1 answer

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.
leeand00's user avatar
  • 3,467
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 ...
l4mpi's user avatar
  • 805
14 votes
2 answers

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 ...
EvergreenTree's user avatar
12 votes
2 answers

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, [...
Rob W's user avatar
  • 381
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 https:/...
kenorb's user avatar
  • 18.2k
4 votes
2 answers

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 vs: vim
kenorb's user avatar
  • 18.2k
28 votes
3 answers

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: ...
200_success's user avatar
  • 9,379
170 votes
2 answers

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?
nos's user avatar
  • 1,853
18 votes
2 answers

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 probably ...
Roflo's user avatar
  • 757
116 votes
8 answers

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 ...
janos's user avatar
  • 2,818