mirror of
https://github.com/ViViDboarder/vim-settings.git
synced 2024-12-22 07:47:35 +00:00
Add startify config and local require
This commit is contained in:
parent
d87d6c8d6a
commit
497c580c12
1
neovim/.gitignore
vendored
Normal file
1
neovim/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*_local.lua
|
@ -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 {
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user