vim / vim

The official Vim repository
https://www.vim.org
Vim License
36.64k stars 5.46k forks source link

Please, add HEX editor to Vim #16031

Closed nevapadonak closed 15 hours ago

nevapadonak commented 2 days ago

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

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

chrisbra commented 2 days ago

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

nevapadonak commented 2 days ago

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

chrisbra commented 2 days ago

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.

Shougo commented 2 days ago

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

k-takata commented 2 days ago

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.

nevapadonak commented 2 days ago

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

chrisbra commented 15 hours ago

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.