23 lines
606 B
Nix
23 lines
606 B
Nix
|
{ lib, pkgs, config, ... }:
|
||
|
let
|
||
|
cfg = config.mae.nvim.hexeditor;
|
||
|
in
|
||
|
{
|
||
|
options.mae.nvim.hexeditor.enable = lib.mkEnableOption "Enable hexediting in neovim";
|
||
|
config = lib.mkIf cfg.enable {
|
||
|
programs.neovim.extraConfig = ''
|
||
|
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
|
||
|
'';
|
||
|
};
|
||
|
}
|
||
|
|