oluevaera / tmux-conda-inherit

Make new tmux windows and panes inherit the currently active conda environment.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

conda inherit plugin

You are working on a new project, you have your conda environment set up with all your requirements, you are about to test run your changes on a new pane.

Why is my conda environment back to "base"?! 😩

Introducing the conda-inherit plugin for tmux!

You won't be annoyed like that again, your tmux will now always open new windows and panes with the environment of your currently selected (cursor) window/pane.

To install, just follow the instructions below! 😎

Requirements

The following dependencies are required in order to use this plugin:

Installation (via tpm)

Add the following lines to your tmux.config file:

set -g @plugin 'oluevaera/tmux-conda-inherit'

Extend your current new-window and split-window keybinds with -e "TMUX_PARENT_PANE_ID=#{pane_id}.
For example:

bind '%' run 'tmux split-window -c "#{pane_current_path}" -e "TMUX_PARENT_PANE_ID=#{pane_id}" -h'
bind '"' run 'tmux split-window -c "#{pane_current_path}" -e "TMUX_PARENT_PANE_ID=#{pane_id}" -v'
bind c run 'tmux new-window -c "#{pane_current_path}" -e "TMUX_PARENT_PANE_ID=#{pane_id}"'

Add the following lines to your .bashrc or .zshrc.

if [[ -n "$TMUX" ]] then
  export flavor='micromamba'
  source $HOME/.config/tmux/plugins/conda-inherit/conda-inherit.sh
fi

Change the flavor value to the conda version you're using (conda, mamba, micromamba, etc.).
Make sure that the source path corresponds to the conda-inherit plugin path.

Future

Working on adding support for fish.

About

Make new tmux windows and panes inherit the currently active conda environment.


Languages

Language:Shell 100.0%