Skip to content
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

Improve handling of comments and doc comments #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wchargin
Copy link

@wchargin wchargin commented May 3, 2021

Doc comments are now properly formatted with gq and J. For example,
on this input text:

/// one
/// two

pressing J on the top line used to result in /// one / two, and now
results in /// one two. Conversely, on this input text:

/// this long line exceeds the text width

pressing gqgq with a textwidth of 20 now yields:

/// this long line
/// exceeds the text
/// width

instead of:

/// this long line
//exceeds the text
//width

Furthermore, adding a new line to an existing comment, by pressing o
in normal mode or Enter in insert mode, now automatically inserts the
appropriate comment leader (// or ///).

wchargin-branch: comment-doc-and-leader

Doc comments are now properly formatted with `gq` and `J`. For example,
on this input text:

```
/// one
/// two
```

pressing `J` on the top line used to result in `/// one / two`, and now
results in `/// one two`. Conversely, on this input text:

```
/// this long line exceeds the text width
```

pressing `gqgq` with a `textwidth` of 20 now yields:

```
/// this long line
/// exceeds the text
/// width
```

instead of:

```
/// this long line
//exceeds the text
//width
```

Furthermore, adding a new line to an existing comment, by pressing `o`
in normal mode or `Enter` in insert mode, now automatically inserts the
appropriate comment leader (`//` or `///`).

wchargin-branch: comment-doc-and-leader
wchargin-source: 93a80fff55389ecf7f5a0ae67850bdc40b5f0346
@chanhosuh
Copy link

@wchargin how about also accommodating the /**.. **/ natspec style? ;)

@wchargin
Copy link
Author

@wchargin how about also accommodating the /**.. **/ natspec style? ;)

Go for it! I personally don't use that natspec style and am not super
familiar with this corner of Vim config, so I'm not going to implement
this myself.

@mhluongo
Copy link

Hey @wchargin, I merged this PR in our maintained fork!

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.

3 participants