Skip to content

docs(plugin): add docs for installing comment.nvim with lazy.nvim #367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

sadiksaifi
Copy link

No description provided.

Comment on lines +26 to +29
{ "gcc", mode = "n", desc = "Toggles the current line using linewise comment" },
{ "gbc", mode = "n", desc = "Toggles the current line using blockwise comment" },
{ "gc", mode = "v", desc = "Toggles the region using linewise comment" },
{ "gb", mode = "v", desc = "Toggles the region using blockwise comment" },
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is way too much noise for an install instruction.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the recommended way to install via lazy.nvim?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intent of keys here is to register the key mapping, but not load the plugin until the keys are actually use (ie 'lazy' load it).

If you don't include keys, then the next best thing would be using an event to use.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That file specifically, or comment.nvim in general?

I am looking at that file, and I'm kinda surprised to not see a setup method 🤔 Actually, it looks like https://github.com/numToStr/Comment.nvim/blob/master/lua/Comment/init.lua is what would actually be loaded via require('Comment').setup.

Lazy.nvim has a convention of, if you have opts = true or opts = { ... }, it essentially ends up doing:

require('Comment').setup(opts)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@technicalpickles setup() method in init.lua create keymaps. And Comment.lua file is for Plug mappings and is the base for most of the keymaps in init.lua. Also, in general <Plug> mappings should never require any setup() call in any plugin.

Assuming if a user doesn't want any keymaps, they don't need to call setup() they can directly use <Plug> mappings to create their own keymaps.

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.

5 participants