viniarck / direnv.vim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

direnv.vim - yup

This plugin aim is to integrate Direnv and Vim. Because Vim can shell out to other tools it's nice if the environment is in sync with the usual shell.

It also set filetype=bash for .envrc files.

Features

  • Direnv environment loading
  • filetype=bash for .envrc files
  • Asynchronous running of Direnv command which won't delay your workflow. Supported in Vim 8 (with job and channel) or NeoVim.

Limitations

The Vimscript syntax seems to limit keys to alphanumeric characters. If any environment variable key is something different the plugin might fail.

Mainline Vim doesn't (yet) have auto command event that is fired on directory change, however in NeoVim there already is one named: DirChange. Thanks to that Direnv will be fired only on VimEnter (as entering Vim isn't directory change) and on DirChange.

For mainline Vim there is fallback that run on each BufEnter (not ideal solution, but for now we have no other option).

Due to asynchronous calls to Direnv if you work too fast then it can happen that variables from .envrc will not be yet loaded. However highly unlikely you are so fast.

Install

Then install the plugin. With Pathogen

git clone https://github.com/direnv/direnv.vim.git ~/.vim/bundle/direnv.vim

and restart.

TODO

  • Allow/deny authorization mechanism.
  • Add proper Vim documentation.

My Vimscript skill is tangent to zero, feedback is welcome https://github.com/direnv/direnv.vim

About


Languages

Language:Vim Script 100.0%