Last active
April 21, 2025 10:28
-
-
Save zba/1c524ced6d01b209643d066ec9b0e70f to your computer and use it in GitHub Desktop.
run zellij session in current dir, with own autoupdated HISTFILE, good for run in vscode with ctrl+a unlocks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#name as ~/bin/runZellijSession.sh | |
session_name=$(echo $PWD|sed "s/\\//_/g")_ | |
hist_path="$HOME/.config/zellij/bash_histories" | |
mkdir -p $hist_path | |
old_hist_file="$HOME/.bash_history" | |
export HISTFILE="$hist_path/$session_name" | |
if [ ! -f "$HISTFILE" ]; then | |
cp "$old_hist_file" "$HISTFILE" | |
fi | |
export HISTSIZE=100000 | |
export HISTFILESIZE=100000 | |
export HISTCONTROL=ignoredups | |
# Save history after each command | |
export PROMPT_COMMAND="history -a;history -r;$PROMPT_COMMAND" | |
zellij a -c $session_name||sleep 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment