Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/RaafatTurki/hex.nvim
hex editing done right
https://github.com/RaafatTurki/hex.nvim
neovim-plugin
Last synced: about 2 months ago
JSON representation
hex editing done right
- Host: GitHub
- URL: https://github.com/RaafatTurki/hex.nvim
- Owner: RaafatTurki
- License: mit
- Created: 2023-01-12T00:40:06.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-03-03T07:24:38.000Z (11 months ago)
- Last Synced: 2024-08-07T18:35:31.171Z (6 months ago)
- Topics: neovim-plugin
- Language: Lua
- Homepage:
- Size: 13.7 KB
- Stars: 181
- Watchers: 6
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Hex.nvim
![Lua](https://img.shields.io/badge/Made%20with%20Lua-blueviolet.svg?style=for-the-badge&logo=lua)Hex editing done right.
Shift address lines around, edit and delete bytes, it will all work itself out on `:w`.
![demo](https://user-images.githubusercontent.com/16624558/211962886-f5e67052-03d8-41c2-844f-720550c935b4.gif)
## Install
```lua
{ 'RaafatTurki/hex.nvim' }
```
This plugin makes use of the `xxd` utility by default, make sure it's on `$PATH`:
- `xxd-standalone` from aur
- compile from [source](https://github.com/vim/vim/tree/master/src/xxd)
- install vim (it comes with it)## Setup
```lua
require 'hex'.setup()
```## Use
```lua
require 'hex'.dump() -- switch to hex view
require 'hex'.assemble() -- go back to normal view
require 'hex'.toggle() -- switch back and forth
```
or their vim cmds
```
:HexDump
:HexAssemble
:HexToggle
```
any file opens in hex view if opened with `-b`:
```bash
nvim -b file
nvim -b file1 file2
```## Config
```lua
-- defaults
require 'hex'.setup {-- cli command used to dump hex data
dump_cmd = 'xxd -g 1 -u',-- cli command used to assemble from hex data
assemble_cmd = 'xxd -r',
-- function that runs on BufReadPre to determine if it's binary or not
is_file_binary_pre_read = function()
-- logic that determines if a buffer contains binary data or not
-- must return a bool
end,-- function that runs on BufReadPost to determine if it's binary or not
is_file_binary_post_read = function()
-- logic that determines if a buffer contains binary data or not
-- must return a bool
end,
}
```## Plans
- [ ] Implement pagination
- [x] Implement auto bin detection
- [ ] Transform cursor position across views
- [ ] Create an `xxd` TS parserFeel free to PR