numToStr / FTerm.nvim

:fire: No-nonsense floating terminal plugin for neovim :fire:
MIT License
721 stars 24 forks source link

How to use the same python venv that was set in shell #101

Closed akmalsoliev closed 4 months ago

akmalsoliev commented 4 months ago

I am trying to figure out how to ensure that python venv that is set in shell is the same as the one in FTerm. At current moment, I have to manually set it up by activating the venv, is there a better solution if the first option is not available? Thanks for all the hard work, love the plugin.

akmalsoliev commented 4 months ago

UPDATE: works with the following addition to config.fish:

# Activate venv
function sv
    source venv/bin/activate
    and tmux set-environment VIRTUAL_ENV $VIRTUAL_ENV
end
if test -n "$VIRTUAL_ENV"
    source $VIRTUAL_ENV/bin/activate.fish
end

bash version:

# Activate venv
function sv() {
    source venv/bin/activate && tmux set-environment VIRTUAL_ENV $VIRTUAL_ENV
}

if [ -n "$VIRTUAL_ENV" ]; then
    source $VIRTUAL_ENV/bin/activate
fi

All credits to: https://www.mackorone.com/2020/02/23/tmux-and-venv.html