Coder Social home page Coder Social logo

auenv.nvim's Introduction

Auto-Fetching Python Environment in Neovim

AuEnv automatically activates 'known' environments (see usage section), thus making terminal sessions and buffer diagnostics more relevant to a user project they work on.

AuEnv ensures that a terminal session opened from Vim will have a proper conda environment. However, it does not guarantee that after it updates buffer diagnostics and removes irrelevant ones, none of relevant will be removed. The latter may depend on how well one sets up their LSP clients.

Installation

With Packer

use {
  'rxi/json.lua',
  run = 'mkdir -p lua/json && mv json.lua lua/json/init.lua',
}

use {
  'lukoshkin/auenv.nvim',
  requires = 'rxi/json.lua',
  config = function ()
    require'auenv'.setup {
      --- The only available customization.
      -- auenv_datafile = /where/to/keep/dict/with/registered/envs
      --- By default, it is vim.fn.stdpath'data' .. '/auenv/envs.json'
    }
  end
}

Usage

AuEnv's tab completion is now enabled! Use it for hints.

:AuEnv add <env_name>
:AuEnv rm [path]

" <env_name> is a name of an existing conda environment.
" If omitting `[path]`, the folder of the current buffer is used.
" To display the dict with the registered envs and edit it manually,
" one can use the following two commands.

:AuEnv print
:AuEnv edit

" To mannually change a conda environment
" (and freeze it for the current buffer), use

:AuEnv set <env_name>
:AuEnv unset                         " set to 'base'
:unlet b:auenv_manually_set_env      " unfreeze

" Deletion of keys that correspond to removed conda environments or
" those having empty dict values is done with

:AuEnv maintain
" (not implemented yet)
" Whether to name it 'prune' or 'maintain' is still debatable.

After registering a conda environment for some path with AuEnv's add command, the environment will be activated automatically when opening any Python file in the deepest directory of the path hierarchy.

Remembering not a folder but exactly a file where the command was run is a possible future enhancement (that currently is not available though easy to add).

Future Development

  • Add Virtualenv support
  • maintain (or prune) command (see usage)
  • Integration with shell's conda-autoenv
  • Per file environment (see usage)
  • set/unset API commands
  • Tab completion/expansion

auenv.nvim's People

Contributors

lukoshkin avatar

Watchers

 avatar  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.