~gpanders/dotfiles

ref: 885174d3dacde7705891f7dc7934650f50697c87 dotfiles/vim/.vim/plugin/binary.vim -rw-r--r-- 665 bytes
885174d3Greg Anders Update fzf configuration 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
" Improved editing of binary files
" This makes vim a slightly more tolerable hex editor, although there are
" still better options out there
" Most of the magic happens in the xxd filetype plugin, not here
" Author: Greg Anders <greg@gpanders.com>
" Date: 2018-12-24

augroup Binary
  autocmd!
  autocmd BufReadPost  * if &bin | %!xxd
  autocmd BufReadPost  * set ft=xxd
  autocmd BufReadPost  * endif
  autocmd BufWritePre  * if &bin | %!xxd -r
  autocmd BufWritePre  * endif
  autocmd BufWritePost * if &bin | %!xxd
  autocmd BufWritePost * set nomod | endif
augroup END

" Delete the augroup if not in binary mode
au VimEnter * if !&binary | au! Binary | endif