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 [[