summaryrefslogtreecommitdiff
path: root/custom/zsh.nix
blob: 7279cf4ff473dace4ce6972f94c4ab4781b36449 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{ config, pkgs, ... }:
let
	antigen = pkgs.callPackage (import ./antigen.nix) {};
in rec {
  programs.zsh.enable = true;
  programs.zsh.shellAliases = {
    less = "less -R";
    ls = "ls --color=auto";
    l = "ls -lhAF";
    ll = "l --color=always L";
    ".." = "cd ..";
    "nix-shell" = "nix-shell --command $(getent passwd $LOGNAME | cut -d: -f7)";
  };
  programs.zsh.interactiveShellInit = ''
    setopt clobber
    setopt nobeep

    alias -g L='|less'
    alias -g S='&> /dev/null'
    alias -g G='|grep --color=auto'
    alias -g B='&> /dev/null &!'

    cl() { cd; clear }
  '';
  programs.zsh.promptInit = ''
    bindkey -e
    source ${antigen}/antigen.zsh

    antigen use oh-my-zsh
    antigen bundles <<EOBUNDLES
      tmux
      zsh-users/zsh-syntax-highlighting
      systemd
    EOBUNDLES

    if [[ -e ~/.zsh-theme ]]; then
      antigen theme ~
    else
      antigen theme jreese
    fi

    antigen apply
  '';
}