2022-04-23 03:56:57 +00:00
|
|
|
-- Prelude initializes everything else for our shell
|
|
|
|
local _ = require 'succulent' -- Function additions
|
2022-06-20 21:07:15 +00:00
|
|
|
local fs = require 'fs'
|
2022-04-23 03:56:57 +00:00
|
|
|
|
|
|
|
package.path = package.path .. ';' .. hilbish.dataDir .. '/?/init.lua'
|
2022-05-08 20:01:06 +00:00
|
|
|
.. ';' .. hilbish.dataDir .. '/?/?.lua' .. ";" .. hilbish.dataDir .. '/?.lua'
|
2022-04-23 03:56:57 +00:00
|
|
|
|
|
|
|
require 'nature.commands'
|
2022-04-24 13:00:06 +00:00
|
|
|
require 'nature.completions'
|
2022-05-01 01:22:37 +00:00
|
|
|
require 'nature.opts'
|
2022-05-14 00:52:48 +00:00
|
|
|
require 'nature.vim'
|
2022-05-28 23:06:18 +00:00
|
|
|
require 'nature.runner'
|
2022-07-09 20:49:56 +00:00
|
|
|
require 'nature.history'
|
2022-04-23 03:56:57 +00:00
|
|
|
|
|
|
|
local shlvl = tonumber(os.getenv 'SHLVL')
|
|
|
|
if shlvl ~= nil then
|
|
|
|
os.setenv('SHLVL', tostring(shlvl + 1))
|
|
|
|
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
|
|
|
|
|
|
|
|
virt_G[key] = os.getenv(key)
|
|
|
|
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
|
|
|
|
|
2022-06-20 21:07:15 +00:00
|
|
|
do
|
|
|
|
local startSearchPath = hilbish.userDir.data .. '/hilbish/start/?/init.lua;'
|
|
|
|
.. hilbish.userDir.data .. '/hilbish/start/?.lua'
|
|
|
|
|
|
|
|
local ok, modules = pcall(fs.readdir, hilbish.userDir.data .. '/hilbish/start/')
|
|
|
|
if ok then
|
|
|
|
for _, module in ipairs(modules) do
|
|
|
|
local entry = package.searchpath(module, startSearchPath)
|
|
|
|
print(entry)
|
|
|
|
if entry then
|
|
|
|
dofile(entry)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
package.path = package.path .. ';' .. startSearchPath
|
|
|
|
end
|