diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2020-10-06 15:23:14 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2020-10-06 15:23:14 +1300 |
commit | 5116c5415cab2839450f11914f288d322d536a29 (patch) | |
tree | 7c0238c9b486ea21e3379f69fb6805234c77e1bc /vim/autoload/xdg.vim | |
parent | Rewrite comments in patch#() (diff) | |
download | dotfiles-5116c5415cab2839450f11914f288d322d536a29.tar.gz dotfiles-5116c5415cab2839450f11914f288d322d536a29.zip |
Inline environment retrieval to save a file load
Diffstat (limited to 'vim/autoload/xdg.vim')
-rw-r--r-- | vim/autoload/xdg.vim | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/vim/autoload/xdg.vim b/vim/autoload/xdg.vim index c5737506..67a9c5b2 100644 --- a/vim/autoload/xdg.vim +++ b/vim/autoload/xdg.vim @@ -12,10 +12,11 @@ function! s:Get(name) abort if !has_key(s:defaults, name) throw 'Illegal XDG basedirs env var name' endif - let value = getenv#(name) - return value !=# '' - \ ? value - \ : s:defaults[name] + let value = s:defaults[name] + if exists('$'.a:name) + execute 'let value = $'.a:name + endif + return value endfunction function! s:Absolute(path) abort |