summaryrefslogtreecommitdiff
path: root/config/bash.nix
blob: bdd89c4982be244600d38d7c105c8be8df380fd1 (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
{
  programs.bash = {
    enable = true;
    initExtra= ''
      export PS1='\h \[\[\e[38;5;254m\]\w \[\033[0m\]> '

      bind "set completion-ignore-case on"

      sessionizer() {
        DIR=$(fd . /home/compromyse --type d -L -d 3 | fzf)
        SESSION_NAME="$DIR_$(date +%M%S)"

        if [ -n "$DIR" ]
        then
          cd $DIR
        fi
      }

      if [[ $- != *i* ]]
      then
        sessionizer
      fi

      bind '"\C-f": "sessionizer\n"'

      alias poof="rm $HOME/.ssh/known_hosts*"

      if [ -f $HOME/.custom_bashrc ]; then
        source $HOME/.custom_bashrc
      fi
    '';
  };
}