"============================================================================= " Copyright: Copyright (C) 2003-2014 Peter Franz " Permission is hereby granted to use and distribute this code, " with or without modifications, provided that this copyright " notice is copied with it. Like anything else that's free, " hexman.vim is provided *as is* and comes with no " warranty of any kind, either expressed or implied. In no " event will the copyright holder be liable for any damamges " resulting from the use of this software. " Name Of File: hexman.vim " Description: HexManger: Simpler Hex viewing and editing - Vim Plugin " " Hexmanger provides keymapping to view quickly your file " in hexmode (convertion is done over the program xxd). " (more info - see Additional Features in HexManger). " " Maintainer: Peter Franz (Peter.Franz.muc( @ )freenet.de) " URL: http://www.vim.org/scripts/script.php?script_id=666 " LastChange : 18Jan07 " Version: 0.7.3 " Usage: Normally, this file should reside in the plugins " directory and be automatically sourced. If not, you must " manually source this file using ':source hexman.vim'. " " If you want to edit a file in hexmode, start vim " with the -b option - like: " vim -b " and then switch to hexmode with hm " (see Available functions). " The program xxd is needed to convert the file in hex (and " back). " " Changes in the printable text part are now supported in " Replace mode (command "R" or Select Mode "gh" ) " for most characters (as of version 0.5.0). " " Additional help: " :help *23.4* " :help xxd " " Vim Features: As this plugin relies on the vim features: " autocmd, langmap and byte_offset, make sure Vim is built with " this features (info with :version cammand). " " Vim Version: 7.4 onward " " History: 0.7.3 Gvim 7.4 support - xxd on Windows was not found. " 0.7.2 Patch from Ingo Karkat / 'xxd' did not " start when VIM is installed in a directory containing " spaces (e.g. on an English Windows XP: " "c:\Program Files\vim\vim70\xxd.exe"). " 0.7.1 Patch from Alejandro Cornejo / language independent " cursor offset calculation. " 0.7.0 Support VIM7 " In vim7.0c xxd was not found / changed match syntax. " 0.6.0 Search Hex Char with \hf " With search history eg. / you can repeat the search. " Possibility to switch off advanced ascii/hex editing " (see Additional Features). " 0.5.3 While Hex editing, move cursor to next hex block. " 0.5.2 FIX: error message E197 on unix systems . " 0.5.1 FIX: Editing in Hex part was not possible (as of 0.5.0). " 0.5.0 Changing characters in ascii area shows the releated " hex values. Note: not all ascii characters are supported! " (see Known Problems). " 0.4.1 FIX: use english Message. " 0.4.0 Switch cursor between hex and ascii area. " (see Additional Features). " 0.3.0 After calling/leaving hexman the cursor is set to current " file position. " 0.2.1 FIX: from Ingo karkat - conversion back fails " (xxd-path was not enclosed in double quotes). " 0.2.0 Staying on a ascii character it marks the " related hex column. " 0.1.1 FIX: hit enter message after moving cursor. " 0.1.0 Show own hexman menu entry with hexman commands " (gui version). " 0.0.2 FIX: default moving to next hex character " with and don't work on (LINUX/UNIX) " (see Additional Features). " 0.0.1 Initial Release " Some Functions are derived from Robert Roberts " byteme.vim version 0.0.2 " The original plugin can be found at: " http://www.vim.org/scripts/script.php?script_id=268 " Thank you very much! " "============================================================================= " " Available functions: " " hm HexManager: Call/Leave Hexmode (using xxd) " hd HexDelete: delete hex character under cursor " hi HexInsert: Insert Ascii character before cursor " hg HexGoto: Goto hex offset. " hn HexNext: Goto next hex offset. " hp HexPrev: Goto previous hex offset. " ht HexToggle: Switch cursor between hex and ascii area. " hs HexStatus: Show / Hide hexoffset infos in statusline " and related ascii colum. " hf HexFind: Find Hex Character " " If you want, you can change the mapping in your vimrc: " Example: call/leave with function key F6 the Hexmode: " map HexManager " " Additional Features in HexManger: " - Find Hex Character (see Available functions). " - Changes in the printable text part are now supported in " Replace mode (command "R" or Select Mode "gh" ). " In hex part cursor moves automatically to next hex block. " If you don't like or have problems with it - please " set in your vimrc: let hex_mapchars = 0 " (see also Known Problems). " - show in statusline the current offset (hex and dec.) " - staying on a hex character it marks the related ascii column " - move to next/previous hex character with and " If you don't like this mapping - please set in your vimrc: " let hex_movetab = 0 " - Switch cursor between hex and ascii area " (as of version 0.4.0) " - staying on a hex character it marks the related ascii column " - staying on a ascii character it marks the related hex column " (as of version 0.2.0) " - Goto hex offset " - Delete hex character under cursor " - Insert ascii character before cursor " - Show own hexman menu entry with hexman commands (gui version). " If you don't like the menu - please set in your vimrc: " let hex_menu = 0 (as of version 0.1.0) " " If something is wrong (I think there is) or we can do " something better - please let me know... " "============================================================================= " Known Problems: " - Changes in the printable text part are now supported in " Replace mode (command "R" or Select Mode "gh" ) " for most characters. " For this feature I'll try to map all ascii characters, echo the " typed character and call a function wich show in the hexpart the " related hex value. For this I have to leave the Replace mode. " I don't know if it is possible to enter the Replace mode again - " we need a function like startreplace - so I switch to Select mode. " In this mode I'm not able to map some keys - like: + - ? " Appreciate any help! "============================================================================= " " Define mapping: " if !hasmapto('HexManager') map hm HexManager endif if !hasmapto('HexDelete') map hd HexDelete endif if !hasmapto('HexInsert') map hi HexInsert endif if !hasmapto('HexGoto') map hg HexGoto endif if !hasmapto('HexNext') map hn HexNext endif if !hasmapto('HexPrev') map hp HexPrev endif if !hasmapto('HexToggle') map ht HexToggle endif if !hasmapto('HexStatus') map hs HexStatus endif if !hasmapto('HexFind') map hf HexFind endif noremap