Skip to content

Commit 7882047

Browse files
committed
move pak update event to plugin/defold.lua
1 parent 6ed9149 commit 7882047

2 files changed

Lines changed: 21 additions & 21 deletions

File tree

README.md

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -94,31 +94,17 @@ defold.nvim is replacing these variables in the arguments list
9494
```lua
9595
-- install the plugin
9696
vim.pack.add({
97-
-- optional dependencies
98-
"https://github.com/mfussenegger/nvim-dap", -- (Optional) Required when using the debugger
99-
"https://github.com/L3MON4D3/LuaSnip", -- (Optional) Required when using snippets
97+
-- (Optional) Required when using the debugger
98+
"https://github.com/mfussenegger/nvim-dap",
99+
-- (Optional) Required when using snippets
100+
"https://github.com/L3MON4D3/LuaSnip",
100101

101102
"https://github.com/atomicptr/defold.nvim",
102103
})
103104

104-
-- setup the plugin
105-
require("defold").setup({
105+
require("defold").setup {
106106
-- config options, see below
107-
})
108-
109-
-- download the native library at installation/updates
110-
vim.api.nvim_create_autocmd("PackChanged", {
111-
callback = function(ev)
112-
if ev.data.spec.name ~= "defold.nvim" then
113-
return
114-
end
115-
116-
if ev.data.kind == "install" or ev.data.kind == "update" then
117-
require("defold").download()
118-
end
119-
end,
120-
})
121-
107+
}
122108
```
123109

124110
### Lazy.nvim

plugin/defold.lua

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,15 @@
1-
require("defold").setup()
1+
require("defold").setup {}
2+
3+
if vim.version.cmp(vim.version(), { 0, 12, 0 }) >= 0 then
4+
vim.api.nvim_create_autocmd("PackChanged", {
5+
callback = function(ev)
6+
if ev.data.spec.name ~= "defold.nvim" then
7+
return
8+
end
9+
10+
if ev.data.kind == "install" or ev.data.kind == "update" then
11+
require("defold").download()
12+
end
13+
end,
14+
})
15+
end

0 commit comments

Comments
 (0)