direnv.vim


Ⅰ. 插件描述

vim plugin for direnv support

Ⅱ. 基本信息

创建日期:  2014-05-24
使用用户:  37
Github星:  70
插件作者:  direnv - unclutter your .profile

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'direnv/direnv-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'direnv/direnv-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'direnv/direnv-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/direnv/direnv.vim

Ⅳ. 文档说明

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 adds syntax highlighting for .envrc files.

Features

  • Direnv environment loading
  • filetype & syntax highlighting 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.

The newer Vim builds (>8.0.1459) & NeoVim have auto command event
that is fired on directory changes, named: DirChanged. Thanks to that Direnv
will be fired only on VimEnter (as entering Vim isn't directory change) and
on DirChanged.

For older Vim's 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

添加新评论