Skip to content

feat: multiple venv support, --active flag, auto pyproject sync, and terminal options#25

Open
ABCtoDev wants to merge 1 commit intobenomahony:mainfrom
ABCtoDev:feature/multiple-venv-patterns
Open

feat: multiple venv support, --active flag, auto pyproject sync, and terminal options#25
ABCtoDev wants to merge 1 commit intobenomahony:mainfrom
ABCtoDev:feature/multiple-venv-patterns

Conversation

@ABCtoDev
Copy link
Copy Markdown

@ABCtoDev ABCtoDev commented Jan 9, 2026

Summary

Add support for multiple virtual environment directory patterns with comprehensive venv management features.

Problem

Currently, uv.nvim only detects .venv directories. Many projects use different naming conventions like .venv-3.11, venv, or venv-dev.

Solution

Multiple venv pattern support

Added find_venvs() helper function that detects:

  • .venv (exact match)
  • .venv-* (prefix match, e.g., .venv-3.11, .venv-dev)
  • venv (exact match)
  • venv-* (prefix match, e.g., venv-py311)

Improved picker display

Updated both Snacks and Telescope pickers to show activation status:

  • ● .venv (Active) - Currently active venv
  • ○ .venv-3.11 - Available but inactive

venv-selector.nvim integration

Activating a venv through uv.nvim will also update venv-selector's state. This provides unified venv management across different picker UIs.

--active flag support for custom venv

When a non-default venv (e.g., .venv-3.11) is activated, uv commands automatically include the --active flag:

  • uv adduv add --active
  • uv removeuv remove --active
  • uv syncuv sync --active
  • uv runuv run --active

Auto pyproject.toml and .python-version sync

When switching to a different venv:

  • Updates requires-python with strict range (e.g., >=3.11,<3.12)
  • Updates .python-version file to match
  • Runs uv lock with target Python version to resolve compatible packages
  • Syncs packages and updates dependency versions in pyproject.toml

Auto LSP restart

After uv add/uv remove/uv sync commands complete, LSP is automatically restarted to recognize new packages immediately.

New execution options

execution = {
  -- Where to open the terminal: "split" | "vsplit" | "tab"
  terminal = "split",

  -- Hide result buffer from buffer list (tabline)
  hide_result_buffer = false,

  -- Reuse existing result split window instead of creating new one
  reuse_result_split_buffer = false,
}

Required Dependencies

Testing

  • Tested with multiple venv patterns in workspace
  • Verified Snacks picker displays correctly
  • Confirmed venv-selector integration works
  • Verified --active flag is added for custom venvs
  • Confirmed LSP restart after package changes
  • Tested terminal reuse and hide options

Breaking Changes

  • venv-selector.nvim is now a required dependency

…terminal options

## Multiple venv pattern support
- Added find_venvs() helper that detects: .venv, .venv-*, venv, venv-*
- Updated Snacks and Telescope pickers to show activation status

## venv-selector.nvim integration
- Activating venv through uv.nvim updates venv-selector state
- Provides unified venv management across different picker UIs

## --active flag support for custom venv
When a non-default venv is activated, uv commands automatically include --active:
- uv add → uv add --active
- uv remove → uv remove --active
- uv sync → uv sync --active
- uv run → uv run --active

## Auto pyproject.toml and .python-version sync
When switching venv:
- Updates requires-python with strict range (e.g., >=3.11,<3.12)
- Runs uv lock with target Python version
- Syncs packages and updates dependency versions

## Auto LSP restart
After uv add/remove/sync commands complete, LSP automatically restarts

## New execution options
- hide_result_buffer: Hide result buffer from tabline (default: false)
- reuse_result_split_buffer: Reuse existing result split window (default: false)
- terminal: Where to open terminal - split/vsplit/tab (default: split)

## Breaking Changes
- venv-selector.nvim is now a required dependency
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant