mirror of
https://github.com/Cian-H/dotfiles.git
synced 2025-12-26 20:51:56 +00:00
This change allows the dotfiles to work with chezmoi (e.g: on windows) and improves grepability with neovim/telescope
Auto virtual environment scripts
The scripts in this directory activate virtual environments whenever you cd into a directory with a "trigger" file
Usage
- set
$env.AUTO_VENV_TRIGGERas the preferred name of a trigger file - import
auto-venvinto your environment - Create a symlink via
ln -sof the script file./auto-venv/venvs/python-venv.nuto a trigger file in project at/path/to/project/$AUTO_VENV_TRIGGER cdinto/path/to/project/
For example:
# config.nu
export-env {
$env.AUTO_VENV_TRIGGER = '__auto-venv.nu'
source-env ~/path/to/nu_scripts/modules/virtual_environments/auto-venv/auto-venv.nu
}
use ~/path/to/nu_scripts/modules/virtual_environments/auto-venv/auto-venv.nu *
When auto-venv detects that a file of that name exists in the folder you cd'ed into (or one of it's parents), it will automatically enable an overlay (as defined by the trigger file).
An example overlay for python venv is in ./venvs
NOTE: the trigger file must export a custom command called auto-venv-on-enter that takes in the $env (this is the environment before the overlay was enabled).
Limitations
- Due to limitations with overlay naming, you cannot nest auto-venv triggers, even for separate languages / toolchains