Advertisement
Wurfkreuz

Untitled

May 15th, 2023
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. swenv.nvim
  2. Tiny plugin to quickly switch python virtual environments from within neovim without restarting.
  3.  
  4. gscreenshot_2022-09-19-144438
  5.  
  6. Installation
  7. For example using packer:
  8.  
  9. use 'AckslD/swenv.nvim'
  10. Usage
  11. Call
  12.  
  13. require('swenv.api').pick_venv()
  14. to pick an environment. Uses vim.ui.select so a tip is to use eg dressing.nvim.
  15.  
  16. To show the current venv in for example a status-line you can call
  17.  
  18. require('swenv.api').get_current_venv()
  19. For lualine there is already a configured component called swenv.
  20.  
  21. Configuration
  22. Pass a dictionary into require("swenv").setup() with callback functions. These are the defaults:
  23.  
  24. require('swenv').setup({
  25. -- Should return a list of tables with a `name` and a `path` entry each.
  26. -- Gets the argument `venvs_path` set below.
  27. -- By default just lists the entries in `venvs_path`.
  28. get_venvs = function(venvs_path)
  29. return require('swenv.api').get_venvs(venvs_path)
  30. end,
  31. -- Path passed to `get_venvs`.
  32. venvs_path = vim.fn.expand('~/venvs'),
  33. -- Something to do after setting an environment, for example call vim.cmd.LspRestart
  34. post_set_venv = nil,
  35. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement