Detect if currently editing a comment #346
lougreenwood
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Maybe this isn't the correct place to ask since it's not strictly comment related, but it is tangential.
I'm trying to build an autocmd to change the
textwidth
when editing a comment. The reason is that the code base I work on is Javascript and uses Prettier to format it's code with a line length of 120. With Prettier this isn't a strict rule, but a guideline so lines are often more or less than 120. This is all inherited from the editor config.However, for comments, 120 is too long, so I want to dynamically change the
textwidth
value when editing a comment, my idea is to use an autocmd and somehow detect if the current line is a comment (and then updatetextwidth
).So, my question is, can anyone give tips on how to detect if the current line is a comment? I skimmed through the API for
Comment.nvim
, but I didn't see any utils for this.Beta Was this translation helpful? Give feedback.
All reactions