blob: bf53bbd63dc80cd7fd1d03c3f99040a094c22884 (
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
45
46
 | {
  programs.bash = {
    enable = true;
    initExtra= ''
      export PS1="\[\e[38;5;243m\]\h \[\e[38;5;254m\]\w \[\033[0m\]> "
      bind "set completion-ignore-case on"
      if [[ -n "$IN_NIX_SHELL" ]]; then
        export PS1="\[\e[38;5;242m\](dev) $PS1"
      fi
      sessionizer() {
        DIR=$(fd . /home/compromyse --type d -L -d 3 | fzf)
        SESSION_NAME="$DIR_$(date +%M%S)"
        if [ -n "$DIR" ]
        then
          if [ "$1" == "-cd" ]
          then
            cd $DIR
            return
          fi
          tmux new-session -d -c "$DIR" -s "$SESSION_NAME"
          if [ -n "$TMUX" ]
          then
            tmux switch -t "$SESSION_NAME"
          else
            tmux attach -t "$SESSION_NAME"
          fi
        fi
      }
      if [[ $- != *i* ]]
      then
        sessionizer
      fi
      bind '"\C-g": "sessionizer\n"'
      bind '"\C-f": "sessionizer -cd\n"'
      alias c="ssh root@cacer.local"
      alias ub1="ssh ubuntu@ub1.local"
      alias ub2="ssh ubuntu@ub2.local"
    '';
  };
}
 |