From 6f8a11cb1ab26a51b54396509229b941f5f7199d Mon Sep 17 00:00:00 2001 From: PowerUser64 Date: Thu, 23 Sep 2021 17:13:45 -0700 Subject: [PATCH] nvim: add support for hex editing --- .config/nvim/lua/settings.lua | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.config/nvim/lua/settings.lua b/.config/nvim/lua/settings.lua index e787f58..c0a9917 100644 --- a/.config/nvim/lua/settings.lua +++ b/.config/nvim/lua/settings.lua @@ -81,7 +81,21 @@ vim.cmd [[ vnoremap J :m '>+1gv=gv vnoremap K :m '<-2gv=gv -colorscheme slate + " Make vim a hex editor + " Edit *.bin files as binaries rather than text files (if your file isn't a .bin, + " make a symlink that points to it with the .bin extension and edit the symlink ;) + 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 + + colorscheme slate ]] vim.cmd [[