aboutsummaryrefslogtreecommitdiff
path: root/base/vim
diff options
context:
space:
mode:
authorAdam Hovorka <[email protected]>2018-07-12 10:50:23 -0600
committerAdam Hovorka <[email protected]>2018-07-12 10:50:23 -0600
commitc817818569ee99df20763d250a9d0cd4eb1d59d9 (patch)
tree7e75603a1a40583bd81bb8173d25628d0b244a0d /base/vim
parentec360351276eebc4f52822d81f44cabeda08eb55 (diff)
Add binary.vim
Diffstat (limited to 'base/vim')
-rw-r--r--base/vim/plugin/binary.vim12
1 files changed, 12 insertions, 0 deletions
diff --git a/base/vim/plugin/binary.vim b/base/vim/plugin/binary.vim
new file mode 100644
index 0000000..f9a850c
--- /dev/null
+++ b/base/vim/plugin/binary.vim
@@ -0,0 +1,12 @@
+" change *.bin to comma separated extension list
+" vim -b : edit binary using xxd-format!
+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