Skip to content

feat: Commands for cmdline#14

Open
vunhatchuong wants to merge 2 commits into
tamton-aquib:mainfrom
vunhatchuong:feat/command
Open

feat: Commands for cmdline#14
vunhatchuong wants to merge 2 commits into
tamton-aquib:mainfrom
vunhatchuong:feat/command

Conversation

@vunhatchuong

Copy link
Copy Markdown

Add commands so people can lazy load with cmd

{
    'tamton-aquib/duck.nvim',
    cmd = "Duck",
    opts = {},
}

Or use it in keymap

vim.keymap.set('n', '<leader>dd', ":Duck hatch 🦆10<CR> , {}) -- A pretty fast duck

instead of

vim.keymap.set('n', '<leader>dd', function() require("duck").hatch("🦆", 10) end, {}) -- A pretty fast duck

@tamton-aquib

tamton-aquib commented Dec 28, 2024

Copy link
Copy Markdown
Owner

Heyyo @vunhatchuong,

A relly cool addition ❤️ .

But could you move the file inside a folder called duck maybe? Else the command.lua will conflict with other module with the same name if the user has any. After moving and resolving the comments, I think I'll merge

Or it would be better to move the contents inside command.lua inside plugin/duck.lua.
Also is the complete() method needed? I think neovim will handle matches we might just need to return the table

@vunhatchuong

vunhatchuong commented Dec 28, 2024

Copy link
Copy Markdown
Author

Yeah that's what I initially want to do but I was afraid maybe it will break some user or that's not what you want.

To clarify, is this what you want?

.
├── lua
│   └── duck
│       ├── command.lua
│       ├── duck.lua
│       └── init.lua
├── .github/
├── CHANGELOG.md
├── LICENSE
├── README.md
└── plugin
    └── duck.lua

I export conf and put setup in init.lua.

@tamton-aquib

Copy link
Copy Markdown
Owner

This will be fine too. But if command.lua doesnt have much logic inside then i guess we could move it inside plugin/duck.lua itself.

So it becomes;

.
├── lua
│   └── duck.lua
├── .github/
├── CHANGELOG.md
├── LICENSE
├── README.md
└── plugin
    └── duck.lua

@vunhatchuong

Copy link
Copy Markdown
Author

I think this is fine, what do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants