🗂️ Built-in searches
The plugin uses fd for the built-in searches. Its possible to set the option fd_binary_name
if your binary has a different name on your system, but the plugin attempts to find and use common names like fdfind
or fd_find
automatically.
Built-in searches
- Linux
- Mac
- Windows
📝 Poetry | ~/.cache/pypoetry/virtualenvs |
🐍 Pyenv | ~/.pyenv/versions |
🔧 Pipenv | ~/.local/share/virtualenvs |
📦 Pipx | ~/.local/share/pipx/venvs , ~/.local/pipx/venvs |
🥚 Hatch | ~/.local/share/hatch |
🐍 Vanilla python venvs | ~/.virtualenvs |
🐍 Anaconda Base | /opt/anaconda/bin |
🐍 Anaconda Environments | ~/.conda/envs |
🐍 Miniconda Base | ~/miniconda3/bin |
🐍 Miniconda Environments | ~/miniconda3/envs |
📁 cwd | current working dir |
🔧 workspace | lsp workspace dirs |
📄 file | active file dir |
📝 Poetry | ~/Library/Caches/pypoetry/virtualenvs |
🐍 Pyenv | ~/.pyenv/versions |
🔧 Pipenv | ~/.local/share/virtualenvs |
📦 Pipx | ~/.local/share/pipx/venvs , ~/.local/pipx/venvs |
🥚 Hatch | ~/Library/Application Support/hatch/env/virtual |
🐍 Vanilla python venvs | ~/.virtualenvs |
🐍 Anaconda Base | /opt/anaconda/bin |
🐍 Anaconda Environments | ~/.conda/envs |
🐍 Miniconda Base | ~/miniconda3/bin |
🐍 Miniconda Environments | ~/miniconda3/envs |
📁 cwd | current working dir |
🔧 workspace | lsp workspace dirs |
📄 file | active file dir |
📝 Poetry | $HOME/AppData/Local/pypoetry/Cache/virtualenvs |
🐍 Pyenv | $HOME/.pyenv/pyenv-win/versions |
🔧 Pipenv | $HOME/.virtualenvs |
📦 Pipx | $HOME/pipx/venvs |
🥚 Hatch | $HOME/AppData/Local/hatch/env/virtual |
🐍 Vanilla python venvs | N/A |
🐍 Anaconda Base | $HOME/anaconda3 |
🐍 Anaconda Environments | $HOME/anaconda3/envs |
🐍 Miniconda Base | $HOME/miniconda3 |
🐍 Miniconda Environments | $HOME/miniconda3/envs |
📁 cwd | current working dir |
🔧 workspace | lsp workspace dirs |
📄 file | active file dir |
Disabling built-in searches
This is useful if you have virtual environments in the default locations but you dont want them to show up in the plugin.
To turn off all built-in searches:
opts = {
options = {
enable_default_searches = false -- disable all built-in searches
}
}
To turn off only some searches, create a new search with the same name and set it to false:
opts = {
search = {
hatch = false,
pipx = false
}
}
Overriding built-in searches
You can override any built-in search by creating a new search with the same name as the built-in one:
opts = {
search = {
anaconda = {
command = "$FD '/python$' /opt/anaconda/bin --full-path --color never"
type = "anaconda" -- This needs to be set for anaconda and miniconda environments ONLY
}
}
}
The built-in searches look different for different operating systems.
Look in the plugin code here to see how the built-in searches are written for your operating system.
The $FD
variable gets replaced with your fd
binary.
Its a good idea to test the search you are creating outside of neovim first. It needs to return only python interpreters with absolute paths, like this:
$ fd '/python$' /opt/anaconda/bin --full-path --color never
/opt/anaconda/bin/python
Creating your own search
This is similar to overriding an built-in search. You just give it your own name.
opts = {
search = {
my_projects = {
command = "$FD '/python$' ~/Code/PythonProjects --full-path --color never"
}
}
}
Otherwise the same ideas from Overriding built-in searches applies here too.
Set the type to anaconda
both for anaconda and miniconda searches.
The plugin uses this information to set the correct environment variables in the terminal.
Dont set the type at all for other venv managers.
Testing your searches
Testing from inside VenvSelector
When creating your own search, you can test the command from inside VenvSelector like this:
:VenvSelect fd 'python$' ~/Code --full-path -IH -a
Replace the paths with somewhere your venvs live and you should get results of type interactive
like this:
Once it works, you can add the search to your config.
Testing in a terminal
Test the command in a terminal like this (replacing the paths to suit your system)
fd 'python$' ~/Code --full-path -IH -a
Special variables in a search
These can be used in your searches to target specific paths that neovim knows about.
Variable | Description |
---|---|
$CWD | Current working directory. The directory where you start neovim. |
$WORKSPACE_PATH | The workspace directories found by your LSP when you have an opened python file. |
$FILE_DIR | The directory of the file in the neovim buffer. |