mawww / kakoune

mawww's experiment for a better code editor
http://kakoune.org
The Unlicense
9.97k stars 714 forks source link

[feature request] disable automatic comment insertion #3179

Open etoombs-encircle opened 5 years ago

etoombs-encircle commented 5 years ago

When adding a new line under a commented line, kakoune automatically inserts a comment leader. How can I disable that behaviour / if I can't could this be added as a boolean option?

JJK96 commented 5 years ago

You can disable the hook that is responsible for the behaviour. For example, in c-family languages the hook that does this is c-insert.

You can disable the behaviour by executing remove-hooks window c-insert to remove the hook.

lenormf commented 5 years ago

You can hit \ followed by any primitive (o for instance) to prevent the hook from triggering.

SeerLite commented 4 years ago

+1. IMO this should be a global option/hook. It's not like you change your commenting habits with each language. Besides, that way you don't have to look at each language file to see what hook is responsible for it. Some languages don't even have hooks and do it directly (like sh, for example).

ismay commented 6 months ago

In #3647 mawww mentioned that automatic comment insertion could be turned off by disabled a certain group of hooks:

Most language support script already distinguish between auto indent and auto insertion, putting them into different hook groups, I think setting the disabled_hooks to .*-insert should disable auto commenting (along with other automatic code insertion hooks) while preserving auto indentation, if it does not it might be that scripts are not putting the correct group onto their hook.

I was just checking this out for .js and it seems like that also doesn't follow the recommended structure for the hooks. Maybe it'd be good to have an issue tracking which language scripts still aren't following these conventions, so that we have a reminder to update them? Both the hook naming, as well as removing an empty comment on enter does not seem to be a convention that's being followed everywhere.