C hxavi : vi or Vim style binary (hex) editor on FreeBSD

I've wanted a vi/Vim-like binary editor that I could use on FreeBSD.
With existing tools, hexdump -C only lets you view files,
and vim -b isn't particularly well-suited for heavy editing.
Using :%!xxd in vim allows you to edit in hexadecimal, but it doesn't allow you to insert or delete data.
bvi is a solid tool, but it's a shame that you can only undo once.
So I developed a binary editor on FreeBSD that includes the features I wanted.
I call it "hxavi."
- Since the operation is nearly identical to vi/Vim, the learning curve is low for vi/Vim users.
- There's no limit on the number of undo/redo operations.
- You can even edit huge files by overwriting them.
I don't think you'll use a binary editor very often, but
I'd appreciate it if anyone interested would try it out and give me feedback.
Source files (.tar.gz) and packages (.pkg) are available at
https://hxavi.net/en/
Registration with the official ports/packages is currently being requested.
 
AI,
To set up
coc.nvim (Conquer of Completion) as your intellisense engine using vim-plug, follow these steps. This setup provides modern IDE features like autocompletion and linting to your Vim or Neovim editor.


1. Requirements

Before installing, ensure you have the following binaries installed on your system:

  • Node.js (version 14.14 or higher).
  • npm or yarn to manage dependencies.

2. Installation with vim-plug

Add the following line to your .vimrc (Vim) or init.vim (Neovim) within the plug#begin and plug#end block:

plug#begin()
Use release branch (recommended)
Plug 'neoclide/coc.nvim' , 'branch':'release'}
plug#end()<br></span>
Use code with caution.

After adding the line, restart Vim and run the command:
PlugInstall.


3. Basic Configuration

To make coc.nvim behave like a modern editor, you should add standard mappings to your configuration file (e.g., using Tab for completion):


vim

Blablabla


4. Installing Language Servers

coc.nvim itself is just the engine. You must install extensions for specific languages:

  • Python: :CocInstall coc-pyright
  • C/C++: :CocInstall coc-clangd
  • JSON: :CocInstall coc-json
  • Rust: :CocInstall coc-rust-analyzer

5. Hex/Binary Editing (Optional)

If you specifically need to edit binary files in a hex-style view (often confused with the "binary" requirements of plugins), you can use a dedicated hex-editor plugin alongside CoC:

  • hexmode: Automatically toggles hex mode for binary files.
  • pfp-vim: A hex-editor plugin that uses templates to parse binary structures.
 
AI,
To set up
coc.nvim (Conquer of Completion) as your intellisense engine using vim-plug, follow these steps. This setup provides modern IDE features like autocompletion and linting to your Vim or Neovim editor.


1. Requirements

Before installing, ensure you have the following binaries installed on your system:

  • Node.js (version 14.14 or higher).
  • npm or yarn to manage dependencies.

2. Installation with vim-plug

Add the following line to your .vimrc (Vim) or init.vim (Neovim) within the plug#begin and plug#end block:

plug#begin()
Use release branch (recommended)
Plug 'neoclide/coc.nvim' , 'branch':'release'}
plug#end()<br></span>
Use code with caution.

After adding the line, restart Vim and run the command:
PlugInstall.


3. Basic Configuration

To make coc.nvim behave like a modern editor, you should add standard mappings to your configuration file (e.g., using Tab for completion):


vim

Blablabla


4. Installing Language Servers

coc.nvim itself is just the engine. You must install extensions for specific languages:

  • Python: :CocInstall coc-pyright
  • C/C++: :CocInstall coc-clangd
  • JSON: :CocInstall coc-json
  • Rust: :CocInstall coc-rust-analyzer

5. Hex/Binary Editing (Optional)

If you specifically need to edit binary files in a hex-style view (often confused with the "binary" requirements of plugins), you can use a dedicated hex-editor plugin alongside CoC:

  • hexmode: Automatically toggles hex mode for binary files.
  • pfp-vim: A hex-editor plugin that uses templates to parse binary structures.
I was completely unaware of the Vim features you mentioned. I'd like to try them out.
...
Thank you for the suggestion. After doing a little research, coc.nvim seems a great tool for IDE features.
But my focus with hxavi is to solve specific issues in binary editing that existing Vim plugins can't handle.
Such as inserting/deleting bytes without breaking the format and efficiently handling huge files.
hexmode still relies on xxd, which has the limitations I mentioned in my original post. hxavi is a standalone tool designed to overcome these.

The other tool you recommended, pfp-vim, sounds interesting.
My hxavi doesn't have structural analysis capabilities yet, but I'd like to add such features someday.
 
Hxavi has been merged into the official FreeBSD Ports tree.
Standard installation procedure for ports is now available.
I welcome your feedback after you try it.

portsnap extract editors/hxavi
cd /usr/ports/editors/hxavi
make install
 
If you're already messing with vi-style tools like hxavi, you might as well turn Neovim into a precision C and Lua IDE.

On FreeBSD, it’s the most direct way to get a high-performance workstation without the "conceptual bloat" of a standard IDE.

Skip the heavy wrappers and configure it using pure Lua to keep the logic loops transparent.


pkg install neovim gmake gcc llvm


In Neovim, Lua is the first-class citizen. This config sets the structural boundaries for your development environment without any "black box" overhead.

init.lua


-- Bootstrap the plugin orchestrator (lazy.nvim)

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
-- LSP for C and Lua
{ "neovim/nvim-lspconfig" },
-- Treesitter for syntax logic
{ "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" },
})

-- Precision LSP configuration
local lspconfig = require('lspconfig')

-- C/C++ logic (uses FreeBSD's native clangd)
lspconfig.clangd.setup{}

-- Lua logic for bare-metal scripting
lspconfig.lua_ls.setup{
settings = { Lua = { diagnostics = { globals = {'vim'} } } }
}



From an architectural standpoint, this setup is lean and efficient. Instead of a massive abstraction layer, you’re using the native FreeBSD clang (via the llvm package) as your backend.

> "Neovim is built for users who want the good parts of Vim, and more. It is a refactor... to improve the extensibility and maintainability."
> — Neovim Documentation, "Vision"
>


By defining your IDE in Lua, you ensure the system is persistent and optimized. You aren't just using a tool; you're building a precision execution engine for your code.
 
If you're already messing with vi-style tools like hxavi, you might as well turn Neovim into a precision C and Lua IDE.

On FreeBSD, it’s the most direct way to get a high-performance workstation without the "conceptual bloat" of a standard IDE.

Skip the heavy wrappers and configure it using pure Lua to keep the logic loops transparent.


pkg install neovim gmake gcc llvm


In Neovim, Lua is the first-class citizen. This config sets the structural boundaries for your development environment without any "black box" overhead.

init.lua


-- Bootstrap the plugin orchestrator (lazy.nvim)

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
-- LSP for C and Lua
{ "neovim/nvim-lspconfig" },
-- Treesitter for syntax logic
{ "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" },
})

-- Precision LSP configuration
local lspconfig = require('lspconfig')

-- C/C++ logic (uses FreeBSD's native clangd)
lspconfig.clangd.setup{}

-- Lua logic for bare-metal scripting
lspconfig.lua_ls.setup{
settings = { Lua = { diagnostics = { globals = {'vim'} } } }
}



From an architectural standpoint, this setup is lean and efficient. Instead of a massive abstraction layer, you’re using the native FreeBSD clang (via the llvm package) as your backend.

> "Neovim is built for users who want the good parts of Vim, and more. It is a refactor... to improve the extensibility and maintainability."
> — Neovim Documentation, "Vision"
>


By defining your IDE in Lua, you ensure the system is persistent and optimized. You aren't just using a tool; you're building a precision execution engine for your code.
Thanks for sharing the Neovim/Lua setup.
That looks like a very lean and powerful environment for C development on FreeBSD.
 
Back
Top