Browse Source

Allow creating "virtual" plugins which load lua script but do not

register with vim-plug
master
Adam Pippin 2 years ago
parent
commit
9ab5f5d5b0
  1. 1
      lua/config/_plugins.lua
  2. 3
      lua/config/_settings.lua
  3. 17
      lua/config/plugins/lang-beancount.lua
  4. 13
      lua/config/plugins/ui.lua
  5. 6
      lua/module/plugins.lua

1
lua/config/_plugins.lua

@ -24,6 +24,7 @@ return merge({
require('config/plugins/tmp'),
require('config/plugins/lang-beancount'),
require('config/plugins/lang-php'),
})

3
lua/config/_settings.lua

@ -50,6 +50,9 @@ return {
-- a file.
undofile = true,
-- Allow mouse only in normal mode
mouse = 'n',
},
-- global variables
-- these are things you would apply with `let g:thing=value`

17
lua/config/plugins/lang-beancount.lua

@ -0,0 +1,17 @@
return {
--------------------------------------------------------------------------------
-- Beancount
--------------------------------------------------------------------------------
----------------------------------------------------------------------------
-- Improve handling of beancount accounting files
--
{
name = 'nukevim/beancount',
opts = {
virtual = true
}
},
}

13
lua/config/plugins/ui.lua

@ -111,7 +111,8 @@ return {
-- Highlight hex codes (and in css, css named colors + rgb/hsl, etc) by
-- colouring their background to match the colour.
--
{ name = 'ap/vim-css-color' },
-- Disabled because it's causing warnings when closing files with colours in them.
{ enable = false, name = 'ap/vim-css-color' },
----------------------------------------------------------------------------
-- Dim inactive buffers
@ -146,4 +147,14 @@ return {
}
},
----------------------------------------------------------------------------
-- Better undotree interface
--
{
name = 'mbbill/undotree',
opts = {
['on'] = { 'UndotreeToggle' }
}
},
}

6
lua/module/plugins.lua

@ -78,7 +78,7 @@ function M:commit()
-- so we can just install it after.
if (plugin_enabled and (plugin_installed or self.auto_install) and plugin_required_providers and plugin_required_binaries and plugin_required_plugins) then
self:enablePlugin(plugin)
if (not plugin_installed) then self.needs_install = true end
if (not plugin_installed and not plugin.opts.virtual) then self.needs_install = true end
table.remove(plugins, idx)
-- Otherwise if any of these conditions occur then we know the plugin
@ -118,7 +118,9 @@ end
-- Once we determine a plugin should be loaded, this actually does it
function M:enablePlugin(plugin)
package_manager:add(plugin.name, plugin.opts)
if (plugin.opts.virtual ~= true) then
package_manager:add(plugin.name, plugin.opts)
end
-- Register key bindings
if (plugin.keys ~= nil) then

Loading…
Cancel
Save