File tree Expand file tree Collapse file tree 3 files changed +6
-6
lines changed
Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 22local module = require (" plugin_name.module" )
33
44local M = {}
5- local config = {
5+ M . config = {
66 -- default config
77 opt = " Hello!" ,
88}
@@ -11,12 +11,12 @@ local config = {
1111M .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 {} )
1515end
1616
1717-- "hello" is a public method for the plugin
1818M .hello = function ()
19- module .my_first_function (config . opt )
19+ module .my_first_function ()
2020end
2121
2222return M
Original file line number Diff line number Diff line change 11-- module represents a lua module for the plugin
22local 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! "
66end
77
88return M
Original file line number Diff line number Diff line change 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 , {} )
You can’t perform that action at this time.
0 commit comments