From 9104f3b5afc03c0d24fee2d29e334267d0e6bee9 Mon Sep 17 00:00:00 2001 From: voidarc Date: Wed, 15 Jul 2026 17:47:26 +0100 Subject: [PATCH] reformat and added vinix and nrs functions --- modules/features/zsh/default.nix | 94 +++++++++++++++++--------------- 1 file changed, 50 insertions(+), 44 deletions(-) diff --git a/modules/features/zsh/default.nix b/modules/features/zsh/default.nix index 92d2be5..83799c6 100644 --- a/modules/features/zsh/default.nix +++ b/modules/features/zsh/default.nix @@ -30,58 +30,64 @@ ... }: { packages = { - zsh = inputs.wrappers.wrappers.zsh.wrap { - inherit pkgs; - runtimePkgs = [pkgs.carapace pkgs.fzf]; - zshAliases = { - ls = "${lib.getExe pkgs.lsd} -l"; - v = lib.getExe self'.packages.nvim; - cat = lib.getExe pkgs.bat; - lg = lib.getExe pkgs.lazygit; - devenv = lib.getExe pkgs.devenv; - carapace = lib.getExe pkgs.carapace; - man = "man -P \"${lib.getExe pkgs.bat} -p\""; - nsh = "nix-shell -p"; - }; - zshrc.content = '' - if (( ''${+terminfo[smkx]} )) && (( ''${+terminfo[rmkx]} )); then - function zle-line-init() { echoti smkx } - function zle-line-finish() { echoti rmkx } - zle -N zle-line-init - zle -N zle-line-finish - fi - autoload -U compinit && compinit - export CARAPACE_BRIDGES='zsh,fish,bash,inshellisense' # optional - zstyle ':completion:*' format $'\e[2;37mCompleting %d\e[m' - source <(${lib.getExe pkgs.carapace} _carapace) - zstyle ':completion:*' matcher-list 'm:{[:lower:]}={[:upper:]}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' + zsh = let + flakeLocation = builtins.getEnv "PWD"; + in + assert flakeLocation != ""; + inputs.wrappers.wrappers.zsh.wrap { + inherit pkgs; + runtimePkgs = [pkgs.carapace pkgs.fzf]; + zshAliases = { + ls = "${lib.getExe pkgs.lsd} -l"; + v = lib.getExe self'.packages.nvim; + cat = lib.getExe pkgs.bat; + lg = lib.getExe pkgs.lazygit; + devenv = lib.getExe pkgs.devenv; + carapace = lib.getExe pkgs.carapace; + man = "man -P \"${lib.getExe pkgs.bat} -p\""; + nsh = "nix-shell -p"; + nrs = "( cd ${flakeLocation} && sudo nixos-rebuild switch --impure --flake . )"; + vinix = "nvim --cmd 'cd ${flakeLocation}'"; + }; + zshrc.content = '' + if (( ''${+terminfo[smkx]} )) && (( ''${+terminfo[rmkx]} )); then + function zle-line-init() { echoti smkx } + function zle-line-finish() { echoti rmkx } + zle -N zle-line-init + zle -N zle-line-finish + fi + autoload -U compinit && compinit + export CARAPACE_BRIDGES='zsh,fish,bash,inshellisense' # optional + zstyle ':completion:*' format $'\e[2;37mCompleting %d\e[m' + source <(${lib.getExe pkgs.carapace} _carapace) + zstyle ':completion:*' matcher-list 'm:{[:lower:]}={[:upper:]}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' - autoload -U select-word-style - select-word-style bash + autoload -U select-word-style + select-word-style bash - autoload -U up-line-or-beginning-search down-line-or-beginning-search - zle -N up-line-or-beginning-search - zle -N down-line-or-beginning-search - bindkey "^[OA" up-line-or-beginning-search - bindkey "^[OB" down-line-or-beginning-search + autoload -U up-line-or-beginning-search down-line-or-beginning-search + zle -N up-line-or-beginning-search + zle -N down-line-or-beginning-search + bindkey "^[OA" up-line-or-beginning-search + bindkey "^[OB" down-line-or-beginning-search - bindkey "^[[1;5C" forward-word - bindkey "^[[1;5D" backward-word - bindkey "^[[3;5~" kill-word - bindkey "^H" backward-kill-word + bindkey "^[[1;5C" forward-word + bindkey "^[[1;5D" backward-word + bindkey "^[[3;5~" kill-word + bindkey "^H" backward-kill-word - source <(${lib.getExe pkgs.fzf} --zsh) + source <(${lib.getExe pkgs.fzf} --zsh) - setopt NO_CASE_GLOB + setopt NO_CASE_GLOB - export EDITOR=nvim + export EDITOR=nvim - eval "$(${lib.getExe pkgs.devenv} hook zsh)" - eval "$(${lib.getExe self'.packages.ohMyPosh} init zsh)" + eval "$(${lib.getExe pkgs.devenv} hook zsh)" + eval "$(${lib.getExe self'.packages.ohMyPosh} init zsh)" - ${lib.getExe pkgs.any-nix-shell} zsh --info-right | source /dev/stdin - ''; - }; + ${lib.getExe pkgs.any-nix-shell} zsh --info-right | source /dev/stdin + ''; + }; ohMyPosh = inputs.wrappers.wrappers.oh-my-posh.wrap { inherit pkgs; configFile = ./config.toml;