Giter Site home page Giter Site logo

swenv.nvim's Introduction

swenv.nvim

Tiny plugin to quickly switch python virtual environments from within neovim without restarting.

gscreenshot_2022-09-19-144438

Installation

For example using packer:

use 'AckslD/swenv.nvim'

Usage

Call

require('swenv.api').pick_venv()

to pick an environment. Uses vim.ui.select so a tip is to use eg dressing.nvim.

To show the current venv in for example a status-line you can call

require('swenv.api').get_current_venv()

Configuration

Pass a dictionary into require("swenv").setup() with callback functions. These are the defaults:

require('swenv').setup({
  -- Should return a list of tables with a `name` and a `path` entry each.
  -- Gets the argument `venvs_path` set below.
  -- By default just lists the entries in `venvs_path`.
  get_venvs = function(venvs_path)
    return require('swenv.api').get_venvs(venvs_path)
  end,
  -- Path passed to `get_venvs`.
  venvs_path = vim.fn.expand('~/venvs'),
  -- Something to do after setting an environment, for example call vim.cmd.LspRestart
  post_set_venv = nil,
})

Lualine Component

For lualine there is already a configured component called swenv. It displays an icon and the name of the activated environment.

Usage

Add this to your lualine sections to use the component

sections = {
    ...
    lualine_a = 'swenv' -- uses default options
    lualine_x = { 'swenv', icon = '<icon>' } -- passing lualine component options
    ...
}

These are the defaults options:

{
  icon = "",
  color = { fg = "#8fb55e" },
}

swenv.nvim's People

Contributors

acksld avatar christianchiarulli avatar skolj avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.