aboutsummaryrefslogtreecommitdiff
path: root/vim/autoload
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2020-05-03 15:37:55 +1200
committerTom Ryder <tom@sanctum.geek.nz>2020-05-03 15:40:53 +1200
commit7177aa780fd4293c968ecd5331f67cf4a64b046d (patch)
tree697249d63aa4a45a78379c90bdca7bd59fcee6bf /vim/autoload
parentMerge branch 'hotfix/v8.25.1' (diff)
downloaddotfiles-7177aa780fd4293c968ecd5331f67cf4a64b046d.tar.gz
dotfiles-7177aa780fd4293c968ecd5331f67cf4a64b046d.zip
Write v:null back out of XDG routines
I had misconfigured my test machine, and was testing the latest Vim v8.2.x when I thought I was testing v7.0.0, which misled me into thinking v:null was defined on the latter version in commit 145998c. Reverse this and just use an empty string as the sentinel value; it's not strictly correct, but it doesn't matter much to XDG.
Diffstat (limited to 'vim/autoload')
-rw-r--r--vim/autoload/getenv.vim11
-rw-r--r--vim/autoload/xdg.vim4
2 files changed, 5 insertions, 10 deletions
diff --git a/vim/autoload/getenv.vim b/vim/autoload/getenv.vim
index 2b8fef1b..3b5f4c1b 100644
--- a/vim/autoload/getenv.vim
+++ b/vim/autoload/getenv.vim
@@ -1,19 +1,14 @@
-" Backport getenv() from v8.1.1305
+" Backport getenv() from v8.1.1305, except return an empty string rather than
+" v:null
"
" <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
+ let value = ''
if exists('$'.a:name)
execute 'let value = $'.a:name
endif
diff --git a/vim/autoload/xdg.vim b/vim/autoload/xdg.vim
index 2b90f5f1..3dff52a5 100644
--- a/vim/autoload/xdg.vim
+++ b/vim/autoload/xdg.vim
@@ -15,7 +15,7 @@ function! s:Get(name) abort
throw 'Illegal XDG basedirs env var name'
endif
let value = getenv#(name)
- return value !=# v:null
+ return value !=# ''
\ ? value
\ : s:defaults[name]
endfunction
@@ -29,7 +29,7 @@ endfunction
function! s:Home(name) abort
let home = s:Get(a:name)
if !s:Absolute(home)
- return v:null
+ return ''
endif
return join([home, s:subdir], '/')
endfunction