make lazy loading better...
- add a ft function to make it better when trying to load a plugin on a ft - add shorthands to make it easier to create one load condition
This commit is contained in:
@ -46,7 +46,7 @@ function lazy:cmd(name, opts)
|
||||
table.insert(self.command_ids, name)
|
||||
end
|
||||
|
||||
--- user an auto command which will trigger the plugin to load
|
||||
--- create an auto command which will trigger the plugin to load
|
||||
---@param event string the event to trigger on
|
||||
---@param opts vim.api.keyset.create_autocmd? options
|
||||
function lazy:auto(event, opts)
|
||||
@ -60,6 +60,14 @@ function lazy:auto(event, opts)
|
||||
table.insert(self.auto_ids, vim.api.nvim_create_autocmd(event, opts))
|
||||
end
|
||||
|
||||
--- create an auto command which will trigger on filetype
|
||||
---@param filetype string filetype to register the auto on
|
||||
function lazy:ft(filetype)
|
||||
lazy:auto("FileType", {
|
||||
pattern = filetype
|
||||
})
|
||||
end
|
||||
|
||||
--- create a keybind which will trigger the plugin to load
|
||||
---@param mode string the mode to trigger in
|
||||
---@param bind string the binding to use
|
||||
|
Reference in New Issue
Block a user