feat(zsh): attach to or create tmux session in interactive shells
This commit is contained in:
parent
b437553ce3
commit
a0f53489fa
1 changed files with 18 additions and 4 deletions
|
@ -1,8 +1,13 @@
|
||||||
{ pkgs, theme, ... }:
|
|
||||||
let
|
|
||||||
zsh_autosuggest_highlight_style = if theme == "light" then "fg=180" else "fg=10";
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
pkgs,
|
||||||
|
theme,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
zsh_autosuggest_highlight_style =
|
||||||
|
if theme == "light"
|
||||||
|
then "fg=180"
|
||||||
|
else "fg=10";
|
||||||
|
in {
|
||||||
programs.zsh = {
|
programs.zsh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableCompletion = true;
|
enableCompletion = true;
|
||||||
|
@ -14,6 +19,15 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
initContent = ''
|
initContent = ''
|
||||||
|
# Auto-start tmux if conditions are met
|
||||||
|
if [[ -z "$TMUX" && -z "$SSH_TTY" && $- == *i* ]]; then
|
||||||
|
# Check if tmux is available and terminal supports it
|
||||||
|
if command -v tmux >/dev/null 2>&1; then
|
||||||
|
# Try to attach to existing session, or create new one
|
||||||
|
exec tmux new-session -A -s default
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
function set_win_title(){
|
function set_win_title(){
|
||||||
local TITLE=$(git config --get remote.origin.url || echo "$PWD")
|
local TITLE=$(git config --get remote.origin.url || echo "$PWD")
|
||||||
echo -ne "\033]0; $(basename "$TITLE") \007"
|
echo -ne "\033]0; $(basename "$TITLE") \007"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue