vim-hec5 : Hex editor for Vim. It uses UNIX utility xxd for conversion.
script karma |
Rating 4/1,
Downloaded by 127 |
Comments, bugs, improvements
|
Vim wiki
|
created by |
Artem Korotchenko |
|
script type |
ftplugin |
|
description |
- 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 for ASCII block.
Extended encodings which use eight bit are not supported by xxd.
But this plugin adds support of one-byte encodings. (Latin 1, KOI8-R, CP1251,
CP866 are tested.)
And even UTF-8 is supported.
- Work with newlines accurately.
Please, set binary mode and turn off EOL if you are editing an blob.
- Some options allow to tune the plugin. (Number of them will increase in
future.) |
|
install details |
Install xxd.
Install Perl interpreter and Iconv binding for it:
$ sudo apt install xxd
$ sudo apt install perl libtext-iconv-perl
Copy the plugin to your Vim directory (usually, ~/.vim/):
+ doc/vim-hec5.txt
+ plugin/vim-hec5.vim
+ ftplugin/xxd.vim
Then add to your .vimrc:
" General behavior
filetype on " Enable file detection
filetype plugin on " Enable loading the plug-in files for specific file types
syntax on " Enable syntax highlighting
" Load hex editor
runtime plugins/vim-hec5.vim
" <Shift-F6> Convert to hex / convert back using vim-hec5
noremap <S-F6> :HexConvert<CR>
imap <S-F6> <C-O><S-F6>
" Toggle hex file protection by entering "gp".
" This protection is also controlled by g:hec5_protection.
map gp <Plug>hexprotectiontoggle
" Move cursor to the corresponding ASCII character (and then back) by entering
" "gs"
map gs <Plug>hexblockscycle
(You can use any other available keybindings for this purpose.)
vim-hec5 is filetype plugin (ftplugin), not syntax plugin.
But it works in conjunction with xxd.vim syntax plugin by Charles E. Campbell.
xxd.vim should be already installed in your system, check it:
$ ls /usr/share/vim/vim*/syntax/xxd.vim # Debian- and Ubuntu-based distros path |
|
script versions (upload new version)
Click on the package to download.
vim-hec5.tar.xz |
0.1.7 |
2022-11-13 |
8.2 |
Artem Korotchenko |
- Data protection can be toggled by "gp". (Or another keybinding.)
Many bugs had been fixed. |
vim-hec5.tar.xz |
0.1.1 |
2022-11-07 |
8.2 |
Artem Korotchenko |
Blocks cycle mapping bug fix |
vim-hec5.tar.xz |
0.1.0 |
2022-11-07 |
8.2 |
Artem Korotchenko |
- 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.
- Some options allow to tune the plugin. (Number of them will increase in
future.)
And other improvements and bug fixes. |
vim-hec5.tar.xz |
0.0.11 |
2022-11-03 |
8.2 |
Artem Korotchenko |
Initial upload |
ip used for rating: 3.226.122.122
|