all repos — dotfiles @ b014e77ebaf6a6fc8b4e8850e59379a8be302ca3

my *nix dotfiles

nix/programs/bash.nix (view raw)

 1{ config
 2, pkgs
 3, ...
 4}:
 5
 6{
 7  programs.bash = {
 8    enable = true;
 9    historyControl = [ "erasedups" ];
10    historyFile = "\$HOME/.bash_history";
11    historyFileSize = 40000;
12    historyIgnore = [ "ls" "exit" "kill" ];
13    historySize = 40000;
14
15    shellAliases = {
16      o = "xdg-open";
17      gc = "git commit -v -S";
18      gst = "git status --short";
19      ga = "git add";
20      gd = "git diff --minimal";
21      gl = "git log --oneline --decorate --graph";
22      k = "kubectl";
23      n = "j";
24    };
25
26    shellOptions = [
27      "histappend"
28      "autocd"
29      "globstar"
30      "checkwinsize"
31      "cdspell"
32      "dirspell"
33      "expand_aliases"
34      "dotglob"
35      "gnu_errfmt"
36      "histreedit"
37      "nocasematch"
38    ];
39
40    sessionVariables = {
41
42      TERM = "xterm-256color-italic";
43      EDITOR = "nvim";
44      MANPAGER = "nvim +Man!";
45      BROWSER = "firefox";
46      PW_DIR = "$HOME/.pw";
47      PW_KEY = "x@icyphox.sh";
48      PATH = "$PATH:$HOME/bin";
49
50    };
51
52    initExtra = ''
53      # Ctrl+W kills word
54      stty werase undef
55
56      # fzy reverse search
57      __fzy_history() {
58          ch="$(fc -rl 1 | awk -F'\t' '{print $2}' | sort -u | fzy)"
59          : "''${ch#"''${ch%%[![:space:]]*}"}"
60          printf "$_"
61      }
62
63      bind -x '"\C-r": READLINE_LINE=$(__fzy_history); READLINE_POINT="''${#READLINE_LINE}"'
64
65      complete -cf doas
66
67      for i in ~/.bashrc.d/[0-9]*; do
68          . "$i"
69      done
70    '';
71
72  };
73}