Add support for hexediting to nvim

This commit is contained in:
mae 2023-04-30 18:26:56 +02:00
parent af53ec73c7
commit 30cc4f16e5
3 changed files with 24 additions and 0 deletions

View file

@ -14,6 +14,7 @@ in
./clangd.nix
./elixir.nix
./dart.nix
./hexeditor.nix
];
options.mae.nvim = {

View file

@ -0,0 +1,22 @@
{ 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
'';
};
}

View file

@ -12,5 +12,6 @@
python.enable = true;
elixir.enable = true;
dart.enable = true;
hexeditor.enable = true;
};
}