Questions tagged [binary-file]
Questions about editing non-text files.
23
questions
-1
votes
0
answers
24
views
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 ...
0
votes
0
answers
187
views
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 ...
1
vote
1
answer
107
views
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 ...
1
vote
0
answers
45
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
1
answer
223
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) ...
5
votes
2
answers
3k
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 6161 ...
3
votes
1
answer
408
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 ...
2
votes
1
answer
383
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
0
answers
218
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 ...
3
votes
1
answer
1k
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 ...
10
votes
1
answer
1k
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?
1
vote
1
answer
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 ...
8
votes
1
answer
3k
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 ...
3
votes
1
answer
18k
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
1
answer
338
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 ...
14
votes
2
answers
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 ...
12
votes
2
answers
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, [...
2
votes
2
answers
2k
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 https:/...
4
votes
2
answers
2k
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-...
28
votes
3
answers
19k
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: ...
170
votes
2
answers
332k
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?
18
votes
2
answers
7k
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 probably ...
116
votes
8
answers
136k
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 ...