From fdb9ba23a2cff4b50a699eb89435aa9a9de77891 Mon Sep 17 00:00:00 2001 From: Shubham Saini Date: Fri, 29 Sep 2023 20:32:40 -0700 Subject: nix: trying modules --- darwin/home.nix | 54 ++++-------------------------------------------------- modules/zsh.nix | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 50 deletions(-) create mode 100644 modules/zsh.nix diff --git a/darwin/home.nix b/darwin/home.nix index e0b1bb0..5e24a76 100644 --- a/darwin/home.nix +++ b/darwin/home.nix @@ -44,6 +44,10 @@ }; }; + imports = [ + ../modules/zsh.nix + ]; + home.sessionVariables = { PATH = "$PATH:$HOME/.bin"; EDITOR = "nvim"; @@ -51,56 +55,6 @@ }; programs.home-manager.enable = true; - programs.zsh = { - enable = true; - enableCompletion = true; - enableAutosuggestions = true; - dotDir = ".zsh"; - history = { - ignoreAllDups = true; - path = "$HOME/.zsh/history"; - }; - initExtra = '' - zstyle ':completion:*' menu select - zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' - zmodload zsh/complist - bindkey -M menuselect 'h' vi-backward-char - bindkey -M menuselect 'k' vi-up-line-or-history - bindkey -M menuselect 'l' vi-forward-char - bindkey -M menuselect 'j' vi-down-line-or-history - bindkey '^f' autosuggest-accept - source ${pkgs.zsh-vi-mode}/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh - zvm_after_init_commands+=('source ${pkgs.fzf}/share/fzf/completion.zsh && source ${pkgs.fzf}/share/fzf/key-bindings.zsh') - ''; - shellAliases = { - ".." = "cd .."; - l = "ls --color -al"; - ls = "ls --color"; - v = "nvim"; - o = "xdg-open"; - t = "tmux"; - f = "lf"; - tf = "terraform"; - k = "kubectl"; - gst = "git status --short"; - ga = "git add"; - gp = "git push"; - gl = "git log --oneline --decorate --graph"; - gc = "git commit -v -S"; - gd = "git diff --minimal"; - }; - plugins = [ - { - name = "pure"; - src = pkgs.fetchFromGitHub { - owner = "sindresorhus"; - repo = "pure"; - rev = "v1.22.0"; - sha256 = "177vabhvgrxdcwvc29rmfmfr96wl75hrkhymnd8qcaky2v4047jd"; - }; - } - ]; - }; programs.fzf = { enable = true; enableZshIntegration = false; diff --git a/modules/zsh.nix b/modules/zsh.nix new file mode 100644 index 0000000..bd7a30f --- /dev/null +++ b/modules/zsh.nix @@ -0,0 +1,52 @@ +{ + programs.zsh = { + enable = true; + enableCompletion = true; + enableAutosuggestions = true; + dotDir = ".zsh"; + history = { + ignoreAllDups = true; + path = "$HOME/.zsh/history"; + }; + initExtra = '' + zstyle ':completion:*' menu select + zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' + zmodload zsh/complist + bindkey -M menuselect 'h' vi-backward-char + bindkey -M menuselect 'k' vi-up-line-or-history + bindkey -M menuselect 'l' vi-forward-char + bindkey -M menuselect 'j' vi-down-line-or-history + bindkey '^f' autosuggest-accept + source ${pkgs.zsh-vi-mode}/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh + zvm_after_init_commands+=('source ${pkgs.fzf}/share/fzf/completion.zsh && source ${pkgs.fzf}/share/fzf/key-bindings.zsh') + ''; + shellAliases = { + ".." = "cd .."; + l = "ls --color -al"; + ls = "ls --color"; + v = "nvim"; + o = "xdg-open"; + t = "tmux"; + f = "lf"; + tf = "terraform"; + k = "kubectl"; + gst = "git status --short"; + ga = "git add"; + gp = "git push"; + gl = "git log --oneline --decorate --graph"; + gc = "git commit -v -S"; + gd = "git diff --minimal"; + }; + plugins = [ + { + name = "pure"; + src = pkgs.fetchFromGitHub { + owner = "sindresorhus"; + repo = "pure"; + rev = "v1.22.0"; + sha256 = "177vabhvgrxdcwvc29rmfmfr96wl75hrkhymnd8qcaky2v4047jd"; + }; + } + ]; + }; +} -- cgit v1.2.3