diff options
Diffstat (limited to '')
| -rw-r--r-- | config/bash.nix | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/config/bash.nix b/config/bash.nix new file mode 100644 index 0000000..506400c --- /dev/null +++ b/config/bash.nix @@ -0,0 +1,43 @@ +{ + programs.bash = { + enable = true; + initExtra= '' + export PS1="\[\e[38;5;243m\]\h \[\e[38;5;254m\]\w \[\033[0m\]> " + set -o vi + + if [[ -n "$IN_NIX_SHELL" ]]; then + export PS1="\[\e[38;5;242m\](dev) $PS1" + fi + + sessionizer() { + DIR=$(fd . /data --type d -L -H | 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-f": "sessionizer\n"' + bind '"\C-a": "sessionizer -cd\n"' + ''; + }; + +} |
