Add startify config and local require

This commit is contained in:
ViViDboarder 2021-08-24 16:12:16 -07:00
parent d87d6c8d6a
commit 497c580c12
3 changed files with 45 additions and 0 deletions

1
neovim/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*_local.lua

View File

@ -254,6 +254,18 @@ return require('packer').startup(function()
config = config_dark_notify,
requires = { "hoob3rt/lualine.nvim" },
}
use {
'mhinz/vim-startify',
config = function()
vim.g.startify_list_order = {
{ ' My Bookmarks'}, 'bookmarks',
{ ' Most recently used files in the current directory' }, 'dir',
{ ' Most recently used files' }, 'files',
{ ' My Sessions' }, 'sessions'
}
require("utils").maybe_require("plugins.startify_local")
end,
}
-- LSP
use {

View File

@ -48,4 +48,36 @@ function M.env_default(name, def)
return val == nil and def or val
end
-- Checks to see if a package can be required
function M.can_require(name)
if package.loaded[name] then
return false
else
for _, searcher in ipairs(package.searchers or package.loaders) do
local loader = searcher(name)
if type(loader) == 'function' then
package.preload[name] = loader
return true
end
end
return false
end
end
-- Require a package if possible
function M.maybe_require(name)
if M.can_require(name) then
return require(name)
end
return nil
end
-- Require a package and a "_local" suffixed one
function M.require_with_local(name)
require(name)
M.maybe_require(name .. "_local")
end
return M