aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--base.yaml1
-rw-r--r--base/vim/plugin/binary.vim12
2 files changed, 13 insertions, 0 deletions
diff --git a/base.yaml b/base.yaml
index 0f260e8..d4affd6 100644
--- a/base.yaml
+++ b/base.yaml
@@ -22,6 +22,7 @@
~/.vim/ftdetect: base/vim/ftdetect
~/.vim/ftplugin: base/vim/ftplugin
~/.vim/indent: base/vim/indent
+ ~/.vim/plugin: base/vim/plugin
~/.vim/syntax: base/vim/syntax
~/.vimrc: base/vimrc
~/.zsh: base/zsh
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