[vim/vim] Please, add HEX editor to Vim (Issue #16031)

20 views
Skip to first unread message

НЕВСКИЙ БЛЯДИНА

unread,
Nov 11, 2024, 2:47:06 AM11/11/24
to vim/vim, Subscribed

Is your feature request about something that is currently impossible or hard to do? Please describe the problem.

Hi folks,

Please, add my plugin to the base distribution of Vim.

Describe the solution you'd like

NAME vim-deadc0de-name

vim-deadc0de

DESCRIPTION vim-deadc0de-description

Hex editor for Vim.
It uses UNIX utility xxd for conversion.

FEATURES vim-deadc0de-features

  • Open hex editor by pressing <Shift-F6>. (Of course, you can set your own
    keybinding.) It does buffer conversion.
  • When you complete editing, convert to plain text/blob back by pressing
    <Shift-F6>.
  • Vim almost supports hex edition, but it lacks of very important features.
    This plugin updates ASCII block of edited blob while you're changing the
    HEXes.
  • Reverse action is supported too. Edit the ASCII block and it changes the
    HEX.
    But be sure the edited ASCII line doesn't contain any unprintable
    characters, i. e. control sequences. Such characters are presented by
    dotas (.).
  • The plugin highlights the currently selected byte in HEX block and the
    corresponding character in ASCII block.
  • Reverse is done too.
  • Switch between them by entering "gs". (Again, you can set your own
    keybinding.)
  • Data protection prevents you from breaking a hex file.
    Assume you has entered "x" character, which is not hexadecimal character.
    Buffer would be restored immidiately.
  • Data protection can be toggled by "gp". (Or another keybinding.)
  • xxd utility supports only 7-bit ASCII table encoding that outputs in ASCII
    block. (Not all special characters work even so.).
    Extended encodings which use eight bit are not supported by xxd.
    But this plugin adds support of all printable characters. (One-byte encodings
    Latin 1, KOI8-R, CP1251, CP866 are tested; One-byte characters from UTF-8 are
    tested.)
  • Work with newlines accurately.
    Please, set binary mode and turn off EOL if you are editing an blob.
  • Open hexadecimal editor in a new buffer. (Due to safety.)
    It is saved to temporary directory, usually, /tmp/.
  • Some options allow to tune the plugin. (Number of them will increase in
    future.)

USAGE vim-deadc0de-usage

Now you can open any file in your Vim.
If you're editing an blob, be sure binary mode is enabled.
Also turn off adding of end-of-line characters.

:set binary
:set noendofline

Vim adds newline character if you hadn't set this option.
Set proper encoding:

:edit ++encoding=koi8-r " Replace encoding by yours

Now press <Shift-F6>.
Edit hex and convert it back: <Shift-F6>. Save.

RTFM if you still have any questions:

Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

I'd tried to find other HEX editors on vim.org and what I saw.
There is no such things.
All HEX editors are simple, little, has no enough functions, don't light up the symbol you are working on in the second ASCII block and vice versa.

FOR HACKERS vim-deadc0de-hackers

... (see :help vim-deadc0de)

Additionally, you can setup your encoding smartly:

" General behavior
set wildcharm=<Tab> " Command-line completion key

" Encodings order
set encoding=utf-8
set termencoding=utf-8
set fileencodings=utf-8,koi8-r,cp866,cp1251,ucs-2le,latin1

" <F8> Change file format (UNIX / DOS / Mac)
... (see :help deadc0de)

" <Ctrl-F8> Change open encoding
... (see :help deadc0de)

" <Shift-F8> Change save encoding (convert)
... (see :help deadc0de)

" <Ctrl-Shift-F8> Toggle ASCII/binary mode (also affects EOL)
menu File\ mode.ASCII  :set nobinary<CR>:set endofline<CR>
menu File\ mode.Binary :set binary<CR>:set noendofline<CR>
noremap <C-S-F8> :emenu File\ mode.<Tab>
imap    <C-S-F8> <C-O><C-S-F8>

Additional context

It is must have thing.
This is link to my plugin:
https://www.vim.org/scripts/script.php?script_id=6033


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/16031@github.com>

Christian Brabandt

unread,
Nov 11, 2024, 2:49:15 AM11/11/24
to vim/vim, Subscribed

I don't think this belongs into core Vim. You seem to have created a plugin for this feature, that should be fine.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/16031/2467450642@github.com>

НЕВСКИЙ БЛЯДИНА

unread,
Nov 11, 2024, 2:52:45 AM11/11/24
to vim/vim, Subscribed

It may belong to core Vim.
I hope you add it to base distribution.
It would be fine and helpfull for many people.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/16031/2467456203@github.com>

Christian Brabandt

unread,
Nov 11, 2024, 2:57:36 AM11/11/24
to vim/vim, Subscribed

Vim is foremost a text editor. Hex editor core functions do not belong to core Vim. For simple cases you can follow the guide at :h hex-editing. People who need more advanced features can make use of your plugin.

You are not giving convincing arguments, why this should be included into core Vim.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/16031/2467463842@github.com>

Shougo

unread,
Nov 11, 2024, 3:06:17 AM11/11/24
to vim/vim, Subscribed

Your requested feature is very complex and I think it should not be implemented by Vim core.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/16031/2467479184@github.com>

K.Takata

unread,
Nov 11, 2024, 3:26:44 AM11/11/24
to vim/vim, Subscribed

Recent Vim plugin managers can normally install a Vim plugin directly from a git repository if you add a line to your vimrc.
So, if you upload the plugin to GitHub (or GitLab, etc.), that should be enough for most people.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/16031/2467518402@github.com>

НЕВСКИЙ БЛЯДИНА

unread,
Nov 11, 2024, 3:41:05 AM11/11/24
to vim/vim, Subscribed

Sure, it has GitLab link:
https://gitlab.com/neva_blyad/vim-deadc0de


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/16031/2467546931@github.com>

Christian Brabandt

unread,
Nov 12, 2024, 3:27:10 PM11/12/24
to vim/vim, Subscribed

This:

Install Perl interpreter and Iconv binding for it:

$ sudo apt install xxd
$ sudo apt install perl libtext-iconv-perl

is already a bummer, even if I would consider to bundle this.

But I am not planning this. People who want to use it can install your plugin using the plugin manager of their choice. Sorry.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/16031/2471515768@github.com>

Christian Brabandt

unread,
Nov 12, 2024, 3:27:14 PM11/12/24
to vim/vim, Subscribed

Closed #16031 as not planned.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/16031/issue_event/15270627900@github.com>

Reply all
Reply to author
Forward
0 new messages