From 1158a1ecfe71effa192832679a69c7bd5ec34743 Mon Sep 17 00:00:00 2001 From: Trolli Schmittlauch Date: Thu, 12 May 2022 22:31:59 +0200 Subject: [PATCH] move zshrc into home-manager config --- home/home.nix | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/home/home.nix b/home/home.nix index 0d0d0b6..b99e6e3 100644 --- a/home/home.nix +++ b/home/home.nix @@ -378,4 +378,70 @@ in }; lfs.enable = true; }; + + # shell config + programs.zsh = { + enable = true; + enableSyntaxHighlighting = true; + history.ignoreSpace = true; + initExtra = '' + # Uncomment following line if you want red dots to be displayed while waiting for completion + COMPLETION_WAITING_DOTS="true" + ### Fix slowness of pastes with zsh-syntax-highlighting.zsh + pasteinit() { + OLD_SELF_INSERT=$\{$\{(s.:.)widgets[self-insert]}[2,3]} + zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`? + } + + pastefinish() { + zle -N self-insert $OLD_SELF_INSERT + } + zstyle :bracketed-paste-magic paste-init pasteinit + zstyle :bracketed-paste-magic paste-finish pastefinish + + # automatic rehash of path completion + zstyle ':completion:*' rehash true + + eval "$(${pkgs.thefuck}/bin/thefuck --alias)" + + ## helper functions + nixify() { + if [ ! -e ./.envrc ]; then + echo "eval \"$(lorri direnv)\"" > .envrc + direnv allow + fi + if [ ! -e shell.nix ]; then + cat > shell.nix <<'EOF' + with import {}; + mkShell { + buildInputs = [ + bashInteractive + ]; + } + EOF + ${EDITOR:-vim} default.nix + fi + } + + binpath() { + realpath $(${pkgs.which}/bin/which $1) + } + ''; + + + oh-my-zsh = { + enable = true; + theme = "bira"; + plugins = [ "git" "python" "systemd" "gpg-agent" "zsh-syntax-highlighting"]; + }; + }; + home.shellAliases = { + ip = "ip --color"; + ipb = "ip --color --brief"; + ll = "ls -l"; + wavesynth = "nix-shell -p sox --run 'play -n synth brownnoise synth pinknoise mix synth 0 0 0 15 40 80 trapezium amod 0.2 20'"; + }; + home.sessionVariables = { + EDITOR = "vim"; + }; }