Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions nature/env.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
env = {}

setmetatable(env, {
__index = function(_, k)
return os.getenv(k)
end,
__newindex = function(_, k, v)
os.setenv(k, tostring(v))
end
})
31 changes: 1 addition & 30 deletions nature/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ require 'nature.opts'
require 'nature.vim'
require 'nature.runner'
require 'nature.hummingbird'
require 'nature.env'
require 'nature.abbr'

local shlvl = tonumber(os.getenv 'SHLVL')
Expand All @@ -35,36 +36,6 @@ else
os.setenv('SHLVL', '0')
end

do
local virt_G = { }

setmetatable(_G, {
__index = function (_, key)
local got_virt = virt_G[key]
if got_virt ~= nil then
return got_virt
end

if type(key) == 'string' then
virt_G[key] = os.getenv(key)
end
return virt_G[key]
end,

__newindex = function (_, key, value)
if type(value) == 'string' then
os.setenv(key, value)
virt_G[key] = value
else
if type(virt_G[key]) == 'string' then
os.setenv(key, '')
end
virt_G[key] = value
end
end,
})
end

do
local startSearchPath = hilbish.userDir.data .. '/hilbish/start/?/init.lua;'
.. hilbish.userDir.data .. '/hilbish/start/?.lua'
Expand Down