Skip to content

Commit 6fa91d3

Browse files
committed
neovim 0.7 updates
1 parent 12adcfa commit 6fa91d3

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

lua/plugin_name.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
local module = require("plugin_name.module")
33

44
local M = {}
5-
local config = {
5+
M.config = {
66
-- default config
77
opt = "Hello!",
88
}
@@ -11,12 +11,12 @@ local config = {
1111
M.setup = function(args)
1212
-- you can define your setup function here. Usually configurations can be merged, accepting outside params and
1313
-- you can also put some validation here for those.
14-
config = vim.tbl_deep_extend("keep", args, config)
14+
M.config = vim.tbl_deep_extend("force", M.config, args or {})
1515
end
1616

1717
-- "hello" is a public method for the plugin
1818
M.hello = function()
19-
module.my_first_function(config.opt)
19+
module.my_first_function()
2020
end
2121

2222
return M

lua/plugin_name/module.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
-- module represents a lua module for the plugin
22
local M = {}
33

4-
M.my_first_function = function(var)
5-
return "my first function with param = " .. var
4+
M.my_first_function = function()
5+
return "hello world!"
66
end
77

88
return M

plugin/plugin_name.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
vim.cmd([[command! MyFirstFunction lua require('plugin_name.module').my_first_function() ]])
1+
vim.api.nvim_create_user_command("MyFirstFunction", require("plugin_name").hello, {})

0 commit comments

Comments
 (0)