[TMUX/ZSH] Venv improvements
This commit is contained in:
+13
-2
@@ -27,8 +27,19 @@ bind -T off F12 \
|
||||
setw -g mode-keys vi
|
||||
set-option -g status-keys vi
|
||||
|
||||
bind | split-window -h -c '#{pane_current_path}'
|
||||
bind - split-window -v -c '#{pane_current_path}'
|
||||
# Splits keep the source pane's cwd AND its active Python venv. #{@venv} is set
|
||||
# per-pane by the shell (see .virtual_env_config.zsh); we go through run-shell
|
||||
# because tmux expands FORMATS in a run-shell command but NOT in split-window's
|
||||
# own -e value. The new pane inherits VIRTUAL_ENV and .zshrc re-activates it;
|
||||
# when the source pane has no venv we omit -e so no empty var leaks in. New
|
||||
# *windows* deliberately don't inherit it.
|
||||
bind | run-shell 'v="#{@venv}"; d="#{pane_current_path}"; if [ -n "$v" ]; then tmux split-window -h -c "$d" -e VIRTUAL_ENV="$v"; else tmux split-window -h -c "$d"; fi'
|
||||
bind - run-shell 'v="#{@venv}"; d="#{pane_current_path}"; if [ -n "$v" ]; then tmux split-window -v -c "$d" -e VIRTUAL_ENV="$v"; else tmux split-window -v -c "$d"; fi'
|
||||
|
||||
# New windows always start in the base environment: -e clears any inherited
|
||||
# VIRTUAL_ENV (e.g. if the tmux server was first started from inside a venv, so
|
||||
# its global env carries one), regardless of what the source pane had.
|
||||
bind c new-window -e VIRTUAL_ENV=
|
||||
|
||||
# Switch windows
|
||||
bind-key -n M-Left select-window -t -1
|
||||
|
||||
Reference in New Issue
Block a user