blob: 2b8fef1b82aec3b4c24d9b9e9b6897f8c09a043b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
" Backport getenv() from v8.1.1305
"
" <https://github.com/vim/vim/releases/tag/v8.1.1305>
"
function! getenv#(name) abort
" Use native if available
if exists('*getenv')
return getenv(a:name)
endif
" Backport
if a:name !~# '^[A-Z][A-Z0-9_]*$'
throw 'Illegal env var name'
endif
let value = v:null
if exists('$'.a:name)
execute 'let value = $'.a:name
endif
return value
endfunction
|