A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/tpope/vim-dotenv below:

tpope/vim-dotenv: dotenv.vim: Basic support for .env and Procfile

This plugin provides basic support for .env and Procfile.

Use :Dotenv {file} or :Dotenv {dir} to load a .env file and set the corresponding environment variables in Vim. Use :verbose Dotenv to see what variables are actually being set.

With projectionist.vim and dispatch.vim installed, you'll get a default :Start of foreman start for projects with a Procfile, and a default :Dispatch of foreman check for the Procfile itself.

If you call :Dispatch foreman run whatever or :Dispatch dotenv whatever, the compiler will be correctly selected for the whatever command.

While the above are all marginally helpful, this is the use case that inspired the plugin. Other plugins can call DotenvGet('VAR') to get the value of $VAR globally or from the current buffer's .env. Here's a wrapper to optionally use DotenvGet() if it's available.

function! s:env(var) abort
  return exists('*DotenvGet') ? DotenvGet(a:var) : eval('$'.a:var)
endfunction

let db_url = s:env('DATABASE_URL')

There's also DotenvExpand(), a drop-in replacement for expand().

function! s:expand(expr) abort
  return exists('*DotenvExpand') ? DotenvExpand(a:expr) : expand(a:expr)
endfunction

Copyright © Tim Pope. Distributed under the same terms as Vim itself. See :help license.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4