diff options
| author | Raghuram Subramani <raghus2247@gmail.com> | 2024-02-01 18:40:39 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-01 18:40:39 +0530 |
| commit | 88cc3e7e0765b5dd11b06db442ad46536342bba5 (patch) | |
| tree | d3b1c7b0d54ef3c2274d64967a3bcd2818c03c8e /config/bash.nix | |
| parent | 01bb0877c285383fd2857920048bd2576f4d31e9 (diff) | |
Updates (#1)
* .
* .
* .
* .
* .
* .
* .
* .
* .
* .
* update
* .
* temp
* .
* .
* .
* .
* .
* .
* .
* .
* .
* .
* .
* .
* temp
* .
* .
* .
* update
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"' + ''; + }; + +} |
