bin-copy-region(3)bin-copy-region - Binary supporting copy region
bin-yank - Binary supporting kill buffer insert
n bin-copy-region (esc A-w)
n bin-yank (A-C-y)
The bin-copy-region command operates the same as the copy-region(2) command except it adds the region as a hex strings, 2 hex characters per byte of data. If the current buffer has binary(2m) or rbin(2m) mode enabled then the hex bytes of the underlying binary file are extracted from the region, whereas if neither of these modes are enabled the region text is converted into a hex string (respecting end of line termination modes). As this command works with the current buffer modes, identifying the type of data being added is not an issue.
The bin-yank command operates the same as the yank(2) command except it inserts the kill buffer in the most appropriate way considering the format of the data in the kill buffer and the modes of the current buffer. If the kill buffer contains a hex string or binary mode compatible data then the kill buffer is deemed to contain binary data, otherwise it is considered plain text. If the current buffer has binary or rbin mode enabled then the kill buffer is inserted as binary data in the form of appropriately formatted hex strings, otherwise the data is converted to text if needed and inserted.
As the source of the kill buffer data is unknown bin-yank can misidentify the format, for example 'dead' is both a 4 letter word and a 2 byte hex string. Priority is given to the hex string so if it is used in conjuction with bin-copy-region the result should always be correct.
These commands and their global bindings are only defined when the first binary file is loaded.
When inserting binary data into a non-binary buffer bytes may be lost as they cannot be represented in a text buffer, for example the null character (' ') cannot be inserted as it is a string termination character so is discarded. bin-yank will report how many characters had to be discarded.
(c) Copyright JASSPA 2025
Last Modified: 2024/05/08
Generated On: 2025/09/29