Thursday, December 22, 2011

Re: Binary editing

Daryl Lee wrote:
> I'm trying to use the "binary" feature of Vim 7.3, and I can't get it
> to turn on. I have it on both Windows 7 and Linux (Ubuntu 11.10 and
> Redhat 5.7). I've tried:
>
> vim -b <filename>
> :set binary
> :set display=uhex
>
> and nothing takes any effect. I get the normal "text" assortment of
> ASCII characters and <xx> values in a totally useless arrangement.
>
> Might there be a configuration issue I'm missing?
>
I think you _are_ getting binary editing mode, but that mode isn't
really what you want. See if :help xxd helps you to achieve your
objective.

If it is of interest, then (going further out on a limb), perhaps

" Augroup Binary: vim -b : edit binary using xxd-format! {{{2
augroup Binary
au!
au BufReadPre *.bin let &bin=1
au BufReadPost *.bin if &bin |%!xxd
au BufReadPost *.bin set ft=xxd|endif
au BufWritePre *.bin if &bin |%!xxd -r
au BufWritePre *.bin endif
au BufWritePost *.bin if &bin |%!xxd
au BufWritePost *.bin set nomod |endif
augroup END

in your .vimrc will further assist you. You'll probably be wanting to
extend *.bin to additional suffices, though. For example, if you're
using Windows, change *.bin to *.exe . If you're using linux its a
bit more involved, as executables under linux seldom have suffices.

Regards,
Chip Campbell

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: