Answer from help-info.de is working.
However it is not that great if you are in a context where you need to copy paste the result of the hex output provided by the plugin.
For example let's say the following bytes are displayed by the NPP_HexEdit window:
00 06 12 0b
If you select from left to right, copy then paste (in a new text file), you will get:
20 06 12 0b
For some reason, '0x00' are converted into UTF-8 '20' and since '0x20' are also converted into UTF-8 '20' you can't really use the copy + paste feature here.
If you select from right to left, copy then paste (in a new text file), you will get:
12 01 0e 0d
I will not even try to convert this one, clearly unusable....
Solution (Windows)
From Plugins > Plugins Admin
select and install NppExec, restart npp.
Select Plugins > NppExec > Npp Execute...
and enter the following:
SET local OUTFILE = "$(FULL_CURRENT_PATH).hex.txt"
cmd /c <XXD_DIRECTORY>\xxd.exe -p $(FULL_CURRENT_PATH) >$(OUTFILE)
NPP_OPEN $(OUTFILE)
From the same window save your script, for example bin_to_hex
.
From Plugins > NppExec > Advanced Options
select your script from Associated script:
and add it with Add/Modify
then press Ok and restart npp.
In npp, open your bin file.
Select Plugins > NppExec > bin_to_hex
and you are done!, should get your bin as HEX in a new tab.
xxd.exe can be recovered from multiple location such as:
- C:\Program Files (x86)\Vim\vim74
- (I used this on my side, from Cmder) C:\Cmder\vendor\git-for-windows\usr\bin
Edited
Instead of using xxd.exe, you can use the following powershell approach (better format but longer to execute). Replace the script with:
SET local OUTFILE = "$(FULL_CURRENT_PATH).hex.txt"
cmd /c powershell -command "format-hex $(FULL_CURRENT_PATH) > $(OUTFILE);exit"
NPP_OPEN $(OUTFILE)