diff options
Diffstat (limited to 'user/settings/zsh.nix')
-rw-r--r-- | user/settings/zsh.nix | 76 |
1 files changed, 42 insertions, 34 deletions
diff --git a/user/settings/zsh.nix b/user/settings/zsh.nix index 6e6c04d3..2a30bc63 100644 --- a/user/settings/zsh.nix +++ b/user/settings/zsh.nix @@ -1,16 +1,25 @@ -{ config, lib, pkgs, ... }: - -let +{ + config, + lib, + pkgs, + ... +}: let inherit (pkgs) stdenv; - lsOptions = if stdenv.isDarwin then "-p" else "-v --group-directories-first"; - lsIsoDate = if stdenv.isDarwin then "" else "--time-style=long-iso"; + lsOptions = + if stdenv.isDarwin + then "-p" + else "-v --group-directories-first"; + lsIsoDate = + if stdenv.isDarwin + then "" + else "--time-style=long-iso"; zshrc = ".config/zsh/.zshrc"; mkZshPlugin = attrs: { name = attrs.name; src = stdenv.mkDerivation { inherit (attrs) src; name = "zsh-plugin-${attrs.name}"; - buildInputs = [ pkgs.zsh ]; + buildInputs = [pkgs.zsh]; buildPhase = '' zsh -c 'for f in **/*.zsh; zcompile "$f"' ''; @@ -19,8 +28,7 @@ let ''; }; }; -in -{ +in { home.packages = with pkgs; [ fzf ghq @@ -52,7 +60,7 @@ in ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE = "fg=8"; }; - plugins = (map mkZshPlugin [ + plugins = map mkZshPlugin [ { name = "cd-gitroot"; src = pkgs.fetchFromGitHub { @@ -93,7 +101,7 @@ in sha256 = "0qmm0xm1aiy3fnn2vib26z10cfy707yqg0vg5236r7978glswdlg"; }; } - ]); + ]; shellAliases = { l = "ls ${lsOptions} -Bp"; @@ -111,10 +119,8 @@ in https = "http --default-scheme https"; history = "fc -l $(( $LINES - 2 ))"; - hist-freq-lines = - "fc -l -10000 | cut -d' ' -f4- | sort | uniq -c | sort -g | tail -n100 | less"; - hist-freq-commands = - "fc -l -10000 | cut -d' ' -f4 | sort | uniq -c | sort -g | tail -n10 | less"; + hist-freq-lines = "fc -l -10000 | cut -d' ' -f4- | sort | uniq -c | sort -g | tail -n100 | less"; + hist-freq-commands = "fc -l -10000 | cut -d' ' -f4 | sort | uniq -c | sort -g | tail -n10 | less"; wprop = "xprop | egrep '^WM_(CLASS|NAME|WINDOW_ROLE|TYPE)'"; # Enable the following commands to support aliases. @@ -213,26 +219,28 @@ in fi ''; - initExtra = '' - autoload -Uz compinit - compinit -C - typeset -T GHQ_ROOT ghq_root - export GHQ_ROOT="$HOME/projects" - - function hist-freq-subcommands () { - fc -l -m "$1*" -10000 | cut -d' ' -f4- | sort | uniq -c | sort -g | tail -n100 | less - } - - source ${pkgs.fzf}/share/fzf/key-bindings.zsh - source ${pkgs.fzf}/share/fzf/completion.zsh - - '' + builtins.readFile ../zsh/zshrc + ( - if stdenv.isDarwin - then builtins.readFile ../zsh/zshrc.darwin - else "" - ); + initExtra = + '' + autoload -Uz compinit + compinit -C + typeset -T GHQ_ROOT ghq_root + export GHQ_ROOT="$HOME/projects" + + function hist-freq-subcommands () { + fc -l -m "$1*" -10000 | cut -d' ' -f4- | sort | uniq -c | sort -g | tail -n100 | less + } + + source ${pkgs.fzf}/share/fzf/key-bindings.zsh + source ${pkgs.fzf}/share/fzf/completion.zsh + + '' + + builtins.readFile ../zsh/zshrc + + ( + if stdenv.isDarwin + then builtins.readFile ../zsh/zshrc.darwin + else "" + ); }; - home.file."${zshrc}".onChange = - "${pkgs.zsh}/bin/zsh -i -c 'autoload -Uz compinit && compinit && zcompile ${zshrc}'"; + home.file."${zshrc}".onChange = "${pkgs.zsh}/bin/zsh -i -c 'autoload -Uz compinit && compinit && zcompile ${zshrc}'"; } |