feat: Allow subcommands in :Neogen (#36)
This commit is contained in:
@@ -16,9 +16,8 @@ require("neogen.granulators.default")
|
|||||||
require("neogen.generators.default")
|
require("neogen.generators.default")
|
||||||
|
|
||||||
neogen.generate = function(opts)
|
neogen.generate = function(opts)
|
||||||
opts = opts or {
|
opts = opts or {}
|
||||||
type = "func",
|
opts.type = (opts.type == nil or opts.type == "") and "func" or opts.type -- Default type
|
||||||
}
|
|
||||||
|
|
||||||
local parser = vim.treesitter.get_parser(0, vim.bo.filetype)
|
local parser = vim.treesitter.get_parser(0, vim.bo.filetype)
|
||||||
local tstree = parser:parse()[1]
|
local tstree = parser:parse()[1]
|
||||||
@@ -133,7 +132,7 @@ function neogen.jumpable(reverse)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function neogen.generate_command()
|
function neogen.generate_command()
|
||||||
vim.api.nvim_command('command! -range -bar Neogen lua require("neogen").generate()')
|
vim.api.nvim_command('command! -nargs=? -range -bar Neogen lua require("neogen").generate({ type = <q-args>})')
|
||||||
end
|
end
|
||||||
|
|
||||||
neogen.setup = function(opts)
|
neogen.setup = function(opts)
|
||||||
|
|||||||
Reference in New Issue
Block a user