raafatturki / hex.nvim Goto Github PK
View Code? Open in Web Editor NEWhex editing done right
License: MIT License
hex editing done right
License: MIT License
I tried to install the plugin with Vim plugged:
Plug 'RaafatTurki/hex.nvim'
require 'hex'.setup()
:PlugInstall gave me a successfull installation, but I cant use the commands like :HexDump
It would be good to have instructions for vim plugged.
I assume at least that it did not work because of my install method.
Is there a method available such that hex would not be applied to certain filetypes? Have a bunch of large files that are text files but hex detects them as binary files and automagically displays the file in hex. Simple :HexToggle
does revert it back so not that big of an issue. But the files are big and it does take a few seconds to convert back and forth.
Awesome plugin. Works seamlessly with LazyVim.
I'm not exactly sure how hex editors work. Is this a compiled view or can this also be dynamic view? Is there a way to connect to dap-ui and view the editor update the memory in real time?
Like a floating window, but in neovim:
Ref: Video from 22:16 https://youtu.be/T4CjOB0y9nI?feature=shared
WSL2 Ubuntu 22.04.2 LTS
NVIM v0.10.0-dev
I followed the exact steps as the gif in the README and attempting to write the buffer makes the binary no longer executable.
Resulting an error of either exec format error: ./a.out
or Segmentation fault
.
This occurs without any modification to the data, simply writing the buffer after opening a.out
had the same result.
When I toggle the hex view it works, but when going from hex view to normal view I get:
Error executing Lua callback: ...are/nvim/site/pack/packer/opt/hex.nvim/lua/hex/utils.lua:17: Vim:E492: Not an editor command: LspStop
stack traceback:
[C]: in function 'cmd'
...are/nvim/site/pack/packer/opt/hex.nvim/lua/hex/utils.lua:17: in function 'dump_to_hex'
...cal/share/nvim/site/pack/packer/opt/hex.nvim/lua/hex.lua:31: in function 'dump'
...cal/share/nvim/site/pack/packer/opt/hex.nvim/lua/hex.lua:47: in function <...cal/share/nvim/site/pack/packer/opt/hex.nvim/lua/hex.lu
a:45>
Opening a binary file and trying to save it after using :HexToggle
breaks the executable.
The problem stems from the binary being opened as a regular file, since the plugin cannot determine that the file is a binary due to missing file extension and not being opened with the -b
flag.
From the VIM docs, this will likely break the file due to wrong handling.
This is likely a user error since the flag should be provided when opening the file but (some) users likely don't know about this behavior.
Set the buffer as "binary" when calling dump_to_hex
.
vim.bo.bin = true
I can prepare a PR for this if you'd like.
Compile the following content with gcc -o run main.c
.
#include <stdio.h>
int main() {
printf("hello\n");
return 0;
}
Executing the binary prints "hello", as expected.
nvim run
:HexToggle
(hexdump content still correct):w
The binary is broken after step 3.
Trying to execute the binary now gives the output
Segmentation fault (core dumped)
I like to manually patch my games to fit my monitor ratio of 4:3 then run those patched files through proton, I wanted to switch from using ghex to using your tool because I already use nvim for everything else.
Whenever I open any exe files I get the following for example when opening tekken..
xxd: /away/plant/Steam/steamapps/common/TEKKEN\ 7/TEKKEN\ 7.exe: No such file or directory
When trying to save the hex the following error is thrown:
Error detected while processing BufWritePre Autocommands for "*":
Error executing lua callback: vim/_editor.lua:0: BufWritePre Autocommands for "*"..script nvim_exec2() called at BufWritePre Autocommands for "*":0: Vim(!):Error executi
ng lua callback: Vim:E976: using Blob as a String
stack traceback:
[C]: in function 'strcharpart'
...cal/share/nvim/lazy/cmp-buffer/lua/cmp_buffer/buffer.lua:316: in function 'index_line'
...cal/share/nvim/lazy/cmp-buffer/lua/cmp_buffer/buffer.lua:125: in function 'callback'
...cal/share/nvim/lazy/cmp-buffer/lua/cmp_buffer/buffer.lua:110: in function 'safe_buf_call'
...cal/share/nvim/lazy/cmp-buffer/lua/cmp_buffer/buffer.lua:117: in function 'index_range'
...cal/share/nvim/lazy/cmp-buffer/lua/cmp_buffer/buffer.lua:272: in function <...cal/share/nvim/lazy/cmp-buffer/lua/cmp_buffer/buffer.lua:187>
[C]: in function 'nvim_exec2'
vim/_editor.lua: in function 'cmd'
...myzel394/.local/share/nvim/lazy/hex.nvim/lua/hex/utils.lua:30: in function 'begin_patch_from_hex'
/Users/myzel394/.local/share/nvim/lazy/hex.nvim/lua/hex.lua:71: in function </Users/myzel394/.local/share/nvim/lazy/hex.nvim/lua/hex.lua:69>
stack traceback:
[C]: in function 'nvim_exec2'
vim/_editor.lua: in function 'cmd'
...myzel394/.local/share/nvim/lazy/hex.nvim/lua/hex/utils.lua:30: in function 'begin_patch_from_hex'
/Users/myzel394/.local/share/nvim/lazy/hex.nvim/lua/hex.lua:71: in function </Users/myzel394/.local/share/nvim/lazy/hex.nvim/lua/hex.lua:69>
I'm running on MacOS Sonoma 14.1.1.
May be I'm not getting how this plugin works, but when in the hex / bytes area, I can input any text there, not just 00 - FF values. Is that intended? It feels confusing or at least not correct for hex editing.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.