From 84bacb23f00ceb4bcf3b81aac9535bab5c2cacc3 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Tue, 20 May 2025 12:25:29 +0800 Subject: [PATCH] refactor(homeModules/cli): idomaticity --- modules/home/cli/default.nix | 14 ++++---------- .../home/cli/editor/{nvf.nix => nvf/default.nix} | 10 +--------- modules/home/cli/editor/nvf/keymaps.nix | 9 +++++++++ modules/home/cli/file-browser/default.nix | 5 +++++ modules/home/cli/shell/{zsh.nix => default.nix} | 0 modules/home/cli/utilities/default.nix | 3 +++ modules/home/cli/utilities/git.nix | 6 ------ 7 files changed, 22 insertions(+), 25 deletions(-) rename modules/home/cli/editor/{nvf.nix => nvf/default.nix} (59%) create mode 100644 modules/home/cli/editor/nvf/keymaps.nix create mode 100644 modules/home/cli/file-browser/default.nix rename modules/home/cli/shell/{zsh.nix => default.nix} (100%) create mode 100644 modules/home/cli/utilities/default.nix diff --git a/modules/home/cli/default.nix b/modules/home/cli/default.nix index d471526..0653214 100644 --- a/modules/home/cli/default.nix +++ b/modules/home/cli/default.nix @@ -1,19 +1,13 @@ {config, lib, osConfig, ... }: { - imports = [ - ./file-browser/yazi.nix - ./editor/nvf.nix - ./shell/zsh.nix - ./utilities/git.nix - ]; - options.cli = { shell = lib.pantheon.mkStrOption; editor = lib.pantheon.mkStrOption; file-browser = lib.pantheon.mkStrOption; +git = { + name = lib.pantheon.mkStrOption; + email = lib.pantheon.mkStrOption; + defaultBranch = lib.pantheon.mkStrOption; }; - - config = { - }; } diff --git a/modules/home/cli/editor/nvf.nix b/modules/home/cli/editor/nvf/default.nix similarity index 59% rename from modules/home/cli/editor/nvf.nix rename to modules/home/cli/editor/nvf/default.nix index 1a5164e..ef30023 100644 --- a/modules/home/cli/editor/nvf.nix +++ b/modules/home/cli/editor/nvf/default.nix @@ -5,15 +5,7 @@ programs.nvf = { enable = true; settings.vim = { - keymaps = [ - { - desc = "Open the file path under the cursor, making the file if it doesn't exist."; - key = "gf"; - mode = "n"; - action = ":cd %:p:h:e "; - silent = true; - } - ]; + keymaps = import ./keymaps.nix; utility.yazi-nvim = { enable = true; mappings = { diff --git a/modules/home/cli/editor/nvf/keymaps.nix b/modules/home/cli/editor/nvf/keymaps.nix new file mode 100644 index 0000000..3a90792 --- /dev/null +++ b/modules/home/cli/editor/nvf/keymaps.nix @@ -0,0 +1,9 @@ +[ + { + desc = "Open the file path under the cursor, making the file if it doesn't exist."; + key = "gf"; + mode = "n"; + action = ":cd %:p:h:e "; + silent = true; + } + ] diff --git a/modules/home/cli/file-browser/default.nix b/modules/home/cli/file-browser/default.nix new file mode 100644 index 0000000..77b567e --- /dev/null +++ b/modules/home/cli/file-browser/default.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ./yazi.nix + ]; +} diff --git a/modules/home/cli/shell/zsh.nix b/modules/home/cli/shell/default.nix similarity index 100% rename from modules/home/cli/shell/zsh.nix rename to modules/home/cli/shell/default.nix diff --git a/modules/home/cli/utilities/default.nix b/modules/home/cli/utilities/default.nix new file mode 100644 index 0000000..a55eb04 --- /dev/null +++ b/modules/home/cli/utilities/default.nix @@ -0,0 +1,3 @@ +{ + imports = [ ./git.nix ]; +} diff --git a/modules/home/cli/utilities/git.nix b/modules/home/cli/utilities/git.nix index 1f0d337..0e55c37 100644 --- a/modules/home/cli/utilities/git.nix +++ b/modules/home/cli/utilities/git.nix @@ -1,11 +1,5 @@ {lib,config,...}: { - options.cli.git = { - name = lib.pantheon.mkStrOption; - email = lib.pantheon.mkStrOption; - defaultBranch = lib.pantheon.mkStrOption; - }; - config = { home.sessionVariables.GIT_CONFIG_GLOBAL = "$HOME/.config/git/config"; home.shellAliases = {