From 468b7cf7fc3f22561eef5296ec52986d71b95744 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Sat, 11 Jan 2025 00:31:13 +0100 Subject: [PATCH] Automatically start nvim on tmux new session --- modules/cli/tools/tmux-sessionizer.sh | 2 +- modules/cli/zsh/default.nix | 6 ------ modules/cli/zsh/init.zsh | 6 ++++++ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/cli/tools/tmux-sessionizer.sh b/modules/cli/tools/tmux-sessionizer.sh index cf9d03e..1713779 100644 --- a/modules/cli/tools/tmux-sessionizer.sh +++ b/modules/cli/tools/tmux-sessionizer.sh @@ -21,7 +21,7 @@ fi current_session=$(tmux display-message -p "#S") if ! tmux has-session "-t=$selected_name" 2> /dev/null; then - tmux new-session -ds "$selected_name" -c "$selected" "CMD='nvim .' $SHELL" + tmux new-session -ds "$selected_name" -c "$selected" -e "CMD=$EDITOR ." fi tmux switch-client -t "$selected_name" diff --git a/modules/cli/zsh/default.nix b/modules/cli/zsh/default.nix index dce8a39..eb3f8f1 100644 --- a/modules/cli/zsh/default.nix +++ b/modules/cli/zsh/default.nix @@ -108,12 +108,6 @@ } trap __onExit EXIT fi - - # execute arbitrary commands on startup since `zsh -sc` is not a real option :c - if [[ -n CMD ]]; then - eval $CMD - unset CMD - fi ''; initExtraBeforeCompInit = builtins.readFile ./comp.zsh; completionInit = diff --git a/modules/cli/zsh/init.zsh b/modules/cli/zsh/init.zsh index 3569294..1d4fea4 100644 --- a/modules/cli/zsh/init.zsh +++ b/modules/cli/zsh/init.zsh @@ -163,3 +163,9 @@ proxy() { # disable space between right prompt and end of line ZLE_RPROMPT_INDENT=0 + +# execute arbitrary commands on startup since `zsh -sc` is not a real option :c +if [[ -n CMD ]]; then + eval $CMD + unset CMD +fi