From 9f13bdf474f712114adeb00370dc6b8ed687d6a6 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Mon, 18 Mar 2024 12:57:53 -0400 Subject: [PATCH] refactor: parametrize using module system --- home/helix.nix | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/home/helix.nix b/home/helix.nix index 53d2914..74e3f41 100644 --- a/home/helix.nix +++ b/home/helix.nix @@ -1,17 +1,23 @@ -{ pkgs, ... }: +{ config, pkgs, lib, ... }: { - programs.helix = { + options = { + my.helix = { + markdown.enable = lib.mkEnableOption "Enable markdown support" // { default = true; }; + }; + }; + + config.programs.helix = { enable = true; - extraPackages = with pkgs; [ - marksman - ]; + extraPackages = lib.optional config.my.helix.markdown.enable pkgs.marksman; settings = { theme = "snazzy"; - editor .true-color = true; - keys.insert.j.j = "normal_mode"; - # Shortcut to save file, in any mode. - keys.insert."C-s" = [ ":write" "normal_mode" ]; - keys.normal."C-s" = ":write"; + editor.true-color = true; + keys = { + insert.j.j = "normal_mode"; + # Shortcut to save file, in any mode. + insert."C-s" = [ ":write" "normal_mode" ]; + normal."C-s" = ":write"; + }; editor.lsp = { display-messages = true;